-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathcmakebuild.bat
48 lines (39 loc) · 1.71 KB
/
cmakebuild.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
@echo off
set mode=
:next-arg
if "%1"=="" goto args-done
if /i "%1"=="Debug" set mode=Debug&goto arg-ok
if /i "%1"=="Release" set mode=Release&goto arg-ok
:arg-ok
shift
goto next-arg
:args-done
if "%mode%" == "" set mode=Release
echo %mode%
set cmakeoutdir=.cgenbuild
if not exist %cmakeoutdir% mkdir %cmakeoutdir%
if "%mode%" == "Debug" (
call npx.cmd cgen rebuild -e --debug
) else (
call npx.cmd cgen rebuild -e
)
@REM cd %cmakeoutdir%
@REM cmake -DCMAKE_TOOLCHAIN_FILE=%EMSDK%\upstream\emscripten\cmake\Modules\Platform\Emscripten.cmake -DCMAKE_BUILD_TYPE=%mode% -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=make ..
@REM cmake --build .
@REM cd ..
set exename=wz
copy /Y %cmakeoutdir%\%exename%.js .\dist\%exename%.js
copy /Y %cmakeoutdir%\%exename%.js ..\src\util\%exename%.js
mkdir ..\lib\cjs-modern\util
mkdir ..\lib\esm\util
mkdir ..\lib\esm-modern\util
copy /Y %cmakeoutdir%\%exename%.js ..\lib\cjs-modern\util\%exename%.js
node -e "require('fs').writeFileSync('./.cgenbuild/%exename%asm.js', require('fs').readFileSync('./.cgenbuild/%exename%asm.js', 'utf8').replace('%exename%asm.js.mem', '%exename%.js.mem').replace('%exename%asm.wasm', '%exename%.wasm'), 'utf8')"
copy /Y %cmakeoutdir%\%exename%asm.js ..\lib\esm\util\%exename%.js
copy /Y %cmakeoutdir%\%exename%.js ..\lib\esm-modern\util\%exename%.js
copy /Y %cmakeoutdir%\%exename%.wasm .\dist\%exename%.wasm
copy /Y %cmakeoutdir%\%exename%.wasm ..\lib\cjs-modern\util\%exename%.wasm
copy /Y %cmakeoutdir%\%exename%asm.js.mem ..\lib\esm\util\%exename%.js.mem
copy /Y %cmakeoutdir%\%exename%asm.wasm ..\lib\esm\util\%exename%.wasm
copy /Y %cmakeoutdir%\%exename%.wasm ..\lib\esm-modern\util\%exename%.wasm
copy /Y %cmakeoutdir%\%exename%.wasm.map .\%exename%.wasm.map