--- /dev/null
+Instruction for building OCCT for ASRV
+======================================
+
+Build using regular native compiler
+-----------------------------------
+
+1. Make sure the directory 3rdparty is next to occt. It must contain the following products:
+ freetype
+ tcltk
+2. Change current directory to adm/scripts.
+3. On Windows run the script cmake_gen.bat.
+ On Linux run 'cmake_gen.sh' for release build and 'cmake_gen.sh -d' for debug build.
+4. Go to build directory and build and install OCCT.
+ On Windows run:
+ build.bat
+ build.bat vc14 64 d
+ install.bat
+ install.bat vc14 64 d
+ On Linux run:
+ make -j4 install
+
+Build using Emscripten to generate libs for Web assembly
+--------------------------------------------------------
+
+1. Make sure you have installed Emscripten. For that you can make sure occ-web3d directory
+ is next to occt. It must contain fips\fips-sdks\emsdk.
+2. Make sure the directory 3rdparty is next to occt. It must contain the following products:
+ freetype wasm build
+3. Change current directory to adm/scripts.
+4. Run the script wasm_build.bat (wasm_build.sh on Linux).
+5. Copy installed files from work/wasm to the 3rdparty under occt77-wasm.
+++ /dev/null
-*custom.bat
-*custom.sh
--- /dev/null
+rem Environment configuration template for cmake_gen.bat (to be renamed as cmake_gen_custom.bat)
+
+set "OCCT3RDPARTY=%SrcRoot%\..\3rdparty"
+
+set VS=14
+set VSDATA=2015
+
+rem Leave VSPLATFORM empty to build for x86 platform
+set VSPLATFORM=Win64
+
+rem ------------------------------------
+rem Uncomment to customize building steps
+rem ------------------------------------
+
+rem set "BUILD_DIR=build-vs%VS%-%VSPLATFORM%"
+set "INSTALL_DIR=%SrcRoot%\..\3rdparty\occt-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
+rem set BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
+rem set BUILD_WITH_DEBUG=OFF
+rem set BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
+rem set BUILD_USE_PCH=OFF
+rem set BUILD_FORCE_RelWithDebInfo=OFF
+
+rem Use semicolon-separated list of toolkits if you want to disable all modules
+rem and build only some toolkits.
+rem set BUILD_ADDITIONAL_TOOLKITS=
+
+rem Set a directory recognized as a patch for OCCT.
+rem set BUILD_PATCH=
+
+rem set BUILD_MODULE_ApplicationFramework=ON
+rem set BUILD_MODULE_DataExchange=ON
+rem set BUILD_MODULE_Draw=ON
+rem set BUILD_MODULE_ModelingAlgorithms=ON
+rem set BUILD_MODULE_ModelingData=ON
+rem set BUILD_MODULE_Visualization=ON
+
+rem set USE_D3D=OFF
+rem set USE_FFMPEG=OFF
+set USE_FREEIMAGE=ON
+rem set USE_GLES2=OFF
+set USE_RAPIDJSON=ON
+rem set USE_DRACO=OFF
+rem set USE_TBB=OFF
+rem set USE_VTK=OFF
--- /dev/null
+# Environment configuration template for cmake_gen.sh (to be renamed as cmake_gen_custom.sh)
+
+OCCT3RDPARTY="$SrcRoot/../3rdparty"
+FREETYPE_DIR="$OCCT3RDPARTY/freetype-2.7.1"
+
+# ------------------------------------
+# Uncomment to customize building steps
+# ------------------------------------
+
+#BUILD_DIR=build
+INSTALL_DIR="$SrcRoot/../3rdparty/occt"
+
+BUILD_CPP_STANDARD=C++14
+
+#BUILD_DOC_Overview=OFF
+#BUILD_Inspector=OFF
+#BUILD_LIBRARY_TYPE=Shared
+#BUILD_RELEASE_DISABLE_EXCEPTIONS=ON
+#BUILD_WITH_DEBUG=OFF
+#BUILD_ENABLE_FPE_SIGNAL_HANDLER=ON
+
+# Use semicolon-separated list of toolkits if you want to disable all modules
+# and build only some toolkits.
+#BUILD_ADDITIONAL_TOOLKITS=
+
+# Set a directory recognized as a patch for OCCT.
+#BUILD_PATCH=
+
+#BUILD_MODULE_ApplicationFramework=ON
+#BUILD_MODULE_DataExchange=ON
+#BUILD_MODULE_Draw=ON
+#BUILD_MODULE_ModelingAlgorithms=ON
+#BUILD_MODULE_ModelingData=ON
+#BUILD_MODULE_Visualization=ON
+
+#USE_FFMPEG=OFF
+USE_FREEIMAGE=ON
+#USE_GLES2=OFF
+USE_RAPIDJSON=ON
+#USE_DRACO=OFF
+#USE_TBB=OFF
+#USE_VTK=OFF
+
+# This is to add any additional arguments to cmake
+#AUX_ARGS=
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
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% ^
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
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" \
set "toBuildSample=0"
set "sourceMapBase="
+set "aBuildType=Release"
+if /I ["%1"] == ["-d"] (
+ set "toDebug=1"
+ set "aBuildType=Debug"
+)
+
rem OCCT Modules to build
set "BUILD_ModelingData=ON"
set "BUILD_ModelingAlgorithms=ON"
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 "aPlatformAndCompiler="
+set "aWorkDir="
+set "aDestDir="
+set "aLogFile="
+
+set "aSrcRootSmpl=%aCasSrc%\samples\webgl"
+set "aWorkDirSmpl="
+set "aDestDirSmpl="
+set "aLogFileSmpl="
+
rem Configuration file
if exist "%~dp0wasm_custom.bat" call "%~dp0wasm_custom.bat"
+set "aBuildTypePrefix="
+set "anExtraCxxFlags="
+if /I ["%USE_PTHREADS%"] == ["ON"] (
+ set "anExtraCxxFlags=-pthread"
+ set "aBuildTypePrefix=%aBuildTypePrefix%-pthread"
+)
+if ["%toDebug%"] == ["1"] (
+ set "aBuildTypePrefix=%aBuildTypePrefix%-debug"
+)
+
+if ["%aPlatformAndCompiler%"] == [""] ( set "aPlatformAndCompiler=wasm32%aBuildTypePrefix%" )
+if ["%aWorkDir%"] == [""] ( set "aWorkDir=%aBuildRoot%\occt-%aPlatformAndCompiler%-make" )
+if ["%aDestDir%"] == [""] ( set "aDestDir=%aBuildRoot%\occt-%aPlatformAndCompiler%" )
+if ["%aLogFile%"] == [""] ( set "aLogFile=%aBuildRoot%\occt-%aPlatformAndCompiler%-build.log" )
+
+if ["%aWorkDirSmpl%"] == [""] ( set "aWorkDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-make" )
+if ["%aDestDirSmpl%"] == [""] ( set "aDestDirSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%" )
+if ["%aLogFileSmpl%"] == [""] ( set "aLogFileSmpl=%aBuildRoot%\sample-%aPlatformAndCompiler%-build.log" )
+
call "%EMSDK_ROOT%\emsdk_env.bat"
set "aToolchain=%EMSDK%/upstream/emscripten/cmake/Modules/Platform/Emscripten.cmake"
if not ["%aCmakeBin%"] == [""] ( set "PATH=%aCmakeBin%;%PATH%" )
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"] (
- pause
- )
exit /B 1
goto :eof
)
"%THE_7Z_PATH%" a -r %THE_7Z_PARAMS% "%aBuildRoot%/%anArchName%.7z" "%aTarget%"
)
-if not ["%1"] == ["-nopause"] (
- pause
-)
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%"
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"] (
if errorlevel 1 (
popd
- pause
exit /B
goto :eof
)
if errorlevel 1 (
type "%aLogFileSmpl%"
popd
- pause
exit /B
goto :eof
)
if errorlevel 1 (
type "%aLogFileSmpl%"
popd
- pause
exit /B
goto :eof
)
# 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
export BUILD_DataExchange=ON
export BUILD_DETools=OFF
+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
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
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" \
-DINSTALL_DIR_RESOURCE:STRING="src" \
-D3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
--D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
--D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
+-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include/freetype2" \
+-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include/freetype2" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \
-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" \
-DINSTALL_DIR_RESOURCE:STRING="src" \
-D3RDPARTY_FREETYPE_DIR:PATH="$aFreeType" \
--D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include" \
--D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include" \
+-D3RDPARTY_FREETYPE_INCLUDE_DIR_freetype2:FILEPATH="$aFreeType/include/freetype2" \
+-D3RDPARTY_FREETYPE_INCLUDE_DIR_ft2build:FILEPATH="$aFreeType/include/freetype2" \
-DBUILD_MODULE_FoundationClasses:BOOL="ON" \
-DBUILD_MODULE_ModelingData:BOOL="${BUILD_ModelingData}" \
-DBUILD_MODULE_ModelingAlgorithms:BOOL="${BUILD_ModelingAlgorithms}" \
--- /dev/null
+rem Environment configuration template for wasm_build.bat (to be renamed as wasm_custom.bat)
+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\occt-wasm"
+
+rem Uncomment to customize building steps
+rem set "aBuildRoot=work"
+rem set "toCMake=1"
+rem set "toClean=0"
+rem set "toMake=1"
+rem set "toInstall=1"
+set "toPack=0"
+set "toBuildSample=0"
+rem Source map base (should point to server where C++ sources will be copied)
+rem enables -g4 debug building option for WebGL sample and allows navigating C++ source code within JavaScript debugger.
+rem set "sourceMapBase=http://localhost:9090/"
+
+set "BUILD_ModelingData=OFF"
+set "BUILD_ModelingAlgorithms=OFF"
+rem set "BUILD_Visualization=ON"
+set "BUILD_ApplicationFramework=OFF"
+set "BUILD_DataExchange=OFF"
+
+set "USE_RAPIDJSON=OFF"
+set "USE_DRACO=OFF"
+set "USE_PTHREADS=OFF"
--- /dev/null
+# 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/../emsdk"
+
+export aDestDir="${aSrcRoot}/../3rdparty/occt-wasm"
+
+# Uncomment to customize building steps
+#export aBuildRoot=work
+#export toCMake=1
+#export toClean=0
+#export toMake=1
+#export toInstall=1
+
+export BUILD_ModelingData=OFF
+export BUILD_ModelingAlgorithms=OFF
+#export BUILD_Visualization=ON
+export BUILD_ApplicationFramework=OFF
+export BUILD_DataExchange=OFF
+
+export aNbJobs=10