Merge branch 'v0.8.0' into ifcmax/initial-refresh

This commit is contained in:
Josef Wienerroither
2026-02-27 12:13:08 +01:00
334 changed files with 1174 additions and 1611 deletions
+22 -5
View File
@@ -6,6 +6,7 @@ but also archives them to '~/outputs'.
import os
import subprocess
import zipfile
from pathlib import Path
from zipfile import ZipFile
@@ -27,7 +28,23 @@ ZIP_TEMPLATE = f"{{package_name}}-v{VERSION}-{SHA}-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:
@@ -40,16 +57,16 @@ def build() -> None:
text=True,
input="y\n",
)
OLD_ADD_COMMIT_SHA = set_env("ADD_COMMIT_SHA", "ON")
run(
[
str(REPO_WIN / "run-cmake.bat"),
"vs2022-x64",
"-DENABLE_BUILD_OPTIMIZATIONS=ON",
"-DGLTF_SUPPORT=ON",
"-DADD_COMMIT_SHA=ON",
"-DVERSION_OVERRIDE=ON",
]
)
restore_env(*OLD_ADD_COMMIT_SHA)
run([str(REPO_WIN / "install-ifcopenshell.bat"), "vs2022-x64", "Release"])
@@ -61,7 +78,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 +93,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)
+38 -11
View File
@@ -249,8 +249,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
)
@@ -269,13 +270,13 @@ 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 ^
@@ -297,8 +298,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
@@ -412,6 +414,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%"
@@ -462,8 +469,10 @@ 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.
:: 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=""
-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 :BuildCMakeProject "%DEPENDENCY_DIR%\%BUILD_DIR%" %DEBUG_OR_RELEASE%
@@ -509,9 +518,18 @@ cd "%DEPENDENCY_DIR%"
:: 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 -DUSE_FREETYPE=OFF ^
-DBUILD_USE_PCH=ON
-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
@@ -572,7 +590,7 @@ IF NOT %ERRORLEVEL%==0 GOTO :Error
:SWIG
set DEPENDENCY_NAME=SWIG
set SWIG_VERSION=4.1.0
set SWIG_VERSION=4.2.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%"
@@ -917,6 +935,15 @@ exit /b 0
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
call "%~dp0\utils\cecho.cmd" 0 10 "Requirements for a successful execution:"
+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()
+19 -12
View File
@@ -20,6 +20,10 @@
:: 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 )
@@ -105,7 +109,13 @@ 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_INSTALL_DIR=%INSTALL_DIR%\cgal
set GMP_INSTALL_DIR=%INSTALL_DIR%\mpir
@@ -180,19 +190,16 @@ if defined USE_NINJA (
)
IF NOT "%VS_TOOLSET_HOST%"=="" (
cmake.exe %CMAKELISTS_DIR% -G %GENERATOR% %ARCH_OPTION% -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% %ARCH_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% %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.
+59 -19
View File
@@ -2,6 +2,8 @@ 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 {
@@ -18,7 +20,7 @@ function mark {
if (Test-Path -Path $marker_filepath) {
return
}
cecho.cmd 0 13 "Marking installation in '$installation_dir' with '$ENV:MARKER_FILE'."
. $cecho 0 13 "Marking installation in '$installation_dir' with '$ENV:MARKER_FILE'."
New-Item -Path $marker_filepath -ItemType File | Out-Null
}
@@ -76,7 +78,7 @@ function mark_based_on_artifacts {
if (Test-Path -Path $marker_filepath) {
return
}
cecho.cmd 0 13 "Found artifact '$artifact' for dependency '$dependency_name' $env:BUILD_CFG."
. $cecho 0 13 "Found artifact '$artifact' for dependency '$dependency_name' $env:BUILD_CFG."
& mark $installation_dir
}
@@ -138,12 +140,11 @@ function extract_file {
[string]$dir_after_extraction
)
if (Test-Path -Path "$dir_after_extraction") {
cecho.cmd 0 13 "$dependency_name already extracted into '$dir_after_extraction'. Skipping."
exit 0
. $cecho 0 13 "$dependency_name already extracted into '$dir_after_extraction'. Skipping."
return
}
cecho.cmd 0 13 "Extracting $dependency_name into '$destination_dir' from '$filename'."
. $cecho 0 13 "Extracting $dependency_name into '$destination_dir' from '$filename'."
7za x "$filename" -o"$destination_dir"
exit 0
}
@@ -161,13 +162,12 @@ function download_file {
mkdir "$destination_dir" -Force | Out-Null
pushd "$destination_dir"
if (Test-Path -Path "$filename") {
cecho.cmd 0 13 "$dependency_name already downloaded. Skipping."
exit 0
. $cecho 0 13 "$dependency_name already downloaded. Skipping."
return
}
cecho.cmd 0 13 "Downloading $dependency_name into '$destination_dir'"
. $cecho 0 13 "Downloading $dependency_name into '$destination_dir'"
Invoke-WebRequest $url -OutFile $filename
exit 0
}
@@ -185,21 +185,20 @@ function git_clone_and_checkout_revision {
[string]$revision
)
if (Test-Path -Path "$dest_dir") {
cecho.cmd 0 13 "Cloning $dependency_name is already cloned."
exit 0
. $cecho 0 13 "Cloning $dependency_name is already cloned."
return
}
cecho.cmd 0 13 "Cloning $dependency_name into '$dest_dir'."
. $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.cmd 0 13 "Checking out $dependency_name revision $revision."
. $cecho 0 13 "Checking out $dependency_name revision $revision."
git reset --hard
git checkout $revision
popd
exit 0
}
function install_cmake_project {
@@ -212,20 +211,61 @@ function install_cmake_project {
[string]$configuration
)
pushd "$build_dir"
cecho.cmd 0 13 "Installing $dependency_name ($configuration). Please be patient, this may take a while."
. $cecho 0 13 "Installing $dependency_name ($configuration). Please be patient, this may take a while."
$command = "cmake --install . --config $configuration"
cecho.cmd 0 13 "$command"
. $cecho 0 13 "$command"
Invoke-Expression $command
popd
exit 0
}
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]
$command_args = $Args[1..($args.Count - 1)]
if ($args.Count -gt 1) {
$command_args = $Args[1..($args.Count - 1)]
}
else {
$command_args = @()
}
& $command @command_args
}
+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%