diff --git a/adm/scripts/cmake_custom.bat b/adm/scripts/cmake_custom.bat index 47aaf44bfc..4b9a9d843b 100644 --- a/adm/scripts/cmake_custom.bat +++ b/adm/scripts/cmake_custom.bat @@ -15,6 +15,8 @@ rem ------------------------------------ rem set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%" set "INSTALL_DIR=%SrcRoot%\..\3rdparty\occt77-vc14-64" +set BUILD_CPP_STANDARD=C++14 + rem set BUILD_DOC_Overview=OFF rem set BUILD_Inspector=OFF rem set BUILD_LIBRARY_TYPE=Shared diff --git a/adm/scripts/cmake_custom.sh b/adm/scripts/cmake_custom.sh index 31183848b0..49e4c6d330 100644 --- a/adm/scripts/cmake_custom.sh +++ b/adm/scripts/cmake_custom.sh @@ -10,6 +10,8 @@ FREETYPE_DIR="$OCCT3RDPARTY/freetype-2.7.1" #BUILD_DIR=build INSTALL_DIR="$SrcRoot/../3rdparty/occt77" +BUILD_CPP_STANDARD=C++14 + #BUILD_DOC_Overview=OFF #BUILD_Inspector=OFF #BUILD_LIBRARY_TYPE=Shared diff --git a/adm/scripts/cmake_gen.bat b/adm/scripts/cmake_gen.bat index f60e47b129..c901b4274b 100644 --- a/adm/scripts/cmake_gen.bat +++ b/adm/scripts/cmake_gen.bat @@ -15,6 +15,8 @@ set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%" set "OCCT3RDPARTY=" set "INSTALL_DIR=%SrcRoot%\install" +set BUILD_CPP_STANDARD=C++11 + set BUILD_ADDITIONAL_TOOLKITS= set BUILD_DOC_Overview=OFF set BUILD_Inspector=OFF @@ -55,6 +57,7 @@ if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%" pushd "%BUILD_DIR%" cmake -G "%arch_compile%" ^ + -D BUILD_CPP_STANDARD:STRING="%BUILD_CPP_STANDARD%" ^ -D 3RDPARTY_DIR:STRING="%OCCT3RDPARTY%" ^ -D BUILD_ADDITIONAL_TOOLKITS:STRING="%BUILD_ADDITIONAL_TOOLKITS%" ^ -D BUILD_DOC_Overview:BOOL=%BUILD_DOC_Overview% ^ diff --git a/adm/scripts/cmake_gen.sh b/adm/scripts/cmake_gen.sh index 9c088715d2..32e3b815fb 100755 --- a/adm/scripts/cmake_gen.sh +++ b/adm/scripts/cmake_gen.sh @@ -14,12 +14,13 @@ DEB= CMAKE_BUILD_TYPE=Release if [ "$1" = "-d" ]; then DEB=d - BUILD_DIR=${BUILD_DIR}-deb CMAKE_BUILD_TYPE=Debug fi INSTALL_DIR_BIN=lin64/gcc/bin$DEB INSTALL_DIR_LIB=lin64/gcc/lib$DEB +BUILD_CPP_STANDARD=C++11 + BUILD_ADDITIONAL_TOOLKITS= BUILD_DOC_Overview=OFF BUILD_Inspector=OFF @@ -54,6 +55,7 @@ if [ ! -d "$BUILD_DIR" ]; then mkdir -p "$BUILD_DIR"; fi pushd "$BUILD_DIR" cmake -G "Unix Makefiles" \ + -D BUILD_CPP_STANDARD:STRING="$BUILD_CPP_STANDARD" \ -D CMAKE_BUILD_TYPE=$CMAKE_BUILD_TYPE \ -D 3RDPARTY_DIR:PATH="$OCCT3RDPARTY" \ -D 3RDPARTY_FREETYPE_DIR:PATH="$FREETYPE_DIR" \ diff --git a/adm/scripts/wasm_build.bat b/adm/scripts/wasm_build.bat index 4ef9a61f73..d7ed334be3 100644 --- a/adm/scripts/wasm_build.bat +++ b/adm/scripts/wasm_build.bat @@ -44,6 +44,28 @@ rem Archive tool set "THE_7Z_PARAMS=-t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on" set "THE_7Z_PATH=%ProgramW6432%\7-Zip\7z.exe" +set "aBuildType=Release" +set "aBuildTypePrefix=" +set "anExtraCxxFlags=" +if /I ["%USE_PTHREADS%"] == ["ON"] ( + set "anExtraCxxFlags=-pthread" + set "aBuildTypePrefix=%aBuildTypePrefix%-pthread" +) +if ["%toDebug%"] == ["1"] ( + set "aBuildType=Debug" + set "aBuildTypePrefix=%aBuildTypePrefix%-debug" +) + +set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%" +set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make" +set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%" +set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log" + +set "aSrcRootSmpl=%aCasSrc%\samples\webgl" +set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make" +set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%" +set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log" + rem Configuration file if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat" @@ -58,18 +80,6 @@ for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_DEVELOP for /f tokens^=2^ delims^=^" %%i in ('findstr /b /c:"#define OCC_VERSION_COMPLETE" "%aCasSrc%\src\Standard\Standard_Version.hxx"') do ( set "anOcctVersion=%%i" ) for /f %%i in ('git symbolic-ref --short HEAD') do ( set "aGitBranch=%%i" ) -set "aBuildType=Release" -set "aBuildTypePrefix=" -set "anExtraCxxFlags=" -if /I ["%USE_PTHREADS%"] == ["ON"] ( - set "anExtraCxxFlags=-pthread" - set "aBuildTypePrefix=%aBuildTypePrefix%-pthread" -) -if ["%toDebug%"] == ["1"] ( - set "aBuildType=Debug" - set "aBuildTypePrefix=%aBuildTypePrefix%-debug" -) - call :cmakeGenerate if errorlevel 1 ( if not ["%1"] == ["-nopause"] ( @@ -115,10 +125,6 @@ if not ["%1"] == ["-nopause"] ( goto :eof :cmakeGenerate -set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%" -set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make" -set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%" -set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log" if ["%toCMake%"] == ["1"] ( if ["%toClean%"] == ["1"] ( rmdir /S /Q %aWorkDir%" @@ -128,10 +134,6 @@ if ["%toCMake%"] == ["1"] ( if not exist "%aWorkDir%" ( mkdir "%aWorkDir%" ) if exist "%aLogFile%" ( del "%aLogFile%" ) -set "aSrcRootSmpl=%aCasSrc%\samples\webgl" -set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make" -set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%" -set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log" if ["%toBuildSample%"] == ["1"] ( if ["%toCMake%"] == ["1"] ( if ["%toClean%"] == ["1"] ( diff --git a/adm/scripts/wasm_build.sh b/adm/scripts/wasm_build.sh index 3840e966f5..81a2179316 100755 --- a/adm/scripts/wasm_build.sh +++ b/adm/scripts/wasm_build.sh @@ -4,6 +4,11 @@ # wasm_custom.sh should be configured with paths to CMake, 3rd-parties and Emscripten SDK. # FreeType should be specified as mandatory dependency. +CMAKE_BUILD_TYPE=Release +if [ "$1" = "-d" ]; then + CMAKE_BUILD_TYPE=Debug +fi + export aScriptDir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" export aSrcRoot="${aScriptDir}/../.." export aBuildRoot=work @@ -21,6 +26,12 @@ export BUILD_Visualization=ON export BUILD_ApplicationFramework=ON export BUILD_DataExchange=ON +export aPlatformAndCompiler=wasm + +export aWorkDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}-make" +export aDestDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}" +export aLogFile="${aSrcRoot}/${aBuildRoot}/build-${aPlatformAndCompiler}.log" + if [ -f "${aScriptDir}/wasm_custom.sh" ] ; then . "${aScriptDir}/wasm_custom.sh" fi @@ -33,19 +44,14 @@ export aGitBranch=`git symbolic-ref --short HEAD` echo "Compilation OCCT branch : $aGitBranch" -export aPlatformAndCompiler=wasm - -export aWorkDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}-make" if [ ! -d "${aWorkDir}" ]; then mkdir -p "${aWorkDir}" fi -export aDestDir="${aSrcRoot}/${aBuildRoot}/${aPlatformAndCompiler}" if [ ! -d "${aDestDir}" ]; then mkdir -p "${aDestDir}" fi -export aLogFile="${aSrcRoot}/${aBuildRoot}/build-${aPlatformAndCompiler}.log" if [ -f "${aLogFile}" ]; then rm "${aLogFile}" fi @@ -60,7 +66,7 @@ if [ "${toCMake}" = "1" ]; then echo "Configuring OCCT for WASM..." echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \ --DCMAKE_BUILD_TYPE:STRING="Release" \ +-DCMAKE_BUILD_TYPE:STRING="$CMAKE_BUILD_TYPE" \ -DBUILD_LIBRARY_TYPE:STRING="Static" \ -DINSTALL_DIR:PATH="${aDestDir}" \ -DINSTALL_DIR_INCLUDE:STRING="inc" \ @@ -78,7 +84,7 @@ echo cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \ -DBUILD_DOC_Overview:BOOL="OFF" "${aSrcRoot}" cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE:FILEPATH="${aToolchain}" \ --DCMAKE_BUILD_TYPE:STRING="Release" \ +-DCMAKE_BUILD_TYPE:STRING="$CMAKE_BUILD_TYPE" \ -DBUILD_LIBRARY_TYPE:STRING="Static" \ -DINSTALL_DIR:PATH="${aDestDir}" \ -DINSTALL_DIR_INCLUDE:STRING="inc" \ diff --git a/adm/scripts/wasm_custom.bat b/adm/scripts/wasm_custom.bat index b02fd4c69b..973d481b75 100644 --- a/adm/scripts/wasm_custom.bat +++ b/adm/scripts/wasm_custom.bat @@ -1,10 +1,12 @@ rem Environment configuration template for wasm_build.bat (to be renamed as wasm_custom.bat) -set "EMSDK_ROOT=%aCasSrc%\..\asrv-web3d\fips\fips-sdks\emsdk" set "aFreeType=%aCasSrc%\..\3rdparty\freetype-2.7.1-wasm" +set "EMSDK_ROOT=%aCasSrc%\..\emsdk" rem set "aRapidJson=%aCasSrc%\..\3rdparty\rapidjson-1.1.0" rem set "aDraco=%aCasSrc%\..\3rdparty\draco-1.4.1-wasm32" rem set "aCmakeBin=%ProgramW6432%\CMake\bin" +set "aDestDir=%aCasSrc%\..\3rdparty\occt77-wasm" + rem Uncomment to customize building steps rem set "aBuildRoot=work" rem set "toCMake=1" diff --git a/adm/scripts/wasm_custom.sh b/adm/scripts/wasm_custom.sh index aa3536a873..98e1a56b43 100644 --- a/adm/scripts/wasm_custom.sh +++ b/adm/scripts/wasm_custom.sh @@ -1,6 +1,8 @@ # environment configuration template for occ_build_wasm.sh (to be renamed as wasm_custom_env.sh) export aFreeType="$aSrcRoot/../3rdparty/freetype-2.7.1-wasm" -export EMSDK_ROOT="$aSrcRoot/../asrv-web3d/fips/fips-sdks/emsdk" +export EMSDK_ROOT="$aSrcRoot/../emsdk" + +export aDestDir="${aSrcRoot}/../3rdparty/occt77-wasm" # Uncomment to customize building steps #export aBuildRoot=work