Samples: build orca core lib as a separate lib from the app #144

Merged
MartinFouilleul merged 2 commits from samples-build-corelib into main 2023-09-27 11:08:20 +00:00
5 changed files with 35 additions and 5 deletions
Showing only changes of commit 9448104f41 - Show all commits

View File

@ -15,6 +15,7 @@ fi
ORCA_DIR=../.. ORCA_DIR=../..
STDLIB_DIR=$ORCA_DIR/src/libc-shim STDLIB_DIR=$ORCA_DIR/src/libc-shim
# common flags to build wasm modules
wasmFlags="--target=wasm32 \ wasmFlags="--target=wasm32 \
--no-standard-libraries \ --no-standard-libraries \
-mbulk-memory \ -mbulk-memory \
@ -26,6 +27,11 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \ -I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext" -I $ORCA_DIR/src/ext"
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c # build orca core as wasm module
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
# build sample as wasm module and link it with the orca module
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
# create app directory and copy files into it
orca bundle --orca-dir $ORCA_DIR --name Breakout --icon icon.png --resource-dir data module.wasm orca bundle --orca-dir $ORCA_DIR --name Breakout --icon icon.png --resource-dir data module.wasm

View File

@ -15,6 +15,7 @@ fi
ORCA_DIR=../.. ORCA_DIR=../..
STDLIB_DIR=$ORCA_DIR/src/libc-shim STDLIB_DIR=$ORCA_DIR/src/libc-shim
# common flags to build wasm modules
wasmFlags="--target=wasm32 \ wasmFlags="--target=wasm32 \
--no-standard-libraries \ --no-standard-libraries \
-mbulk-memory \ -mbulk-memory \
@ -26,6 +27,11 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \ -I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext" -I $ORCA_DIR/src/ext"
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c # build orca core as wasm module
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
# build sample as wasm module and link it with the orca module
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
# create app directory and copy files into it
orca bundle --orca-dir $ORCA_DIR --name Clock --icon icon.png --resource-dir data module.wasm orca bundle --orca-dir $ORCA_DIR --name Clock --icon icon.png --resource-dir data module.wasm

View File

@ -17,6 +17,7 @@ STDLIB_DIR=$ORCA_DIR/src/libc-shim
python3 ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h src/shaders/*.glsl python3 ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h src/shaders/*.glsl
# common flags to build wasm modules
wasmFlags="--target=wasm32 \ wasmFlags="--target=wasm32 \
--no-standard-libraries \ --no-standard-libraries \
-mbulk-memory \ -mbulk-memory \
@ -28,6 +29,11 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \ -I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext" -I $ORCA_DIR/src/ext"
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c # build orca core as wasm module
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
# build sample as wasm module and link it with the orca module
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
# create app directory and copy files into it
orca bundle --orca-dir $ORCA_DIR --name Fluid --icon icon.png module.wasm orca bundle --orca-dir $ORCA_DIR --name Fluid --icon icon.png module.wasm

View File

@ -15,6 +15,7 @@ fi
ORCA_DIR=../.. ORCA_DIR=../..
STDLIB_DIR=$ORCA_DIR/src/libc-shim STDLIB_DIR=$ORCA_DIR/src/libc-shim
# common flags to build wasm modules
wasmFlags="--target=wasm32 \ wasmFlags="--target=wasm32 \
--no-standard-libraries \ --no-standard-libraries \
-mbulk-memory \ -mbulk-memory \
@ -26,6 +27,11 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \ -I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext" -I $ORCA_DIR/src/ext"
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c # build orca core as wasm module
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
# build sample as wasm module and link it with the orca module
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
# create app directory and copy files into it
orca bundle --orca-dir $ORCA_DIR --name Triangle module.wasm orca bundle --orca-dir $ORCA_DIR --name Triangle module.wasm

View File

@ -15,6 +15,7 @@ fi
ORCA_DIR=../.. ORCA_DIR=../..
STDLIB_DIR=$ORCA_DIR/src/libc-shim STDLIB_DIR=$ORCA_DIR/src/libc-shim
# common flags to build wasm modules
wasmFlags="--target=wasm32 \ wasmFlags="--target=wasm32 \
--no-standard-libraries \ --no-standard-libraries \
-mbulk-memory \ -mbulk-memory \
@ -26,6 +27,11 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \ -I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext" -I $ORCA_DIR/src/ext"
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c # build orca core as wasm module
clang $wasmFlags -Wl,--relocatable -o ./liborca.a $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c
# build sample as wasm module and link it with the orca module
clang $wasmFlags -L . -lorca -o module.wasm src/main.c
# create app directory and copy files into it
orca bundle --orca-dir $ORCA_DIR --name UI --resource-dir data module.wasm orca bundle --orca-dir $ORCA_DIR --name UI --resource-dir data module.wasm