add build script for Windows

This commit is contained in:
xhacker-zzz 2023-01-21 01:19:37 +08:00 committed by GitHub
parent de40f3385a
commit d7e718890f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 40 additions and 0 deletions

40
build-wasm.cmd Normal file
View File

@ -0,0 +1,40 @@
@echo off
setlocal
set "CURR_DIR=%CD%"
set "BUILD_TYPE=%1"
if "%BUILD_TYPE%"=="" set "BUILD_TYPE=Release"
md build\wasm 2>nul
if not exist build\emsdk (
git clone https://github.com/emscripten-core/emsdk.git build\emsdk
)
pushd build\emsdk
rem git pull
call emsdk.bat install 3.0.0
call emsdk.bat activate 3.0.0
call emsdk_env.bat
popd
pushd build\wasm
call emcmake cmake -DCMAKE_BUILD_TYPE=%BUILD_TYPE% ..\..
rem Check if Ninja binary exists
if not exist "ninja.exe" (
rem Install Ninja
curl -L https://github.com/ninja-build/ninja/releases/download/v1.11.1/ninja-win.zip -o ninja.zip
unzip ninja.zip
del ninja.zip
)
ninja.exe -f build.ninja -j 3
set "TARGET_FILES=QmcLegacy.js QmcWasm.js QmcWasm.wasm QmcWasmBundle.js %CURR_DIR%\LICENSE.txt"
for %%f in (%TARGET_FILES%) do (
copy "%%f" "%CURR_DIR%\npm"
)
popd
endlocal