summaryrefslogtreecommitdiffhomepage
path: root/samples/12_c_extensions/01_basics/pre.sh
diff options
context:
space:
mode:
authorAmir Rajan <[email protected]>2020-10-13 00:45:16 -0500
committerAmir Rajan <[email protected]>2020-10-13 00:48:54 -0500
commit05cbef7fb8224332795e5685be499d81d20e7d93 (patch)
tree13ec5f1755c2f45618741f2f016ed8729dbedd41 /samples/12_c_extensions/01_basics/pre.sh
parentabad948c1154d88d79b9f891e3b7315540e0b0a3 (diff)
downloaddragonruby-game-toolkit-contrib-05cbef7fb8224332795e5685be499d81d20e7d93.tar.gz
dragonruby-game-toolkit-contrib-05cbef7fb8224332795e5685be499d81d20e7d93.zip
Synced with 1.26.
Diffstat (limited to 'samples/12_c_extensions/01_basics/pre.sh')
-rwxr-xr-xsamples/12_c_extensions/01_basics/pre.sh17
1 files changed, 13 insertions, 4 deletions
diff --git a/samples/12_c_extensions/01_basics/pre.sh b/samples/12_c_extensions/01_basics/pre.sh
index 8aa9eb7..07965a5 100755
--- a/samples/12_c_extensions/01_basics/pre.sh
+++ b/samples/12_c_extensions/01_basics/pre.sh
@@ -1,10 +1,19 @@
#!/bin/sh
+
+OSTYPE=`uname -s`
+if [ "x$OSTYPE" = "xDarwin" ]; then
+ PLATFORM=macos
+ DLLEXT=dylib
+else
+ PLATFORM=linux-amd64
+ DLLEXT=so
+fi
+
DRB_ROOT=../../..
-mkdir -p build.dir
+mkdir -p native/$PLATFORM
-$DRB_ROOT/dragonruby-bind --output=build.dir/ext-bindings.c app/ext.c
+$DRB_ROOT/dragonruby-bind --output=native/ext-bindings.c app/ext.c
clang \
-isystem $DRB_ROOT/include -I. \
- -undefined dynamic_lookup \
- -fPIC -shared build.dir/ext-bindings.c -o build.dir/ext.lib
+ -fPIC -shared native/ext-bindings.c -o native/$PLATFORM/ext.$DLLEXT