diff --git a/.gitignore b/.gitignore index 719ccf91..74e7e26a 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ vendor/pcre *.so *.dylib *.dll +*.a bin/ scratch/ tools/build_helpers diff --git a/.gitmodules b/.gitmodules index 8f76ddbb..12d267cb 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,6 +7,6 @@ url = https://github.com/dsrw/godot.git branch = enu ignore = untracked -[submodule "vendor/pcre2"] - path = vendor/pcre2 - url = https://github.com/PhilipHazel/pcre2.git +[submodule "vendor/pcre"] + path = vendor/pcre + url = https://github.com/luvit/pcre diff --git a/app/libenu.a b/app/libenu.a deleted file mode 100644 index f2f58d1c..00000000 Binary files a/app/libenu.a and /dev/null differ diff --git a/enu.nimble b/enu.nimble index f1b166c2..f53a289a 100644 --- a/enu.nimble +++ b/enu.nimble @@ -38,7 +38,6 @@ requires "nim >= 2.0.2", "https://github.com/dsrw/model_citizen 0.19.2", "https://github.com/dsrw/nanoid.nim 0.2.1", "cligen 1.6.17", "https://github.com/treeform/pretty", - "https://github.com/theAkito/xxnimterop", "chroma", "markdown", "chronicles", "dotenv", "nimibook", "metrics#51f1227", "zippy" diff --git a/ios.sh b/ios.sh deleted file mode 100755 index ddef8734..00000000 --- a/ios.sh +++ /dev/null @@ -1,4 +0,0 @@ -nim c --os:ios --debugger:native -o:dist/ios/Enu/libenu.a -t:'-Ivendor/pcre -miphoneos-version-min=12.0 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -mcpu=apple-a10' -l:'-target aarch64-ios --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk' src/enu.nim - - -# TARGET=ios nim c -o:app/enu.simulator.a -t:'-mios-simulator-version-min=12.0 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -mcpu=apple-a10' -l:'-target arm64-apple-ios-simulator --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk' src/enu.nim \ No newline at end of file diff --git a/src/config.nims b/src/config.nims index 10f9de96..86419ab8 100644 --- a/src/config.nims +++ b/src/config.nims @@ -50,15 +50,15 @@ if defined(release): # --passC:"-I/opt/homebrew/include" ---define:usePcreHeader ---passC:"-Ivendor/pcre" - if project_name() == "enu": if host_os == "ios": + --define:use_pcre_header + --define:"chronicles_colors=None" + --passC:"-Ivendor/pcre -miphoneos-version-min=12.0 --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -mcpu=apple-a10" + --passL:"-target aarch64-ios --sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk" --app:staticlib else: --app:lib - --passL:"-Lvendor/pcre/.libs -lpcre" --no_main else: --define: diff --git a/src/controllers/script_controllers/host_bridge_utils.nim b/src/controllers/script_controllers/host_bridge_utils.nim index 88053aa4..cf30159a 100644 --- a/src/controllers/script_controllers/host_bridge_utils.nim +++ b/src/controllers/script_controllers/host_bridge_utils.nim @@ -125,7 +125,12 @@ macro bridged_from_vm( result.add quote do: mixin implement_routine debug "implementing routine", name = `proc_name` - `self`.interpreter.implement_routine "*", + const pkg_name = + when host_os == "ios": + "unknown" + else: + "enu" + `self`.interpreter.implement_routine pkg_name, `module_name`, `proc_impl_name`, proc(a {.inject.}: VmArgs) {.gcsafe.} = diff --git a/src/libs/eval.nim b/src/libs/eval.nim index 93f67d01..c0d48bf5 100644 --- a/src/libs/eval.nim +++ b/src/libs/eval.nim @@ -156,8 +156,6 @@ proc loadModule*( if iface.module != nil and iface.module.name.s == moduleName and fileName == toFullPath(i.graph.config, iface.module.info): module = iface.module - print "@@@@module ", iface.module.info - discard posix.raise SIGINT break if module.isNil: diff --git a/tools/build_ios.sh b/tools/build_ios.sh new file mode 100755 index 00000000..947fd7c3 --- /dev/null +++ b/tools/build_ios.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -e + +export SDK=$(xcrun --sdk iphoneos --show-sdk-path) +export CC=$(xcrun --sdk iphoneos -f clang) +export CFLAGS="-arch arm64 -isysroot $SDK -mios-version-min=12.0" +export LDFLAGS="-arch arm64 -isysroot $SDK" + +cd "$(dirname "$0")/../vendor/pcre" +./configure --disable-shared --disable-cpp --enable-unicode-properties --enable-pcre16 --enable-pcre32 --host=arm-apple-darwin +make + +cd ../.. + +nim c --os:ios --debugger:native -o:libenu.a src/enu.nim + +libtool -static -o app/libenu.a libenu.a vendor/pcre/.libs/libpcre.a diff --git a/vendor/pcre b/vendor/pcre new file mode 160000 index 00000000..5c78f7d5 --- /dev/null +++ b/vendor/pcre @@ -0,0 +1 @@ +Subproject commit 5c78f7d5d7f41bdd4be4867ef3a1030af3e973e3