diff --git a/nim.cfg b/nim.cfg index 2297f99..1bd5aad 100644 --- a/nim.cfg +++ b/nim.cfg @@ -2,6 +2,6 @@ -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_TTFSetVer="2.0.15" -d:SDL_TTF_DL -d:SDL_TTF_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 \ No newline at end of file diff --git a/sdl2.nimble b/sdl2.nimble index 60a539d..aef2d17 100644 --- a/sdl2.nimble +++ b/sdl2.nimble @@ -5,14 +5,15 @@ author = "Joey Yakimowich-Payne" description = "SDL2 Autogenerated wrapper" license = "MIT" srcDir = "src" +skipDirs = @["build"] # Dependencies -requires "nim >= 1.0.6", "nimterop#cpluginpath", "regex" +requires "nim >= 1.0.6", "nimterop#head", "regex" when gorgeEx("nimble path nimterop").exitCode == 0: import nimterop/docs task docs, "Generate docs": - buildDocs(@["src/sdl2.nim"], "build/htmldocs") + buildDocs(@["src/sdl2.nim", "src/sdl2/sdl2_gpu.nim"], "build/htmldocs") cpFile("build/htmldocs/dochack.js", "build/htmldocs/sdl2/dochack.js") else: diff --git a/cmake/sdl2/Copyright.txt b/src/cmake/sdl2/Copyright.txt similarity index 100% rename from cmake/sdl2/Copyright.txt rename to src/cmake/sdl2/Copyright.txt diff --git a/cmake/sdl2/FindSDL2.cmake b/src/cmake/sdl2/FindSDL2.cmake similarity index 100% rename from cmake/sdl2/FindSDL2.cmake rename to src/cmake/sdl2/FindSDL2.cmake diff --git a/cmake/sdl2/FindSDL2_gfx.cmake b/src/cmake/sdl2/FindSDL2_gfx.cmake similarity index 100% rename from cmake/sdl2/FindSDL2_gfx.cmake rename to src/cmake/sdl2/FindSDL2_gfx.cmake diff --git a/cmake/sdl2/FindSDL2_image.cmake b/src/cmake/sdl2/FindSDL2_image.cmake similarity index 100% rename from cmake/sdl2/FindSDL2_image.cmake rename to src/cmake/sdl2/FindSDL2_image.cmake diff --git a/cmake/sdl2/FindSDL2_mixer.cmake b/src/cmake/sdl2/FindSDL2_mixer.cmake similarity index 100% rename from cmake/sdl2/FindSDL2_mixer.cmake rename to src/cmake/sdl2/FindSDL2_mixer.cmake diff --git a/cmake/sdl2/FindSDL2_net.cmake b/src/cmake/sdl2/FindSDL2_net.cmake similarity index 100% rename from cmake/sdl2/FindSDL2_net.cmake rename to src/cmake/sdl2/FindSDL2_net.cmake diff --git a/cmake/sdl2/FindSDL2_ttf.cmake b/src/cmake/sdl2/FindSDL2_ttf.cmake similarity index 100% rename from cmake/sdl2/FindSDL2_ttf.cmake rename to src/cmake/sdl2/FindSDL2_ttf.cmake diff --git a/cmake/sdl2/README.md b/src/cmake/sdl2/README.md similarity index 100% rename from cmake/sdl2/README.md rename to src/cmake/sdl2/README.md diff --git a/src/sdl2/cleansymbols.nim b/src/sdl2/cleansymbols.nim index ad367cd..aed99cc 100644 --- a/src/sdl2/cleansymbols.nim +++ b/src/sdl2/cleansymbols.nim @@ -1,18 +1,25 @@ -# import macros, nimterop / plugin +import macros, nimterop / plugin import strutils, regex import sets proc firstLetterLower(m: RegexMatch, s: string): string = - s[m.group(0)[0]].toLowerAscii + if m.groupsCount > 0 and m.group(0).len > 0: + return s[m.group(0)[0]].toLowerAscii proc camelCase(m: RegexMatch, s: string): string = - s[m.group(0)[0]].toUpperAscii + if m.groupsCount > 0 and m.group(0).len > 0: + return s[m.group(0)[0]].toUpperAscii proc nothing(m: RegexMatch, s: string): string = - s[m.group(0)[0]] + if m.groupsCount > 0 and m.group(0).len > 0: + return s[m.group(0)[0]] const gpuReg = re"^GPU_(.)" const sdlReg = re"^SDL_(.)" +const ttfReg = re"^TTF_(.)" +const netReg = re"^SDLNet_(.)" +const mixReg = re"^Mix_(.)" +const imgReg = re"^IMG_(.)" const underscoreReg = re"_(.)" const EVENT_TYPES = toHashSet([ @@ -69,9 +76,27 @@ const EVENT_TYPES = toHashSet([ "LASTEVENT", ]) +const INT_TYPES = toHashSet([ + "Uint64", + "Uint32", + "Uint16", + "Uint8", + "Sint64", + "Sint32", + "Sint16", + "Sint8", +]) + + # Symbol renaming examples proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = + if sym.kind == nskType: + if sym.name == "_SDL_Haptic": + sym.name = "PHaptic" + # Remove prefixes or suffixes from procs + if sym.name.startsWith("SDL_HAPTIC_"): + sym.name = sym.name.replace("SDL_HAPTIC_", "HAPTIC_TYPE_") if sym.name == "SDL_init_flags": sym.name = "sdlInitFlags" if sym.name == "GPU_init_flags": @@ -79,14 +104,58 @@ proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = if sym.kind == nskProc or sym.kind == nskType or sym.kind == nskConst: if sym.name != "_": - sym.name = sym.name.strip(chars={'_'}).replace("___", "_") + sym.name = sym.name.strip(chars={'_'}).replace("__", "_") if sym.kind == nskProc: - sym.name = sym.name.replace(gpuReg, firstLetterLower) - sym.name = sym.name.replace(sdlReg, firstLetterLower) + try: + sym.name = sym.name.replace(gpuReg, firstLetterLower) + except: + discard + try: + sym.name = sym.name.replace(sdlReg, firstLetterLower) + except: + discard + try: + sym.name = sym.name.replace(ttfReg, firstLetterLower) + except: + discard + try: + sym.name = sym.name.replace(netReg, firstLetterLower) + except: + discard + try: + sym.name = sym.name.replace(mixReg, firstLetterLower) + except: + discard + try: + sym.name = sym.name.replace(imgReg, firstLetterLower) + except: + discard else: - sym.name = sym.name.replace(gpuReg, nothing) - sym.name = sym.name.replace(sdlReg, nothing) + try: + sym.name = sym.name.replace(gpuReg, nothing) + except: + discard + try: + sym.name = sym.name.replace(sdlReg, nothing) + except: + discard + try: + sym.name = sym.name.replace(ttfReg, nothing) + except: + discard + try: + sym.name = sym.name.replace(netReg, nothing) + except: + discard + try: + sym.name = sym.name.replace(mixReg, nothing) + except: + discard + try: + sym.name = sym.name.replace(imgReg, nothing) + except: + discard if sym.name.startsWith("SDLK_"): sym.name = sym.name.replace("SDLK_", "KEYCODE_") @@ -104,5 +173,14 @@ proc onSymbol*(sym: var Symbol) {.exportc, dynlib.} = if sym.name == "KeyCode": sym.name = "KeyCodeEnum" + if sym.name == "PRIX64": + sym.name = "SDLPRIX64" + if sym.kind == nskField: - sym.name = sym.name.replace(underscoreReg, camelCase) \ No newline at end of file + sym.name = sym.name.replace(underscoreReg, camelCase) + if sym.name == "type": + sym.name = "kind" + + # if INT_TYPES.contains(sym.name): + # sym.name = sym.name.replace("S", "") + # sym.name = sym.name.toLowerAscii() & "_ty" \ No newline at end of file diff --git a/src/sdl2/sdl2.nim b/src/sdl2/sdl2.nim index 68fdd41..70affa4 100644 --- a/src/sdl2/sdl2.nim +++ b/src/sdl2/sdl2.nim @@ -1,24 +1,74 @@ -import os, strutils +import os, strutils, strformat import nimterop/[cimport, build] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - srcDir = baseDir / "build" / "sdl2" + SDLCacheDir* = currentSourcePath.parentDir().parentDir() / "build" #getProjectCacheDir("nimsdl2") + baseDir = SDLCacheDir + srcDir = baseDir / "sdl2" buildDir = srcDir / "buildcache" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" getHeader( "SDL.h", dlurl = "https://www.libsdl.org/release/SDL2-$1.tar.gz", - outdir = srcDir + outdir = srcDir, + cmakeFlags = "-DSDL_STATIC_PIC=ON" ) +# {.passL: "-framework GLUT -framework OpenGL -framework Cocoa -framework IOKit -framework CoreVideo -framework Carbon -framework CoreAudio -lm".} static: - cSkipSymbol @["bool", "compile_time_assert_SDL_Event"] + cSkipSymbol @[ + "bool", "compile_time_assert_SDL_Event", "INLINE", "FUNCTION", + "FILE", "LINE", "PRIu64", "PRIx64", "SDLPRIX64", "assert_state", + "assert_data", + # "SDL_AssertState", "SDL_AssertData", "SDL_threadID", "SDL_Keycode", "SDL_HapticConstant", "SDL_HapticRamp", "SDL_HapticLeftRight", "SDL_HapticCustom", "SDL_HapticPause", "SDL_Log" + ] # cDebug() # cDisableCaching() + # let contents = readFile(srcDir/"src"/"dynapi"/"SDL_dynapi_procs.h") + # writeFile(srcDir/"src"/"dynapi"/"SDL_dynapi_procs.c", contents) + +template sdl_button*(x: untyped): untyped = + (1 shl ((x) - 1)) + +template WINDOWPOS_UNDEFINED_DISPLAY*(x: untyped): untyped = + (WINDOWPOS_UNDEFINED_MASK or (x)) + +template WINDOWPOS_ISUNDEFINED*(x: untyped): untyped = + (((x) and 0xFFFF0000) == WINDOWPOS_UNDEFINED_MASK) + +template WINDOWPOS_CENTERED_DISPLAY*(x: untyped): untyped = + (WINDOWPOS_CENTERED_MASK or (x)) + +template WINDOWPOS_ISCENTERED*(x: untyped): untyped = + (((x) and 0xFFFF0000) == WINDOWPOS_CENTERED_MASK) cOverride: + const + WINDOWPOS_UNDEFINED_MASK* = 0x1FFF0000.uint + WINDOWPOS_CENTERED_MASK* = 0x2FFF0000.uint + Colour* = "" + BlitSurface* = "" + BlitScaled* = "" + MAX_SINT8* = int8.high + MIN_SINT8* = int8.low + MAX_UINT8* = uint8.high + MIN_UINT8* = uint8.low + MAX_SINT16* = int16.high + MIN_SINT16* = int16.low + MAX_UINT16* = uint16.high + MIN_UINT16* = uint16.low + MAX_SINT32* = int32.high + MIN_SINT32* = int32.low + MAX_UINT32* = uint32.high + MIN_UINT32* = uint32.low + MIN_UINT64* = uint64.low + MAX_SINT64* = int64.high + MAX_UINT64* = uint64.high + TOUCH_MOUSEID* = cast[uint32](-1) + MOUSE_TOUCHID* = -1.int64 + MUTEX_MAXWAIT* = ((not cast[uint32](0))) + type BlitMap* {.incompleteStruct.} = object RWops* {.incompleteStruct.} = object @@ -57,8 +107,15 @@ cOverride: cPluginPath(symbolPluginPath) +static: + when SDL_Static: + const conf = staticExec(&"cd {srcDir}; ./sdl2-config --static-libs || (./configure --silent; ./sdl2-config --static-libs)").replace("-lSDL2 ", "").split('\n')[^1] + else: + const conf = staticExec(&"cd {srcDir}; ./sdl2-config --libs || (./configure --silent; ./sdl2-config --libs)").split('\n')[^1] + {.passL: conf.} + when defined(SDL_Static): - cImport(SDL_Path, recurse = true, flags = "-f=ast2 -DDOXYGEN_SHOULD_IGNORE_THIS") + cImport(SDL_Path, recurse = true, flags = "-f=ast2 -DDOXYGEN_SHOULD_IGNORE_THIS -E__,_ -F__,_") else: cImport(SDL_Path, recurse = true, dynlib = "SDL_LPath", flags = "-f=ast2 -DDOXYGEN_SHOULD_IGNORE_THIS") @@ -75,4 +132,34 @@ proc findDynlib(): string = return findFile(pathRegex, buildDir, regex = true) const SDLDyLibPath* = findDynlib() -const SDLMainLib* = buildDir / "libSDL2main.a" \ No newline at end of file +const SDLMainLib* = buildDir / "libSDL2main.a" +const SDLStaticLib* = buildDir / "libSDL2.a" + +const + WINDOWPOS_UNDEFINED* = WINDOWPOS_UNDEFINED_DISPLAY(0) + WINDOWPOS_CENTERED* = WINDOWPOS_CENTERED_DISPLAY(0) + + SCANCODE_MASK* = (1 shl 30) + + BUTTON_LMASK* = sdl_button(BUTTON_LEFT) + BUTTON_MMASK* = sdl_button(BUTTON_MIDDLE) + BUTTON_RMASK* = sdl_button(BUTTON_RIGHT) + BUTTON_X1MASK* = sdl_button(BUTTON_X1) + BUTTON_X2MASK* = sdl_button(BUTTON_X2) + + HAPTIC_CONSTANT_TYPE* = (1 shl 0) + HAPTIC_SINE_TYPE* = (1 shl 1) + HAPTIC_LEFTRIGHT_TYPE* = (1 shl 2) + HAPTIC_TRIANGLE_TYPE* = (1 shl 3) + HAPTIC_SAWTOOTHUP_TYPE* = (1 shl 4) + HAPTIC_SAWTOOTHDOWN_TYPE* = (1 shl 5) + HAPTIC_RAMP_TYPE* = (1 shl 6) + HAPTIC_SPRING_TYPE* = (1 shl 7) + HAPTIC_DAMPER_TYPE* = (1 shl 8) + HAPTIC_INERTIA_TYPE* = (1 shl 9) + HAPTIC_FRICTION_TYPE* = (1 shl 10) + HAPTIC_CUSTOM_TYPE* = (1 shl 11) + HAPTIC_GAIN_TYPE* = (1 shl 12) + HAPTIC_AUTOCENTER_TYPE* = (1 shl 13) + HAPTIC_STATUS_TYPE* = (1 shl 14) + HAPTIC_PAUSE_TYPE* = (1 shl 15) \ No newline at end of file diff --git a/src/sdl2/sdl2_gfx.nim b/src/sdl2/sdl2_gfx.nim index 9c3cdfd..7045467 100644 --- a/src/sdl2/sdl2_gfx.nim +++ b/src/sdl2/sdl2_gfx.nim @@ -3,10 +3,9 @@ import sdl2 import nimterop/[cimport, build] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - buildDir = baseDir / "build" - sdlIncludeDir = buildDir / "sdl2" / "include" - srcDir = buildDir / "sdl2_gfx" + baseDir = SDLCacheDir + sdlIncludeDir = baseDir / "sdl2" / "include" + srcDir = baseDir / "sdl2_gfx" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" getHeader( diff --git a/src/sdl2/sdl2_gpu.nim b/src/sdl2/sdl2_gpu.nim index 8d2c093..df727c9 100644 --- a/src/sdl2/sdl2_gpu.nim +++ b/src/sdl2/sdl2_gpu.nim @@ -3,13 +3,13 @@ import sdl2 import nimterop/[build, cimport] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - buildDir = baseDir / "build" - sdlDir = buildDir / "sdl2" + baseDir = SDLCacheDir + sdlDir = baseDir / "sdl2" sdlIncludeDir = sdlDir / "include" - cmakeModPath = baseDir / "cmake" / "sdl2" - srcDir = buildDir / "sdl2_gpu" - symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" + srcDir = baseDir / "sdl2_gpu" + currentPath = currentSourcePath().parentDir().parentDir() + cmakeModPath = currentPath / "cmake" / "sdl2" + symbolPluginPath = currentPath / "sdl2" / "cleansymbols.nim" getHeader( "SDL_gpu.h", @@ -20,17 +20,85 @@ getHeader( &"-DSDL2MAIN_LIBRARY={SDLMainLib} -DSDL2_PATH={sdlDir} -DSDL2_INCLUDE_DIR={sdlIncludeDir} -DSDL_gpu_BUILD_DEMOS=OFF" ) -# static: -# cDebug() -# cDisableCaching() +static: + cSkipSymbol @["Log"] + # cDebug() + # cDisableCaching() cOverride: type + WindowFlagEnum* = WindowFlags LogLevelEnum* = enum LOG_LEVEL_INFO = 0 LOG_LEVEL_WARNING LOG_LEVEL_ERROR +const + NONE* = 0.uint32 + FEATURE_NON_POWER_OF_TWO* = 0x1.uint32 + FEATURE_RENDER_TARGETS* = 0x2.uint32 + FEATURE_BLEND_EQUATIONS* = 0x4.uint32 + FEATURE_BLEND_FUNC_SEPARATE* = 0x8.uint32 + FEATURE_BLEND_EQUATIONS_SEPARATE* = 0x10.uint32 + FEATURE_GL_BGR* = 0x20.uint32 + FEATURE_GL_BGRA* = 0x40.uint32 + FEATURE_GL_ABGR* = 0x80.uint32 + FEATURE_VERTEX_SHADER* = 0x100.uint32 + FEATURE_FRAGMENT_SHADER* = 0x200.uint32 + FEATURE_PIXEL_SHADER* = 0x200.uint32 + FEATURE_GEOMETRY_SHADER* = 0x400.uint32 + FEATURE_WRAP_REPEAT_MIRRORED* = 0x800.uint32 + FEATURE_CORE_FRAMEBUFFER_OBJECTS* = 0x1000.uint32 + + INIT_ENABLE_VSYNC* = 0x1.uint32 + INIT_DISABLE_VSYNC* = 0x2.uint32 + INIT_DISABLE_DOUBLE_BUFFER* = 0x4.uint32 + INIT_DISABLE_AUTO_VIRTUAL_RESOLUTION* = 0x8.uint32 + INIT_REQUEST_COMPATIBILITY_PROFILE* = 0x10.uint32 + INIT_USE_ROW_BY_ROW_TEXTURE_UPLOAD_FALLBACK* = 0x20.uint32 + INIT_USE_COPY_TEXTURE_UPLOAD_FALLBACK* = 0x40.uint32 + + POINTS* = 0x0.uint32 + LINES* = 0x1.uint32 + LINE_LOOP* = 0x2.uint32 + LINE_STRIP* = 0x3.uint32 + TRIANGLES* = 0x4.uint32 + TRIANGLE_STRIP* = 0x5.uint32 + TRIANGLE_FAN* = 0x6.uint32 + + BATCH_XY* = 0x1.uint32 + BATCH_XYZ* = 0x2.uint32 + BATCH_ST* = 0x4.uint32 + BATCH_RGB* = 0x8.uint32 + BATCH_RGBA* = 0x10.uint32 + BATCH_RGB8* = 0x20.uint32 + BATCH_RGBA8* = 0x40.uint32 + FLIP_NONE* = 0x0.uint32 + FLIP_HORIZONTAL* = 0x1.uint32 + FLIP_VERTICAL* = 0x2.uint32 + + TYPE_BYTE* = 0x1400.uint32 + TYPE_UNSIGNED_BYTE* = 0x1401.uint32 + TYPE_SHORT* = 0x1402.uint32 + TYPE_UNSIGNED_SHORT* = 0x1403.uint32 + TYPE_INT* = 0x1404.uint32 + TYPE_UNSIGNED_INT* = 0x1405.uint32 + TYPE_FLOAT* = 0x1406.uint32 + TYPE_DOUBLE* = 0x140A.uint32 + + RENDERER_UNKNOWN* = 0.uint32 + RENDERER_OPENGL_1_BASE* = 1.uint32 + RENDERER_OPENGL_1* = 2.uint32 + RENDERER_OPENGL_2* = 3.uint32 + RENDERER_OPENGL_3* = 4.uint32 + RENDERER_OPENGL_4* = 5.uint32 + RENDERER_GLES_1* = 11.uint32 + RENDERER_GLES_2* = 12.uint32 + RENDERER_GLES_3* = 13.uint32 + RENDERER_D3D9* = 21.uint32 + RENDERER_D3D10* = 22.uint32 + RENDERER_D3D11* = 23.uint32 + cPluginPath(symbolPluginPath) when defined(SDL_gpu_Static): diff --git a/src/sdl2/sdl2_image.nim b/src/sdl2/sdl2_image.nim index 40956d7..a48f503 100644 --- a/src/sdl2/sdl2_image.nim +++ b/src/sdl2/sdl2_image.nim @@ -3,10 +3,9 @@ import sdl2 import nimterop/[cimport, build] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - buildDir = baseDir / "build" - sdlIncludeDir = buildDir / "sdl2" / "include" - srcDir = buildDir / "sdl2_image" + baseDir = SDLCacheDir + sdlIncludeDir = baseDir / "sdl2" / "include" + srcDir = baseDir / "sdl2_image" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" getHeader( @@ -20,6 +19,12 @@ getHeader( # cDebug() # cDisableCaching() +cOverride: + const + GetError* = "" + SetError* = "" + ClearError* = "" + cPluginPath(symbolPluginPath) when defined(SDL_image_Static): diff --git a/src/sdl2/sdl2_mixer.nim b/src/sdl2/sdl2_mixer.nim index b2a8c2e..13cf642 100644 --- a/src/sdl2/sdl2_mixer.nim +++ b/src/sdl2/sdl2_mixer.nim @@ -3,10 +3,9 @@ import sdl2 import nimterop/[cimport, build] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - buildDir = baseDir / "build" - sdlIncludeDir = buildDir / "sdl2" / "include" - srcDir = buildDir / "sdl2_mixer" + baseDir = SDLCacheDir + sdlIncludeDir = baseDir / "sdl2" / "include" + srcDir = baseDir / "sdl2_mixer" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" getHeader( @@ -20,6 +19,12 @@ getHeader( # cDebug() # cDisableCaching() +cOverride: + const + GetError* = "" + SetError* = "" + ClearError* = "" + cPluginPath(symbolPluginPath) when defined(SDL_mixer_Static): diff --git a/src/sdl2/sdl2_net.nim b/src/sdl2/sdl2_net.nim index 602e67d..cf2fdf1 100644 --- a/src/sdl2/sdl2_net.nim +++ b/src/sdl2/sdl2_net.nim @@ -3,10 +3,9 @@ import sdl2 import nimterop/[cimport, build] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - buildDir = baseDir / "build" - sdlIncludeDir = buildDir / "sdl2" / "include" - srcDir = buildDir / "sdl2_net" + baseDir = SDLCacheDir + sdlIncludeDir = baseDir / "sdl2" / "include" + srcDir = baseDir / "sdl2_net" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" getHeader( @@ -20,6 +19,10 @@ getHeader( # cDebug() # cDisableCaching() +cOverride: + type + Version* = sdl2.Version + cPluginPath(symbolPluginPath) when defined(SDL_net_Static): diff --git a/src/sdl2/sdl2_ttf.nim b/src/sdl2/sdl2_ttf.nim index 67ea99c..3337379 100644 --- a/src/sdl2/sdl2_ttf.nim +++ b/src/sdl2/sdl2_ttf.nim @@ -3,13 +3,13 @@ import sdl2 import nimterop/[cimport, build] const - baseDir = currentSourcePath.parentDir().parentDir().parentDir() - buildDir = baseDir / "build" - sdlDir = buildDir / "sdl2" + baseDir = SDLCacheDir + sdlDir = baseDir / "sdl2" sdlIncludeDir = sdlDir / "include" - cmakeModPath = baseDir / "cmake" / "sdl2" - srcDir = buildDir / "sdl2_ttf" - symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" + srcDir = baseDir / "sdl2_ttf" + currentPath = currentSourcePath().parentDir().parentDir() + cmakeModPath = currentPath / "cmake" / "sdl2" + symbolPluginPath = currentPath / "sdl2" / "cleansymbols.nim" getHeader( "SDL_ttf.h", @@ -26,7 +26,12 @@ getHeader( cPluginPath(symbolPluginPath) +cOverride: + const + GetError* = "" + SetError* = "" + when defined(SDL_ttf_Static): - cImport(SDL_ttf_Path, recurse = false, flags = &"-I={sdlIncludeDir} -f=ast2") + cImport(SDL_ttf_Path, recurse = false, flags = &"-I={sdlIncludeDir} -f=ast2 -d") else: cImport(SDL_ttf_Path, recurse = false, dynlib = "SDL_ttf_LPath", flags = &"-I={sdlIncludeDir} -f=ast2")