Support windows

This commit is contained in:
Joey Yakimowich-Payne 2020-09-10 20:10:20 -06:00
commit c9eb978ec9

View file

@ -10,7 +10,15 @@ const
currentPath = getProjectPath().parentDir().sanitizePath currentPath = getProjectPath().parentDir().sanitizePath
generatedPath = (currentPath / "generated" / "glfw").replace("\\", "/") generatedPath = (currentPath / "generated" / "glfw").replace("\\", "/")
symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim" symbolPluginPath = currentSourcePath.parentDir() / "cleansymbols.nim"
defs = """
when defined(windows):
const defs = """
glfw3SetVer=3.3.2
glfw3DL
glfw3Static
"""
else:
const defs = """
glfw3SetVer=05dd2fa glfw3SetVer=05dd2fa
glfw3Git glfw3Git
glfw3Static glfw3Static
@ -18,9 +26,15 @@ const
setDefines(defs.splitLines()) setDefines(defs.splitLines())
when defined(amd64):
const dlUrl = "https://github.com/glfw/glfw/releases/download/$1/glfw-$1.bin.WIN64.zip"
else:
const dlUrl = "https://github.com/glfw/glfw/releases/download/$1/glfw-$1.bin.WIN32.zip"
getHeader( getHeader(
"glfw3.h", "glfw3.h",
giturl = "https://github.com/glfw/glfw", giturl = "https://github.com/glfw/glfw",
dlUrl = dlUrl,
outdir = srcDir, outdir = srcDir,
altNames = "glfw,glfw3", altNames = "glfw,glfw3",
) )
@ -34,14 +48,23 @@ static:
# cOverride: # cOverride:
# discard # discard
cIncludeDir(srcDir/"include"/"GLFW") when defined(windows):
when defined(amd64):
const inclDir = srcDir / "glfw-3.3.2.bin.WIN64" / "include" / "GLFW"
else:
const inclDir = srcDir / "glfw-3.3.2.bin.WIN32" / "include" / "GLFW"
else:
const inclDir = srcDir / "include" / "GLFW"
cIncludeDir(inclDir)
cPluginPath(symbolPluginPath) cPluginPath(symbolPluginPath)
{.passL: "-pthread".} {.passL: "-pthread".}
when isDefined(glfw3Static): when isDefined(glfw3Static):
cImport(srcDir/"include"/"GLFW"/"glfw3.h", recurse = true, flags = "-f=ast2 -E__,_ -F__,_ -H", nimFile = generatedPath / "glfw.nim") cImport(inclDir/"glfw3.h", recurse = true, flags = "-f=ast2 -E__,_ -F__,_ -H", nimFile = generatedPath / "glfw.nim")
else: else:
cImport(srcDir/"include"/"GLFW"/"glfw3.h", recurse = true, dynlib = "glfw3LPath", flags = "-f=ast2 -E__,_ -F__,_ -H", nimFile = generatedPath / "glfw.nim") cImport(inclDir/"glfw3.h", recurse = true, dynlib = "glfw3LPath", flags = "-f=ast2 -E__,_ -F__,_ -H", nimFile = generatedPath / "glfw.nim")
const const
KEY_LAST* = KEY_MENU KEY_LAST* = KEY_MENU
@ -56,7 +79,9 @@ const
GAMEPAD_BUTTON_SQUARE* = GAMEPAD_BUTTON_X GAMEPAD_BUTTON_SQUARE* = GAMEPAD_BUTTON_X
GAMEPAD_BUTTON_TRIANGLE* = GAMEPAD_BUTTON_Y GAMEPAD_BUTTON_TRIANGLE* = GAMEPAD_BUTTON_Y
GAMEPAD_AXIS_LAST* = GAMEPAD_AXIS_RIGHT_TRIGGER GAMEPAD_AXIS_LAST* = GAMEPAD_AXIS_RIGHT_TRIGGER
OPENGL_DEBUG_CONTEXT* = CONTEXT_DEBUG when not defined(windows):
HRESIZE_CURSOR* = RESIZE_EW_CURSOR const
VRESIZE_CURSOR* = RESIZE_NS_CURSOR OPENGL_DEBUG_CONTEXT* = CONTEXT_DEBUG
HAND_CURSOR* = POINTING_HAND_CURSOR HRESIZE_CURSOR* = RESIZE_EW_CURSOR
VRESIZE_CURSOR* = RESIZE_NS_CURSOR
HAND_CURSOR* = POINTING_HAND_CURSOR