From e31f6cd4ec7838365b9f01cde7169565ed7d322e Mon Sep 17 00:00:00 2001 From: martinfouilleul Date: Sun, 2 Jul 2023 12:50:32 +0200 Subject: [PATCH] [win32] Fix building the pong sample on win32 --- milepost | 2 +- samples/pong/build.bat | 12 ++++++------ scripts/mkapp.py | 18 ++++++++++++------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/milepost b/milepost index 21aa1be..36c75a5 160000 --- a/milepost +++ b/milepost @@ -1 +1 @@ -Subproject commit 21aa1bef68c3590c1898a539da4c38e3854a5a9d +Subproject commit 36c75a55dd1d843b29691293410344a9f48a9201 diff --git a/samples/pong/build.bat b/samples/pong/build.bat index ae1f2ba..7ba6677 100644 --- a/samples/pong/build.bat +++ b/samples/pong/build.bat @@ -5,13 +5,13 @@ set wasmFlags=--target=wasm32^ --no-standard-libraries ^ -fno-builtin ^ -Wl,--no-entry ^ - -Wl,--export-all ^ - -Wl,--allow-undefined ^ + -Wl,--export-dynamic ^ -g ^ + -O2 ^ + -mbulk-memory ^ -D__ORCA__ ^ - -I ..\.. -I ..\..\src -I ..\..\sdk -I..\..\milepost -I ..\..\milepost\src + -isystem ..\..\cstdlib\include -I ..\..\sdk -I..\..\milepost\ext -I ..\..\milepost -I ..\..\milepost\src -clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c src\main.c +clang %wasmFlags% -o .\module.wasm ..\..\sdk\orca.c ..\..\cstdlib\src\*.c src\main.c - -python3 ..\..\scripts\mkapp.py --orca-dir ../.. --name Pong --icon icon.png --data-dir dir1 module.wasm +python3 ..\..\scripts\mkapp.py --orca-dir ..\.. --name Pong --icon icon.png --resource-dir data module.wasm diff --git a/scripts/mkapp.py b/scripts/mkapp.py index 687cc19..af5aeaa 100644 --- a/scripts/mkapp.py +++ b/scripts/mkapp.py @@ -184,15 +184,21 @@ def windows_make_app(args): #----------------------------------------------------------- #NOTE: copy wasm module and data #----------------------------------------------------------- + shutil.copy(args.module, wasm_dir + '/module.wasm') - if args.data_files != None: - for data in args.data_files: - shutil.copy(data, data_dir) + if args.resource_files != None: + for resource in args.resource_files: + shutil.copytree(resource, data_dir + '/' + os.path.basename(resource), dirs_exist_ok=True) - if args.data_dirs != None: - for data in args.data_dirs: - shutil.copytree(data, data_dir + '/' + os.path.basename(data), dirs_exist_ok=True) + if args.resource_dirs != None: + for resource_dir in args.resource_dirs: + for resource in os.listdir(resource_dir): + src = resource_dir + '/' + resource + if os.path.isdir(src): + shutil.copytree(src, data_dir + '/' + os.path.basename(resource), dirs_exist_ok=True) + else: + shutil.copy(src, data_dir) #----------------------------------------------------------- #NOTE: copy runtime resources