@@ -186,8 +186,6 @@ IF DEFINED PYTHON_VERSION (
186186)
187187
188188:: VERSION DERIVATIONS
189- set OCC_INCLUDE_DIR = %INSTALL_DIR% \opencascade-%OCCT_VERSION% \inc>> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
190- set OCC_LIBRARY_DIR = %INSTALL_DIR% \opencascade-%OCCT_VERSION% \win%ARCH_BITS% \lib>> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
191189IF " %IFCOS_INSTALL_PYTHON% " == " TRUE" (
192190 set PYTHONHOME = %DEPS_DIR% \python.%PYTHON_VERSION% \tools
193191)
@@ -197,8 +195,6 @@ IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
197195:: executed by jumping (using goto) to different labels.
198196if defined GEN_SHORTHAND echo GEN_SHORTHAND=%GEN_SHORTHAND% > " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
199197echo HDF5_VERSION=%HDF5_VERSION% >> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
200- echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR% >> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
201- echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR% >> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
202198IF " %IFCOS_INSTALL_PYTHON% " == " TRUE" (
203199 echo PYTHONHOME=%PYTHONHOME% >> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
204200)
@@ -481,9 +477,13 @@ call :MarkInstallation
481477SET OCCT_VER = V%OCCT_VERSION:. =_ %
482478
483479set DEPENDENCY_NAME = OpenCASCADE
484- set OCCT_DEPENDENCY_INSTALL_NAME = opencascade-%OCCT_VERSION%
480+ :: `new-layout` suffix can be removed on the next OCCT version update
481+ :: it's needed to separate legacy layout installation from the new one.
482+ set OCCT_DEPENDENCY_INSTALL_NAME = opencascade-%OCCT_VERSION% -new-layout
485483set DEPENDENCY_INSTALL_NAME = %OCCT_DEPENDENCY_INSTALL_NAME%
484+ set DEPENDENCY_INSTALL_DIR = %INSTALL_DIR% \%DEPENDENCY_INSTALL_NAME%
486485set NEXT_DEPENDENCY_LABEL = Python
486+ echo OCC_INSTALL_DIR=%DEPENDENCY_INSTALL_DIR% >> " %~dp0 \%BUILD_DEPS_CACHE_PATH% "
487487
488488call :CheckInstallation
489489if %ERRORLEVEL% == 200 GOTO %NEXT_DEPENDENCY_LABEL%
@@ -525,7 +525,10 @@ findstr IfcOpenShell "%DEPENDENCY_DIR%\CMakeLists.txt">NUL
525525if not %ERRORLEVEL% == 0 goto :Error
526526
527527cd " %DEPENDENCY_DIR% "
528- call :RunCMake -DINSTALL_DIR=" %INSTALL_DIR% \%DEPENDENCY_INSTALL_NAME% " -DBUILD_LIBRARY_TYPE=" Static" -DCMAKE_DEBUG_POSTFIX=d ^
528+ :: TODO: remove CMAKE_DEBUG_POSTFIX setting later.
529+ :: Temporarily explicitly set `CMAKE_DEBUG_POSTFIX` to empty to override it's perviously being set to `d`.
530+ :: OCCT don't need it, since it's layout is separating debug and release build by different folders.
531+ call :RunCMake -DINSTALL_DIR=" %DEPENDENCY_INSTALL_DIR% " -DBUILD_LIBRARY_TYPE=" Static" -DCMAKE_DEBUG_POSTFIX=" " ^
529532 -DBUILD_MODULE_Draw=0 -D3RDPARTY_FREETYPE_DIR=" %INSTALL_DIR% \freetype"
530533if not %ERRORLEVEL% == 0 goto :Error
531534
@@ -538,28 +541,23 @@ IF %ARCH_BITS%==32 (
538541
539542call :BuildSolution " %DEPENDENCY_DIR% \%BUILD_DIR% \OCCT.sln" %BUILD_CFG%
540543if not %ERRORLEVEL% == 0 goto :Error
544+
545+ :: If `inc` is present in installation folder, then installation takes much longer
546+ :: See https://github.com/Open-Cascade-SAS/OCCT/issues/901
547+ powershell -c " $path = '%DEPENDENCY_INSTALL_DIR% \inc'; if (Test-Path $path) { Remove-Item -Recurse -Force $path }"
541548call :InstallCMakeProject " %DEPENDENCY_DIR% \%BUILD_DIR% " %BUILD_CFG%
542549if not %ERRORLEVEL% == 0 goto :Error
550+
551+ :: Fix upstream bug in cmake config file with unescaped quotes preventing configuration.
552+ :: The issue is fixed in 7.9.0+.
553+ :: See https://github.com/Open-Cascade-SAS/OCCT/pull/373
554+ powershell -c " $path='%DEPENDENCY_INSTALL_DIR% \cmake\OpenCASCADEConfig.cmake'; (Get-Content $path) -replace '/wd\" (\d+)\" ','/wd$1' | Set-Content $path"
555+ if not %ERRORLEVEL% == 0 goto :Error
556+
543557call :MarkInstallation
544558
545559SET COMPILE_WITH_WPO = FALSE
546560
547- :: Use a single lib directory for release and debug libraries as is done with OCE
548- if not exist " %OCC_LIBRARY_DIR% " . mkdir " %OCC_LIBRARY_DIR% "
549- :: NOTE OCCT (at least occt-V7_0_0-9059ca1) directory creation code is hardcoded and doesn't seem handle future VC versions
550- set OCCT_VC_VER = %VC_VER%
551- IF %OCCT_VC_VER% GTR 14 (
552- set OCCT_VC_VER = 14
553- )
554- move /y " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \win%ARCH_BITS% \vc%OCCT_VC_VER% \libi\*.*" " %OCC_LIBRARY_DIR% "
555- move /y " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \win%ARCH_BITS% \vc%OCCT_VC_VER% \libd\*.*" " %OCC_LIBRARY_DIR% "
556- move /y " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \win%ARCH_BITS% \vc%OCCT_VC_VER% \lib\*.*" " %OCC_LIBRARY_DIR% "
557- rmdir /s /q " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \win%ARCH_BITS% \vc%OCCT_VC_VER% "
558- :: Removed unneeded bits
559- rmdir /s /q " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \data"
560- rmdir /s /q " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \samples"
561- del " %INSTALL_DIR% \opencascade-%OCCT_VERSION% \*.bat"
562-
563561:Python
564562set DEPENDENCY_NAME = Python %PYTHON_VERSION%
565563set DEPENDENCY_DIR = N/A
0 commit comments