myou-engine-template-project/scripts/update_ios_files.sh

34 lines
913 B
Bash
Raw Normal View History

2024-08-23 15:08:24 +00:00
# TODO: port this to nimscript
# Build for ios like this:
# nim c -c --os:ios --cpu:arm64 src/main.nim
# then run this script to copy the missing files
# and then remove and add the folder again in xcode
# If there are old files that are no longer used
# you have to delete the cache first:
# rm tmp/ios/* -rf
# then build and follow the above instructions
OUT_NAME=game
cd tmp/ios
DIR="$(pwd)"
# copy header files
(cat "$OUT_NAME.json" |
grep -- -I/|
grep -o -- '-I/[^ ]*' |
grep -v '^-I/$' |
sed 's@^..@@' | sort | uniq |
xargs -d'\n' -I {} find {} -iname "*.h" |
xargs -d'\n' -I {} cp "{}" .
)
# copy c files outside cache
echo ignore any error below saying "*.h" does not exist
(cat "$OUT_NAME.json" |
grep '\.\(c\|cpp\|m\)",' |
grep -v "\"$DIR" |
sed -e 's/",$//' -e 's/^\s*"//' -e 's/\\"/"/g' |
xargs -d'\n' -I {} sh -c 'cp "{}" "$(dirname {})/"*.h .'
)