Merge remote-tracking branch 'origin/v0.8.0' into datamodel-v1.0

This commit is contained in:
Thomas Krijnen
2026-04-18 20:15:28 +02:00
1655 changed files with 105534 additions and 46934 deletions
+38 -11
View File
@@ -5,13 +5,24 @@ but also archives them to '~/outputs'.
"""
import os
import platform
import subprocess
import zipfile
from pathlib import Path
from zipfile import ZipFile
def is_arm64() -> bool:
arch = os.environ.get("TARGET_ARCH", "").lower()
if arch in ("arm64", "aarch64"):
return True
if arch in ("x64", "amd64", "x86_64"):
return False
return platform.machine().lower() in ("arm64", "aarch64")
assert Path.cwd() == Path(__file__).parent, "Run this script from the 'win' directory."
PYTHON_VERSIONS = ["3.9.13", "3.10.3", "3.11.8", "3.12.1", "3.13.0", "3.14.0"]
PYTHON_VERSIONS = ["3.10.3", "3.11.8", "3.12.1", "3.13.0", "3.14.0"]
REPO_PATH = Path(__file__).parent.parent
REPO_WIN = REPO_PATH / "win"
VERSION = (REPO_PATH / "VERSION").read_text().strip()
@@ -22,12 +33,28 @@ else:
OUTPUT_DIR = Path.home() / "output"
OUTPUT_DIR.mkdir(exist_ok=True)
print("Output directory:", OUTPUT_DIR)
ZIP_TEMPLATE = f"{{package_name}}-v{VERSION}-{SHA}-win64.zip"
ZIP_TEMPLATE = f"{{package_name}}-v{VERSION}-{SHA}-{'win-arm64' if is_arm64() else 'win64'}.zip"
def run(command: list[str]) -> None:
print("Running:", command)
subprocess.check_call(command) # nosec B603
subprocess.check_call(command)
def set_env(var_name: str, value: str) -> tuple[str, str | None]:
"""
:return: Tuple of ``(var_name, old_value)`` to be passed to ``restore_env``.
"""
old_value = os.getenv(var_name)
os.environ[var_name] = value
return var_name, old_value
def restore_env(var_name: str, old_value: str | None) -> None:
if old_value is None:
del os.environ[var_name]
else:
os.environ[var_name] = old_value
def build() -> None:
@@ -35,22 +62,22 @@ def build() -> None:
os.environ["PYTHON_VERSION"] = python_version
print(f"Building for Python {python_version}...")
subprocess.run(
[str(REPO_WIN / "build-deps.cmd"), "vs2022-x64", "Release"],
[str(REPO_WIN / "build-deps.cmd"), "vs2022-ARM64" if is_arm64() else "vs2022-x64", "Release"],
check=True,
text=True,
input="y\n",
)
OLD_ADD_COMMIT_SHA = set_env("ADD_COMMIT_SHA", "ON")
run(
[
str(REPO_WIN / "run-cmake.bat"),
"vs2022-x64",
"vs2022-ARM64" if is_arm64() else "vs2022-x64",
"-DENABLE_BUILD_OPTIMIZATIONS=ON",
"-DGLTF_SUPPORT=ON",
"-DADD_COMMIT_SHA=ON",
"-DVERSION_OVERRIDE=ON",
]
)
run([str(REPO_WIN / "install-ifcopenshell.bat"), "vs2022-x64", "Release"])
restore_env(*OLD_ADD_COMMIT_SHA)
run([str(REPO_WIN / "install-ifcopenshell.bat"), "vs2022-ARM64" if is_arm64() else "vs2022-x64", "Release"])
def archive_executables() -> None:
@@ -61,7 +88,7 @@ def archive_executables() -> None:
if file.suffix.lower() != ".exe":
continue
zip_name = ZIP_TEMPLATE.format(package_name=file.stem)
with ZipFile(OUTPUT_DIR / zip_name, "w") as zipf:
with ZipFile(OUTPUT_DIR / zip_name, "w", compression=zipfile.ZIP_DEFLATED) as zipf:
zipf.write(file, arcname=file.name)
print(f"{file} -> {zip_name}")
@@ -76,7 +103,7 @@ def archive_python_package(python_version: str, python_path: Path) -> None:
file.unlink()
zip_name = ZIP_TEMPLATE.format(package_name=f"ifcopenshell-python-{python_version_major_minor}")
with ZipFile(OUTPUT_DIR / zip_name, "w") as zipf:
with ZipFile(OUTPUT_DIR / zip_name, "w", compression=zipfile.ZIP_DEFLATED) as zipf:
for file in package_path.rglob("*"):
arcname = file.relative_to(site_packages)
zipf.write(file, arcname=arcname)
@@ -87,7 +114,7 @@ def archive_python_packages() -> None:
deps_path = REPO_PATH / "_deps"
python_versions: list[str] = []
for d in deps_path.iterdir():
if d.is_dir() and d.name.startswith("python."):
if d.is_dir() and (d.name.startswith("python.") or d.name.startswith("pythonarm64.")):
python_version = d.name.partition(".")[2]
python_path = d / "tools"
archive_python_package(python_version, python_path)
+233 -203
View File
@@ -41,6 +41,8 @@ echo.
:: Enable the delayed environment variable expansion needed in vs-cfg.cmd.
setlocal EnableDelayedExpansion
set SCRIPT_DIR=%~dp0
:: Make sure vcvarsall.bat is called and dev env set is up.
IF "%VSINSTALLDIR%"=="" (
call utils\cecho.cmd 0 12 "Visual Studio environment variables not set- cannot proceed."
@@ -96,7 +98,8 @@ IF NOT DEFINED IFCOS_NUM_BUILD_PROCS set IFCOS_NUM_BUILD_PROCS=%NUMBER_OF_PROCES
:: For subroutines
REM /clp:ErrorsOnly;WarningsOnly
:: Note BUILD_TYPE not passed, Clean e.g. wouldn't delete the installed files.
set MSBUILD_CMD=MSBuild.exe /nologo /m:%IFCOS_NUM_BUILD_PROCS%
set MSBUILD_MULTIPROC=/m /p:CL_MPCount=%IFCOS_NUM_BUILD_PROCS% /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true
set MSBUILD_CMD=MSBuild.exe /nologo %MSBUILD_MULTIPROC%
echo.
@@ -108,6 +111,7 @@ FOR %%i IN (powershell git cmake) DO (
:: Check powershell version
powershell -c "exit $PSVersionTable.PSVersion.Major -lt 5"
IF NOT %ERRORLEVEL%==0 call cecho.cmd 0 12 "Powershell version 5 or higher required" && goto :ErrorAndPrintUsage
set PWSH_TOOLS=powershell -NonInteractive -File %SCRIPT_DIR%\utils\tools.ps1
cmake --version | findstr version > temp.txt
set /p CMAKE_VERSION=<temp.txt
@@ -128,7 +132,7 @@ call cecho.cmd 0 10 "Script configuration:"
call cecho.cmd 0 13 "* CMake Generator`t= '`"%GENERATOR%`'`t
echo - Passed to CMake -G option.
call cecho.cmd 0 13 "* Target Architecture`t= %TARGET_ARCH%"
echo - Whether were doing 32-bit (x86) or 64-bit (x64) build.
echo - Whether were doing 32-bit (x86) or 64-bit (x64, arm64) build.
call cecho.cmd 0 13 "* Target Platform`t= %VS_PLATFORM%"
echo - Passed to CMake -A option.
call cecho.cmd 0 13 "* Target Toolset`t= %VS_TOOLSET%"
@@ -183,10 +187,15 @@ IF DEFINED PYTHON_VERSION (
)
:: VERSION DERIVATIONS
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%"
for /f "tokens=1,2,3 delims=." %%a in ("%PYTHON_VERSION%") do (
set PY_VER_MAJOR_MINOR=%%a%%b
)
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
set PYTHONHOME=%DEPS_DIR%\python.%PYTHON_VERSION%\tools
IF /I "%TARGET_ARCH%"=="arm64" (
set PYTHONHOME=%DEPS_DIR%\pythonarm64.%PYTHON_VERSION%\tools
) ELSE (
set PYTHONHOME=%DEPS_DIR%\python.%PYTHON_VERSION%\tools
)
)
:: Cache last used CMake generator and configurable dependency dirs for other scripts to use
@@ -194,8 +203,6 @@ IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
:: executed by jumping (using goto) to different labels.
if defined GEN_SHORTHAND echo GEN_SHORTHAND=%GEN_SHORTHAND%>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
echo HDF5_VERSION=%HDF5_VERSION%>>"%~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%"
IF "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
echo PYTHONHOME=%PYTHONHOME%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
)
@@ -250,8 +257,9 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
:proj
IF EXIST "%INSTALL_DIR%\proj-9.2.1" (
echo Found existing "%INSTALL_DIR%\proj-9.2.1", skipping
set PROJ_VERSION=9.4.1
IF EXIST "%INSTALL_DIR%\proj-%PROJ_VERSION%" (
echo Found existing "%INSTALL_DIR%\proj-%PROJ_VERSION%", skipping
goto :mpir
)
@@ -270,20 +278,20 @@ copy sqlite3.h %INSTALL_DIR%\sqlite3\include
popd
set DEPENDENCY_NAME=proj
set DEPENDENCY_DIR=%DEPS_DIR%\proj-9.2.1
call :DownloadFile https://download.osgeo.org/proj/proj-9.2.1.zip "%DEPS_DIR%" proj-9.2.1.zip
set DEPENDENCY_DIR=%DEPS_DIR%\proj-%PROJ_VERSION%
call :DownloadFile https://download.osgeo.org/proj/proj-%PROJ_VERSION%.zip "%DEPS_DIR%" proj-%PROJ_VERSION%.zip
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :ExtractArchive proj-9.2.1.zip "%DEPS_DIR%" "%DEPS_DIR%\proj-9.2.1"
call :ExtractArchive proj-%PROJ_VERSION%.zip "%DEPS_DIR%" "%DEPS_DIR%\proj-%PROJ_VERSION%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
pushd "%DEPENDENCY_DIR%"
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\proj-9.2.1" ^
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\proj-%PROJ_VERSION%" ^
-DSQLITE3_INCLUDE_DIR=%INSTALL_DIR%\sqlite3\include ^
-DSQLITE3_LIBRARY=%INSTALL_DIR%\sqlite3\lib\sqlite3.lib ^
-DENABLE_TIFF=Off -DENABLE_CURL=Off -DBUILD_PROJSYNC=Off ^
-DBUILD_SHARED_LIBS=Off ^
-DBUILD_TESTING=Off
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\PROJ.sln" %BUILD_CFG%
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -298,8 +306,9 @@ IF EXIST "%INSTALL_DIR%\mpir" (
)
set DEPENDENCY_NAME=mpir
:: `mpfr` depends on relative path `..\mpir\config.h`, so dependency name should match exactly.
set DEPENDENCY_DIR=%DEPS_DIR%\mpir
call :GitCloneAndCheckoutRevision https://github.com/BrianGladman/mpir.git "%DEPENDENCY_DIR%"
call :GitCloneAndCheckoutRevision https://github.com/Andrej730/mpir-vs2026.git "%DEPENDENCY_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
pushd "%DEPENDENCY_DIR%"
git reset --hard
@@ -311,6 +320,11 @@ powershell -c "get-content %~dp0patches\mpir.patch | %%{$_ -replace \"sdk\",\"%U
IF NOT %ERRORLEVEL%==0 GOTO :Error
if NOT "%USE_STATIC_RUNTIME%"=="FALSE" git apply "%~dp0patches\mpir_runtime.patch" --unidiff-zero --ignore-whitespace
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF /I "%VS_PLATFORM%"=="ARM64" (
echo "Applying ARM64 Patches for Mpir"
git apply "%~dp0patches\mpir-arm64-changes.patch" --unidiff-zero --ignore-whitespace
)
IF NOT %ERRORLEVEL%==0 GOTO :Error
cd msvc
cd vs%VS_VER:~2,2%
call .\msbuild.bat gc LIB %VS_PLATFORM% %DEBUG_OR_RELEASE%
@@ -337,6 +351,10 @@ powershell -c "get-content %~dp0patches\mpfr.patch | %%{$_ -replace \"sdk\",\"%U
IF NOT %ERRORLEVEL%==0 GOTO :Error
if NOT "%USE_STATIC_RUNTIME%"=="FALSE" git apply "%~dp0patches\mpfr_runtime.patch" --unidiff-zero --ignore-whitespace
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF /I "%VS_PLATFORM%"=="ARM64" (
echo "Applying ARM64 Patches for Mpfr"
git apply "%~dp0patches\mpfr-arm64-changes.patch" --unidiff-zero --ignore-whitespace
)
if "%VS_VER%"=="2017" (
set mpfr_sln=build.vc15
set orig_platform_toolset=v141
@@ -359,12 +377,12 @@ popd
set DEPENDENCY_NAME=hdf5
set DEPENDENCY_DIR=%DEPS_DIR%\hdf5-%HDF5_VERSION%
set HDF5_CMAKE_ZIP=hdf5-%HDF5_VERSION%.zip
set HDF5_INSTALL_NAME=HDF5-%HDF5_VERSION%-win%ARCH_BITS%
set DEPENDENCY_INSTALL_NAME=HDF5-%HDF5_VERSION%-win%ARCH_BITS%
set HDF5_INSTALL_NAME=%DEPENDENCY_INSTALL_NAME%
set NEXT_DEPENDENCY_LABEL=Boost
IF EXIST "%INSTALL_DIR%\%HDF5_INSTALL_NAME%" (
echo Found existing "%INSTALL_DIR%\%HDF5_INSTALL_NAME%", skipping
goto :Boost
)
call :CheckInstallation
if %ERRORLEVEL%==200 GOTO %NEXT_DEPENDENCY_LABEL%
if "%ARCH_BITS%"=="64" set ARCH_BITS_64=64
call :DownloadFile ^
@@ -380,10 +398,11 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\%HDF5_INSTALL_NAME%" ^
-DHDF5_BUILD_TOOLS=OFF -DHDF5_BUILD_EXAMPLES=OFF -DBUILD_SHARED_LIBS=OFF -DHDF5_BUILD_UTILS=OFF ^
-DHDF5_BUILD_CPP_LIB=ON
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\HDF5.sln" %DEBUG_OR_RELEASE%
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :MarkInstallation
popd
:: Note all of the dependencies have appropriate label so that user can easily skip something if wanted
@@ -396,7 +415,6 @@ set DEPENDENCY_INSTALL_DIR=%DEPENDENCY_DIR%\stage\%GEN_SHORTHAND%
echo BOOST_INSTALL_DIR=%DEPENDENCY_INSTALL_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
:: Needed for CGAL build.
set BOOST_ROOT=%DEPENDENCY_DIR%
set BOOST_LIBRARYDIR=%DEPENDENCY_DIR%\stage\%GEN_SHORTHAND%\lib
:: NOTE Also zip download exists, if encountering problems with 7z for some reason.
set ZIP_EXT=7z
set BOOST_ZIP=boost-%BOOST_VERSION%-b2-nodocs.%ZIP_EXT%
@@ -405,6 +423,7 @@ cd "%DEPS_DIR%"
call :DownloadFile https://github.com/boostorg/boost/releases/download/boost-%BOOST_VERSION%/%BOOST_ZIP% "%DEPS_DIR%" %BOOST_ZIP%
IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPS_DIR%"
call :ExtractArchive %BOOST_ZIP% "%DEPS_DIR%" %DEPENDENCY_DIR%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -413,6 +432,11 @@ if exist "%DEPS_DIR%\boost-%BOOST_VERSION%". (
ren %DEPS_DIR%\boost-%BOOST_VERSION% boost_%BOOST_VER%
)
:: As boost 1.90.0 it still includes b2 that doesn't support vc145 (not to mention older boost versions).
:: So to support vc145 we download b2 separately (only if we do use vc145).
call :check_boost_vc145_compatibility "%VC_VER%" "%DEPS_DIR%" "%DEPENDENCY_DIR%"
if NOT %ERRORLEVEL%==0 GOTO :Error
:: Build Boost build script
if not exist "%DEPENDENCY_DIR%\project-config.jam". (
cd "%DEPS_DIR%"
@@ -423,13 +447,21 @@ if not exist "%DEPENDENCY_DIR%\project-config.jam". (
IF NOT %ERRORLEVEL%==0 GOTO :Error
)
if /I "%TARGET_ARCH%"=="x64" (
set B2_ARCH_FEATURE=x86
) else if /I "%TARGET_ARCH%"=="arm64" (
set B2_ARCH_FEATURE=arm
) else (
echo "Failed to identify architecture"
GOTO :Error
)
set BOOST_LIBS=--with-system --with-regex --with-thread --with-program_options --with-date_time --with-iostreams --with-filesystem
:: NOTE Boost is fast to build with limited set of libraries so build it always.
cd "%DEPENDENCY_DIR%"
call cecho.cmd 0 13 "Building %DEPENDENCY_NAME% %BOOST_LIBS% Please be patient, this will take a while."
IF EXIST "%DEPENDENCY_DIR%\bin.v2\project-cache.jam" del "%DEPENDENCY_DIR%\bin.v2\project-cache.jam"
call .\b2 toolset=%BOOST_TOOLSET% runtime-link=shared address-model=%ARCH_BITS% --abbreviate-paths -j%IFCOS_NUM_BUILD_PROCS% ^
call .\b2 toolset=%BOOST_TOOLSET% architecture=%B2_ARCH_FEATURE% runtime-link=shared address-model=%ARCH_BITS% --abbreviate-paths -j%IFCOS_NUM_BUILD_PROCS% ^
variant=%DEBUG_OR_RELEASE_LOWERCASE% %BOOST_WIN_API% %BOOST_LIBS% stage --stagedir=%DEPENDENCY_INSTALL_DIR%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -444,15 +476,14 @@ call :DownloadFile https://github.com/nlohmann/json/releases/download/v3.6.1/jso
:: Note OpenCOLLADA has only Release and Debug builds.
set DEPENDENCY_NAME=OpenCOLLADA
set DEPENDENCY_DIR=%DEPS_DIR%\OpenCOLLADA
set DEPENDENCY_INSTALL_NAME=OpenCOLLADA
set NEXT_DEPENDENCY_LABEL=OCCT
:: Always clone it, even if it's installed, because it contains xml headers we need.
:: Use a fixed revision in order to prevent introducing breaking changes
call :GitCloneAndCheckoutRevision https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPENDENCY_DIR%" 064a60b65c2c31b94f013820856bc84fb1937cc6
IF EXIST "%INSTALL_DIR%\OpenCOLLADA" (
echo Found existing "%INSTALL_DIR%\OpenCOLLADA", skipping
:: we do need to clone though because the bundled libxml includes are not installed
goto :OCCT
)
call :CheckInstallation
if %ERRORLEVEL%==200 GOTO %NEXT_DEPENDENCY_LABEL%
IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPENDENCY_DIR%"
@@ -464,45 +495,37 @@ IF NOT %ERRORLEVEL%==0 git apply --reject --whitespace=fix "%~dp0patches\OpenCOL
:: uncomment to following line in order to delete the CMakeCache.txt always if experiencing problems.
REM IF EXIST "%DEPENDENCY_DIR%\%BUILD_DIR%\CMakeCache.txt". del "%DEPENDENCY_DIR%\%BUILD_DIR%\CMakeCache.txt"
:: NOTE Enforce that the embedded LibXml2 and PCRE are used as there might be problems with arbitrary versions of the libraries.
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\OpenCOLLADA" -DUSE_STATIC_MSVC_RUNTIME=0 -DCMAKE_DEBUG_POSTFIX=d ^
-DLIBXML2_LIBRARIES="" -DLIBXML2_INCLUDE_DIR="" -DPCRE_INCLUDE_DIR="" -DPCRE_LIBRARIES=""
:: OpenCOLLADA is ancient at this point and allows cmake 2.6+, which results in error in cmake 4, so we override minimum cmake version.
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%" -DUSE_STATIC_MSVC_RUNTIME=0 -DCMAKE_DEBUG_POSTFIX=d ^
-DLIBXML2_LIBRARIES="" -DLIBXML2_INCLUDE_DIR="" -DPCRE_INCLUDE_DIR="" -DPCRE_LIBRARIES="" ^
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
IF NOT %ERRORLEVEL%==0 GOTO :Error
REM IF NOT EXIST "%DEPS_DIR%\OpenCOLLADA\%BUILD_DIR%\lib\%DEBUG_OR_RELEASE%\OpenCOLLADASaxFrameworkLoader.lib".
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OPENCOLLADA.sln" %DEBUG_OR_RELEASE%
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :MarkInstallation
:OCCT
SET OCCT_VER=V%OCCT_VERSION:.=_%
IF EXIST "%INSTALL_DIR%\opencascade-%OCCT_VERSION%" (
echo Found existing "%INSTALL_DIR%\opencascade-%OCCT_VERSION%", skipping
goto :Python
)
set DEPENDENCY_NAME=OpenCASCADE
:: `new-layout` suffix can be removed on the next OCCT version update
:: it's needed to separate legacy layout installation from the new one.
set OCCT_DEPENDENCY_INSTALL_NAME=opencascade-%OCCT_VERSION%-new-layout
set DEPENDENCY_INSTALL_NAME=%OCCT_DEPENDENCY_INSTALL_NAME%
set DEPENDENCY_INSTALL_DIR=%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%
set NEXT_DEPENDENCY_LABEL=Python
echo OCC_INSTALL_DIR=%DEPENDENCY_INSTALL_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
:: OCCT has many dependencies but FreeType is the only mandatory
set DEPENDENCY_NAME=FreeType
set DEPENDENCY_DIR=%DEPS_DIR%\freetype-2.7.1
set FREETYPE_ZIP=VER-2-7-1.zip
cd "%DEPS_DIR%"
call :DownloadFile https://github.com/freetype/freetype/archive/refs/tags/%FREETYPE_ZIP% "%DEPS_DIR%" %FREETYPE_ZIP%
if not %ERRORLEVEL%==0 goto :Error
call :ExtractArchive %FREETYPE_ZIP% "%DEPS_DIR%" "%DEPENDENCY_DIR%"
if not %ERRORLEVEL%==0 goto :Error
if exist "%DEPS_DIR%\freetype-VER-2-7-1" ren "%DEPS_DIR%\freetype-VER-2-7-1" "freetype-2.7.1"
cd "%DEPENDENCY_DIR%"
:: NOTE FreeType is built as a static library by default
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\freetype"
if not %ERRORLEVEL%==0 goto :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\freetype.sln" %BUILD_CFG%
if not %ERRORLEVEL%==0 goto :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
if not %ERRORLEVEL%==0 goto :Error
call :CheckInstallation
if %ERRORLEVEL%==200 GOTO %NEXT_DEPENDENCY_LABEL%
set DEPENDENCY_NAME=Open CASCADE %OCCT_VERSION%
set DEPENDENCY_DIR=%DEPS_DIR%\occt_git
set DEPENDENCY_INSTALL_NAME=%OCCT_DEPENDENCY_INSTALL_NAME%
cd "%DEPS_DIR%"
call :GitCloneAndCheckoutRevision https://github.com/Open-Cascade-SAS/OCCT "%DEPENDENCY_DIR%" %OCCT_VER%
if not %ERRORLEVEL%==0 goto :Error
@@ -518,8 +541,21 @@ findstr IfcOpenShell "%DEPENDENCY_DIR%\CMakeLists.txt">NUL
if not %ERRORLEVEL%==0 goto :Error
cd "%DEPENDENCY_DIR%"
call :RunCMake -DINSTALL_DIR="%INSTALL_DIR%\opencascade-%OCCT_VERSION%" -DBUILD_LIBRARY_TYPE="Static" -DCMAKE_DEBUG_POSTFIX=d ^
-DBUILD_MODULE_Draw=0 -D3RDPARTY_FREETYPE_DIR="%INSTALL_DIR%\freetype"
:: TODO: remove CMAKE_DEBUG_POSTFIX setting later.
:: Temporarily explicitly set `CMAKE_DEBUG_POSTFIX` to empty to override it's perviously being set to `d`.
:: OCCT don't need it, since it's layout is separating debug and release build by different folders.
::
:: OCCT 7.8.1 we're using is becoming old and it was targeting cmake 3.1+.
::To make it buildable on cmake 4, we override policy version, but it may have some quirks in the future and we may consider version bump.
call :RunCMake -DINSTALL_DIR="%DEPENDENCY_INSTALL_DIR%" -DBUILD_LIBRARY_TYPE="Static" -DCMAKE_DEBUG_POSTFIX="" ^
-DBUILD_MODULE_Draw=0 ^
-DBUILD_RELEASE_DISABLE_EXCEPTIONS=OFF ^
-DUSE_XLIB=OFF ^
-DUSE_FREETYPE=OFF ^
-DUSE_OPENGL=OFF ^
-DUSE_GLES2=OFF ^
-DBUILD_USE_PCH=ON ^
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
if not %ERRORLEVEL%==0 goto :Error
:: whole program optimization avoids Visual C++ hanging when compiling 32-bit release OCCT up to version 7.4.0
@@ -529,63 +565,63 @@ IF %ARCH_BITS%==32 (
)
)
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\OCCT.sln" %BUILD_CFG%
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
if not %ERRORLEVEL%==0 goto :Error
:: If `inc` is present in installation folder, then installation takes much longer
:: See https://github.com/Open-Cascade-SAS/OCCT/issues/901
powershell -c "$path = '%DEPENDENCY_INSTALL_DIR%\inc'; if (Test-Path $path) { Remove-Item -Recurse -Force $path }"
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
if not %ERRORLEVEL%==0 goto :Error
SET COMPILE_WITH_WPO=FALSE
:: Fix upstream bug in cmake config file with unescaped quotes preventing configuration.
:: The issue is fixed in 7.9.0+.
:: See https://github.com/Open-Cascade-SAS/OCCT/pull/373
powershell -c "$path='%DEPENDENCY_INSTALL_DIR%\cmake\OpenCASCADEConfig.cmake'; (Get-Content $path) -replace '/wd\"(\d+)\"','/wd$1' | Set-Content $path"
if not %ERRORLEVEL%==0 goto :Error
:: Use a single lib directory for release and debug libraries as is done with OCE
if not exist "%OCC_LIBRARY_DIR%". mkdir "%OCC_LIBRARY_DIR%"
:: NOTE OCCT (at least occt-V7_0_0-9059ca1) directory creation code is hardcoded and doesn't seem handle future VC versions
set OCCT_VC_VER=%VC_VER%
IF %OCCT_VC_VER% GTR 14 (
set OCCT_VC_VER=14
)
move /y "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\win%ARCH_BITS%\vc%OCCT_VC_VER%\libi\*.*" "%OCC_LIBRARY_DIR%"
move /y "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\win%ARCH_BITS%\vc%OCCT_VC_VER%\libd\*.*" "%OCC_LIBRARY_DIR%"
move /y "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\win%ARCH_BITS%\vc%OCCT_VC_VER%\lib\*.*" "%OCC_LIBRARY_DIR%"
rmdir /s /q "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\win%ARCH_BITS%\vc%OCCT_VC_VER%"
:: Removed unneeded bits
rmdir /s /q "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\data"
rmdir /s /q "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\samples"
del "%INSTALL_DIR%\opencascade-%OCCT_VERSION%\*.bat"
call :MarkInstallation
SET COMPILE_WITH_WPO=FALSE
:Python
set DEPENDENCY_NAME=Python %PYTHON_VERSION%
set DEPENDENCY_DIR=N/A
set PYTHON_AMD64_POSTFIX=-amd64
IF NOT %TARGET_ARCH%==x64 set PYTHON_AMD64_POSTFIX=
set PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.exe
set PYTHON_AMD64_POSTFIX=
IF /I "%TARGET_ARCH%"=="x64" set "PYTHON_AMD64_POSTFIX=-amd64"
IF /I "%TARGET_ARCH%"=="arm64" set "PYTHON_AMD64_POSTFIX=-arm64"
set "PYTHON_INSTALLER=python-%PYTHON_VERSION%%PYTHON_AMD64_POSTFIX%.exe"
IF NOT "%IFCOS_INSTALL_PYTHON%"=="TRUE" (
call cecho.cmd 0 13 "IFCOS_INSTALL_PYTHON not 'TRUE', skipping installation of Python."
goto :SWIG
)
:: nuget doesn't support providing architecture for packages.
if NOT %TARGET_ARCH%==x64 (
call cecho.cmd 0 12 "Automatic installation of Python for x86 builds is not supported,"
call cecho.cmd 0 12 "please install Python %PYTHON_VERSION% manually and ensure that it is available in PATH."
call cecho.cmd 0 12 "https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER%"
goto :Error
)
:: nuget doesn't support providing architecture for packages.
IF /I NOT "%TARGET_ARCH%"=="x64" IF /I NOT "%TARGET_ARCH%"=="arm64" (
call cecho.cmd 0 12 "Automatic installation of Python for x86 builds is not supported,"
call cecho.cmd 0 12 "please install Python %PYTHON_VERSION% manually and ensure that it is available in PATH."
call cecho.cmd 0 12 "https://www.python.org/ftp/python/%PYTHON_VERSION%/%PYTHON_INSTALLER%"
goto :Error
)
if EXIST "%PYTHONHOME%" (
echo Found existing '%PYTHONHOME%', skipping installation.
goto :SWIG
)
"%NUGET_EXE%" install Python -Version %PYTHON_VERSION% -OutputDirectory "%DEPS_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
IF /I "%TARGET_ARCH%"=="x64" (
"%NUGET_EXE%" install Python -Version %PYTHON_VERSION% -OutputDirectory "%DEPS_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
) ELSE (
"%NUGET_EXE%" install pythonarm64 -Version %PYTHON_VERSION% -OutputDirectory "%DEPS_DIR%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
)
:SWIG
set DEPENDENCY_NAME=SWIG
set SWIG_VERSION=4.4.1
set DEPENDENCY_DIR=%DEPS_DIR%\swig-%SWIG_VERSION%
:SWIG
set DEPENDENCY_NAME=SWIG
set SWIG_VERSION=4.4.1
set DEPENDENCY_DIR=%DEPS_DIR%\swig-%SWIG_VERSION%
set DEPENDENCY_INSTALL_DIR=%INSTALL_DIR%\swig-%SWIG_VERSION%
echo SWIG_INSTALL_DIR=%DEPENDENCY_INSTALL_DIR%>>"%~dp0\%BUILD_DEPS_CACHE_PATH%"
@@ -596,15 +632,15 @@ IF EXIST "%DEPENDENCY_INSTALL_DIR%" (
cd "%DEPS_DIR%"
:: Install bizon dependency for SWIG.
:: Install bison dependency for SWIG.
set SWIG_DEPENDENCY_NAME=%DEPENDENCY_NAME%
set DEPENDENCY_NAME=win_flex_bison
set WIN_FLEX_BIZON=win_flex_bison-2.5.25
set WIN_FLEX_BIZON_ZIP=%WIN_FLEX_BIZON%.zip
call :DownloadFile https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/%WIN_FLEX_BIZON_ZIP% "%DEPS_DIR%" %WIN_FLEX_BIZON_ZIP%
set WIN_FLEX_BISON=win_flex_bison-2.5.25
set WIN_FLEX_BISON_ZIP=%WIN_FLEX_BISON%.zip
call :DownloadFile https://github.com/lexxmark/winflexbison/releases/download/v2.5.25/%WIN_FLEX_BISON_ZIP% "%DEPS_DIR%" %WIN_FLEX_BISON_ZIP%
IF NOT %ERRORLEVEL%==0 GOTO :Error
echo test %WIN_FLEX_BIZON%
call :ExtractArchive %WIN_FLEX_BIZON_ZIP% "%DEPS_DIR%\%WIN_FLEX_BIZON%" "%DEPS_DIR%\%WIN_FLEX_BIZON%"
echo test %WIN_FLEX_BISON%
call :ExtractArchive %WIN_FLEX_BISON_ZIP% "%DEPS_DIR%\%WIN_FLEX_BISON%" "%DEPS_DIR%\%WIN_FLEX_BISON%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
set DEPENDENCY_NAME=%SWIG_DEPENDENCY_NAME%
@@ -618,9 +654,9 @@ cd "%DEPENDENCY_DIR%"
call :RunCMake -DCMAKE_INSTALL_PREFIX="%DEPENDENCY_INSTALL_DIR%" ^
-DWITH_PCRE=OFF ^
-DBISON_EXECUTABLE="%DEPS_DIR%\%WIN_FLEX_BIZON%\win_bison.exe"
-DBISON_EXECUTABLE="%DEPS_DIR%\%WIN_FLEX_BISON%\win_bison.exe"
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\swig.sln" Release
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" Release
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" Release
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -643,15 +679,9 @@ cd "%DEPENDENCY_DIR%"
git reset --hard
git apply --ignore-whitespace "%~dp0patches\cgal_no_zlib.patch"
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\cgal" ^
-DBOOST_ROOT="%BOOST_ROOT%" ^
-DGMP_INCLUDE_DIR="%INSTALL_DIR%\mpir" ^
-DGMP_LIBRARIES="%INSTALL_DIR%\mpir\mpir.lib" ^
-DMPFR_INCLUDE_DIR="%INSTALL_DIR%\mpfr" ^
-DMPFR_LIBRARIES="%INSTALL_DIR%\mpfr\mpfr.lib" ^
-DCGAL_HEADER_ONLY=On ^
-DBOOST_LIBRARYDIR="%BOOST_LIBRARYDIR%"
-DCGAL_HEADER_ONLY=On
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\CGAL.sln" %BUILD_CFG%
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -687,7 +717,7 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
cd "%DEPENDENCY_DIR%"\build\cmake
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\zstd" -DZSTD_BUILD_STATIC=ON -DZSTD_BUILD_SHARED=OFF
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\build\cmake\%BUILD_DIR%\zstd.sln" %BUILD_CFG%
call :BuildCMakeProject "%DEPENDENCY_DIR%\build\cmake\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\build\cmake\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -697,11 +727,11 @@ set DEPENDENCY_NAME=rocksdb
set ROCKSDB_VERSION=9.11.2
set ROCKSDB_ZIP=rocksdb-%ROCKSDB_VERSION%.zip
set DEPENDENCY_DIR=%DEPS_DIR%\%DEPENDENCY_NAME%-%ROCKSDB_VERSION%
set DEPENDENCY_INSTALL_NAME=%DEPENDENCY_NAME%
set NEXT_DEPENDENCY_LABEL=Successful
IF EXIST "%INSTALL_DIR%\%DEPENDENCY_NAME%" (
echo Found existing "%INSTALL_DIR%\%DEPENDENCY_NAME%", skipping
goto :Successful
)
call :CheckInstallation
if %ERRORLEVEL%==200 GOTO %NEXT_DEPENDENCY_LABEL%
cd %DEPS_DIR%
call :DownloadFile ^
@@ -716,7 +746,7 @@ cd "%DEPENDENCY_DIR%"
set ZSTD_INCLUDE=%INSTALL_DIR%\zstd\include
set ZSTD_LIB_DEBUG=%INSTALL_DIR%\zstd\lib\zstd_static.lib
set ZSTD_LIB_RELEASE=%INSTALL_DIR%\zstd\lib\zstd_static.lib
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\rocksdb" ^
call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%" ^
-DROCKSDB_INSTALL_ON_WINDOWS=On ^
-DFAIL_ON_WARNINGS=Off ^
-DWITH_TESTS=OFF ^
@@ -725,12 +755,17 @@ call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\rocksdb" ^
-DWITH_CORE_TOOLS=OFF ^
-DROCKSDB_BUILD_SHARED=OFF ^
-DWITH_ZSTD=On ^
-DPORTABLE=1
-DZSTD_INCLUDE_DIR="%ZSTD_INCLUDE%" ^
-DZSTD_LIBRARY_DEBUG="%ZSTD_LIB_DEBUG%" ^
-DZSTD_LIBRARY_RELEASE="%ZSTD_LIB_RELEASE%" ^
-DPORTABLE=1 ^
-DCMAKE_DEBUG_POSTFIX="_d"
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\rocksdb.sln" %BUILD_CFG%
call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
IF NOT %ERRORLEVEL%==0 GOTO :Error
call :MarkInstallation
:manifold
set DEPENDENCY_NAME=manifold
@@ -774,7 +809,7 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
:: call :RunCMake -DCMAKE_INSTALL_PREFIX="%INSTALL_DIR%\tbb" ^
:: -DBUILD_SHARED_LIBS=Off
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
:: call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\TBB.sln" %BUILD_CFG%
:: call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
:: call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -797,9 +832,8 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
:: -DPXR_BUILD_USD_TOOLS=FALSE ^
:: -DPXR_BUILD_TESTS=FALSE ^
:: -DBUILD_SHARED_LIBS=Off ^
:: -DBOOST_LIBRARYDIR="%DEPS_DIR%\boost_%BOOST_VER%\stage\vs%VS_VER%-%VS_PLATFORM%\lib"
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
:: call :BuildSolution "%DEPENDENCY_DIR%\%BUILD_DIR%\USD.sln" %BUILD_CFG%
:: call :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
:: call :InstallCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %BUILD_CFG%
:: IF NOT %ERRORLEVEL%==0 GOTO :Error
@@ -839,82 +873,37 @@ echo Build ended at %END_TIME%. Time elapsed %hh%:%mm%:%ss%.%cc%.
:BuildTimeSkipped
set PATH=%ORIGINAL_PATH%
cd "%~dp0"
exit /b %IFCOS_SCRIPT_RET%
exit %IFCOS_SCRIPT_RET%
::::::::::::::::::::::::::::::::::::: Subroutines :::::::::::::::::::::::::::::::::::::
:: DownloadFile - Downloads a file using PowerShell
:: Params: %1 url, %2 destinationDir, %3 filename
:: Required vars:
:: - DEPENDENCY_NAME
:DownloadFile
mkdir "%2"
pushd "%2"
if not exist "%~3". (
call cecho.cmd 0 13 "Downloading %DEPENDENCY_NAME% into %~2."
powershell -Command "[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; $webClient = new-object System.Net.WebClient; $webClient.Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials; $webClient.DownloadFile('%1', '%3')"
REM Old wget version in case someone has problem with PowerShell: wget --no-check-certificate %1
) else (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already downloaded. Skipping."
)
set RET=%ERRORLEVEL%
set LAST_ACTION=DownloadFile '%DEPENDENCY_NAME%'.
popd
exit /b %RET%
%PWSH_TOOLS% download_file "%DEPENDENCY_NAME%" "%1" "%2" "%3"
IF NOT %ERRORLEVEL%==0 GOTO :Error
exit /b 0
:: ExtractArchive - Extracts an archive file using 7-zip
:: Params: %1 filename, %2 destinationDir, %3 dirAfterExtraction
:: Required vars:
:: - DEPENDENCY_NAME
:ExtractArchive
if not exist "%~3". (
call cecho.cmd 0 13 "Extracting %DEPENDENCY_NAME% into %~2 from %1"
7za x %1 -y -o%2 > nul
) else (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already extracted into %~3. Skipping."
)
set RET=%ERRORLEVEL%
set LAST_ACTION=ExtractArchive '%DEPENDENCY_NAME%'.
exit /b %RET%
:: GitCloneOrPullRepository - Clones or pulls (if repository already cloned) a Git repository
:: Params: %1 gitUrl, %2 destDir
:: F.ex. call :GitCloneRepository https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPS_DIR%\OpenCOLLADA\"
:GitCloneOrPullRepository
if not exist "%~2". (
call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %~2."
pushd "%DEPS_DIR%"
call git clone %1 %2
set RET=!ERRORLEVEL!
) else (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned. Pulling latest changes."
git reset --hard
pushd %2
call git pull
set RET=0
)
popd
exit /b %RET%
%PWSH_TOOLS% extract_file "%DEPENDENCY_NAME%" "%1" "%2" "%3"
IF NOT %ERRORLEVEL%==0 GOTO :Error
exit /b 0
:: GitCloneAndCheckoutRevision - Clones a Git repository and checks out a specific revision or tag
:: Params: %1 gitUrl, %2 destDir, %3 revision
:: F.ex. call :GitCloneAndCheckoutRevision https://github.com/KhronosGroup/OpenCOLLADA.git "%DEPENDENCY_DIR%" 064a60b65c2c31b94f013820856bc84fb1937cc6
:: Required vars:
:: - DEPENDENCY_NAME
:GitCloneAndCheckoutRevision
if not exist "%~2". (
call cecho.cmd 0 13 "Cloning %DEPENDENCY_NAME% into %~2."
pushd "%DEPS_DIR%"
call git clone %1 %2
set RET=!ERRORLEVEL!
if not "!RET!"=="0" exit /b !RET!
popd
) else (
call cecho.cmd 0 13 "%DEPENDENCY_NAME% already cloned."
set RET=0
)
pushd "%2"
call git fetch
call cecho.cmd 0 13 "Checking out %DEPENDENCY_NAME% revision %3."
call git reset --hard
call git checkout %3
set RET=%ERRORLEVEL%
popd
exit /b %RET%
%PWSH_TOOLS% git_clone_and_checkout_revision "%DEPENDENCY_NAME%" "%1" "%2" "%3"
IF NOT %ERRORLEVEL%==0 GOTO :Error
exit /b 0
:: RunCMake - Runs CMake for a CMake-based project
:: Params: %* cmakeOptions
@@ -928,20 +917,36 @@ pushd %BUILD_DIR%
:: cache always e.g. when we've had new changes in the repository.
IF %BUILD_TYPE%==Rebuild IF EXIST CMakeCache.txt. del CMakeCache.txt
set VS_TOOLSET_CMAKE_ARG=
IF NOT "%VS_TOOLSET_HOST%"=="" (
cmake .. -G %GENERATOR% -A %VS_PLATFORM% -T %VS_TOOLSET_HOST% %*
) ELSE (
cmake .. -G %GENERATOR% -A %VS_PLATFORM% %*
set VS_TOOLSET_CMAKE_ARG=-T %VS_TOOLSET_HOST%
)
set COMMAND=cmake .. -G %GENERATOR% -A %VS_PLATFORM% %VS_TOOLSET_CMAKE_ARG% %*
echo %COMMAND%
%COMMAND%
set RET=%ERRORLEVEL%
popd
exit /b %RET%
:: TODO add BuildCMakeProject which utilizes cmake --build
:: Params: %1 buildDir, %2 configuration
:: Required vars:
:: - DEPENDENCY_NAME
:BuildCMakeProject
pushd %1
call cecho.cmd 0 13 "Building %DEPENDENCY_NAME%. Please be patient, this will take a while."
set COMPILE_WITH_WPO_SETTING=
IF NOT %COMPILE_WITH_WPO%==FALSE (
set COMPILE_WITH_WPO_SETTING=;WholeProgramOptimization=TRUE
)
set COMMAND=cmake --build . --config %2 -- %MSBUILD_MULTIPROC%
echo %COMMAND%
%COMMAND%
set RET=%ERRORLEVEL%
popd
exit /b %RET%
:: BuildSolution - Builds/Rebuilds/Cleans a solution using MSBuild
:: Params: %1 solutioName, %2 configuration
:: Params: %1 solutionName, %2 configuration
:BuildSolution
IF [%~3]==[] (
set TARGET=%BUILD_TYPE%
@@ -956,30 +961,56 @@ IF [%~3]==[] (
call cecho.cmd 0 13 "Building %TARGET% of %DEPENDENCY_NAME%. Please be patient, this will take a while."
:: whole program optimization avoids Visual C++ hanging when compiling 32-bit release OCCT up to version 7.4.0
IF %COMPILE_WITH_WPO%==FALSE (
%MSBUILD_CMD% %1 /p:configuration=%2;platform=%VS_PLATFORM% /t:"%TARGET%"
) ELSE (
%MSBUILD_CMD% %1 /p:configuration=%2;platform=%VS_PLATFORM%;WholeProgramOptimization=TRUE /t:"%TARGET%"
set COMPILE_WITH_WPO_SETTING=
IF NOT %COMPILE_WITH_WPO%==FALSE (
set COMPILE_WITH_WPO_SETTING=;WholeProgramOptimization=TRUE
)
%MSBUILD_CMD% %1 /p:configuration=%2;platform=%VS_PLATFORM%%COMPILE_WITH_WPO_SETTING% /t:"%TARGET%"
exit /b %ERRORLEVEL%
:: InstallCMakeProject - Builds the INSTALL project of CMake-based project
:: Params: %1 buildDir, %2 == configuration
:: NOTE the actual install dir is set during cmake run.
:: TODO Utilize cmake --build --target INSTALL
:: Params: %1 buildDir, %2 configuration
:: Required vars:
:: - DEPENDENCY_NAME
:InstallCMakeProject
pushd %1
call cecho.cmd 0 13 "Installing %2 %DEPENDENCY_NAME%. Please be patient, this will take a while."
%PWSH_TOOLS% install_cmake_project "%DEPENDENCY_NAME%" "%1" "%2"
IF NOT %ERRORLEVEL%==0 GOTO :Error
exit /b 0
:: whole program optimization avoids Visual C++ hanging when compiling 32-bit release OCCT up to version 7.4.0
IF %COMPILE_WITH_WPO%==FALSE (
%MSBUILD_CMD% INSTALL.%VCPROJ_FILE_EXT% /p:configuration=%2;platform=%VS_PLATFORM%
) ELSE (
%MSBUILD_CMD% INSTALL.%VCPROJ_FILE_EXT% /p:configuration=%2;platform=%VS_PLATFORM%;WholeProgramOptimization=TRUE
)
:: Checks whether a dependency is already installed for the specified config
:: Doesn't work for dependencies, only for those that need separate Debug/Release installs.
:: Required vars:
:: - DEPENDENCY_NAME
:: - DEPENDENCY_INSTALL_NAME
:: - NEXT_DEPENDENCY_LABEL
:: Always intended to be used with the code below
:: (unfortunately we can't move `GOTO` to the this label too,
:: because of how it would interact with `call` and `exit /b`):
:: ```
:: call :CheckInstallation
:: if %ERRORLEVEL%==200 GOTO %NEXT_DEPENDENCY_LABEL%
:: ```
:CheckInstallation
%PWSH_TOOLS% check_installation %DEPENDENCY_NAME% "%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%"
set RET=%ERRORLEVEL%
popd
exit /b %RET%
if %RET%==200 echo Found existing "%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%" for %BUILD_CFG%, skipping && exit /b 200
if %RET% NEQ 404 GOTO :Error
exit /b 0
:: Required vars:
:: - DEPENDENCY_INSTALL_NAME
:MarkInstallation
%PWSH_TOOLS% mark "%INSTALL_DIR%\%DEPENDENCY_INSTALL_NAME%"
IF NOT %ERRORLEVEL%==0 GOTO :Error
exit /b 0
:: Params:
:: - %1 - VC_VER
:: - %2 - DEPS_DIR
:: - %3 - BOOST_ROOT
:check_boost_vc145_compatibility
%PWSH_TOOLS% check_boost_vc145_compatibility "%1" "%2" "%3"
IF NOT %ERRORLEVEL%==0 GOTO :Error
exit /b 0
:: PrintUsage - Prints usage information
:PrintUsage
@@ -997,4 +1028,3 @@ echo - https://msdn.microsoft.com/en-us/library/ms229859(v=vs.110).aspx
echo.
echo NB: This script needs to be ran from the directory directly containing it.
echo.
+5 -1
View File
@@ -20,6 +20,9 @@
:: This batch file expects CMake generator as %1 and build configuration type as %2. If not provided,
:: a deduced generator will be used for %1 and BUILD_CFG_DEFAULT for %2 (both set in vs-cfg.cmd)
:: Possible extra parameters are passed for the MSBuild call.
::
:: Example usage:
:: install-ifcopenshell.bat vs2022-x64 Debug
@if not defined ECHO_ON ( echo off )
set PROJECT_NAME=IfcOpenShell
@@ -55,7 +58,8 @@ call cecho.cmd 0 13 "* IFCOS_NUM_BUILD_PROCS`t= %IFCOS_NUM_BUILD_PROCS%"
echo.
call cecho.cmd 0 13 "Installing %VS_PLATFORM% %BUILD_CFG% %PROJECT_NAME%"
cmake --build ..\%BUILD_DIR% --target INSTALL -- /nologo /m:%IFCOS_NUM_BUILD_PROCS% /p:Platform=%VS_PLATFORM% ^
set MSBUILD_MULTIPROC=/m /p:CL_MPCount=%IFCOS_NUM_BUILD_PROCS% /p:UseMultiToolTask=true /p:EnforceProcessCountAcrossBuilds=true
cmake --build ..\%BUILD_DIR% --target INSTALL -- /nologo %MSBUILD_MULTIPROC% /p:Platform=%VS_PLATFORM% ^
/p:Configuration=%BUILD_CFG% %3 %4 %5 %6 %7 %8 %9
IF NOT %ERRORLEVEL%==0 GOTO :Error
+1
View File
@@ -0,0 +1 @@
disable_formatting: true
+13
View File
@@ -84,3 +84,16 @@ index c9399159f1..0aa55392f9 100644
endif()
if (BUILD_SHARED_LIBS AND NOT "${BUILD_SHARED_LIBRARY_NAME_POSTFIX}" STREQUAL "")
diff --git a/adm/cmake/cotire.cmake b/adm/cmake/cotire.cmake
index acdca71a9f..6c6e29b374 100644
--- a/adm/cmake/cotire.cmake
+++ b/adm/cmake/cotire.cmake
@@ -37,7 +37,7 @@ set(__COTIRE_INCLUDED TRUE)
if (NOT CMAKE_SCRIPT_MODE_FILE)
cmake_policy(PUSH)
endif()
-cmake_minimum_required(VERSION 2.8.12)
+cmake_minimum_required(VERSION 3.5)
if (NOT CMAKE_SCRIPT_MODE_FILE)
cmake_policy(POP)
endif()
File diff suppressed because it is too large Load Diff
+519
View File
@@ -0,0 +1,519 @@
diff --git a/msvc/postbuild.bat b/msvc/postbuild.bat
index 1c301d1a..7d5362be 100644
--- a/msvc/postbuild.bat
+++ b/msvc/postbuild.bat
@@ -1,6 +1,6 @@
@echo off
rem %1 = full target path
-rem %2 = last two digits of the Visual Studio version number (e.g. 17)
+rem %2 = last two digits of the Visual Studio version number (e.g. 17 or 22)
set vs_ver=%2
set str=%~1
@@ -20,11 +20,13 @@ goto dele
set str=%str_confirmed%
echo "Final subpath %str%"
-rem we now have: msvc.\vs<nn>\<project_directory>\<win32|x64>\<debug|release>\mpir.<lib|dll>
-rem extract: project_directory, platform (plat=<win32|x64>), configuration (conf=<debug|release>) and file name
+rem we now have: msvc\vs<nn>\<project>\<plat>\<conf>\mpir(.xx).<lib|dll>
+rem extract: project_directory, platform (plat), configuration (conf) and file name
set file=
-for /f "tokens=1,2,3,4,5,6 delims=\" %%a in ("%str%") do set tloc=%%c&set plat=%%d&set conf=%%e&set file=%%f
+for /f "tokens=1,2,3,4,5,6 delims=\" %%a in ("%str%") do (
+ set tloc=%%c&set plat=%%d&set conf=%%e&set file=%%f
+)
if /i "%file%" NEQ "" (goto next)
call :seterr & echo ERROR: %1 is not supported & exit /b %errorlevel%
@@ -42,9 +44,9 @@ call :seterr & echo "postbuild copy error ERROR: target=%tloc%, plat=%plat%, con
:is2nd:
rem set the target and final binary output directories
-set tgt_dir="vs%vs_ver%\%loc%%plat%\%conf%\"
-set bin_dir="..\%extn%\%plat%\%conf%\"
-set hdr_dir="..\%extn%\%plat%\%conf%\"
+set "tgt_dir=vs%vs_ver%\%loc%%plat%\%conf%"
+set "bin_dir=..\%extn%\%plat%\%conf%"
+set "hdr_dir=..\%extn%\%plat%\%conf%"
rem output parametrers for the MPIR tests
if /i "%filename%" EQU "mpirxx" goto skip
@@ -66,43 +68,42 @@ rem %1 = target (build output) directory
rem %2 = binary destination directory
rem %3 = configuration (debug/release)
rem %4 = library (lib/dll)
-rem %5 = file name
+rem %5 = file name (mpir | mpirxx)
:copyb
if "%4" EQU "dll" (
- copy %1mpir.dll %2mpir.dll > nul 2>&1
- copy %1mpir.exp %2mpir.exp > nul 2>&1
- copy %1mpir.lib %2mpir.lib > nul 2>&1
- if exist %1mpir.pdb (copy %1mpir.pdb %2mpir.pdb > nul 2>&1)
+ copy "%~1\mpir.dll" "%~2\mpir.dll" > nul 2>&1
+ copy "%~1\mpir.exp" "%~2\mpir.exp" > nul 2>&1
+ copy "%~1\mpir.lib" "%~2\mpir.lib" > nul 2>&1
+ if exist "%~1\mpir.pdb" copy "%~1\mpir.pdb" "%~2\mpir.pdb" > nul 2>&1
) else if "%4" EQU "lib" (
if "%5" EQU "mpir" (
- if exist %1mpir.lib (
- copy %1mpir.lib %2mpir.lib > nul 2>&1
- if exist %1mpir.pdb (copy %1mpir.pdb %2mpir.pdb > nul 2>&1)
+ if exist "%~1\mpir.lib" (
+ copy "%~1\mpir.lib" "%~2\mpir.lib" > nul 2>&1
+ if exist "%~1\mpir.pdb" copy "%~1\mpir.pdb" "%~2\mpir.pdb" > nul 2>&1
+ ) else (
+ echo "Not Found MPIR at location" "%~1\mpir.lib"
)
) else if "%5" EQU "mpirxx" (
- if exist %1mpirxx.lib (
- copy %1mpirxx.lib %2mpirxx.lib > nul 2>&1
- if exist %1mpirxx.pdb (copy %1mpirxx.pdb %2mpirxx.pdb > nul 2>&1)
+ if exist "%~1\mpirxx.lib" (
+ copy "%~1\mpirxx.lib" "%~2\mpirxx.lib" > nul 2>&1
+ if exist "%~1\mpirxx.pdb" copy "%~1\mpirxx.pdb" "%~2\mpirxx.pdb" > nul 2>&1
)
)
) else (
- call :seterr & echo ERROR: illegal library type %4 & exit /b %errorlevel%
+ call :seterr & echo ERROR: illegal library type %4 & exit /b %errorlevel%
)
-
-rem set configuration for the tests
-call gen_test_config_props %plat% %conf% %vs_ver%
exit /b 0
rem copy headers to final destination directory
:copyh
-copy ..\config.h %1config.h > nul 2>&1
-copy ..\gmp-mparam.h %1gmp-mparam.h > nul 2>&1
-copy ..\mpir.h %1mpir.h > nul 2>&1
-copy ..\mpir.h %1gmp.h > nul 2>&1
-copy ..\gmp-impl.h %1gmp-impl.h > nul 2>&1
-copy ..\longlong.h %1longlong.h > nul 2>&1
-copy ..\mpirxx.h %1mpirxx.h > nul 2>&1
-copy ..\mpirxx.h %1gmpxx.h > nul 2>&1
+copy "..\config.h" "%~1\config.h" > nul 2>&1
+copy "..\gmp-mparam.h" "%~1\gmp-mparam.h" > nul 2>&1
+copy "..\mpir.h" "%~1\mpir.h" > nul 2>&1
+copy "..\mpir.h" "%~1\gmp.h" > nul 2>&1
+copy "..\gmp-impl.h" "%~1\gmp-impl.h" > nul 2>&1
+copy "..\longlong.h" "%~1\longlong.h" > nul 2>&1
+copy "..\mpirxx.h" "%~1\mpirxx.h" > nul 2>&1
+copy "..\mpirxx.h" "%~1\gmpxx.h" > nul 2>&1
exit /b 0
:seterr
diff --git a/msvc/prebuild.bat b/msvc/prebuild.bat
index 243d054f..c1d49c67 100644
--- a/msvc/prebuild.bat
+++ b/msvc/prebuild.bat
@@ -1,29 +1,56 @@
@echo off
-rem %1 = mpn directory (generic, x86\... or x86_64\...)
-rem %2 = platform (win32 or x64)
+rem %1 = mpn directory (generic, x86\... or x86_64\... or arm64\...)
+rem %2 = platform (win32, x64/amd64, or arm64)
rem %3 = MSVC version number (e.g. 14)
-if /i "%2" EQU "win32" ((set platform=win32) & (set bdir=x86w\)) else ((set platform=x64) & (set bdir=x86_64w\))
-set sdir=
-if /i "%1" EQU "gc" ((set sdir=generic) & (set bdir=generic)) else (set sdir=%bdir%%1)
-if not exist ..\mpn\%sdir% (call :seterr & echo ERROR: %1 is not supported & exit /b %errorlevel%)
+set "platform="
+set "bdir="
+
+if /i "%2"=="win32" (
+ set "platform=win32"
+ set "bdir=x86w\"
+) else if /i "%2"=="x64" (
+ set "platform=x64"
+ set "bdir=x86_64w\"
+) else if /i "%2"=="arm64" (
+ set "platform=arm64"
+ set "bdir=arm64w\"
+) else (
+ call :seterr & echo ERROR: Unsupported platform "%2" (expected win32, x64/amd64, or arm64) & exit /b %errorlevel%
+)
+
+set "sdir="
+if /i "%1"=="gc" (
+ rem Generic C (portable) implementation
+ set "sdir=generic"
+ set "bdir=generic"
+) else (
+ set "sdir=%bdir%%~1"
+)
+
+if not exist "..\mpn\%sdir%" (
+ call :seterr & echo ERROR: %1 is not supported & exit /b %errorlevel%
+)
echo building MPIR for %1 (%platform%) from directory mpn\%sdir%
-set cdir=vs%3\cdata\mpn\%sdir%\
-set sdir=..\mpn\%sdir%\
-set bdir=..\mpn\%bdir%\
+set "cdir=vs%3\cdata\mpn\%sdir%\"
+set "sdir=..\mpn\%sdir%\"
+set "bdir=..\mpn\%bdir%\"
call gen_mpir_h %platform%
call gen_config_h %cdir%
-if exist %sdir%\gmp-mparam.h (call out_copy_rename %sdir%\gmp-mparam.h ..\ gmp-mparam.h) else (
- call out_copy_rename %bdir%\gmp-mparam.h ..\ gmp-mparam.h)
+if exist "%sdir%\gmp-mparam.h" (
+ call out_copy_rename "%sdir%\gmp-mparam.h" "..\" "gmp-mparam.h"
+) else (
+ call out_copy_rename "%bdir%\gmp-mparam.h" "..\" "gmp-mparam.h"
+)
-type ..\longlong_pre.h >tmp.h
-type %bdir%\longlong_inc.h >>tmp.h
-type ..\longlong_post.h >>tmp.h
-call out_copy_rename tmp.h ..\ longlong.h
+type "..\longlong_pre.h" > tmp.h
+type "%bdir%\longlong_inc.h" >> tmp.h
+type "..\longlong_post.h" >> tmp.h
+call out_copy_rename tmp.h "..\" "longlong.h"
del tmp.h
exit /b 0
diff --git a/msvc/vs22/lib_mpir_cxx/lib_mpir_cxx.vcxproj b/msvc/vs22/lib_mpir_cxx/lib_mpir_cxx.vcxproj
index 0aca0c6e..e4bcf619 100644
--- a/msvc/vs22/lib_mpir_cxx/lib_mpir_cxx.vcxproj
+++ b/msvc/vs22/lib_mpir_cxx/lib_mpir_cxx.vcxproj
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="19.30.30401" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|ARM64">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM64">
+ <Configuration>Release</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@@ -40,11 +48,21 @@
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
@@ -58,17 +76,27 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
<Import Project="..\..\mpir_release_lib.props" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ <Import Project="..\..\mpir_release_lib.props" />
+ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
<Import Project="..\..\mpir_debug_lib.props" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ <Import Project="..\..\mpir_debug_lib.props" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mpirxx</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mpirxx</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mpirxx</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">mpirxx</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mpirxx</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">mpirxx</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
@@ -99,6 +127,17 @@ postbuild "$(TargetPath)" 22
</ClCompile>
<PostBuildEvent>
<Command>cd ..\..\
+postbuild "$(TargetPath)" 22
+ </Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>cd ..\..\
postbuild "$(TargetPath)" 22
</Command>
</PostBuildEvent>
@@ -110,6 +149,17 @@ postbuild "$(TargetPath)" 22
</ClCompile>
<PostBuildEvent>
<Command>cd ..\..\
+postbuild "$(TargetPath)" 22
+ </Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;WIN32;_LIB;HAVE_CONFIG_H;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>cd ..\..\
postbuild "$(TargetPath)" 22
</Command>
</PostBuildEvent>
@@ -141,7 +191,7 @@ postbuild "$(TargetPath)" 22
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-<ItemGroup>
+ <ItemGroup>
<None Include="..\..\..\gmp-h.in" />
- </ItemGroup>
-</Project>
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/msvc/vs22/lib_mpir_gc/lib_mpir_gc.vcxproj b/msvc/vs22/lib_mpir_gc/lib_mpir_gc.vcxproj
index 350ee110..faf49ac3 100644
--- a/msvc/vs22/lib_mpir_gc/lib_mpir_gc.vcxproj
+++ b/msvc/vs22/lib_mpir_gc/lib_mpir_gc.vcxproj
@@ -1,6 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="19.30.30401" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
+ <ProjectConfiguration Include="Debug|ARM64">
+ <Configuration>Debug</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
+ <ProjectConfiguration Include="Release|ARM64">
+ <Configuration>Release</Configuration>
+ <Platform>ARM64</Platform>
+ </ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@@ -40,11 +48,21 @@
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>false</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
</PropertyGroup>
+ <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
+ <ConfigurationType>StaticLibrary</ConfigurationType>
+ <UseDebugLibraries>true</UseDebugLibraries>
+ <PlatformToolset>v143</PlatformToolset>
+ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
@@ -58,23 +76,32 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
<Import Project="..\..\mpir_release_lib.props" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ <Import Project="..\..\mpir_release_lib.props" />
+ </ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
<Import Project="..\..\mpir_debug_lib.props" />
</ImportGroup>
+ <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="PropertySheets">
+ <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+ <Import Project="..\..\mpir_debug_lib.props" />
+ </ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">mpir</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">mpir</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">mpir</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">mpir</TargetName>
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">mpir</TargetName>
+ <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">mpir</TargetName>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<PreBuildEvent>
<Command>cd ..\..\
-prebuild gc Win32 22
- </Command>
+prebuild gc $(Platform) 22</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
@@ -82,15 +109,13 @@ prebuild gc Win32 22
</ClCompile>
<PostBuildEvent>
<Command>cd ..\..\
-postbuild "$(TargetPath)" 22
- </Command>
+postbuild "$(TargetPath)" 22</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<PreBuildEvent>
<Command>cd ..\..\
-prebuild gc Win32 22
- </Command>
+prebuild gc $(Platform) 22</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
@@ -98,15 +123,27 @@ prebuild gc Win32 22
</ClCompile>
<PostBuildEvent>
<Command>cd ..\..\
-postbuild "$(TargetPath)" 22
- </Command>
+postbuild "$(TargetPath)" 22</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<PreBuildEvent>
<Command>cd ..\..\
-prebuild gc x64 22
- </Command>
+prebuild gc $(Platform) 22</Command>
+ </PreBuildEvent>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>NDEBUG;WIN32;_LIB;HAVE_CONFIG_H;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>cd ..\..\
+postbuild "$(TargetPath)" 22</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+ <PreBuildEvent>
+ <Command>cd ..\..\
+prebuild gc $(Platform) 22</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
@@ -114,15 +151,13 @@ prebuild gc x64 22
</ClCompile>
<PostBuildEvent>
<Command>cd ..\..\
-postbuild "$(TargetPath)" 22
- </Command>
+postbuild "$(TargetPath)" 22</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<PreBuildEvent>
<Command>cd ..\..\
-prebuild gc x64 22
- </Command>
+prebuild gc $(Platform) 22</Command>
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
@@ -130,8 +165,21 @@ prebuild gc x64 22
</ClCompile>
<PostBuildEvent>
<Command>cd ..\..\
-postbuild "$(TargetPath)" 22
- </Command>
+postbuild "$(TargetPath)" 22</Command>
+ </PostBuildEvent>
+ </ItemDefinitionGroup>
+ <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
+ <PreBuildEvent>
+ <Command>cd ..\..\
+prebuild gc $(Platform) 22</Command>
+ </PreBuildEvent>
+ <ClCompile>
+ <AdditionalIncludeDirectories>..\..\..\</AdditionalIncludeDirectories>
+ <PreprocessorDefinitions>_DEBUG;WIN32;_LIB;HAVE_CONFIG_H;_WIN64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ </ClCompile>
+ <PostBuildEvent>
+ <Command>cd ..\..\
+postbuild "$(TargetPath)" 22</Command>
</PostBuildEvent>
</ItemDefinitionGroup>
<ImportGroup>
@@ -667,7 +715,7 @@ postbuild "$(TargetPath)" 22
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
-<ItemGroup>
+ <ItemGroup>
<None Include="..\..\..\gmp-h.in" />
- </ItemGroup>
-</Project>
+ </ItemGroup>
+</Project>
\ No newline at end of file
diff --git a/msvc/vs22/msbuild.bat b/msvc/vs22/msbuild.bat
index f119c3e9..36bfe28b 100644
--- a/msvc/vs22/msbuild.bat
+++ b/msvc/vs22/msbuild.bat
@@ -1,7 +1,7 @@
@echo off
rem %1 = architecture
rem %2 = library type (LIB|DLL)
-rem %3 = platform (Win32|x64)
+rem %3 = platform (Win32|x64|ARM64)
rem %4 = configuration (Release|Debug)
rem %5 = Windows SDK Version
rem %6 = build tests (|+tests)
@@ -31,15 +31,21 @@ if not exist !msb_exe! (
if "%4" NEQ "" if "%3" NEQ "" if "%2" NEQ "" if "%1" NEQ "" goto cont
call :get_architectures -
-echo usage: msbuild architecture=^<%architectures:|=^|%^> library_type=^<LIB^|DLL^> platform=^<Win32^|x64^> configuration=^<Release^|Debug^> [Windows_SDK_Version=^<n^>] [+tests]
+echo usage: msbuild architecture=^<%architectures:|=^|%^> library_type=^<LIB^|DLL^> platform=^<Win32^|x64^|ARM64^> configuration=^<Release^|Debug^> [Windows_SDK_Version=^<n^>] [+tests]
goto :eof
:cont
rem example use: msbuild sandybridge_ivybridge dll x64 release
if not exist "lib_mpir_%1" (call :get_architectures & call :seterr & echo ERROR: architecture is one of ^(%architectures%^) ^(not %1^) & exit /b %errorlevel%)
if /i "%2" EQU "DLL" (set libp=dll) else (if /i "%2" EQU "LIB" (set libp=lib) else ((call :seterr & echo ERROR: library type is "lib" or "dll" ^(not "%2"^) & exit /b %errorlevel%)))
-if /i "%3" EQU "x64" (set plat=x64) else (if /i "%3" EQU "Win32" (set plat=win32) else (call :seterr & echo ERROR: platform is "Win32" or "x64" ^(not "%3"^) & exit /b %errorlevel%))
-if /i "%4" EQU "Debug" (set conf=Debug) else (if /i "%4" EQU "Release" (set conf=Release) else (call :seterr & echo ERROR: configuration is "Release" or "Debug" ^(not "%4"^) & exit /b %errorlevel%))
+if /i "%3" EQU "x64" (set plat=x64) else (
+ if /i "%3" EQU "Win32" (set plat=win32) else (
+ if /i "%3" EQU "ARM64" (set plat=ARM64) else (
+ call :seterr & echo ERROR: platform is "Win32", "x64", or "ARM64" ^(not %3^) & exit /b %errorlevel%
+ )
+ )
+)
+if /i "%4" EQU "Debug" (set conf=Debug) else (if /i "%4" EQU "Release" (set conf=Release) else (call :seterr & echo ERROR: configuration is "Release" or "Debug" ^(not %4^) & exit /b %errorlevel%))
if /i "%5" NEQ "" if "%5" EQU "+tests" (set run_tests=y) else (set win_sdk=%5)
if /i "%6" NEQ "" if "%6" EQU "+tests" (set run_tests=y)
+50 -34
View File
@@ -16,6 +16,15 @@
:: along with this program. If not, see <http://www.gnu.org/licenses/>. ::
:: ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::
:: Example usage:
:: run-cmake.bat vs2022-x64
:: run-cmake.bat vs2022-x64 -DGLTF_SUPPORT=ON -DHDF5_SUPPORT=OFF
::
:: Used environment variables:
:: - `ADD_COMMIT_SHA` - if defined then `ADD_COMMIT_SHA` and `VERSION_OVERRIDE` cmake args will be set to `ON`.
:: - `USE_NINJA` - if defined then the Ninja generator will be used instead of the Visual Studio.
@if not defined ECHO_ON ( echo off )
echo.
@@ -84,8 +93,6 @@ if not defined BOOST_INSTALL_DIR (
set BOOST_INSTALL_DIR=%DEPS_DIR%\boost_1_86_0\stage\%GEN_SHORTHAND%
)
if not defined OCC_INCLUDE_DIR set OCC_INCLUDE_DIR=%INSTALL_DIR%\oce\include\oce
if not defined OCC_LIBRARY_DIR set OCC_LIBRARY_DIR=%INSTALL_DIR%\oce\Win%ARCH_BITS%\lib
set OPENCOLLADA_INSTALL_DIR=%INSTALL_DIR%\OpenCOLLADA
set LIBXML2_INCLUDE_DIR=%DEPS_DIR%\OpenCOLLADA\Externals\LibXML\include
set LIBXML2_LIBRARIES=%INSTALL_DIR%\OpenCOLLADA\lib\opencollada\xml.lib
@@ -102,21 +109,22 @@ set PYTHON_LIBRARY=%PYTHONHOME%\libs\python%PY_VER_MAJOR_MINOR%.lib
:: we can remove it later.
if not defined SWIG_INSTALL_DIR set SWIG_INSTALL_DIR=%INSTALL_DIR%\swigwin
set JSON_INCLUDE_DIR=%INSTALL_DIR%\json
if not defined ADD_COMMIT_SHA set ADD_COMMIT_SHA=Off
if defined ADD_COMMIT_SHA (
set ADD_COMMIT_SHA=ON
set VERSION_OVERRIDE=ON
) else (
set ADD_COMMIT_SHA=OFF
set VERSION_OVERRIDE=OFF
)
set CGAL_INCLUDE_DIR=%INSTALL_DIR%\cgal\include
:: set CGAL_LIBRARY_DIR=%INSTALL_DIR%\cgal\lib
set GMP_INCLUDE_DIR=%INSTALL_DIR%\mpir
set GMP_LIBRARY_DIR=%INSTALL_DIR%\mpir
set MPFR_INCLUDE_DIR=%INSTALL_DIR%\mpfr
set MPFR_LIBRARY_DIR=%INSTALL_DIR%\mpfr
set CGAL_INSTALL_DIR=%INSTALL_DIR%\cgal
set GMP_INSTALL_DIR=%INSTALL_DIR%\mpir
set MPFR_INSTALL_DIR=%INSTALL_DIR%\mpfr
:: We don't install Eigen currently,
:: so there's no Eigen3config.cmake and therefore we provide path explicitly.
set EIGEN_DIR=%INSTALL_DIR%\Eigen
set USD_INCLUDE_DIR=%INSTALL_DIR%\usd\include
set USD_LIBRARY_DIR=%INSTALL_DIR%\usd\lib
set TBB_INCLUDE_DIR=%INSTALL_DIR%\tbb\include
set TBB_LIBRARY_DIR=%INSTALL_DIR%\tbb\lib
set TBB_INSTALL_DIR=%INSTALL_DIR%\tbb
set USD_INSTALL_DIR=%INSTALL_DIR%\usd
set ROCKSDB_INSTALL_DIR=%INSTALL_DIR%\rocksdb
set ZSTD_INSTALL_DIR=%INSTALL_DIR%\zstd
@@ -129,9 +137,10 @@ echo Arguments = %ARGUMENTS%
echo.
call cecho.cmd 0 10 "Dependency Environment Variables for %PROJECT_NAME%:"
echo BOOST_INSTALL_DIR = %BOOST_INSTALL_DIR%
echo BOOST_LIBRARYDIR = %BOOST_LIBRARYDIR%
:: OCC_INCLUDE_DIR / OCC_LIBRARY_DIR are legacy vars, they're not defined by build-deps.cmd anymore.
echo OCC_INCLUDE_DIR = %OCC_INCLUDE_DIR%
echo OCC_LIBRARY_DIR = %OCC_LIBRARY_DIR%
echo OCC_INSTALL_DIR = %OCC_INSTALL_DIR%
echo OPENCOLLADA_INSTALL_DIR = %OPENCOLLADA_INSTALL_DIR%
echo LIBXML2_INCLUDE_DIR = %LIBXML2_INCLUDE_DIR%
echo LIBXML2_LIBRARIES = %LIBXML2_LIBRARIES%
@@ -143,17 +152,13 @@ echo PYTHON_EXECUTABLE = %PYTHON_EXECUTABLE%
echo SWIG_INSTALL_DIR = %SWIG_INSTALL_DIR%
echo JSON_INCLUDE_DIR = %JSON_INCLUDE_DIR%
echo.
echo CGAL_INCLUDE_DIR = %CGAL_INCLUDE_DIR%
echo CGAL_INSTALL_DIR = %CGAL_INSTALL_DIR%
:: echo CGAL_LIBRARY_DIR = %CGAL_LIBRARY_DIR%
echo GMP_INCLUDE_DIR = %GMP_INCLUDE_DIR%
echo GMP_LIBRARY_DIR = %GMP_LIBRARY_DIR%
echo MPFR_INCLUDE_DIR = %MPFR_INCLUDE_DIR%
echo MPFR_LIBRARY_DIR = %MPFR_LIBRARY_DIR%
echo GMP_INSTALL_DIR = %GMP_INSTALL_DIR%
echo MPFR_INSTALL_DIR = %MPFR_INSTALL_DIR%
echo EIGEN_DIR = %EIGEN_DIR%
echo USD_INCLUDE_DIR = %USD_INCLUDE_DIR%
echo USD_LIBRARY_DIR = %USD_LIBRARY_DIR%
echo TBB_INCLUDE_DIR = %TBB_INCLUDE_DIR%
echo TBB_LIBRARY_DIR = %TBB_LIBRARY_DIR%
echo TBB_INSTALL_DIR = %TBB_INSTALL_DIR%
echo USD_INSTALL_DIR = %USD_INSTALL_DIR%
echo ROCKSDB_INSTALL_DIR = %ROCKSDB_INSTALL_DIR%
echo ZSTD_INSTALL_DIR = %ZSTD_INSTALL_DIR%
echo CCACHE_INSTALL_DIR = %CCACHE_INSTALL_DIR%
@@ -169,21 +174,32 @@ echo "Running CMake for %PROJECT_NAME%."
set CMAKE_PREFIX_PATH=%HDF5_INSTALL_DIR%;%OPENCOLLADA_INSTALL_DIR%;%SWIG_INSTALL_DIR%
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%ROCKSDB_INSTALL_DIR%;%ZSTD_INSTALL_DIR%
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%BOOST_INSTALL_DIR%;%CCACHE_INSTALL_DIR%
set CMake_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%USD_INSTALL_DIR%;%TBB_INSTALL_DIR%
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%OCC_INSTALL_DIR%;%CGAL_INSTALL_DIR%
set CMAKE_PREFIX_PATH=%CMAKE_PREFIX_PATH%;%GMP_INSTALL_DIR%;%MPFR_INSTALL_DIR%
:: Not fully supported - not available from install-ifcopenshell
:: and some logs are still showing Visual Studio generators.
:: Needed just for debugging.
if defined USE_NINJA (
set GENERATOR=Ninja
set ARCH_OPTION=
) else (
set GENERATOR=%GENERATOR%
set ARCH_OPTION=-A %VS_PLATFORM%
)
IF NOT "%VS_TOOLSET_HOST%"=="" (
cmake.exe %CMAKELISTS_DIR% -G %GENERATOR% -A %VS_PLATFORM% -T %VS_TOOLSET_HOST% ^
-DCMAKE_INSTALL_PREFIX="%CMAKE_INSTALL_PREFIX%" ^
-DWITH_ROCKSDB=On -DWITH_ZSTD=On ^
-DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%" ^
-DADD_COMMIT_SHA=%ADD_COMMIT_SHA% %ARGUMENTS%
) ELSE (
cmake.exe %CMAKELISTS_DIR% -G %GENERATOR% -A %VS_PLATFORM% ^
-DCMAKE_INSTALL_PREFIX="%CMAKE_INSTALL_PREFIX%" ^
-DWITH_ROCKSDB=On -DWITH_ZSTD=On ^
-DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%" ^
-DADD_COMMIT_SHA=%ADD_COMMIT_SHA% %ARGUMENTS%
set VS_TOOLSET_OPTION=-T %VS_TOOLSET_HOST%
)
cmake.exe %CMAKELISTS_DIR% -G %GENERATOR% %ARCH_OPTION% %VS_TOOLSET_OPTION% ^
-DCMAKE_INSTALL_PREFIX="%CMAKE_INSTALL_PREFIX%" ^
-DWITH_ROCKSDB=On -DWITH_ZSTD=On ^
-DCMAKE_PREFIX_PATH="%CMAKE_PREFIX_PATH%" ^
-DADD_COMMIT_SHA=%ADD_COMMIT_SHA% -DVERSION_OVERRIDE=%VERSION_OVERRIDE% ^
%ARGUMENTS%
IF NOT %ERRORLEVEL%==0 GOTO :Error
echo.
+273
View File
@@ -0,0 +1,273 @@
Set-PSDebug -Trace 0
Set-StrictMode -Version 3
$ErrorActionPreference = "Stop"
$cecho = "$PSScriptRoot\cecho.cmd"
# Create marker file to indicate whether Release or Debug build was installed.
function mark {
param(
[Parameter(Mandatory = $true)]
[string]$installation_dir
)
if (-not (Test-Path -Path $installation_dir)) {
throw "Directory '$installation_dir' does not exist."
}
$marker_filepath = Join-Path -Path $installation_dir -ChildPath $ENV:MARKER_FILE
if (Test-Path -Path $marker_filepath) {
return
}
. $cecho 0 13 "Marking installation in '$installation_dir' with '$ENV:MARKER_FILE'."
New-Item -Path $marker_filepath -ItemType File | Out-Null
}
# This function can be deprecated in the future, since installations are marked automatically.
# It's here only to avoid some disruption during the transition period.
function mark_based_on_artifacts {
param(
[Parameter(Mandatory = $true)]
[string]$dependency_name,
[Parameter(Mandatory = $true)]
[string]$installation_dir
)
if ($dependency_name -eq "hdf5") {
if ($env:BUILD_CFG -eq "Debug") {
$artifact = "lib\libhdf5_D.lib"
}
else {
$artifact = "lib\libhdf5.lib"
}
}
elseif ($dependency_name -eq "opencollada") {
if ($env:BUILD_CFG -eq "Debug") {
$artifact = "lib\opencollada\OpenCOLLADAFrameworkd.lib"
}
else {
$artifact = "lib\opencollada\OpenCOLLADAFramework.lib"
}
}
elseif ($dependency_name -eq "OpenCASCADE") {
# New OCCT folder layout was introduced after marker files were added,
# so installation don't need artifact-based detection.
return
}
elseif ($dependency_name -eq "rocksdb") {
if ($env:BUILD_CFG -eq "Debug") {
$artifact = "lib\rocksdb_d.lib"
}
else {
$artifact = "lib\rocksdb.lib"
}
}
else {
throw "Unexpected dependency name '$dependency_name'."
}
$artifact_filepath = Join-Path -Path $installation_dir -ChildPath $artifact
if (-not (Test-Path -Path $artifact_filepath)) {
return
}
if (-not (Test-Path -Path $installation_dir)) {
throw "Directory '$installation_dir' does not exist."
}
$marker_filepath = Join-Path -Path $installation_dir -ChildPath $ENV:MARKER_FILE
if (Test-Path -Path $marker_filepath) {
return
}
. $cecho 0 13 "Found artifact '$artifact' for dependency '$dependency_name' $env:BUILD_CFG."
& mark $installation_dir
}
# Check if installation exists for the current `BUILD_CFG`.
# Returns exit code 200 if installation exists, 404 otherwise.
# Since we want Release and Debug installation to coexist,
# we add special marker file to indicate which build type was installed.
function check_installation {
param(
[Parameter(Mandatory = $true)]
[string]$dependency_name,
[Parameter(Mandatory = $true)]
[string]$installation_dir
)
if (-not (Test-Path -Path $installation_dir)) {
exit 404
}
& mark_based_on_artifacts $dependency_name $installation_dir
$marker_filepath = Join-Path -Path $installation_dir -ChildPath $ENV:MARKER_FILE
if (-not (Test-Path -Path $marker_filepath)) {
exit 404
}
exit 200
}
# Dependencies Release/Debug configs compatibility:
# - hdf5: incompatible
# - OpenCASCADE: incompatible
# - rocksdb: incompatible
# - opencollada: incompatible
# - zstd: compatible
function setup_build_cfg {
if (-not $env:BUILD_CFG) {
throw "Variable 'BUILD_CFG' is not defined."
}
if ($env:BUILD_CFG -eq "Debug") {
$ENV:MARKER_FILE = ".debug_installation"
}
else {
$ENV:MARKER_FILE = ".release_installation"
}
}
function extract_file {
param(
[Parameter(Mandatory = $true)]
[string]$dependency_name,
[Parameter(Mandatory = $true)]
[string]$filename,
[Parameter(Mandatory = $true)]
[string]$destination_dir,
[Parameter(Mandatory = $true)]
[string]$dir_after_extraction
)
if (Test-Path -Path "$dir_after_extraction") {
. $cecho 0 13 "$dependency_name already extracted into '$dir_after_extraction'. Skipping."
return
}
. $cecho 0 13 "Extracting $dependency_name into '$destination_dir' from '$filename'."
7za x "$filename" -o"$destination_dir"
}
function download_file {
param(
[Parameter(Mandatory = $true)]
[string]$dependency_name,
[Parameter(Mandatory = $true)]
[string]$url,
[Parameter(Mandatory = $true)]
[string]$destination_dir,
[Parameter(Mandatory = $true)]
[string]$filename
)
mkdir "$destination_dir" -Force | Out-Null
pushd "$destination_dir"
if (Test-Path -Path "$filename") {
. $cecho 0 13 "$dependency_name already downloaded. Skipping."
return
}
. $cecho 0 13 "Downloading $dependency_name into '$destination_dir'"
Invoke-WebRequest $url -OutFile $filename
}
# Required env variables:
# - DEPS_DIR
function git_clone_and_checkout_revision {
param(
[Parameter(Mandatory = $true)]
[string]$dependency_name,
[Parameter(Mandatory = $true)]
[string]$git_url,
[Parameter(Mandatory = $true)]
[string]$dest_dir,
[Parameter(Mandatory = $false)]
[string]$revision
)
if (Test-Path -Path "$dest_dir") {
. $cecho 0 13 "Cloning $dependency_name is already cloned."
return
}
. $cecho 0 13 "Cloning $dependency_name into '$dest_dir'."
pushd "$env:DEPS_DIR"
git clone $git_url $dest_dir
popd
pushd "$dest_dir"
git fetch
. $cecho 0 13 "Checking out $dependency_name revision $revision."
git reset --hard
git checkout $revision
popd
}
function install_cmake_project {
param(
[Parameter(Mandatory = $true)]
[string]$dependency_name,
[Parameter(Mandatory = $true)]
[string]$build_dir,
[Parameter(Mandatory = $true)]
[string]$configuration
)
pushd "$build_dir"
. $cecho 0 13 "Installing $dependency_name ($configuration). Please be patient, this may take a while."
$command = "cmake --install . --config $configuration"
. $cecho 0 13 "$command"
Invoke-Expression $command
popd
}
function check_boost_vc145_compatibility {
param(
[Parameter(Mandatory = $true)]
[string]$VC_VER,
[Parameter(Mandatory = $true)]
[string]$DEPS_DIR,
[Parameter(Mandatory = $true)]
[string]$BOOST_ROOT
)
$boost_build_path = "$BOOST_ROOT/tools/build"
if ($VC_VER -ne "14.5") {
. $cecho 0 13 "VC_VER is not 14.5, no need to install updated b2."
return
}
$res = Select-String -Path "$boost_build_path/src/engine/build.bat" -Pattern 'vc143, vc145' -Quiet;
if ($res) {
. $cecho 0 13 "vc145 already supported, no need to install updated b2."
return
}
$b2_version = "5.4.2"
$b2_stem = "b2-$b2_version"
$b2_path = "$DEPS_DIR\$b2_stem"
$b2_filename = "$b2_stem.zip"
& download_file "b2" "https://github.com/bfgroup/b2/releases/download/$b2_version/$b2_filename" "$DEPS_DIR" "$b2_filename"
& extract_file "b2" "$b2_filename" "$DEPS_DIR" "$b2_path"
. $cecho 0 13 "Installing b2 with vc145 support..."
Remove-Item -Recurse -Path "$boost_build_path"
Copy-Item -Path "$b2_path" -Destination "$boost_build_path" -Recurse
. $cecho 0 13 "b2 with vc145 support installed."
}
function main {
& setup_build_cfg
# Dispatch command.
$command = $Args[0]
if ($args.Count -gt 1) {
$command_args = $Args[1..($args.Count - 1)]
}
else {
$command_args = @()
}
& $command @command_args
}
& main @Args
exit 0
+11 -1
View File
@@ -35,6 +35,11 @@
:: "vs2019-x86-v141_xp" => cmake -G "Visual Studio 16 2019" -A Win32 -T v141_xp
::
:: NOTE: The delayed environment variable expansion needs to be enabled before calling this.
::
:: Output variables:
:: - VC_VER - e.g. "14.5"
:: - VS_VER - e.g. "2026"
:: - BOOST_BOOTSTRAP_VER - e.g. "vc145"
@if not defined ECHO_ON ( echo off )
@@ -46,7 +51,8 @@ set GENERATORS[2]="Visual Studio 14 2015"
set GENERATORS[3]="Visual Studio 15 2017"
set GENERATORS[4]="Visual Studio 16 2019"
set GENERATORS[5]="Visual Studio 17 2022"
set LAST_GENERATOR_IDX=5
set GENERATORS[6]="Visual Studio 18 2026"
set LAST_GENERATOR_IDX=6
:: Is generator shorthand used?
set GEN_SHORTHAND=!GENERATOR:vs=!
@@ -104,6 +110,9 @@ IF "!GENERATOR!"=="" IF NOT "%VisualStudioVersion%"=="" (
GOTO :GeneratorValid
)
)
call utils\cecho.cmd 0 12 ^
"Generator is not provided and VisualStudioVersion='%VisualStudioVersion%' is not supported - cannot proceed."
exit /b 1
)
:: Check that the used CMake version supports the chosen generator
@@ -157,6 +166,7 @@ IF %VS_VER%==2015 ( set "VC_VER=14.0" )
IF %VS_VER%==2017 ( set "VC_VER=14.1" )
IF %VS_VER%==2019 ( set "VC_VER=14.2" )
IF %VS_VER%==2022 ( set "VC_VER=14.3" )
IF %VS_VER%==2026 ( set "VC_VER=14.5" )
:: determine the argument for Boost bootstrap
set BOOST_BOOTSTRAP_VER=vc%VC_VER%