Some more fixes to the Windows build procedure (#1285)

This commit is contained in:
ahladik
2021-02-02 12:00:55 +01:00
committed by GitHub
parent 55b63410bd
commit adf5af947b
2 changed files with 40 additions and 19 deletions
+13 -13
View File
@@ -58,9 +58,9 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
:: Set up the BuildDepsCache.txt filename
IF DEFINED VS_TOOLSET (
set BUILDDEPTHCACHE=BuildDepsCache-%VS_PLATFORM%-%VS_TOOLSET%.txt
set BUILD_DEPS_CACHE_PATH=BuildDepsCache-%VS_PLATFORM%-%VS_TOOLSET%.txt
) ELSE (
set BUILDDEPTHCACHE=BuildDepsCache-%VS_PLATFORM%.txt
set BUILD_DEPS_CACHE_PATH=BuildDepsCache-%VS_PLATFORM%.txt
)
:: fix for Visual C++ hanging when compiling 32-bit release OCCT up to version 7.4.0
@@ -162,7 +162,7 @@ set /p do_continue="> "
if "%do_continue%"=="n" goto :Finish
:: Cache last used CMake generator for other scripts to use
if defined GEN_SHORTHAND echo GEN_SHORTHAND=%GEN_SHORTHAND%>"%~dp0\%BUILDDEPTHCACHE%"
if defined GEN_SHORTHAND echo GEN_SHORTHAND=%GEN_SHORTHAND%>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo.
set START_TIME=%TIME%
@@ -249,10 +249,10 @@ if %IFCOS_USE_OCCT%==FALSE goto :OCE
set OCCT_VERSION=7.3.0p3
SET OCCT_VER=V%OCCT_VERSION:.=_%
set OCC_INCLUDE_DIR=%INSTALL_DIR%\opencascade-%OCCT_VERSION%\inc>>"%~dp0\%BUILDDEPTHCACHE%"
set OCC_LIBRARY_DIR=%INSTALL_DIR%\opencascade-%OCCT_VERSION%\win%ARCH_BITS%\lib>>"%~dp0\%BUILDDEPTHCACHE%"
echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR%>>"%~dp0\%BUILDDEPTHCACHE%"
echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\%BUILDDEPTHCACHE%"
set OCC_INCLUDE_DIR=%INSTALL_DIR%\opencascade-%OCCT_VERSION%\inc>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
set OCC_LIBRARY_DIR=%INSTALL_DIR%\opencascade-%OCCT_VERSION%\win%ARCH_BITS%\lib>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
:: OCCT has many dependencies but FreeType is the only mandatory
set DEPENDENCY_NAME=FreeType
@@ -326,10 +326,10 @@ del "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\*.bat"
goto :Python
:OCE
set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce>>"%~dp0\%BUILDDEPTHCACHE%"
set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib>>"%~dp0\%BUILDDEPTHCACHE%"
echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR%>>"%~dp0\%BUILDDEPTHCACHE%"
echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\%BUILDDEPTHCACHE%"
set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo OCC_INCLUDE_DIR=%OCC_INCLUDE_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo OCC_LIBRARY_DIR=%OCC_LIBRARY_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
set DEPENDENCY_NAME=Open CASCADE Community Edition
set DEPENDENCY_DIR=%DEPS_DIR%\oce
@@ -369,8 +369,8 @@ set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.msi
:: NOTE/TODO 3.5.0 doesn't use MSI any longer, but exe: set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.exe
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
REM Store Python versions to BuildDepsCache.txt for run-cmake.bat
echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>>"%~dp0\%BUILDDEPTHCACHE%"
echo PYTHONHOME=%PYTHONHOME%>>"%~dp0\%BUILDDEPTHCACHE%"
echo PY_VER_MAJOR_MINOR=%PY_VER_MAJOR_MINOR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo PYTHONHOME=%PYTHONHOME%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
cd "%DEPS_DIR%"
call :DownloadFile https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER% "%DEPS_DIR%" %PYTHON_INSTALLER%
+27 -6
View File
@@ -25,24 +25,45 @@ set PROJECT_NAME=IfcOpenShell
setlocal EnableDelayedExpansion
set IFCOS_PAUSE_ON_ERROR=
:: Read cached variables from the most recently modified BuildDepsCache.txt.
for /f "tokens=*" %%f in ('dir BuildDepsCache-*.txt /o:-n /t:a /b') do (
for /f "delims== tokens=1,2" %%G in (%%f) do set %%G=%%H
)
set GENERATOR=%1
:: If no GENERATOR was provided, read cached variables from any BuildDepsCache-XXX.txt
:: found in this directory; note that if more than one is present, the result could be wrong!
if (%1)==() (
for /f "tokens=*" %%f in ('dir BuildDepsCache-*.txt /o:-n /t:a /b') do (
for /f "delims== tokens=1,2" %%G in (%%f) do set %%G=%%H
)
if not defined GEN_SHORTHAND (
echo BuildDepsCache file does not exist and/or GEN_SHORTHAND missing from it. Run build-deps.cmd to create it.
set IFCOS_PAUSE_ON_ERROR=pause
goto :Error
)
set GENERATOR=%GEN_SHORTHAND%
set GENERATOR=!GEN_SHORTHAND!
echo Generator not passed, but GEN_SHORTHAND=!GENERATOR! read from BuildDepsCache
echo.
)
call vs-cfg.cmd %GENERATOR%
IF NOT %ERRORLEVEL%==0 GOTO :Error
:: If cached variables are still undefined,
:: read them from the specific BuildDepsCache-XXX.txt.
set "_test=0"
if not defined OCC_INCLUDE_DIR set _test=1
if not defined OCC_LIBRARY_DIR set _test=1
if %_test% EQU 1 (
IF DEFINED VS_TOOLSET (
set "BUILD_DEPS_CACHE_PATH=BuildDepsCache-%VS_PLATFORM%-%VS_TOOLSET%.txt"
) ELSE (
set "BUILD_DEPS_CACHE_PATH=BuildDepsCache-%VS_PLATFORM%.txt"
)
for /f "tokens=*" %%f in ('dir !BUILD_DEPS_CACHE_PATH! /o:-n /t:a /b') do (
for /f "delims== tokens=1,2" %%G in (%%f) do set %%G=%%H
)
)
:: As CMake options are typically of format -DSOMETHING:BOOL=ON or -DSOMETHING=1, i.e. they contain an equal sign,
:: they will mess up the batch file argument parsing if the arguments are passed on by splitting them %2 %3 %4 %5
:: %6 %7 %8 %9. Work around that, http://scripts.dragon-it.co.uk/scripts.nsf/docs/batch-search-replace-substitute