Use isDefined

This commit is contained in:
Joey Yakimowich-Payne 2020-08-23 20:36:50 -06:00
commit 944f13a883
9 changed files with 67 additions and 16 deletions

View file

@ -1,7 +0,0 @@
-d:SDL_SetVer="2.0.12" -d:SDL_DL -d:SDL_Static
-d:SDL_ImageSetVer="2.0.5" -d:SDL_Image_DL -d:SDL_Image_Static
-d:SDL_NetSetVer="2.0.1" -d:SDL_Net_DL -d:SDL_Net_Static
-d:SDL_MixerSetVer="2.0.4" -d:SDL_Mixer_DL -d:SDL_Mixer_Static
-d:SDL_ttf_SetVer="2.0.15" -d:SDL_TTF_DL -d:SDL_ttf_Static
-d:SDL_GpuSetVer="def5ea1" -d:SDL_GPU_Git -d:SDL_Gpu_Static
-d:SDL2_GFXPrimitivesSetVer="1.0.4" -d:SDL2_GFXPrimitives_DL -d:SDL2_GFXPrimitives_Static -d:SDL2_GFX_Static

View file

@ -1,6 +1,6 @@
# Package
version = "0.1.0"
version = "0.2.0"
author = "Joey Yakimowich-Payne"
description = "SDL2 Autogenerated wrapper"
license = "MIT"

View file

@ -9,6 +9,14 @@ const
includeDir = (srcDir / "include").sanitizePath
symbolPluginPath = (currentSourcePath.parentDir() / "cleansymbols.nim").sanitizePath
defs = """
SDLSetVer=2.0.12
SDLDL
SDLStatic
"""
setDefines(defs.splitLines())
when defined(windows):
const dlurl = "https://www.libsdl.org/release/SDL2-$1.zip"
else:
@ -174,7 +182,7 @@ static:
if "lSDL2" in line:
return line.strip()#.replace("-lSDL2 ", "").replace("-lSDL2main ", "")
when defined(SDL_Static):
when isDefined(SDLStatic):
when defined(windows):
#TODO: Find a way to automate this on Windows reliably
const conf = &"-lmingw32 {SDLStaticLib} {SDLMainLib} -mwindows -Wl,--no-undefined -Wl,--dynamicbase -Wl,--nxcompat -Wl,--high-entropy-va -lm -ldinput8 -ldxguid -ldxerr8 -luser32 -lgdi32 -lwinmm -limm32 -lole32 -loleaut32 -lshell32 -lsetupapi -lversion -luuid -static-libgcc"
@ -222,7 +230,7 @@ when defined(macosx):
else:
{.passC: "-fPIC".}
when defined(SDL_Static):
when isDefined(SDLStatic):
cImport(srcDir/"include"/"SDL.h", recurse = true, flags = "-f=ast2 -H -DDOXYGEN_SHOULD_IGNORE_THIS -E__,_ -F__,_")
else:
cImport(srcDir/"include"/"SDL.h", recurse = true, dynlib = "SDL_LPath", flags = "-f=ast2 -H -DDOXYGEN_SHOULD_IGNORE_THIS -E__,_ -F__,_")

View file

@ -8,6 +8,15 @@ const
buildDir = srcDir / ".libs"
symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim"
defs = """
SDL2gfxPrimitivesSetVer=1.0.4
SDL2gfxPrimitivesDL
SDL2gfxPrimitivesStatic
SDL2gfxStatic
"""
setDefines(defs.splitLines())
when defined(windows):
when defined(amd64):
const flags = &"--libdir={SDLBuildDir} --includedir={SDLIncludeDir} --host=x86_64-w64-mingw32 CFLAGS=\"-fPIC -I{SDLIncludeDir}\""
@ -33,7 +42,7 @@ static:
cPluginPath(symbolPluginPath)
when defined(SDL2_GfxPrimitives_Static):
when isDefined(SDL2gfxPrimitivesStatic):
cImport(srcDir / "SDL2_gfxPrimitives.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
cImport(srcDir / "SDL2_rotozoom.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
cImport(srcDir / "SDL2_framerate.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")

View file

@ -10,6 +10,14 @@ const
cmakeModPath = (currentPath / "cmake" / "sdl2").replace("\\", "/")
symbolPluginPath = (currentPath / "sdl2" / "cleansymbols.nim").sanitizePath
defs = """
SDLgpuSetVer=def5ea1
SDLgpuGit
SDLgpuStatic
"""
setDefines(defs.splitLines())
getHeader(
"SDL_gpu.h",
giturl = "https://github.com/grimfang4/sdl-gpu",
@ -102,7 +110,7 @@ cOverride:
cPluginPath(symbolPluginPath)
when defined(SDL_gpu_Static):
when isDefined(SDLgpuStatic):
cImport(srcDir/"include"/"SDL_gpu.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
else:
cImport(srcDir/"include"/"SDL_gpu.h", recurse = false, dynlib = "SDL_gpuLPath", flags = &"-I={SDLIncludeDir} -f=ast2 -H")

View file

@ -8,6 +8,15 @@ const
buildDir = srcDir / ".libs"
symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim"
defs = """
SDLimageSetVer=2.0.5
SDLimageDL
SDLimageStatic
"""
setDefines(defs.splitLines())
when defined(windows):
const dlurl = "https://www.libsdl.org/projects/SDL_image/release/SDL2_image-$1.zip"
else:
@ -52,7 +61,7 @@ cIncludeDir(SDLIncludeDir)
{.passL: "-lwebp -lpng -ltiff -ljpeg".}
when defined(SDL_image_Static):
when isDefined(SDLimageStatic):
cImport(srcDir/"SDL_image.h", recurse = false, flags = &"-f=ast2 -H")
else:
cImport(srcDir/"SDL_image.h", recurse = false, dynlib = "SDL_image_LPath", flags = &"-f=ast2 -H")

View file

@ -8,6 +8,14 @@ const
buildDir = srcDir / "build" / ".libs"
symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim"
defs = """
SDLmixerSetVer=2.0.4
SDLmixerDL
SDLmixerStatic
"""
setDefines(defs.splitLines())
when defined(windows):
const dlurl = "https://www.libsdl.org/projects/SDL_mixer/release/SDL2_mixer-$1.zip"
else:
@ -44,7 +52,7 @@ cOverride:
cPluginPath(symbolPluginPath)
when defined(SDL_Mixer_Static):
when isDefined(SDLmixerStatic):
cImport(srcDir/"SDL_mixer.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
else:
cImport(srcDir/"SDL_mixer.h", recurse = false, dynlib = "SDL_mixer_LPath", flags = &"-I={SDLIncludeDir} -f=ast2 -H")

View file

@ -8,6 +8,14 @@ const
buildDir = srcDir / ".libs"
symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim"
defs = """
SDLnetSetVer=2.0.1
SDLnetDL
SDLnetStatic
"""
setDefines(defs.splitLines())
when defined(windows):
const dlurl = "https://www.libsdl.org/projects/SDL_net/release/SDL2_net-$1.zip"
else:
@ -42,7 +50,7 @@ cOverride:
cPluginPath(symbolPluginPath)
when defined(SDL_net_Static):
when isDefined(SDLnetStatic):
cImport(srcDir / "SDL_net.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
cImport(srcDir / "SDLnetsys.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
else:

View file

@ -10,6 +10,14 @@ const
currentPath = currentSourcePath().parentDir().parentDir().sanitizePath
symbolPluginPath = (currentPath / "sdl2" / "cleansymbols.nim").sanitizePath
defs = """
SDLttfSetVer=2.0.15
SDLttfDL
SDLttfStatic
"""
setDefines(defs.splitLines())
when defined(windows):
const dlurl = "https://www.libsdl.org/projects/SDL_ttf/release/SDL2_ttf-$1.zip"
else:
@ -46,7 +54,7 @@ cOverride:
GetError* = ""
SetError* = ""
when defined(SDL_ttf_Static):
when isDefined(SDLttfStatic):
cImport(srcDir / "SDL_ttf.h", recurse = false, flags = &"-I={SDLIncludeDir} -f=ast2 -H")
else:
cImport(srcDir / "SDL_ttf.h", recurse = false, dynlib = "SDL_ttf_LPath", flags = &"-I={SDLIncludeDir} -f=ast2 -H")