3 rem Auxiliary script for semi-automated building of WebGL sample.
4 rem wasm_custom.bat should be configured with paths to CMake, 3rd-parties and Emscripten SDK.
5 rem FreeType should be specified as mandatory dependency.
7 set "aCasSrc=%~dp0..\.."
8 set "aBuildRoot=%aCasSrc%\work"
10 set aNbJobs=%NUMBER_OF_PROCESSORS%
12 rem Paths to 3rd-party tools and libraries
16 rem Build stages to perform
24 rem Configuration file
25 if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
27 call "%EMSDK_ROOT%\emsdk_env.bat"
28 set "aToolchain=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
29 if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
31 set "aBuildType=Release"
32 set "aBuildTypePrefix="
33 if ["%toDebug%"] == ["1"] (
34 set "aBuildType=Debug"
35 set "aBuildTypePrefix=-debug"
39 if not ["%1"] == ["-nopause"] (
46 set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%"
47 set "aDestDirOcct=%aBuildRoot%\occt-%aPlatformAndCompiler%"
48 set "aSrcRootSmpl=%aCasSrc%\samples\webgl"
49 set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make"
50 set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%"
51 set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log"
52 if ["%toCMake%"] == ["1"] (
53 if ["%toClean%"] == ["1"] (
54 rmdir /S /Q %aWorkDirSmpl%"
55 rmdir /S /Q %aDestDirSmpl%"
58 if not exist "%aWorkDirSmpl%" ( mkdir "%aWorkDirSmpl%" )
59 if exist "%aLogFileSmpl%" ( del "%aLogFileSmpl%" )
61 pushd "%aWorkDirSmpl%"
63 if ["%toCMake%"] == ["1"] (
64 cmake -G "MinGW Makefiles" ^
65 -D CMAKE_TOOLCHAIN_FILE:FILEPATH="%aToolchain%" ^
66 -D CMAKE_BUILD_TYPE:STRING="%aBuildType%" ^
67 -D CMAKE_INSTALL_PREFIX:PATH="%aDestDirSmpl%" ^
68 -D SOURCE_MAP_BASE:STRING="%sourceMapBase%" ^
69 -D OpenCASCADE_DIR:PATH="%aDestDirOcct%/lib/cmake/opencascade" ^
70 -D freetype_DIR:PATH="%aFreeType%/lib/cmake/freetype" ^
80 if ["%toClean%"] == ["1"] (
84 if ["%toMake%"] == ["1"] (
86 mingw32-make -j %aNbJobs% 2>> "%aLogFileSmpl%"
97 if ["%toInstall%"] == ["1"] (
98 mingw32-make install 2>> "%aLogFileSmpl%"
100 type "%aLogFileSmpl%"