From 919ff32b1b0a4b8b786290c3c54e1786c7e7bbd8 Mon Sep 17 00:00:00 2001 From: Joey Yakimowich-Payne Date: Sun, 15 Jul 2018 15:54:01 +0900 Subject: [PATCH] Add windows support --- config.nims | 4 -- libnx.nimble | 2 +- libnxGen.cfg | 90 +++++++++++++++++++++---------------------- src/libnx/config.nims | 4 -- src/libnx/console.nim | 2 +- 5 files changed, 45 insertions(+), 57 deletions(-) delete mode 100644 config.nims delete mode 100644 src/libnx/config.nims diff --git a/config.nims b/config.nims deleted file mode 100644 index dc3dbe4..0000000 --- a/config.nims +++ /dev/null @@ -1,4 +0,0 @@ -switch("passC", "-I" & thisDir() & "/src/libnx/wrapper/nx/include") -switch("passL", "-specs="&thisDir()&"/src/libnx/wrapper/nx/switch.specs -L"&thisDir()&"/src/libnx/wrapper/nx/lib -lnx") -#switch("passC", "-I$DEVKITPRO/libnx/include") -#switch("passL", "-specs=$DEVKITPRO/libnx/switch.specs -L$DEVKITPRO/libnx/lib -lnx") diff --git a/libnx.nimble b/libnx.nimble index 2311792..2961780 100644 --- a/libnx.nimble +++ b/libnx.nimble @@ -1,6 +1,6 @@ # Package -version = "0.1.7" +version = "0.1.8" author = "Joey Payne" description = "Nintendo Switch library libnx for Nim." license = "The Unlicense" diff --git a/libnxGen.cfg b/libnxGen.cfg index 3a35ed1..0a8ea3c 100644 --- a/libnxGen.cfg +++ b/libnxGen.cfg @@ -22,12 +22,46 @@ filter=lock "${output}/nim.cfg" "${output}/config.nims" +[svc.h] +search = "PACKED" +replace = "" + +search.noreturn = "NORETURN" +replace.noreturn = "" + +defines=true + +[result.h] +defines = true + +[hid.h] +defines = true +search.static_assert = "static_assert" +replace.static_assert = "// static_assert" +search.touch = "touchPosition" +replace.touch = "TouchPosition" + +[ipc.h] +defines = true + +[romfs_dev.h] +search = "romfs_" +replace = "Romfs_" + +[gfx.h] +defines = true + +[ioctl.h] +defines = true +search = "_NV_" +replace = "UNV_" + +search.nv = "__nv_" +replace.nv = "DUnv_" + [n.wildcard] wildcard.1 = "console.h" -rename = "$replace(console=con)" - -search = "_Bool" -replace = "bool" +rename = "$replace(console=cons)" wildcard.2 = "*.h" @@ -68,10 +102,7 @@ replace.cdecl = "cdecl" [n.prepare] git = "https://github.com/switchbrew/libnx" -execute = """ -cd ${output} -make -""" +#execute = """cd ${output}; make;""" [n.post] reset=true @@ -81,56 +112,21 @@ create = """ --path:"../" --path:"../../" """ +noprocess=true [src/libnx/wrapper/config.nims] create = """ switch("passC", "-I" & thisDir() & "/nx/include") switch("passL", "-specs=" & thisDir() & "/nx/switch.specs -L" & thisDir() & "/nx/lib -lnx") """ - -[result.h] -defines = true - -[hid.h] -defines = true -search.static_assert = "static_assert" -replace.static_assert = "// static_assert" -search.touch = "touchPosition" -replace.touch = "TouchPosition" - -[ipc.h] -defines = true - -[romfs_dev.h] -search = "romfs_" -replace = "Romfs_" - -[gfx.h] -defines = true - -[ioctl.h] -defines = true -search = "_NV_" -replace = "UNV_" - -search.nv = "__nv_" -replace.nv = "DUnv_" - -[svc.h] -search = "PACKED" -replace = "" - -search.noreturn = "NORETURN" -replace.noreturn = "" - -defines=true -pipe = "vim -es +'g/^static inline.*{/norm f{d%r;' -es +%print -es +q! $file" +noprocess=true [switch.h] preprocess = true defines = true recurse = true + [types.nim] search.o = " uint8*" prepend.o = """ @@ -313,7 +309,7 @@ prepend.o = """ import libnx/ext/integer128 """ -[con.nim] +[cons.nim] search.o = "type\n" prepend.o = """ diff --git a/src/libnx/config.nims b/src/libnx/config.nims deleted file mode 100644 index b83d14a..0000000 --- a/src/libnx/config.nims +++ /dev/null @@ -1,4 +0,0 @@ -switch("passC", "-I" & thisDir() & "/wrapper/nx/include") -switch("passL", "-specs=" & thisDir() & "/wrapper/nx/switch.specs -L" & thisDir() & "/wrapper/nx/lib -lnx") -#switch("passC", "-I$DEVKITPRO/libnx/include") -#switch("passL", "-specs=$DEVKITPRO/libnx/switch.specs -L$DEVKITPRO/libnx/lib -lnx") diff --git a/src/libnx/console.nim b/src/libnx/console.nim index 3747d88..2b76cb6 100644 --- a/src/libnx/console.nim +++ b/src/libnx/console.nim @@ -1,4 +1,4 @@ -import libnx/wrapper/con +import libnx/wrapper/cons import libnx/utils import macros, strutils