win32: separate building orca core from samples

This commit is contained in:
Reuben Dunnington 2023-09-20 23:15:19 -07:00
parent 4f0738fe64
commit aac74b0533
Signed by: rdunnington
GPG Key ID: 3D57C8938EA08E90
6 changed files with 49 additions and 18 deletions

1
.gitignore vendored
View File

@ -14,6 +14,7 @@ build
*.wasm *.wasm
*.app *.app
*.dylib *.dylib
*.a
Debug/* Debug/*

View File

@ -15,7 +15,7 @@ if exist "..\..\scripts\sample_build_check.py" (
set ORCA_DIR=..\.. set ORCA_DIR=..\..
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
:: compile wasm module :: common flags to build wasm modules
set wasmFlags=--target=wasm32^ set wasmFlags=--target=wasm32^
--no-standard-libraries ^ --no-standard-libraries ^
-mbulk-memory ^ -mbulk-memory ^
@ -27,7 +27,13 @@ set 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
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: build sample as wasm module and link it with the orca module
clang %wasmFlags% -L . -lorca -o module.wasm src/main.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: 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,7 +15,7 @@ if exist "..\..\scripts\sample_build_check.py" (
set ORCA_DIR=..\.. set ORCA_DIR=..\..
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
:: compile wasm module :: common flags to build wasm modules
set wasmFlags=--target=wasm32^ set wasmFlags=--target=wasm32^
--no-standard-libraries ^ --no-standard-libraries ^
-mbulk-memory ^ -mbulk-memory ^
@ -27,7 +27,13 @@ set 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
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: build sample as wasm module and link it with the orca module
clang %wasmFlags% -L . -lorca -o module.wasm src/main.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: 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

@ -15,7 +15,7 @@ if exist "..\..\scripts\sample_build_check.py" (
set ORCA_DIR=..\.. set ORCA_DIR=..\..
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
:: compile wasm module :: common flags to build wasm modules
set wasmFlags=--target=wasm32^ set wasmFlags=--target=wasm32^
--no-standard-libraries ^ --no-standard-libraries ^
-mbulk-memory ^ -mbulk-memory ^
@ -27,6 +27,10 @@ set wasmFlags=--target=wasm32^
-I%ORCA_DIR%\src ^ -I%ORCA_DIR%\src ^
-I%ORCA_DIR%\src\ext -I%ORCA_DIR%\src\ext
:: build orca core as wasm module
clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
set shaders=src/shaders/advect.glsl^ set shaders=src/shaders/advect.glsl^
src/shaders/blit_div_fragment.glsl^ src/shaders/blit_div_fragment.glsl^
src/shaders/blit_div_vertex.glsl^ src/shaders/blit_div_vertex.glsl^
@ -45,7 +49,9 @@ set shaders=src/shaders/advect.glsl^
call python ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h %shaders% call python ../../scripts/embed_text_files.py --prefix=glsl_ --output src/glsl_shaders.h %shaders%
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL!
clang %wasmFlags% -o .\module.wasm %ORCA_DIR%\src\orca.c %STDLIB_DIR%\src\*.c src\main.c :: build sample as wasm module and link it with the orca module
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! clang %wasmFlags% -L . -lorca -o .\module.wasm src\main.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: 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,7 +15,7 @@ if exist "..\..\scripts\sample_build_check.py" (
set ORCA_DIR=..\.. set ORCA_DIR=..\..
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
:: compile wasm module :: common flags to build wasm modules
set wasmFlags=--target=wasm32^ set wasmFlags=--target=wasm32^
--no-standard-libraries ^ --no-standard-libraries ^
-mbulk-memory ^ -mbulk-memory ^
@ -27,7 +27,13 @@ set 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
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
orca bundle --orca-dir %ORCA_DIR% --name Triangle module.wasm :: build sample as wasm module and link it with the orca module
clang %wasmFlags% -L . -lorca -o module.wasm src/main.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: create app directory and copy files into it
orca bundle --orca-dir %ORCA_DIR% --name Triangle --icon icon.png module.wasm

View File

@ -15,7 +15,7 @@ if exist "..\..\scripts\sample_build_check.py" (
set ORCA_DIR=..\.. set ORCA_DIR=..\..
set STDLIB_DIR=%ORCA_DIR%\src\libc-shim set STDLIB_DIR=%ORCA_DIR%\src\libc-shim
:: compile wasm module :: common flags to build wasm modules
set wasmFlags=--target=wasm32^ set wasmFlags=--target=wasm32^
--no-standard-libraries ^ --no-standard-libraries ^
-mbulk-memory ^ -mbulk-memory ^
@ -27,7 +27,13 @@ set 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
if !ERRORLEVEL! neq 0 exit /b !ERRORLEVEL! clang %wasmFlags% -Wl,--relocatable -o .\liborca.a %ORCA_DIR%\src\orca.c %ORCA_DIR%\src\libc-shim\src\*.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: build sample as wasm module and link it with the orca module
clang %wasmFlags% -L . -lorca -o .\module.wasm src\main.c
IF %ERRORLEVEL% NEQ 0 EXIT /B %ERRORLEVEL%
:: 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