diff --git a/src/sdl2/sdl2.nim b/src/sdl2/sdl2.nim index 1371052..201915d 100644 --- a/src/sdl2/sdl2.nim +++ b/src/sdl2/sdl2.nim @@ -16,11 +16,13 @@ else: when defined(windows): when defined(amd64): - const flags = &"--libdir={buildDir} --includedir={includeDir} --host=x86_64-w64-mingw32" + const flags = &"--libdir={buildDir} --includedir={includeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC\"" else: - const flags = &"--libdir={buildDir} --includedir={includeDir} --host=i686-w64-mingw32" + const flags = &"--libdir={buildDir} --includedir={includeDir} --host=i686-w64-mingw32 CFLAGS=\"-fPIC\"" +elif defined(macosx): + const flags = &"--libdir={buildDir} --includedir={includeDir} CFLAGS=\"-fPIC\"" else: - const flags = &"--libdir={buildDir} --includedir={includeDir}" + const flags = &"CFLAGS=\"-fPIC\"" getHeader( "SDL.h", @@ -200,7 +202,7 @@ static: # else: # putEnv("PATH", buildDir & ":" & pathenv) let cflags = getEnv("CFLAGS") - putEnv("CFLAGS", &"-I{includeDir} {cflags}") + putEnv("CFLAGS", &"-I{includeDir} -fPIC {cflags}") when defined(linux): putEnv("LDFLAGS", &"-L{buildDir} -L{buildDir.unixizePath} {conf} -Wl,--no-as-needed -lsndio -ldl") # & " " & buildDir/"libSDL2main.a") else: @@ -215,7 +217,10 @@ static: # putEnv("DYLD_LIBRARY_PATH", &"{buildDir}:{buildDir.unixizePath}:{dyldpath}") # putEnv("SDL2_PATH", srcDir) -{.passC: "-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC".} +when defined(macosx): + {.passC: "-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC".} +else: + {.passC: "-fPIC".} when defined(SDL_Static): cImport(srcDir/"include"/"SDL.h", recurse = true, flags = "-f=ast2 -DDOXYGEN_SHOULD_IGNORE_THIS -E__,_ -F__,_") diff --git a/src/sdl2/sdl2_gfx.nim b/src/sdl2/sdl2_gfx.nim index 52886e5..3e36f46 100644 --- a/src/sdl2/sdl2_gfx.nim +++ b/src/sdl2/sdl2_gfx.nim @@ -11,11 +11,11 @@ const when defined(windows): when defined(amd64): - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir}" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" getHeader( "SDL2_gfxPrimitives.h", diff --git a/src/sdl2/sdl2_image.nim b/src/sdl2/sdl2_image.nim index 9d5b4ff..2b06787 100644 --- a/src/sdl2/sdl2_image.nim +++ b/src/sdl2/sdl2_image.nim @@ -4,7 +4,6 @@ import nimterop/[cimport, build] const baseDir = SDLCacheDir - sdlIncludeDir = baseDir / "sdl2" / "include" srcDir = baseDir / "sdl2_image" buildDir = srcDir / ".libs" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" @@ -16,13 +15,16 @@ else: when defined(windows): when defined(amd64): - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir}" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" -{.passC: "-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC".} +when defined(macosx): + {.passC: "-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk -fPIC".} +else: + {.passC: "-fPIC -I{SDLIncludeDir}".} getHeader( "SDL_image.h", @@ -46,7 +48,7 @@ cOverride: ClearError* = "" cPluginPath(symbolPluginPath) -cIncludeDir(sdlIncludeDir) +cIncludeDir(SDLIncludeDir) when defined(SDL_image_Static): cImport(srcDir/"SDL_image.h", recurse = false, flags = &"-f=ast2") diff --git a/src/sdl2/sdl2_mixer.nim b/src/sdl2/sdl2_mixer.nim index 533a6e4..becca21 100644 --- a/src/sdl2/sdl2_mixer.nim +++ b/src/sdl2/sdl2_mixer.nim @@ -4,7 +4,6 @@ import nimterop/[cimport, build] const baseDir = SDLCacheDir - sdlIncludeDir = baseDir / "sdl2" / "include" srcDir = baseDir / "sdl2_mixer" buildDir = srcDir / "build" / ".libs" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" @@ -16,11 +15,11 @@ else: when defined(windows): when defined(amd64): - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir}" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" getHeader( "SDL_mixer.h", @@ -46,6 +45,6 @@ cOverride: cPluginPath(symbolPluginPath) when defined(SDL_Mixer_Static): - cImport(srcDir/"SDL_mixer.h", recurse = false, flags = &"-I={sdlIncludeDir} -f=ast2") + cImport(srcDir/"SDL_mixer.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2") else: - cImport(srcDir/"SDL_mixer.h", recurse = false, dynlib = "SDL_mixer_LPath", flags = &"-I={sdlIncludeDir} -f=ast2") + cImport(srcDir/"SDL_mixer.h", recurse = false, dynlib = "SDL_mixer_LPath", flags = &"-I={SDLIncludeDir} -f=ast2") diff --git a/src/sdl2/sdl2_net.nim b/src/sdl2/sdl2_net.nim index accd169..c25b922 100644 --- a/src/sdl2/sdl2_net.nim +++ b/src/sdl2/sdl2_net.nim @@ -4,7 +4,6 @@ import nimterop/[cimport, build] const baseDir = SDLCacheDir - sdlIncludeDir = baseDir / "sdl2" / "include" srcDir = baseDir / "sdl2_net" buildDir = srcDir / ".libs" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" @@ -16,11 +15,11 @@ else: when defined(windows): when defined(amd64): - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir}" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" getHeader( "SDL_net.h", @@ -44,8 +43,8 @@ cOverride: cPluginPath(symbolPluginPath) when defined(SDL_net_Static): - cImport(srcDir / "SDL_net.h", recurse = false, flags = &"-I={sdlIncludeDir} -f=ast2") - cImport(srcDir / "SDLnetsys.h", recurse = false, flags = &"-I={sdlIncludeDir} -f=ast2") + cImport(srcDir / "SDL_net.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2") + cImport(srcDir / "SDLnetsys.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2") else: cImport(srcDir / "SDL_net.h", recurse = false, dynlib = "SDL_net_LPath", flags = &"-I={sdlIncludeDir} -f=ast2") - cImport(srcDir / "SDLnetsys.h", recurse = false, flags = &"-I={sdlIncludeDir} -f=ast2") + cImport(srcDir / "SDLnetsys.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2") diff --git a/src/sdl2/sdl2_ttf.nim b/src/sdl2/sdl2_ttf.nim index a8c3c7d..e95b005 100644 --- a/src/sdl2/sdl2_ttf.nim +++ b/src/sdl2/sdl2_ttf.nim @@ -17,11 +17,11 @@ else: when defined(windows): when defined(amd64): - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=i686-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" else: - const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir}" + const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} CFLAGS=\"-fPIC -I{SDLIncludeDir}\"" getHeader(