mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-06 07:51:47 +00:00
Compare commits
275 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d8da01c877 | |||
| 15bbdc8085 | |||
| c2b72440a2 | |||
| 8205408a66 | |||
| b78db3cae0 | |||
| 81fdf63bd0 | |||
| 454ed2c5a1 | |||
| df6592c7b9 | |||
| e4ba633d94 | |||
| 6f400c8e44 | |||
| 128fe66837 | |||
| 9c8c40c0ff | |||
| ca8eb9b358 | |||
| b6cfd165c2 | |||
| aa8c146f9d | |||
| d2adfc8c5d | |||
| 5ea66730d4 | |||
| 0c3153ab7f | |||
| a460e29473 | |||
| e9eca5e3f2 | |||
| c848462905 | |||
| 321878e1bb | |||
| 831c3190cc | |||
| a17b0604e1 | |||
| db623f4e73 | |||
| cb08191083 | |||
| 4874f7770b | |||
| 56861b9403 | |||
| c20ed44a0f | |||
| 9bac66a01b | |||
| 93de429e03 | |||
| 99b162f712 | |||
| 22dddea0e0 | |||
| f83fd665da | |||
| c0f240379c | |||
| 1fd8878796 | |||
| 315b8b7112 | |||
| d69b4927a2 | |||
| 7fcdec0a4c | |||
| bc6209ad91 | |||
| 19534e225f | |||
| 96fe9b5398 | |||
| 05f7ffcbcc | |||
| 9f8a4d25b5 | |||
| 7fdf815d3c | |||
| 35e2be955b | |||
| 8d3c610965 | |||
| 633c3bc7eb | |||
| 8e639b00e3 | |||
| c6220b79b6 | |||
| 5d8d6a0a4c | |||
| f3669db8e7 | |||
| 1a7947aa75 | |||
| 2403428d12 | |||
| 48bb541f2f | |||
| cc559212a3 | |||
| a3fda66dec | |||
| 3a697e3062 | |||
| d41985f23a | |||
| b686c19a25 | |||
| b0450597d0 | |||
| 2cac0bdca6 | |||
| fb3e35c964 | |||
| 276a488c7e | |||
| 9a1b0ce44c | |||
| 45de750790 | |||
| b1b67de420 | |||
| 13be6ccd45 | |||
| 29176330e8 | |||
| b784cb06ae | |||
| 5d42ded154 | |||
| 4db9d60a97 | |||
| 85aeb6e1cc | |||
| eba4405310 | |||
| 22c972d88a | |||
| abb19e0870 | |||
| cc63e79186 | |||
| a40e211f25 | |||
| d8b8fb628b | |||
| fda3bd319f | |||
| 2c3281917a | |||
| f2eb777b3b | |||
| 2264fbeb44 | |||
| 53115e0654 | |||
| 5dab742623 | |||
| 70cc77df90 | |||
| 633474b4f6 | |||
| 08d9e31a3a | |||
| e4e1364eaa | |||
| 76b6f6b16b | |||
| 888ab85548 | |||
| 34cf69e3fb | |||
| 89973a7a76 | |||
| ba3c96485a | |||
| 3d18aca2f2 | |||
| 71538455b4 | |||
| 7a90388f54 | |||
| 403d761e14 | |||
| 7852102b33 | |||
| 9aea302d92 | |||
| 1fd3e2791f | |||
| 4a71ea1fd6 | |||
| d0dbdbc205 | |||
| c8306d44b9 | |||
| 0c428c54ad | |||
| 50fa245a56 | |||
| 6ba738fcaa | |||
| 2ed991ebce | |||
| 30dbf48f6d | |||
| ba142d3b16 | |||
| 2581c36a5f | |||
| 4d52480cbe | |||
| f8144cdbad | |||
| 59c9b16276 | |||
| affaa859ef | |||
| 738a068474 | |||
| bc5e4d7935 | |||
| 3ebb046619 | |||
| 3f7eba2467 | |||
| 1477d650a4 | |||
| 8912cca652 | |||
| 9d14369656 | |||
| d6e9d7d339 | |||
| 965a303b4b | |||
| bf75509fdf | |||
| ce35903459 | |||
| 21c4382b71 | |||
| 33ba7c45b9 | |||
| 76f4f4e212 | |||
| fdf741b209 | |||
| 5a108b1c0e | |||
| 6135d07b67 | |||
| cf5ffad9af | |||
| b42581b223 | |||
| bf2c27528c | |||
| deb6243ce5 | |||
| 621cc4f039 | |||
| cd87217f4e | |||
| 87e4846f71 | |||
| 4138d9f464 | |||
| c7b75d2863 | |||
| 57197dd439 | |||
| 46dc6cf08b | |||
| 4a2058ebc6 | |||
| 5294fa1cbe | |||
| a98cad161e | |||
| f222a8ba4f | |||
| f902c7a50a | |||
| b1c4822315 | |||
| 93579b8f66 | |||
| 169ca806c0 | |||
| a4e76ed6ee | |||
| 146301b0c0 | |||
| 487a2014f5 | |||
| cb89fbfd86 | |||
| 6ab7acfa57 | |||
| a2a5780d59 | |||
| 276c9c9833 | |||
| 31740784de | |||
| dd683d1115 | |||
| b237fac4b8 | |||
| 20812ecd80 | |||
| 1d7d0f6d05 | |||
| d5210e0d75 | |||
| d303acd660 | |||
| 8f44f60546 | |||
| 01f97a5860 | |||
| 4d34e4296c | |||
| 43533706a4 | |||
| 61269136cd | |||
| 5a0f8d30cf | |||
| 99835fcab3 | |||
| 92964fb5ef | |||
| 159538e2bb | |||
| a62a4bb158 | |||
| 084992ddcc | |||
| 39dd08c84e | |||
| 37f3199749 | |||
| 2627052b55 | |||
| f5b1d7695a | |||
| d876c001e2 | |||
| 20d6547e54 | |||
| 71a36147a6 | |||
| f708594853 | |||
| 01b2124102 | |||
| 592ac168c5 | |||
| 4b56cc7916 | |||
| d91d7257c8 | |||
| dbe23ca809 | |||
| 9880ee79b2 | |||
| 6591a69816 | |||
| c475a377b7 | |||
| ce7fdcc191 | |||
| e503dad510 | |||
| 517ba237f9 | |||
| 994a364474 | |||
| 9d828852c0 | |||
| 7a62f65af0 | |||
| d566ba6e1f | |||
| c32a6dc0ca | |||
| 3971408a07 | |||
| 13ed0c3096 | |||
| 02233f86cf | |||
| 75881aab24 | |||
| c4da1dda4d | |||
| 9f6e92eefd | |||
| db2234acef | |||
| b4135194ca | |||
| d174ecf760 | |||
| 2213c3773d | |||
| 1ad1883f0e | |||
| c2a03eb658 | |||
| 225039aa96 | |||
| 3cc8477a01 | |||
| 40cffe2dd1 | |||
| 0d651e377a | |||
| 8ea4b9e38c | |||
| 0555523c98 | |||
| db09744428 | |||
| 91f19f7a54 | |||
| 6a0caa7989 | |||
| 9820adb337 | |||
| a588d15438 | |||
| bf308995fb | |||
| 172d840a77 | |||
| 16336766da | |||
| 549b2e6ff8 | |||
| 30e750d770 | |||
| f50bbe83a3 | |||
| 4fc2f623cf | |||
| 1468bf3c97 | |||
| c7df59e961 | |||
| 6cbd3ed014 | |||
| a5d0187343 | |||
| 67421c533c | |||
| 2e5d87b5d7 | |||
| 9807c2bedf | |||
| 52baba0fe0 | |||
| e304154037 | |||
| dfb8298ecf | |||
| 0ee084b5d9 | |||
| c769c9e67c | |||
| 349cbf27b9 | |||
| f083425656 | |||
| ad812bda47 | |||
| 5b7888984e | |||
| e3d254d3e5 | |||
| 3b83f978ab | |||
| 5b1e599b5f | |||
| ad4fc76546 | |||
| b7a9199253 | |||
| 986cb905b2 | |||
| 30184a3f6d | |||
| 8f7cf76d98 | |||
| 083fab5255 | |||
| 0724fac698 | |||
| 9775dfc2c1 | |||
| 658713f142 | |||
| 81bf187ee6 | |||
| 8f3e67b747 | |||
| bd57cc8735 | |||
| 1e212f7b23 | |||
| 121acfe6b3 | |||
| d2dfeb79a3 | |||
| 43b12d55d4 | |||
| 834634aedb | |||
| 069873053a | |||
| ec51c67373 | |||
| d8263349cd | |||
| 2be142eff2 | |||
| 19b9a55404 | |||
| ffc538da87 | |||
| c3c63370ba | |||
| a4743b5e04 | |||
| 1cdd44996b |
+11
@@ -0,0 +1,11 @@
|
||||
# yaml-language-server: $schema=https://raw.githubusercontent.com/BlankSpruce/gersemi/0.24.0/gersemi/configuration.schema.json
|
||||
|
||||
# Needed for gersemi to detect custom functions and macros.
|
||||
definitions: ["./cmake"]
|
||||
disable_formatting: false
|
||||
extensions: []
|
||||
indent: 4
|
||||
line_length: 120
|
||||
list_expansion: favour-inlining
|
||||
unsafe: false
|
||||
warn_about_unknown_commands: true
|
||||
@@ -6,3 +6,7 @@ updates:
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
- package-ecosystem: "pip"
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: "weekly"
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from typing import TypedDict
|
||||
|
||||
import github_action_utils as gha_utils
|
||||
|
||||
|
||||
class Entry(TypedDict):
|
||||
location: Location
|
||||
|
||||
|
||||
class Location(TypedDict):
|
||||
path: str
|
||||
lines: Lines
|
||||
|
||||
|
||||
class Lines(TypedDict):
|
||||
begin: int
|
||||
end: int
|
||||
|
||||
|
||||
json_data: list[Entry] = json.load(sys.stdin)
|
||||
|
||||
if os.getenv("RUNNER_DEBUG"):
|
||||
print("Debug: Black formatting JSON data:")
|
||||
print(json.dumps(json_data, indent=2))
|
||||
|
||||
for change in json_data:
|
||||
location = change["location"]
|
||||
path = location["path"]
|
||||
lines = location["lines"]
|
||||
gha_utils.error(
|
||||
f"Black formatting issue in {path}",
|
||||
title="Black Format Issue",
|
||||
file=path,
|
||||
line=lines["begin"],
|
||||
end_line=lines["end"],
|
||||
)
|
||||
@@ -21,12 +21,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout Build Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/build-outputs
|
||||
path: ./build
|
||||
@@ -81,7 +81,7 @@ jobs:
|
||||
|
||||
- name: Upload Build Logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: build-logs-osx-${{ matrix.arch }}
|
||||
path: |
|
||||
|
||||
@@ -9,13 +9,13 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
path: IfcOpenShell
|
||||
|
||||
- name: Checkout Build Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/build-outputs
|
||||
path: ifcopenshell_build
|
||||
@@ -42,7 +42,7 @@ jobs:
|
||||
|
||||
- name: Upload Build Logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: build-logs-pyodide
|
||||
path: |
|
||||
|
||||
@@ -29,12 +29,12 @@ jobs:
|
||||
aws --version
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout Build Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/build-outputs
|
||||
path: ./build
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
|
||||
- name: Upload Build Logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: build-logs-rocky
|
||||
path: |
|
||||
|
||||
@@ -29,12 +29,12 @@ jobs:
|
||||
aws --version
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout Build Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/build-outputs
|
||||
path: ./build
|
||||
@@ -61,7 +61,7 @@ jobs:
|
||||
|
||||
- name: Upload Build Logs
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: build-logs-rocky-arm64
|
||||
path: |
|
||||
|
||||
@@ -12,12 +12,12 @@ jobs:
|
||||
arch: ['x64']
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Checkout Build Repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/build-outputs
|
||||
path: _deps-vs2022-x64-installed
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import os
|
||||
import pathlib
|
||||
import shutil
|
||||
import zipfile
|
||||
|
||||
import requests
|
||||
import zipfile
|
||||
import os
|
||||
|
||||
# To test this locally, set these environment variables
|
||||
REPO_OWNER = os.environ.get("REPO_OWNER", "IfcOpenShell/IfcOpenShell")
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5 # https://github.com/actions/checkout
|
||||
- uses: actions/checkout@v6 # https://github.com/actions/checkout
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -9,12 +9,12 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Action - checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Action - install python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: "3.9"
|
||||
python-version: "3.10"
|
||||
|
||||
- name: Action - install python
|
||||
uses: actions/setup-python@v6
|
||||
@@ -33,23 +33,58 @@ jobs:
|
||||
id: syntax-errors
|
||||
run: |
|
||||
ERROR=0
|
||||
python3.9 -W error -m compileall -q src/ifcopenshell-python || ERROR=1
|
||||
python3.10 -W error -m compileall -q src/ifcopenshell-python || ERROR=1
|
||||
python3.11 -W error -m compileall -q src/bonsai || ERROR=1
|
||||
exit $ERROR
|
||||
continue-on-error: true
|
||||
|
||||
- name: Black formatter
|
||||
id: black
|
||||
uses: psf/black@stable
|
||||
continue-on-error: true
|
||||
|
||||
# Same check as above, but just for creating github annotations.
|
||||
- name: Black formatter annotations
|
||||
id: black-annotations
|
||||
run: |
|
||||
black --diff --check .
|
||||
uv tool install black-codeclimate
|
||||
pip install github_action_utils
|
||||
black --diff --check . | black-codeclimate | python .github/workflows/black_to_github_annotations.py
|
||||
continue-on-error: true
|
||||
|
||||
- name: Ruff check
|
||||
id: ruff
|
||||
run: |
|
||||
# Ensure execution continues, since we need to cache the output.
|
||||
set +e
|
||||
|
||||
ERROR=0
|
||||
poe ruff-main || ERROR=1
|
||||
poe ruff-old || ERROR=1
|
||||
# Keep colored output inside action logs, strip it from color codes for summary.
|
||||
uv tool install ansi2txt
|
||||
# `ruff` disables color output in CI by default.
|
||||
export FORCE_COLOR="1"
|
||||
|
||||
run_check() {
|
||||
local out
|
||||
out="$("$@" 2>&1)"
|
||||
local exit_code=$?
|
||||
|
||||
if [ "$exit_code" -ne 0 ]; then
|
||||
ERROR=1
|
||||
fi
|
||||
|
||||
# Rerun just for GitHub annotations.
|
||||
"$@" --output-format=github || true
|
||||
|
||||
echo "$out"
|
||||
echo "\`\`\`python" >> $GITHUB_STEP_SUMMARY
|
||||
echo "$out" | ansi2txt >> $GITHUB_STEP_SUMMARY
|
||||
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
|
||||
}
|
||||
|
||||
run_check poe ruff-main
|
||||
run_check poe ruff-old
|
||||
|
||||
exit $ERROR
|
||||
continue-on-error: true
|
||||
|
||||
@@ -60,9 +95,9 @@ jobs:
|
||||
echo "::error::Syntax errors check failed, see 'syntax-errors' step for the details." && ERROR=1
|
||||
fi
|
||||
if [ "${{ steps.black.outcome }}" != "success" ]; then
|
||||
echo "::error::Black formatting check failed, see 'black' step for the details." && ERROR=1
|
||||
echo "::error::Black formatting check failed, see Summary or 'black' step for the details." && ERROR=1
|
||||
fi
|
||||
if [ "${{ steps.ruff.outcome }}" != "success" ]; then
|
||||
echo "::error::Ruff check failed, see 'ruff' step for the details." && ERROR=1
|
||||
echo "::error::Ruff check failed, see Summary or 'ruff' step for the details." && ERROR=1
|
||||
fi
|
||||
exit $ERROR
|
||||
|
||||
@@ -34,7 +34,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
fetch-tags: true
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -54,7 +54,7 @@ jobs:
|
||||
short_name: macosm1,
|
||||
}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
@@ -93,7 +93,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout bonsai_unstable_repo repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/bonsai_unstable_repo
|
||||
token: ${{ secrets.IFCOPENBOT_TOKEN }}
|
||||
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
short_name: macosm1,
|
||||
}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -37,7 +37,7 @@ jobs:
|
||||
short_name: macosm164
|
||||
}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
date: ${{ steps.date.outputs.date }}
|
||||
verdate: ${{ steps.verdate.outputs.verdate }}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- name: Set env
|
||||
run: echo ok go
|
||||
|
||||
@@ -54,8 +54,7 @@ jobs:
|
||||
platform: [
|
||||
{ name: win, distver: windows-latest, pkg_dir: 'win-64' },
|
||||
{ name: linux, distver: ubuntu-latest, pkg_dir: 'linux-64' },
|
||||
{ name: macOS-arm, distver: macos-latest, pkg_dir: 'osx-arm64' },
|
||||
{ name: macOS-x86, distver: macos-13, pkg_dir: 'osx-64' }
|
||||
{ name: macOS-arm, distver: macos-latest, pkg_dir: 'osx-arm64' }
|
||||
]
|
||||
steps:
|
||||
- name: Set Swap Space
|
||||
@@ -76,7 +75,7 @@ jobs:
|
||||
echo "ARTIFACTS_DIR=/home/runner/work/artifacts" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: activate
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -42,9 +42,6 @@ jobs:
|
||||
run: |
|
||||
mkdir build && cd build
|
||||
cmake \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DCMAKE_INSTALL_PREFIX=$PWD/install/ \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=/usr \
|
||||
@@ -76,7 +73,7 @@ jobs:
|
||||
make package
|
||||
working-directory: build
|
||||
- name: Upload
|
||||
uses: actions/upload-artifact@v5
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
# Artifact name
|
||||
name: ifcos-artifacts
|
||||
@@ -89,12 +86,12 @@ jobs:
|
||||
name: Docker Build, Tag, Push
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
- name: Download
|
||||
uses: actions/download-artifact@v6.0.0
|
||||
uses: actions/download-artifact@v7.0.0
|
||||
with:
|
||||
# Artifact name
|
||||
name: ifcos-artifacts
|
||||
|
||||
@@ -47,7 +47,7 @@ jobs:
|
||||
short_name: macosm164
|
||||
}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
short_name: macosm164
|
||||
}
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
|
||||
@@ -19,7 +19,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified
|
||||
|
||||
@@ -10,9 +10,9 @@ jobs:
|
||||
publish_website:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- name: Checkout ifctester_org_static_html
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
repository: IfcOpenShell/ifctester_org_static_html
|
||||
token: ${{ secrets.IFCOPENBOT_TOKEN }}
|
||||
|
||||
@@ -18,7 +18,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
- uses: actions/setup-python@v6 # https://github.com/actions/setup-python
|
||||
with:
|
||||
python-version: '3.11' # Version range or exact version of a Python version to use, using SemVer's version range syntax
|
||||
|
||||
@@ -34,8 +34,12 @@ jobs:
|
||||
compile-and-test:
|
||||
runs-on: ubuntu-22.04
|
||||
needs: activate
|
||||
env:
|
||||
# Colored output for cmake.
|
||||
CLICOLOR_FORCE: "1"
|
||||
CMAKE_COLOR_DIAGNOSTICS: "ON"
|
||||
steps:
|
||||
- uses: actions/checkout@v5
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
@@ -55,6 +59,11 @@ jobs:
|
||||
- name: Install C++ dependencies
|
||||
run: |
|
||||
sudo apt update
|
||||
# `occt-misc` is only needed for 22.04, since it has cmake configs.
|
||||
# In 24.04+, the needed files were moved `libocct-foundation-dev` and `occt-misc` can be removed.
|
||||
# Other libs in `OCCT_CMAKE_DEPS` are needed only for cmake config to work properly, they're not used directly.
|
||||
OCCT_CMAKE_DEPS="occt-misc libocct-draw-dev tcl-dev tk-dev libxi-dev"
|
||||
|
||||
sudo apt-get install --no-install-recommends \
|
||||
git cmake gcc g++ \
|
||||
libboost-date-time-dev \
|
||||
@@ -67,6 +76,7 @@ jobs:
|
||||
libpcre3-dev libxml2-dev \
|
||||
libtbb-dev nlohmann-json3-dev \
|
||||
libocct-foundation-dev libocct-modeling-algorithms-dev libocct-modeling-data-dev libocct-ocaf-dev libocct-visualization-dev libocct-data-exchange-dev \
|
||||
${OCCT_CMAKE_DEPS} \
|
||||
libhdf5-dev libcgal-dev libeigen3-dev
|
||||
|
||||
- name: ccache
|
||||
@@ -118,6 +128,31 @@ jobs:
|
||||
-DCMAKE_CXX_FLAGS_INIT="-fPIC"
|
||||
sudo make -j$(nproc) install
|
||||
|
||||
# We need zstd and libxml2 just for cmake config files to test the examples build.
|
||||
# zslibzstd-dev has cmake config only on Ubuntu 24.04+.
|
||||
- name : Build zstd
|
||||
run: |
|
||||
git clone https://github.com/facebook/zstd --depth 1 --branch v1.5.7
|
||||
cd zstd
|
||||
# `build` already exists.
|
||||
mkdir build_ && cd build_
|
||||
cmake ../build/cmake -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
sudo cmake --build . --target install -j $(nproc)
|
||||
|
||||
# libxml2-dev doesn't have cmake configs even on Ubuntu 24.04+.
|
||||
- name: Build libxml2
|
||||
run: |
|
||||
git clone https://gitlab.gnome.org/GNOME/libxml2.git --branch v2.13.8 --depth 1
|
||||
cd libxml2
|
||||
mkdir build && cd build
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
sudo cmake --build . --target install -j $(nproc)
|
||||
|
||||
# Ubuntu has `swig` package, but we build it to match the version we use in the main build.
|
||||
# To avoid failing tests when checking stub generation.
|
||||
- name: build swig
|
||||
@@ -125,9 +160,8 @@ jobs:
|
||||
# Remove default swig to avoid conflicts.
|
||||
sudo apt remove --purge swig swig4.0
|
||||
sudo apt-get install -y libpcre2-dev bison
|
||||
git clone https://github.com/swig/swig
|
||||
git clone https://github.com/swig/swig --branch v4.1.0 --depth 1
|
||||
cd swig
|
||||
git checkout v4.1.0
|
||||
mkdir build && cd build
|
||||
cmake .. \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
@@ -141,15 +175,10 @@ jobs:
|
||||
echo ${{ env.pythonLocation }}
|
||||
|
||||
mkdir build && cd build
|
||||
# Ubuntu 22.04's libocct-foundation-dev package doesn't have Config.cmake, so we provide OCC paths directly.
|
||||
# In later versions of Ubuntu, this can be simplified and the OCC paths can be removed.
|
||||
cmake \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=/usr \
|
||||
-DCMAKE_SYSTEM_PREFIX_PATH=/usr \
|
||||
-DOCC_INCLUDE_DIR=/usr/include/opencascade \
|
||||
-DOCC_LIBRARY_DIR=/usr/lib/x86_64-linux-gnu \
|
||||
-DPYTHON_EXECUTABLE:FILEPATH=${{ env.pythonLocation }}/bin/python \
|
||||
-DPYTHON_INCLUDE_DIR:PATH=${{ env.pythonLocation }}/include/python3.11 \
|
||||
-DUSE_MMAP=On \
|
||||
@@ -178,6 +207,20 @@ jobs:
|
||||
run: |
|
||||
IfcConvert test/input/acad2010_walls.ifc test/input/acad2010_walls.obj
|
||||
|
||||
- name: Build standalone examples to test cmake package
|
||||
run: |
|
||||
cd src/examples
|
||||
mkdir build && cd build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache
|
||||
cmake --build .
|
||||
./IfcParseExamples "../IfcParseExamples_test.ifc"
|
||||
./IfcOpenHouse
|
||||
./IfcAdvancedHouse
|
||||
./IfcAlignment
|
||||
./IfcSimplifiedAlignment
|
||||
|
||||
- name: Test ifcopenshell-python
|
||||
run: |
|
||||
cd test
|
||||
|
||||
@@ -11,7 +11,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
|
||||
@@ -9,7 +9,7 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
|
||||
@@ -26,7 +26,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout (recursive)
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
@@ -17,7 +17,7 @@ jobs:
|
||||
runs-on: ubuntu-22.04
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v5
|
||||
uses: actions/checkout@v6
|
||||
with:
|
||||
submodules: recursive
|
||||
- name: Install C++ dependencies
|
||||
@@ -46,7 +46,6 @@ jobs:
|
||||
mkdir build && cd build
|
||||
cmake \
|
||||
-DCMAKE_INSTALL_PREFIX=$PWD/install/ \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_PREFIX_PATH=/usr \
|
||||
-DCMAKE_SYSTEM_PREFIX_PATH=/usr \
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
/_deps-vs*-x*-installed/
|
||||
/_installed-vs*-x*/
|
||||
/build/
|
||||
/src/examples/build/
|
||||
|
||||
# output directories
|
||||
/cmake/out/
|
||||
|
||||
+3
-3
@@ -5,9 +5,6 @@
|
||||
[submodule "src/ifcopenshell-python/ifcopenshell/mvd"]
|
||||
path = src/ifcopenshell-python/ifcopenshell/mvd
|
||||
url = https://github.com/opensourceBIM/python-mvdxml/
|
||||
[submodule "src/svgfill"]
|
||||
path = src/svgfill
|
||||
url = https://github.com/IfcOpenShell/svgfill
|
||||
[submodule "src/ifcopenshell-python/test/Sample-BIM-Files"]
|
||||
path = src/ifcopenshell-python/test/Sample-BIM-Files
|
||||
url = https://github.com/IfcOpenShell/ids-test-files
|
||||
@@ -20,3 +17,6 @@
|
||||
[submodule "src/pyodide/demo-app/wheels"]
|
||||
path = src/pyodide/demo-app/wheels
|
||||
url = https://github.com/IfcOpenShell/wasm-wheels
|
||||
[submodule "src/svgfill/3rdparty/svgpp"]
|
||||
path = src/svgfill/3rdparty/svgpp
|
||||
url = https://github.com/svgpp/svgpp
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import boto3
|
||||
import ifcopenshell
|
||||
import ifcopenshell.util.element
|
||||
import boto3
|
||||
|
||||
s3 = boto3.client('s3')
|
||||
|
||||
|
||||
@@ -13,9 +13,10 @@ import hashlib
|
||||
import os
|
||||
import pathlib
|
||||
import re
|
||||
from urllib import request
|
||||
from github import Github
|
||||
from typing import NoReturn
|
||||
from urllib import request
|
||||
|
||||
from github import Github
|
||||
|
||||
|
||||
def get_repo_tag_names() -> list[str]:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import bpy
|
||||
|
||||
|
||||
bpy.ops.preferences.addon_disable(module='blenderbim')
|
||||
bpy.ops.wm.save_userpref()
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import bpy
|
||||
|
||||
|
||||
bpy.ops.preferences.addon_enable(module='blenderbim')
|
||||
bpy.ops.wm.save_userpref()
|
||||
|
||||
|
||||
+169
-275
@@ -18,19 +18,28 @@
|
||||
################################################################################
|
||||
|
||||
cmake_minimum_required(VERSION 3.21)
|
||||
if (NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
if(NOT DEFINED CMAKE_CXX_STANDARD)
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
endif()
|
||||
if (CMAKE_CXX_STANDARD LESS 17)
|
||||
if(CMAKE_CXX_STANDARD LESS 17)
|
||||
message(FATAL_ERROR "C++17 or newer is required.")
|
||||
endif()
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON) # not necessary, but encouraged
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
if(VERSION_OVERRIDE)
|
||||
file(READ "../VERSION" "RELEASE_VERSION_")
|
||||
string(STRIP "${RELEASE_VERSION_}" RELEASE_VERSION)
|
||||
message(STATUS "Detected version '${RELEASE_VERSION}'")
|
||||
else()
|
||||
set(RELEASE_VERSION "0.8.0")
|
||||
endif()
|
||||
|
||||
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
|
||||
|
||||
if(POLICY CMP0141) # 3.25+
|
||||
cmake_policy(SET CMP0141 NEW) # Support for `CMAKE_MSVC_DEBUG_INFORMATION_FORMAT`.
|
||||
# Has to be set before `project` to take effect.
|
||||
cmake_policy(SET CMP0141 NEW) # Support for `CMAKE_MSVC_DEBUG_INFORMATION_FORMAT`.
|
||||
endif()
|
||||
if(POLICY CMP0144) # 3.27
|
||||
cmake_policy(SET CMP0144 NEW) # find_package() uses upper-case <PACKAGENAME>_ROOT variables.
|
||||
@@ -39,6 +48,8 @@ if(POLICY CMP0167) # 3.30
|
||||
cmake_policy(SET CMP0167 OLD)
|
||||
endif()
|
||||
|
||||
project(IfcOpenShell VERSION ${RELEASE_VERSION})
|
||||
|
||||
if(NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "Release")
|
||||
endif()
|
||||
@@ -54,7 +65,11 @@ endif()
|
||||
option(MINIMAL_BUILD "The build is to make a minimal version of IFC converter from OCCT into IFC." OFF)
|
||||
option(WASM_BUILD "Build a WebAssembly binary." OFF)
|
||||
|
||||
option(ENABLE_BUILD_OPTIMIZATIONS "Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds." OFF)
|
||||
option(
|
||||
ENABLE_BUILD_OPTIMIZATIONS
|
||||
"Enable certain compiler and linker optimizations on RelWithDebInfo and Release builds."
|
||||
OFF
|
||||
)
|
||||
option(BUILD_SHARED_LIBS "Build IfcParse and IfcGeom as shared libs (SO/DLL)." OFF)
|
||||
option(MSVC_PARALLEL_BUILD "Multi-threaded compilation in Microsoft Visual Studio (/MP)" OFF)
|
||||
option(USE_VLD "Use Visual Leak Detector for debugging memory leaks, MSVC-only." OFF)
|
||||
@@ -70,6 +85,15 @@ option(BUILD_GEOMSERVER "Build IfcGeomServer executable (Open CASCADE is require
|
||||
option(BUILD_IFCMAX "Build IfcMax, a 3ds Max plug-in, Windows-only." OFF)
|
||||
option(BUILD_QTVIEWER "Build IfcOpenShell Qt GUI Viewer" OFF) # QtViewer requires Qt6
|
||||
option(BUILD_PACKAGE "" OFF)
|
||||
# Most users probably need just common schemas,
|
||||
# but we're keeping it `OFF` by default to avoid disruption
|
||||
# (e.g. all Python distribution would need to adapt this option to be set).
|
||||
option(
|
||||
BUILD_ONLY_COMMON_SCHEMAS
|
||||
"Build only common IFC schemas (2x3, 4, 4x3_add2). By default all schemas will be built."
|
||||
OFF
|
||||
)
|
||||
option(SCHEMA_VERSIONS "Explicitly specify schemas to build." "")
|
||||
|
||||
option(WITH_OPENCASCADE "Enable geometry interpretation using Open CASCADE" ON)
|
||||
option(WITH_CGAL "Enable geometry interpretation using CGAL" ON)
|
||||
@@ -84,25 +108,21 @@ option(WITH_ROCKSDB "Support a RocksDB key-value store as a file backend in IfcO
|
||||
option(WITH_ZSTD "Use Zstd compression in RocksDB writes" OFF)
|
||||
|
||||
option(USERSPACE_PYTHON_PREFIX "Installs IfcPython for the current user only instead of system-wide." OFF)
|
||||
option(USE_DEBUG_PYTHON "Use debug binaries when building Debug IfcPython on Windows." OFF)
|
||||
option(ADD_COMMIT_SHA "Add commit sha and branch in version number, requires git" OFF)
|
||||
option(VERSION_OVERRIDE "Override the version defined in buildinfo.cpp with the file VERSION in the repository root" OFF)
|
||||
option(
|
||||
VERSION_OVERRIDE
|
||||
"Override the version defined in buildinfo.cpp with the file VERSION in the repository root"
|
||||
OFF
|
||||
)
|
||||
option(USE_CCACHE "Enable use of ccache if it's available from PATH." ON)
|
||||
|
||||
set(
|
||||
PYTHON_MODULE_INSTALL_DIR
|
||||
"" CACHE PATH
|
||||
set(PYTHON_MODULE_INSTALL_DIR
|
||||
""
|
||||
CACHE PATH
|
||||
"Directory to install IfcPython package to. By default package is installed in found Python's site-packages."
|
||||
)
|
||||
|
||||
if (VERSION_OVERRIDE)
|
||||
file(READ "../VERSION" "RELEASE_VERSION_")
|
||||
string(STRIP "${RELEASE_VERSION_}" RELEASE_VERSION)
|
||||
message(STATUS "Detected version '${RELEASE_VERSION}'")
|
||||
else()
|
||||
set(RELEASE_VERSION "0.8.0")
|
||||
endif()
|
||||
|
||||
project(IfcOpenShell VERSION ${RELEASE_VERSION})
|
||||
|
||||
# Make sure CMake modules in this project are found first
|
||||
list(PREPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
|
||||
|
||||
@@ -118,13 +138,13 @@ if(MINIMAL_BUILD)
|
||||
set(USD_SUPPORT OFF)
|
||||
endif()
|
||||
|
||||
if((BUILD_CONVERT OR BUILD_GEOMSERVER OR BUILD_IFCPYTHON) AND(NOT BUILD_IFCGEOM))
|
||||
if((BUILD_CONVERT OR BUILD_GEOMSERVER OR BUILD_IFCPYTHON) AND (NOT BUILD_IFCGEOM))
|
||||
message(STATUS "'IfcGeom' is required with current outputs")
|
||||
set(BUILD_IFCGEOM ON)
|
||||
endif()
|
||||
|
||||
find_program(CCACHE_FOUND ccache)
|
||||
if(CCACHE_FOUND)
|
||||
if(USE_CCACHE AND CCACHE_FOUND)
|
||||
message(STATUS "`ccache` is found, using it as a compiler launcher.")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND}")
|
||||
if(MSVC)
|
||||
@@ -133,17 +153,15 @@ if(CCACHE_FOUND)
|
||||
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
|
||||
# Not needed for Ninja.
|
||||
if(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
file(COPY_FILE
|
||||
${CCACHE_FOUND} ${CMAKE_BINARY_DIR}/cl.exe
|
||||
ONLY_IF_DIFFERENT)
|
||||
set(CMAKE_VS_GLOBALS
|
||||
"CLToolExe=cl.exe"
|
||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
||||
"UseMultiToolTask=true"
|
||||
)
|
||||
file(COPY_FILE ${CCACHE_FOUND} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT)
|
||||
set(CMAKE_VS_GLOBALS "CLToolExe=cl.exe" "CLToolPath=${CMAKE_BINARY_DIR}" "UseMultiToolTask=true")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
mark_as_advanced(CCACHE_FOUND)
|
||||
|
||||
# Variable to accumulate swig definitions from various submodules.
|
||||
set(SWIG_DEFINES "")
|
||||
|
||||
if(MSVC AND MSVC_PARALLEL_BUILD)
|
||||
add_definitions("/MP")
|
||||
@@ -159,47 +177,28 @@ endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Specify paths to install files
|
||||
if(NOT BINDIR)
|
||||
set(BINDIR bin)
|
||||
endif()
|
||||
if(NOT IS_ABSOLUTE ${BINDIR})
|
||||
set(BINDIR ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
message(STATUS "BINDIR: ${BINDIR}")
|
||||
set(IFCOPENSHELL_EXPORT_TARGETS "${PROJECT_NAME}Targets")
|
||||
|
||||
if(NOT INCLUDEDIR)
|
||||
set(INCLUDEDIR include)
|
||||
# On Windows Release and Debug binaries are not compatible.
|
||||
# So we add a postfix to avoid issues and allow release and debug installations to coexist.
|
||||
if(WIN32)
|
||||
set(CMAKE_DEBUG_POSTFIX "_d")
|
||||
endif()
|
||||
if(NOT IS_ABSOLUTE ${INCLUDEDIR})
|
||||
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
endif()
|
||||
message(STATUS "INCLUDEDIR: ${INCLUDEDIR}")
|
||||
|
||||
if(NOT LIBDIR)
|
||||
set(LIBDIR lib)
|
||||
endif()
|
||||
if(NOT IS_ABSOLUTE ${LIBDIR})
|
||||
set(LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
message(STATUS "LIBDIR: ${LIBDIR}")
|
||||
|
||||
set(IFCOPENSHELL_LIBRARY_DIR "") # for *nix rpaths
|
||||
|
||||
if(BUILD_SHARED_LIBS)
|
||||
add_definitions(-DIFC_SHARED_BUILD)
|
||||
if(MSVC)
|
||||
message(WARNING "Building DLLs against the static VC run-time. This is not recommended if the DLLs are to be redistributed.")
|
||||
message(
|
||||
WARNING
|
||||
"Building DLLs against the static VC run-time. This is not recommended if the DLLs are to be redistributed."
|
||||
)
|
||||
# C4521: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
|
||||
# There will be couple hundreds of these so suppress them away, https://msdn.microsoft.com/en-us/library/esew7y1w.aspx
|
||||
add_definitions(-wd4251)
|
||||
endif()
|
||||
|
||||
set(IFCOPENSHELL_LIBRARY_DIR "${LIBDIR}")
|
||||
endif()
|
||||
|
||||
UNIFY_ENVVARS_AND_CACHE(BOOST_ROOT)
|
||||
UNIFY_ENVVARS_AND_CACHE(BOOST_LIBRARYDIR)
|
||||
|
||||
if(NOT MINIMAL_BUILD)
|
||||
UNIFY_ENVVARS_AND_CACHE(PYTHON_INCLUDE_DIR)
|
||||
@@ -215,88 +214,71 @@ foreach(option_flag IN LISTS option_flags)
|
||||
convert_env_var_to_bool("${option_flag}")
|
||||
endforeach()
|
||||
|
||||
if(WITH_CGAL)
|
||||
find_package(CGAL REQUIRED)
|
||||
if(TARGET CGAL::CGAL)
|
||||
link_libraries(CGAL::CGAL)
|
||||
endif()
|
||||
add_definitions(-DIFOPSH_WITH_CGAL)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_CGAL)
|
||||
list(APPEND GEOMETRY_KERNELS cgal)
|
||||
endif()
|
||||
|
||||
if(WITH_OPENCASCADE)
|
||||
if(BUILD_IFCGEOM AND WITH_OPENCASCADE)
|
||||
find_package(OpenCASCADE REQUIRED)
|
||||
add_definitions(-DIFOPSH_WITH_OPENCASCADE)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_OPENCASCADE)
|
||||
list(APPEND GEOMETRY_KERNELS opencascade)
|
||||
endif()
|
||||
|
||||
set(GLTF_LIBRARIES "")
|
||||
if(GLTF_SUPPORT)
|
||||
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
||||
if(NOT JSON_INCLUDE_DIR)
|
||||
find_package(nlohmann_json CONFIG)
|
||||
if(nlohmann_json_DIR)
|
||||
link_libraries(nlohmann_json::nlohmann_json)
|
||||
else()
|
||||
message(STATUS "Unable to find nlohmann_json package, trying to find it as a header-only library.")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT nlohmann_json_DIR)
|
||||
find_path(json_header_path "nlohmann/json.hpp" HINTS ${JSON_INCLUDE_DIR})
|
||||
set(JSON_INCLUDE_DIR ${json_header_path})
|
||||
|
||||
if(json_header_path)
|
||||
message(STATUS "JSON for Modern C++ header file found in '${JSON_INCLUDE_DIR}'.")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file / package, aborting")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_package(nlohmann_json REQUIRED)
|
||||
set(GLTF_LIBRARIES nlohmann_json::nlohmann_json)
|
||||
add_definitions(-DWITH_GLTF)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_GLTF)
|
||||
endif()
|
||||
|
||||
# Add USD support to serializers
|
||||
set(USD_LIBRARIES "")
|
||||
if(USD_SUPPORT)
|
||||
find_package(USD REQUIRED)
|
||||
set(USD_LIBRARIES pxr::USD)
|
||||
endif(USD_SUPPORT)
|
||||
|
||||
if (WITH_ROCKSDB)
|
||||
set(ROCKSDB_LIBRARIES "")
|
||||
if(WITH_ROCKSDB)
|
||||
# Temporaily mess with CMAKE_FIND_PACKAGE_PREFER_CONFIG to help RocksDB
|
||||
# find it's zstd dependency on Windows.
|
||||
# Only do it on Windows, otherwise it might create problems as
|
||||
# findzstd and zstd-config target names do not match.
|
||||
# https://github.com/facebook/rocksdb/pull/13975
|
||||
if(WIN32)
|
||||
set(TEMP CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
||||
endif()
|
||||
find_package(RocksDB CONFIG REQUIRED)
|
||||
mark_as_advanced(RocksDB_DIR)
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ${TEMP})
|
||||
endif()
|
||||
|
||||
message(STATUS "RocksDB: found at '${RocksDB_DIR}'.")
|
||||
add_definitions(-DIFOPSH_WITH_ROCKSDB)
|
||||
add_library(IFCOPENSHELL_RocksDB INTERFACE)
|
||||
set(ROCKSDB_LIBRARIES "IFCOPENSHELL_RocksDB")
|
||||
target_compile_definitions(IFCOPENSHELL_RocksDB INTERFACE IFOPSH_WITH_ROCKSDB)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_ROCKSDB)
|
||||
link_libraries(RocksDB::rocksdb)
|
||||
target_link_libraries(
|
||||
IFCOPENSHELL_RocksDB
|
||||
INTERFACE $<IF:$<TARGET_EXISTS:RocksDB::rocksdb-shared>,RocksDB::rocksdb-shared,RocksDB::rocksdb>
|
||||
)
|
||||
|
||||
if (WITH_ZSTD)
|
||||
if(WITH_ZSTD)
|
||||
# @todo do we actually need the zstd include dir or rather just pass
|
||||
# the libzstd.a along with the rocksdb library when needed and feature
|
||||
# detect based on rocksdb API?
|
||||
find_package(zstd CONFIG REQUIRED)
|
||||
mark_as_advanced(zstd_DIR)
|
||||
message(STATUS "zstd: found at '${zstd_DIR}'.")
|
||||
link_libraries(zstd::libzstd_static)
|
||||
|
||||
add_definitions(-DIFOPSH_WITH_ROCKSDB_ZSTD)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_ROCKSDB_ZSTD)
|
||||
target_link_libraries(IFCOPENSHELL_RocksDB INTERFACE zstd::libzstd_static)
|
||||
endif()
|
||||
|
||||
install(TARGETS IFCOPENSHELL_RocksDB EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
endif()
|
||||
|
||||
# Find Boost: On win32 the (hardcoded) default is to use static libraries and
|
||||
# runtime, when doing running conda-build we pick what conda prepared for us.
|
||||
if(WIN32 AND("$ENV{CONDA_BUILD}" STREQUAL ""))
|
||||
if(WIN32 AND NOT DEFINED ENV{CONDA_BUILD})
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
@@ -327,7 +309,14 @@ if(WASM_BUILD)
|
||||
else()
|
||||
# @todo review this, shouldn't this be all possible header-only now?
|
||||
# ... or rewritten using C++17 features?
|
||||
set(BOOST_COMPONENTS system program_options regex thread date_time iostreams)
|
||||
set(BOOST_COMPONENTS
|
||||
system
|
||||
program_options
|
||||
regex
|
||||
thread
|
||||
date_time
|
||||
iostreams
|
||||
)
|
||||
endif()
|
||||
|
||||
if(USE_MMAP)
|
||||
@@ -341,35 +330,27 @@ if(USE_MMAP)
|
||||
add_definitions(-DUSE_MMAP)
|
||||
endif()
|
||||
|
||||
# Handle CGAL after Boost settings are set, since CGAL will use them too.
|
||||
# Do `find_package(Boost)` only after this, to make sure `FindBoost` finds correct components.
|
||||
# Otherwise it will find components needed for CGAL and we might some libraries.
|
||||
if(WITH_CGAL)
|
||||
find_package(CGAL REQUIRED)
|
||||
set(CGAL_LIBRARIES IFCOPENSHELL_CGAL)
|
||||
list(APPEND GEOMETRY_KERNELS cgal)
|
||||
endif()
|
||||
|
||||
find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
message(STATUS "Boost include files found in ${Boost_INCLUDE_DIRS}")
|
||||
message(STATUS "Boost libraries found in ${Boost_LIBRARY_DIRS}")
|
||||
|
||||
if(NOT MINIMAL_BUILD)
|
||||
# libxml2 is required for IFCXML (optional) and SVGFILL (mandatory)
|
||||
if(IFCXML_SUPPORT)
|
||||
find_package(LibXml2 REQUIRED)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(IFCXML_SUPPORT)
|
||||
add_definitions(-DWITH_IFCXML)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_IFCXML)
|
||||
endif()
|
||||
|
||||
if(BUILD_IFCGEOM)
|
||||
# Open CASCADE
|
||||
if(WITH_OPENCASCADE)
|
||||
find_package(OpenCASCADE REQUIRED)
|
||||
endif(WITH_OPENCASCADE)
|
||||
endif(BUILD_IFCGEOM)
|
||||
|
||||
if(COLLADA_SUPPORT)
|
||||
find_package(OpenCOLLADA REQUIRED)
|
||||
add_definitions(-DWITH_OPENCOLLADA)
|
||||
endif()
|
||||
|
||||
if(HDF5_SUPPORT)
|
||||
find_package(HDF5 REQUIRED COMPONENTS C CXX)
|
||||
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} hdf5::hdf5_cpp)
|
||||
|
||||
add_definitions(-DWITH_HDF5)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_HDF5)
|
||||
@@ -441,7 +422,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
# Enforce standards-conformance on VS > 2015, older Boost versions fail to compile with this
|
||||
if(MSVC_VERSION GREATER 1900 AND(Boost_MAJOR_VERSION GREATER 1 OR Boost_MINOR_VERSION GREATER 66))
|
||||
if(MSVC_VERSION GREATER 1900 AND (Boost_MAJOR_VERSION GREATER 1 OR Boost_MINOR_VERSION GREATER 66))
|
||||
add_definitions(-permissive-)
|
||||
endif()
|
||||
|
||||
@@ -460,11 +441,11 @@ if(MSVC)
|
||||
# endforeach()
|
||||
# endif()
|
||||
|
||||
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
|
||||
# See #5158.
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.40)
|
||||
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
|
||||
endif()
|
||||
add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)
|
||||
# See #5158.
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.40)
|
||||
add_definitions(-D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR)
|
||||
endif()
|
||||
else()
|
||||
add_definitions(-Wall -Wextra)
|
||||
|
||||
@@ -474,7 +455,10 @@ else()
|
||||
add_definitions(-Wno-maybe-uninitialized)
|
||||
endif()
|
||||
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 9.0))
|
||||
if(
|
||||
CMAKE_CXX_COMPILER_ID MATCHES "GNU"
|
||||
AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0 OR CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 9.0)
|
||||
)
|
||||
# OpenCascade spews a lot of deprecated-copy warnings
|
||||
add_definitions(-Wno-deprecated-copy)
|
||||
endif()
|
||||
@@ -485,40 +469,45 @@ else()
|
||||
endif()
|
||||
endif(MSVC)
|
||||
|
||||
|
||||
find_package(Eigen3 REQUIRED)
|
||||
link_libraries(Eigen3::Eigen)
|
||||
|
||||
include_directories(${INCLUDE_DIRECTORIES} ${OPENCOLLADA_INCLUDE_DIRS}
|
||||
${Boost_INCLUDE_DIRS} ${LIBXML2_INCLUDE_DIR} ${JSON_INCLUDE_DIR} ${HDF5_INCLUDE_DIR}
|
||||
${CGAL_INCLUDE_DIR} ${GMP_INCLUDE_DIR} ${MPFR_INCLUDE_DIR} ${USD_INCLUDE_DIR}
|
||||
${TBB_INCLUDE_DIR}
|
||||
)
|
||||
include_directories(${OPENCOLLADA_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${HDF5_INCLUDE_DIR})
|
||||
|
||||
if(NOT SCHEMA_VERSIONS)
|
||||
if(WASM_BUILD)
|
||||
# super arbitrarily try to keep size down at least a little bit
|
||||
# `WASM_BUILD` - super arbitrarily try to keep size down at least a little bit
|
||||
if(BUILD_ONLY_COMMON_SCHEMAS OR WASM_BUILD)
|
||||
set(SCHEMA_VERSIONS "2x3" "4" "4x3_add2")
|
||||
else()
|
||||
set(SCHEMA_VERSIONS "2x3" "4" "4x1" "4x2" "4x3" "4x3_tc1" "4x3_add1" "4x3_add2")
|
||||
set(SCHEMA_VERSIONS
|
||||
"2x3"
|
||||
"4"
|
||||
"4x1"
|
||||
"4x2"
|
||||
"4x3"
|
||||
"4x3_tc1"
|
||||
"4x3_add1"
|
||||
"4x3_add2"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
message(STATUS "IFC SCHEMA_VERSIONS that will be used for the build: ${SCHEMA_VERSIONS}.")
|
||||
|
||||
set(SCHEMA_DEFINITIONS "")
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
add_definitions(-DHAS_SCHEMA_${schema})
|
||||
list(APPEND SCHEMA_DEFINITIONS "-DHAS_SCHEMA_${schema}")
|
||||
endforeach()
|
||||
|
||||
string(REPLACE ";" ")(" schema_version_seq "(${SCHEMA_VERSIONS})")
|
||||
add_definitions(-DSCHEMA_SEQ=${schema_version_seq})
|
||||
list(APPEND SCHEMA_DEFINITIONS "-DSCHEMA_SEQ=${schema_version_seq}")
|
||||
|
||||
if(COMPILE_SCHEMA)
|
||||
# @todo, this appears to be untested at the moment
|
||||
find_package(PythonInterp)
|
||||
|
||||
if(NOT PYTHONINTERP_FOUND)
|
||||
message(FATAL_ERROR "A Python interpreter is necessary when COMPILE_SCHEMA is enabled. Disable COMPILE_SCHEMA or fix Python paths to proceed.")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"A Python interpreter is necessary when COMPILE_SCHEMA is enabled. Disable COMPILE_SCHEMA or fix Python paths to proceed."
|
||||
)
|
||||
endif()
|
||||
|
||||
set(IFC_RELEASE_NOT_USED ${SCHEMA_VERSIONS})
|
||||
@@ -538,7 +527,10 @@ if(COMPILE_SCHEMA)
|
||||
|
||||
if("${PYPARSING_FOUND}" STREQUAL "-1")
|
||||
message(STATUS "Installing pyparsing")
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} -m pip "install" --user pyparsing
|
||||
RESULT_VARIABLE SUCCESS
|
||||
)
|
||||
|
||||
if(NOT "${SUCCESS}" STREQUAL "0")
|
||||
execute_process(COMMAND pip "install" --user pyparsing RESULT_VARIABLE SUCCESS)
|
||||
@@ -553,19 +545,23 @@ if(COMPILE_SCHEMA)
|
||||
|
||||
# Bootstrap the parser
|
||||
message(STATUS "Compiling schema, this will take a while...")
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} bootstrap.py express.bnf
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} bootstrap.py express.bnf
|
||||
WORKING_DIRECTORY ../src/ifcexpressparser
|
||||
OUTPUT_FILE express_parser.py
|
||||
RESULT_VARIABLE SUCCESS)
|
||||
RESULT_VARIABLE SUCCESS
|
||||
)
|
||||
|
||||
if(NOT "${SUCCESS}" STREQUAL "0")
|
||||
message(FATAL_ERROR "Failed to bootstrap parser. Make sure pyparsing is installed")
|
||||
endif()
|
||||
|
||||
# Generate code
|
||||
execute_process(COMMAND ${PYTHON_EXECUTABLE} ../ifcexpressparser/express_parser.py ../../${COMPILE_SCHEMA}
|
||||
execute_process(
|
||||
COMMAND ${PYTHON_EXECUTABLE} ../ifcexpressparser/express_parser.py ../../${COMPILE_SCHEMA}
|
||||
WORKING_DIRECTORY ../src/ifcparse
|
||||
OUTPUT_VARIABLE COMPILED_SCHEMA_NAME)
|
||||
OUTPUT_VARIABLE COMPILED_SCHEMA_NAME
|
||||
)
|
||||
|
||||
# Prevent the schema that had just been compiled from being excluded
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
@@ -584,78 +580,7 @@ add_subdirectory(../src/ifcparse ifcparse)
|
||||
set(IFCOPENSHELL_LIBRARIES IfcParse)
|
||||
|
||||
if(BUILD_IFCGEOM)
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
set(IFCGEOM_SCHEMA_LIBRARIES ${IFCGEOM_SCHEMA_LIBRARIES} geometry_mapping_ifc${schema})
|
||||
endforeach()
|
||||
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} IfcGeom ${IFCGEOM_SCHEMA_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
||||
if(WITH_OPENCASCADE)
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
set(GEOM_SERIALIZER_SCHEMA_LIBRARIES ${GEOM_SERIALIZER_SCHEMA_LIBRARIES} GeometrySerializers_ifc${schema})
|
||||
|
||||
add_library(geometry_serializer_ifc${schema} OBJECT ../src/ifcgeom/Serialization/schema/Serialization.cpp)
|
||||
set_target_properties(geometry_serializer_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS -DIfcSchema=Ifc${schema}")
|
||||
target_link_libraries(geometry_serializer_ifc${schema} ${OpenCASCADE_LIBRARIES})
|
||||
list(APPEND geometry_serializer_libraries geometry_serializer_ifc${schema})
|
||||
endforeach()
|
||||
|
||||
add_library(geometry_serializer OBJECT ../src/ifcgeom/Serialization/Serialization.h ../src/ifcgeom/Serialization/Serialization.cpp)
|
||||
set_target_properties(geometry_serializer PROPERTIES COMPILE_FLAGS "-DIFC_GEOMSERIALIZATION_EXPORTS")
|
||||
target_link_libraries(geometry_serializer ${geometry_serializer_libraries} IfcParse)
|
||||
set(IFCOPENSHELL_LIBRARIES ${IFCOPENSHELL_LIBRARIES} geometry_serializer ${geometry_serializer_libraries})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(BUILD_IFCGEOM)
|
||||
# CGAL::CGAL target already has dependencies resolved.
|
||||
if(WITH_CGAL AND CGAL_DIR)
|
||||
set(CGAL_LIBRARIES CGAL::CGAL)
|
||||
message(STATUS "Using found CGAL package at '${CGAL_DIR}'")
|
||||
elseif(WITH_CGAL AND NOT CGAL_DIR)
|
||||
find_library(libGMP NAMES gmp mpir PATHS ${GMP_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
find_library(libMPFR NAMES mpfr PATHS ${MPFR_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
if(NOT libGMP)
|
||||
message(FATAL_ERROR "Unable to find GMP library files, aborting")
|
||||
endif()
|
||||
if(NOT libMPFR)
|
||||
message(FATAL_ERROR "Unable to find MPFR library files, aborting")
|
||||
endif()
|
||||
|
||||
list(APPEND CGAL_LIBRARIES "${libMPFR}")
|
||||
list(APPEND CGAL_LIBRARIES "${libGMP}")
|
||||
endif()
|
||||
|
||||
add_subdirectory(../src/ifcgeom ifcgeom)
|
||||
|
||||
# IfcGeom
|
||||
foreach(schema ${SCHEMA_VERSIONS})
|
||||
file(GLOB IFCGEOM_I_FILES ../src/ifcgeom/mapping/*.i)
|
||||
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/mapping/*.h)
|
||||
file(GLOB IFCGEOM_CPP_FILES ../src/ifcgeom/mapping/*.cpp)
|
||||
set(IFCGEOM_FILES ${IFCGEOM_CPP_FILES} ${IFCGEOM_H_FILES} ${IFCGEOM_I_FILES})
|
||||
|
||||
add_library(geometry_mapping_ifc${schema} OBJECT ${IFCGEOM_FILES})
|
||||
set_target_properties(geometry_mapping_ifc${schema} PROPERTIES COMPILE_FLAGS "-DIFC_GEOM_EXPORTS -DIfcSchema=Ifc${schema}")
|
||||
target_link_libraries(geometry_mapping_ifc${schema} IfcParse)
|
||||
list(APPEND mapping_libraries geometry_mapping_ifc${schema})
|
||||
endforeach()
|
||||
|
||||
# IfcGeom (schema agnostic)
|
||||
file(GLOB SCHEMA_AGNOSTIC_H_FILES ../src/ifcgeom/*.h)
|
||||
file(GLOB SCHEMA_AGNOSTIC_CPP_FILES ../src/ifcgeom/*.cpp)
|
||||
set(SCHEMA_AGNOSTIC_FILES ${SCHEMA_AGNOSTIC_H_FILES} ${SCHEMA_AGNOSTIC_CPP_FILES})
|
||||
|
||||
add_library(IfcGeom ${SCHEMA_AGNOSTIC_FILES})
|
||||
set_target_properties(IfcGeom PROPERTIES COMPILE_FLAGS -DIFC_GEOM_EXPORTS VERSION "${PROJECT_VERSION}" SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}")
|
||||
|
||||
if(UNIX)
|
||||
find_package(Threads)
|
||||
endif()
|
||||
|
||||
target_link_libraries(IfcGeom IfcParse ${mapping_libraries} ${CMAKE_THREAD_LIBS_INIT} ${OpenCASCADE_LIBRARIES})
|
||||
|
||||
endif(BUILD_IFCGEOM)
|
||||
|
||||
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
||||
@@ -680,8 +605,8 @@ if(ADD_COMMIT_SHA)
|
||||
endif()
|
||||
|
||||
if(GIT_FOUND)
|
||||
if (VERSION_OVERRIDE)
|
||||
set (git_branch ${RELEASE_VERSION})
|
||||
if(VERSION_OVERRIDE)
|
||||
set(git_branch ${RELEASE_VERSION})
|
||||
else()
|
||||
message("git found: ${GIT_EXECUTABLE} with version ${GIT_VERSION_STRING}")
|
||||
execute_process(
|
||||
@@ -693,8 +618,8 @@ if(ADD_COMMIT_SHA)
|
||||
string(REPLACE "\n" ";" git_branch_list "${git_branches}")
|
||||
|
||||
foreach(git_branch_candidate IN ITEMS ${git_branch_list})
|
||||
string(REPLACE "*" "" git_branch_candidate_temp "${git_branch_candidate}")
|
||||
string(STRIP "${git_branch_candidate_temp}" git_branch_candidate_2)
|
||||
string(REPLACE "*" "" git_branch_candidate_temp "${git_branch_candidate}")
|
||||
string(STRIP "${git_branch_candidate_temp}" git_branch_candidate_2)
|
||||
if(NOT git_branch_candidate_2 MATCHES "^HEAD$")
|
||||
string(REPLACE "/" ";" git_branch_candidate_2_list "${git_branch_candidate_2}")
|
||||
list(GET git_branch_candidate_2_list -1 git_branch)
|
||||
@@ -712,13 +637,13 @@ if(ADD_COMMIT_SHA)
|
||||
message(STATUS "IfcOpenShell branch: \"${git_branch}\"")
|
||||
message(STATUS "IfcOpenShell commit: \"${git_sha}\"")
|
||||
|
||||
if ("${git_branch}" STREQUAL "" OR "${git_sha}" STREQUAL "")
|
||||
if("${git_branch}" STREQUAL "" OR "${git_sha}" STREQUAL "")
|
||||
message(FATAL_ERROR "Unable to determine commit sha and/or branch")
|
||||
endif()
|
||||
|
||||
target_compile_definitions(IfcParse PRIVATE
|
||||
-DIFCOPENSHELL_BRANCH=${git_branch}
|
||||
-DIFCOPENSHELL_COMMIT=${git_sha}
|
||||
target_compile_definitions(
|
||||
IfcParse
|
||||
PRIVATE -DIFCOPENSHELL_BRANCH=${git_branch} -DIFCOPENSHELL_COMMIT=${git_sha}
|
||||
)
|
||||
endif()
|
||||
endif(ADD_COMMIT_SHA)
|
||||
@@ -748,7 +673,7 @@ if(BUILD_IFCMAX)
|
||||
add_subdirectory(../src/ifcmax ifcmax)
|
||||
endif()
|
||||
|
||||
if(WITH_CGAL)
|
||||
if(BUILD_IFCPYTHON AND WITH_CGAL)
|
||||
add_subdirectory(../src/svgfill svgfill)
|
||||
endif()
|
||||
|
||||
@@ -756,66 +681,28 @@ if(BUILD_QTVIEWER)
|
||||
add_subdirectory(../src/qtviewer qtviewer)
|
||||
endif()
|
||||
|
||||
if(BUILD_IFCGEOM)
|
||||
# install(FILES ${IFCGEOM_H_FILES}
|
||||
# DESTINATION ${INCLUDEDIR}/ifcgeom
|
||||
# )
|
||||
|
||||
install(FILES ${SCHEMA_AGNOSTIC_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/ifcgeom
|
||||
)
|
||||
|
||||
file(GLOB SERIALIZATION_H_FILES ../src/ifcgeom/serialization/*.h)
|
||||
install(FILES ${SERIALIZATION_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/ifcgeom/serialization
|
||||
)
|
||||
|
||||
foreach(kernel ${GEOMETRY_KERNELS})
|
||||
file(GLOB IFCGEOM_H_FILES ../src/ifcgeom/kernels/${kernel}/*.h)
|
||||
install(FILES ${IFCGEOM_H_FILES}
|
||||
DESTINATION ${INCLUDEDIR}/ifcgeom/kernels/${kernel}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
install(TARGETS ${IFCGEOM_SCHEMA_LIBRARIES} ${kernel_libraries} IfcGeom
|
||||
ARCHIVE DESTINATION ${LIBDIR}
|
||||
LIBRARY DESTINATION ${LIBDIR}
|
||||
RUNTIME DESTINATION ${BINDIR}
|
||||
)
|
||||
endif(BUILD_IFCGEOM)
|
||||
|
||||
if(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
||||
if(WITH_OPENCASCADE)
|
||||
install(TARGETS geometry_serializer ${geometry_serializer_libraries}
|
||||
ARCHIVE DESTINATION ${LIBDIR}
|
||||
LIBRARY DESTINATION ${LIBDIR}
|
||||
RUNTIME DESTINATION ${BINDIR}
|
||||
)
|
||||
endif()
|
||||
endif(BUILD_CONVERT OR BUILD_IFCPYTHON)
|
||||
|
||||
# Cmake uninstall target
|
||||
if(NOT TARGET uninstall)
|
||||
configure_file(
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
IMMEDIATE @ONLY)
|
||||
IMMEDIATE
|
||||
@ONLY
|
||||
)
|
||||
|
||||
add_custom_target(uninstall
|
||||
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
|
||||
endif()
|
||||
|
||||
# Packaging
|
||||
list(APPEND CPACK_SOURCE_IGNORE_FILES
|
||||
"/\\\\.git"
|
||||
"/build/"
|
||||
"/.pytest_cache/"
|
||||
"/__pycache__/"
|
||||
)
|
||||
list(APPEND CPACK_SOURCE_IGNORE_FILES "/\\\\.git" "/build/" "/.pytest_cache/" "/__pycache__/")
|
||||
set(CPACK_SOURCE_INSTALLED_DIRECTORIES "${CMAKE_SOURCE_DIR}/..;/")
|
||||
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}")
|
||||
set(CPACK_PACKAGE_NAME
|
||||
"${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}"
|
||||
)
|
||||
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}${EXTRA_VERSION}")
|
||||
SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}-${CMAKE_SYSTEM_NAME}")
|
||||
set(CPACK_PACKAGE_FILE_NAME
|
||||
"${PROJECT_NAME}-${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${EXTRA_VERSION}-${CMAKE_SYSTEM_NAME}"
|
||||
)
|
||||
set(CPACK_PACKAGE_DIRECTORY "${PROJECT_BINARY_DIR}/assets")
|
||||
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "IfcOpenShell")
|
||||
set(CPACK_PACKAGE_DESCRIPTION "IfcOpenShell.")
|
||||
@@ -828,6 +715,7 @@ set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}")
|
||||
set(CPACK_GENERATOR "TGZ;DEB")
|
||||
set(CPACK_SOURCE_GENERATOR "TGZ")
|
||||
|
||||
set(BOOST_DEPS "")
|
||||
foreach(COMPONENT IN ITEMS ${BOOST_COMPONENTS})
|
||||
string(REPLACE "_" "-" COMP ${COMPONENT})
|
||||
set(BOOST_DEPS "${BOOST_DEPS}, libboost-${COMP}-dev")
|
||||
@@ -835,13 +723,19 @@ endforeach(COMPONENT)
|
||||
|
||||
set(CPACK_DEBIAN_PACKAGE_NAME "${PROJECT_NAME}")
|
||||
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "${CPACK_PACKAGE_CONTACT}")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS "python3, libxml2, libocct-foundation-dev, libocct-modeling-algorithms-dev, libocct-modeling-data-dev, libocct-ocaf-dev, libocct-visualization-dev, libocct-data-exchange-dev, libhdf5-serial-dev, libpython3-dev, python3-pytest ${BOOST_DEPS}")
|
||||
set(CPACK_DEBIAN_PACKAGE_DEPENDS
|
||||
"python3, libxml2, libocct-foundation-dev, libocct-modeling-algorithms-dev, libocct-modeling-data-dev, libocct-ocaf-dev, libocct-visualization-dev, libocct-data-exchange-dev, libhdf5-serial-dev, libpython3-dev, python3-pytest ${BOOST_DEPS}"
|
||||
)
|
||||
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION_SUMMARY "${CPACK_PACKAGE_DESCRIPTION_SUMMARY}")
|
||||
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "${CPACK_PACKAGE_DESCRIPTION}")
|
||||
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
|
||||
set(CPACK_DEBIAN_PACKAGE_SECTION "science")
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${EXTRA_VERSION}")
|
||||
set(CPACK_DEBIAN_PACKAGE_VERSION
|
||||
"${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}${EXTRA_VERSION}"
|
||||
)
|
||||
set(CPACK_DEBIAN_ARCHITECTURE "${CMAKE_SYSTEM_PROCESSOR}")
|
||||
# set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/cmake/debian/postinst")
|
||||
|
||||
include(CPack)
|
||||
|
||||
include(package_export.cmake)
|
||||
|
||||
+32
-6
@@ -9,10 +9,14 @@
|
||||
# If input variables are not specified, try to find HDF5 config.
|
||||
# Input variables could also be provided as environment variables.
|
||||
#
|
||||
# Output variables:
|
||||
# - `CGAL_INCLUDE_DIR`
|
||||
# Output targets:
|
||||
# - `IFCOPENSHELL_CGAL`
|
||||
#
|
||||
|
||||
if(TARGET IFCOPENSHELL_CGAL)
|
||||
return()
|
||||
endif()
|
||||
|
||||
UNIFY_ENVVARS_AND_CACHE(CGAL_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(CGAL_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(GMP_INCLUDE_DIR)
|
||||
@@ -20,7 +24,21 @@ UNIFY_ENVVARS_AND_CACHE(GMP_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(MPFR_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(MPFR_LIBRARY_DIR)
|
||||
|
||||
if(NOT CGAL_INCLUDE_DIR)
|
||||
if(CGAL_INCLUDE_DIR)
|
||||
find_library(libGMP NAMES gmp mpir PATHS ${GMP_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
find_library(libMPFR NAMES mpfr PATHS ${MPFR_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
if(NOT libGMP)
|
||||
message(FATAL_ERROR "Unable to find GMP library files, aborting")
|
||||
endif()
|
||||
if(NOT libMPFR)
|
||||
message(FATAL_ERROR "Unable to find MPFR library files, aborting")
|
||||
endif()
|
||||
|
||||
add_library(CGAL::CGAL INTERFACE IMPORTED)
|
||||
target_include_directories(CGAL::CGAL INTERFACE "${CGAL_INCLUDE_DIR}")
|
||||
target_include_directories(CGAL::CGAL INTERFACE "${GMP_INCLUDE_DIR}" "${MPFR_INCLUDE_DIR}")
|
||||
target_link_libraries(CGAL::CGAL INTERFACE "${libMPFR}" "${libGMP}")
|
||||
else()
|
||||
# CGAL is not respecting default Boost_USE_STATIC_LIBS value
|
||||
# and sometiems it's getting in the way.
|
||||
if(NOT DEFINED Boost_USE_STATIC_LIBS)
|
||||
@@ -28,8 +46,11 @@ if(NOT CGAL_INCLUDE_DIR)
|
||||
else()
|
||||
set(CGAL_Boost_USE_STATIC_LIBS "${Boost_USE_STATIC_LIBS}")
|
||||
endif()
|
||||
find_package(CGAL CONFIG REQUIRED)
|
||||
if(NOT CGAL_DIR)
|
||||
# Annoyingly this is producing CMP0167 boost warnings, because it's unsetting cmake policies
|
||||
# and using FindBoost module. But there's nothing we can do about it,
|
||||
# since everything happens in the scope of CGAL config. I guess it's be resolved in CGAL 6.1.0.
|
||||
find_package(CGAL CONFIG)
|
||||
if(NOT CGAL_FOUND)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"CGAL_SUPPORT enabled, but CGAL_INCLUDE_DIR wasn't provided and CGAL package couldn't be found."
|
||||
@@ -38,5 +59,10 @@ if(NOT CGAL_INCLUDE_DIR)
|
||||
message(STATUS "CGAL: found config at '${CGAL_DIR}'.")
|
||||
endif()
|
||||
|
||||
add_definitions(-DIFOPSH_WITH_CGAL)
|
||||
# Adding another `IFCOPENSHELL_CGAL` target, because we want to add compile definitions to it,
|
||||
# but in `CGALconfig.cmake` `CGAL::CGAL` is an alias, so you can't add properties to it.
|
||||
add_library(IFCOPENSHELL_CGAL INTERFACE)
|
||||
target_link_libraries(IFCOPENSHELL_CGAL INTERFACE CGAL::CGAL)
|
||||
target_compile_definitions(IFCOPENSHELL_CGAL INTERFACE IFOPSH_WITH_CGAL)
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DIFOPSH_WITH_CGAL)
|
||||
install(TARGETS IFCOPENSHELL_CGAL EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
@@ -19,13 +19,13 @@ UNIFY_ENVVARS_AND_CACHE(HDF5_LIBRARIES)
|
||||
# To avoid cyclic calls to this file
|
||||
list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
||||
|
||||
if("${HDF5_INCLUDE_DIR}" STREQUAL "")
|
||||
if(NOT HDF5_INCLUDE_DIR)
|
||||
message(STATUS "No HDF5 include directory specified")
|
||||
else()
|
||||
set(HDF5_INCLUDE_DIR "${HDF5_INCLUDE_DIR}" CACHE FILEPATH "HDF5 header files")
|
||||
endif()
|
||||
|
||||
if("${HDF5_LIBRARY_DIR}" STREQUAL "")
|
||||
if(NOT HDF5_LIBRARY_DIR)
|
||||
message(STATUS "No HDF5 library directory specified")
|
||||
else()
|
||||
set(HDF5_LIBRARY_DIR "${HDF5_LIBRARY_DIR}" CACHE FILEPATH "HDF5 library files")
|
||||
@@ -35,7 +35,7 @@ if(HDF5_LIBRARY_DIR)
|
||||
# result of the HDF5 ctest package
|
||||
# Find zlib using cmake find_library. How should this be implemented?
|
||||
# FIND_LIBRARY(NAMES z libz libz_debug PATHS ... NO_DEFAULT_PATH)
|
||||
if("$ENV{CONDA_BUILD}" STREQUAL "")
|
||||
if(NOT DEFINED ENV{CONDA_BUILD})
|
||||
# result of the HDF5 ctest package
|
||||
if(WIN32)
|
||||
set(zlib_post lib)
|
||||
@@ -55,7 +55,6 @@ if(HDF5_LIBRARY_DIR)
|
||||
"${HDF5_LIBRARY_DIR}/libsz${debug_postfix}.${lib_ext}"
|
||||
"${HDF5_LIBRARY_DIR}/libaec${debug_postfix}.${lib_ext}"
|
||||
)
|
||||
|
||||
else()
|
||||
message(STATUS "Packaging hdf5 and zlib for conda distribution")
|
||||
|
||||
@@ -86,6 +85,7 @@ endif()
|
||||
if(NOT HDF5_INCLUDE_DIR OR NOT HDF5_LIBRARY_DIR)
|
||||
# First try to find it as a config.
|
||||
find_package(HDF5 CONFIG)
|
||||
mark_as_advanced(HDF5_DIR)
|
||||
if(HDF5_DIR)
|
||||
message(STATUS "HDF5: found config at '${HDF5_DIR}'.")
|
||||
set(HDF5_LIBRARIES hdf5_cpp-static)
|
||||
|
||||
+15
-17
@@ -5,9 +5,8 @@
|
||||
# If input variables are not specified, try to find LibXml2 config.
|
||||
# Input variables could also be provided as environment variables.
|
||||
#
|
||||
# Output variables:
|
||||
# - `LIBXML2_INCLUDE_DIR`
|
||||
# - `LIBXML2_LIBRARIES`
|
||||
# Output targets:
|
||||
# - `LibXml2::LibXml2`
|
||||
#
|
||||
|
||||
# To avoid cyclic calls to this file
|
||||
@@ -27,22 +26,21 @@ if((NOT LIBXML2_INCLUDE_DIR AND NOT LIBXML2_LIBRARIES))
|
||||
else()
|
||||
message(STATUS "Found LibXml2 config: ${LibXml2_DIR}")
|
||||
endif()
|
||||
|
||||
if(TARGET LibXml2::LibXml2)
|
||||
# Config mode already gives us the target
|
||||
set(LIBXML2_LIBRARIES LibXml2::LibXml2)
|
||||
get_target_property(LIBXML2_INCLUDE_DIR LibXml2::LibXml2 INTERFACE_INCLUDE_DIRECTORIES)
|
||||
else()
|
||||
# Module mode (Ubuntu)
|
||||
set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES})
|
||||
set(LIBXML2_INCLUDE_DIR ${LibXml2_INCLUDE_DIRS})
|
||||
endif()
|
||||
else()
|
||||
find_package(LibXml2 REQUIRED)
|
||||
endif()
|
||||
|
||||
if(MSVC AND NOT LibXml2_DIR)
|
||||
add_debug_variants(LIBXML2_LIBRARIES "${LIBXML2_LIBRARIES}" d)
|
||||
if(MSVC)
|
||||
# Unset `IMPORTED_LOCATION` and set it manually.
|
||||
set_property(TARGET LibXml2::LibXml2 PROPERTY IMPORTED_LOCATION)
|
||||
get_release_variant(LIBXML2_RELEASE_LIB "${LIBXML2_LIBRARIES}" "d")
|
||||
get_debug_variant(LIBXML2_DEBUG_LIB "${LIBXML2_LIBRARIES}" "d")
|
||||
set_target_properties(
|
||||
LibXml2::LibXml2
|
||||
PROPERTIES
|
||||
IMPORTED_CONFIGURATIONS "Release;Debug"
|
||||
IMPORTED_LOCATION_RELEASE "${LIBXML2_RELEASE_LIB}"
|
||||
IMPORTED_LOCATION_DEBUG "${LIBXML2_DEBUG_LIB}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Restore module path.
|
||||
|
||||
+59
-23
@@ -22,7 +22,6 @@ if(OCC_LIBRARY_DIR)
|
||||
message(STATUS "Looking for Open CASCADE library files in: ${OCC_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
|
||||
if(NOT OCC_INCLUDE_DIR AND NOT OCC_LIBRARY_DIR)
|
||||
# OCE is not supported for find_package, because it's using a different name (`oce`)
|
||||
# and also has an odd directory structure (install/lib/oce-0.18/*.cmake).
|
||||
@@ -33,9 +32,22 @@ if(NOT OCC_INCLUDE_DIR AND NOT OCC_LIBRARY_DIR)
|
||||
# OpenCASCADE may be built with VTK support. Try to find VTK first to avoid
|
||||
# CMake errors when OpenCASCADE's config references VTK targets.
|
||||
find_package(VTK QUIET)
|
||||
mark_as_advanced(VTK_DIR)
|
||||
|
||||
find_package(OpenCASCADE CONFIG REQUIRED)
|
||||
mark_as_advanced(OpenCASCADE_DIR)
|
||||
message(STATUS "Found OpenCASCADE config: ${OpenCASCADE_DIR}")
|
||||
|
||||
if(OpenCASCADE_VERSION VERSION_LESS "7.7.0")
|
||||
# cmake configs < 7.7.0 were not adding include directories to targets automatically.
|
||||
set_target_properties(TKernel PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${OpenCASCADE_INCLUDE_DIR}")
|
||||
endif()
|
||||
|
||||
if(OpenCASCADE_VERSION VERSION_LESS "7.9.0" AND WIN32)
|
||||
# Bug in OCCT cmake configs < 7.9.0 - missing linked library.
|
||||
list(APPEND OpenCASCADE_LIBRARIES WSOCK32.lib)
|
||||
endif()
|
||||
|
||||
return()
|
||||
endif()
|
||||
|
||||
@@ -47,17 +59,11 @@ if(OCC_INCLUDE_DIR AND OCC_LIBRARY_DIR)
|
||||
"and OCC_LIBRARY_DIR ('${OCC_LIBRARY_DIR}')."
|
||||
)
|
||||
# Parse OCC_VERSION_STRING.
|
||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR
|
||||
REGEX "#define OCC_VERSION_MAJOR.*"
|
||||
)
|
||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAJOR REGEX "#define OCC_VERSION_MAJOR.*")
|
||||
string(REGEX MATCH "[0-9]+" OCC_MAJOR ${OCC_MAJOR})
|
||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR
|
||||
REGEX "#define OCC_VERSION_MINOR.*"
|
||||
)
|
||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MINOR REGEX "#define OCC_VERSION_MINOR.*")
|
||||
string(REGEX MATCH "[0-9]+" OCC_MINOR ${OCC_MINOR})
|
||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT
|
||||
REGEX "#define OCC_VERSION_MAINTENANCE.*"
|
||||
)
|
||||
file(STRINGS ${OCC_INCLUDE_DIR}/Standard_Version.hxx OCC_MAINT REGEX "#define OCC_VERSION_MAINTENANCE.*")
|
||||
string(REGEX MATCH "[0-9]+" OCC_MAINT ${OCC_MAINT})
|
||||
set(OCC_VERSION_STRING "${OCC_MAJOR}.${OCC_MINOR}.${OCC_MAINT}")
|
||||
else()
|
||||
@@ -71,17 +77,37 @@ else()
|
||||
)
|
||||
endif()
|
||||
|
||||
set(
|
||||
OpenCASCADE_LIBRARIES
|
||||
TKernel TKMath TKBRep TKGeomBase TKGeomAlgo TKG3d TKG2d TKShHealing TKTopAlgo TKMesh TKPrim TKBool TKBO
|
||||
TKFillet TKXSBase TKOffset TKHLR
|
||||
|
||||
set(OpenCASCADE_LIBRARIES
|
||||
TKernel
|
||||
TKMath
|
||||
TKBRep
|
||||
TKGeomBase
|
||||
TKGeomAlgo
|
||||
TKG3d
|
||||
TKG2d
|
||||
TKShHealing
|
||||
TKTopAlgo
|
||||
TKMesh
|
||||
TKPrim
|
||||
TKBool
|
||||
TKBO
|
||||
TKFillet
|
||||
TKXSBase
|
||||
TKOffset
|
||||
TKHLR
|
||||
# @todo investigate the exact conditions when this is necessary
|
||||
TKBin
|
||||
)
|
||||
|
||||
if(OCC_VERSION_STRING VERSION_LESS 7.8.0)
|
||||
list(APPEND OpenCASCADE_LIBRARIES TKIGES TKSTEPBase TKSTEPAttr TKSTEP209 TKSTEP)
|
||||
list(
|
||||
APPEND OpenCASCADE_LIBRARIES
|
||||
TKIGES
|
||||
TKSTEPBase
|
||||
TKSTEPAttr
|
||||
TKSTEP209
|
||||
TKSTEP
|
||||
)
|
||||
else(OCC_VERSION_STRING VERSION_LESS 7.8.0)
|
||||
list(APPEND OpenCASCADE_LIBRARIES TKDESTEP TKDEIGES)
|
||||
endif(OCC_VERSION_STRING VERSION_LESS 7.8.0)
|
||||
@@ -91,10 +117,7 @@ find_library(libTKernel NAMES TKernel TKerneld PATHS ${OCC_LIBRARY_DIR} NO_DEFAU
|
||||
if(libTKernel)
|
||||
message(STATUS "Required Open Cascade Library files found")
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Unable to find Open Cascade library files in OCC_LIBRARY_DIR ('${OCC_LIBRARY_DIR}'), aborting"
|
||||
)
|
||||
message(FATAL_ERROR "Unable to find Open Cascade library files in OCC_LIBRARY_DIR ('${OCC_LIBRARY_DIR}'), aborting")
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
@@ -123,9 +146,21 @@ if(OCCT_STATIC)
|
||||
# OpenCASCADE_LIBRARIES repeated N times below in order to fix cyclic dependencies
|
||||
# tfk: --start-group ... --end-group didn't work on the apple linker when last tested
|
||||
if(APPLE)
|
||||
set(OpenCASCADE_LIBRARIES ${OpenCASCADE_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${OpenCASCADE_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
|
||||
set(OpenCASCADE_LIBRARIES
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
else()
|
||||
set(OpenCASCADE_LIBRARIES -Wl,--start-group ${OpenCASCADE_LIBRARIES} -Wl,--end-group ${CMAKE_THREAD_LIBS_INIT})
|
||||
set(OpenCASCADE_LIBRARIES
|
||||
-Wl,--start-group
|
||||
${OpenCASCADE_LIBRARIES}
|
||||
-Wl,--end-group
|
||||
${CMAKE_THREAD_LIBS_INIT}
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@@ -137,8 +172,9 @@ if(OCCT_STATIC)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(OpenCASCADE_INTERFACE INTERFACE IMPORTED)
|
||||
add_library(OpenCASCADE_INTERFACE INTERFACE)
|
||||
target_include_directories(OpenCASCADE_INTERFACE INTERFACE "${OCC_INCLUDE_DIR}")
|
||||
target_link_libraries(OpenCASCADE_INTERFACE INTERFACE ${OpenCASCADE_LIBRARIES})
|
||||
target_link_directories(OpenCASCADE_INTERFACE INTERFACE "${OCC_LIBRARY_DIR}")
|
||||
set(OpenCASCADE_LIBRARIES OpenCASCADE_INTERFACE)
|
||||
install(TARGETS OpenCASCADE_INTERFACE EXPORT ${IFCOPENSHELL_EXPORT_TARGETS})
|
||||
|
||||
+40
-13
@@ -1,4 +1,3 @@
|
||||
|
||||
#
|
||||
# Input variables:
|
||||
# - `OPENCOLLADA_INCLUDE_DIR`
|
||||
@@ -21,6 +20,7 @@ if(NOT OPENCOLLADA_INCLUDE_DIR AND NOT OPENCOLLADA_LIBRARY_DIR)
|
||||
# If package is found, automatically sets
|
||||
# OPENCOLLADA_INCLUDE_DIRS and OPENCOLLADA_LIBRARIES (list of targets, not paths).
|
||||
find_package(OpenCOLLADA CONFIG)
|
||||
mark_as_advanced(OpenCOLLADA_DIR)
|
||||
if(OpenCOLLADA_DIR)
|
||||
message(STATUS "Found OpenCOLLADA: '${OpenCOLLADA_DIR}'.")
|
||||
set(OPENCOLLADA_FOUND TRUE)
|
||||
@@ -40,23 +40,37 @@ if(NOT OpenCOLLADA_DIR)
|
||||
|
||||
if("${OPENCOLLADA_LIBRARY_DIR}" STREQUAL "")
|
||||
message(STATUS "No OpenCOLLADA library directory specified")
|
||||
find_library(OPENCOLLADA_FRAMEWORK_LIB NAMES OpenCOLLADAFramework
|
||||
PATHS /usr/lib64/opencollada /usr/lib/opencollada /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib)
|
||||
find_library(
|
||||
OPENCOLLADA_FRAMEWORK_LIB
|
||||
NAMES OpenCOLLADAFramework
|
||||
PATHS /usr/lib64/opencollada /usr/lib/opencollada /usr/lib64 /usr/lib /usr/local/lib64 /usr/local/lib
|
||||
)
|
||||
get_filename_component(OPENCOLLADA_LIBRARY_DIR ${OPENCOLLADA_FRAMEWORK_LIB} PATH)
|
||||
endif()
|
||||
|
||||
find_library(OpenCOLLADAFramework NAMES OpenCOLLADAFramework OpenCOLLADAFrameworkd PATHS ${OPENCOLLADA_LIBRARY_DIR} NO_DEFAULT_PATH)
|
||||
find_library(
|
||||
OpenCOLLADAFramework
|
||||
NAMES OpenCOLLADAFramework OpenCOLLADAFrameworkd
|
||||
PATHS ${OPENCOLLADA_LIBRARY_DIR}
|
||||
NO_DEFAULT_PATH
|
||||
)
|
||||
|
||||
if(OpenCOLLADAFramework)
|
||||
message(STATUS "OpenCOLLADA library files found")
|
||||
else()
|
||||
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA libraries. "
|
||||
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA libraries. "
|
||||
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed."
|
||||
)
|
||||
endif()
|
||||
|
||||
set(OPENCOLLADA_LIBRARY_DIR "${OPENCOLLADA_LIBRARY_DIR}" CACHE FILEPATH "OpenCOLLADA library files")
|
||||
|
||||
set(OPENCOLLADA_INCLUDE_DIRS "${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils" "${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter")
|
||||
set(OPENCOLLADA_INCLUDE_DIRS
|
||||
"${OPENCOLLADA_INCLUDE_DIR}/COLLADABaseUtils"
|
||||
"${OPENCOLLADA_INCLUDE_DIR}/COLLADAStreamWriter"
|
||||
)
|
||||
|
||||
find_file(COLLADASWStreamWriter_h "COLLADASWStreamWriter.h" ${OPENCOLLADA_INCLUDE_DIRS})
|
||||
|
||||
@@ -65,8 +79,15 @@ if(NOT OpenCOLLADA_DIR)
|
||||
set(OPENCOLLADA_FOUND TRUE)
|
||||
|
||||
set(OPENCOLLADA_LIBRARY_NAMES
|
||||
GeneratedSaxParser MathMLSolver OpenCOLLADABaseUtils OpenCOLLADAFramework OpenCOLLADASaxFrameworkLoader
|
||||
OpenCOLLADAStreamWriter UTF buffer ftoa
|
||||
GeneratedSaxParser
|
||||
MathMLSolver
|
||||
OpenCOLLADABaseUtils
|
||||
OpenCOLLADAFramework
|
||||
OpenCOLLADASaxFrameworkLoader
|
||||
OpenCOLLADAStreamWriter
|
||||
UTF
|
||||
buffer
|
||||
ftoa
|
||||
)
|
||||
|
||||
# Use the found OpenCOLLADAFramework as a template for all other OpenCOLLADA libraries
|
||||
@@ -99,16 +120,22 @@ if(NOT OpenCOLLADA_DIR)
|
||||
list(APPEND OPENCOLLADA_LIBRARIES "${pcre_library}")
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find PCRE. "
|
||||
"Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed.")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"COLLADA_SUPPORT enabled, but unable to find PCRE. "
|
||||
"Disable COLLADA_SUPPORT or fix PCRE_LIBRARY_DIR path to proceed."
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
add_debug_variants(OPENCOLLADA_LIBRARIES "${OPENCOLLADA_LIBRARIES}" d)
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR "COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA headers. "
|
||||
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed.")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"COLLADA_SUPPORT enabled, but unable to find OpenCOLLADA headers. "
|
||||
"Disable COLLADA_SUPPORT or fix OpenCOLLADA paths to proceed."
|
||||
)
|
||||
endif()
|
||||
endif(NOT OpenCOLLADA_DIR)
|
||||
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Input variables:
|
||||
# - `PROJ_INCLUDE_DIR`
|
||||
# - `PROJ_LIBRARIES`
|
||||
# If input variables are not specified, try to find PROJ config.
|
||||
# Input variables could also be provided as environment variables.
|
||||
#
|
||||
# Output targets:
|
||||
# - `PROJ::proj`
|
||||
#
|
||||
|
||||
# To avoid cyclic calls to this file
|
||||
list(REMOVE_ITEM CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
||||
|
||||
UNIFY_ENVVARS_AND_CACHE(PROJ_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(PROJ_LIBRARIES)
|
||||
|
||||
if((NOT PROJ_INCLUDE_DIR AND NOT PROJ_LIBRARIES))
|
||||
find_package(PROJ QUIET CONFIG)
|
||||
|
||||
if(NOT PROJ_FOUND)
|
||||
find_path(PROJ_INCLUDE_DIR proj.h PATHS /usr/include/proj REQUIRED)
|
||||
if(PROJ_INCLUDE_DIR)
|
||||
message(STATUS "Found PROJ include files in: ${PROJ_INCLUDE_DIR}")
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find PROJ include directory, specify PROJ_INCLUDE_DIR manually.")
|
||||
endif()
|
||||
|
||||
find_library(PROJ_LIBRARY NAMES proj PATHS /usr/lib/x86_64-linux-gnu)
|
||||
if(PROJ_LIBRARY)
|
||||
message(STATUS "PROJ libraries ${PROJ_LIBRARY} found in: ${PROJ_LIBRARY_DIR}")
|
||||
set(PROJ_LIBRARIES ${PROJ_LIBRARY})
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find PROJ libraries in: ${PROJ_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
add_library(PROJ::proj INTERFACE IMPORTED)
|
||||
target_include_directories(PROJ::proj INTERFACE "${PROJ_INCLUDE_DIR}")
|
||||
target_link_libraries(PROJ::proj INTERFACE ${PROJ_LIBRARIES})
|
||||
target_link_directories(PROJ::proj INTERFACE "${PROJ_LIBRARY}")
|
||||
endif()
|
||||
else()
|
||||
find_library(PROJ_LIBRARY NAMES proj PATHS ${PROJ_LIBRARY_DIR})
|
||||
if(PROJ_LIBRARY)
|
||||
message(STATUS "PROJ libraries ${PROJ_LIBRARY} found in: ${PROJ_LIBRARY_DIR}")
|
||||
set(PROJ_LIBRARIES ${PROJ_LIBRARY})
|
||||
else()
|
||||
message(FATAL_ERROR "Unable to find PROJ libraries in: ${PROJ_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
set(PROJ_INCLUDE_DIR ${PROJ_INCLUDE_DIR} CACHE FILEPATH "PROJ header files")
|
||||
message(STATUS "Looking for PROJ include files in: ${PROJ_INCLUDE_DIR}")
|
||||
include_directories(${PROJ_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR})
|
||||
+56
-24
@@ -2,23 +2,33 @@
|
||||
# Input variables:
|
||||
# - `USD_INCLUDE_DIR`
|
||||
# - `USD_LIBRARY_DIR`
|
||||
# - `TBB_INCLUDE_DIR`
|
||||
# - `TBB_LIBRARY_DIR`
|
||||
# Input variables could also be provided as environment variables.
|
||||
# TODO: Try to find USD config if varibales are not provided.
|
||||
# TODO: does usd have a config file?
|
||||
# If `USD_INCLUDE_DIR` and `USD_LIBRARY_DIR` are not provided,
|
||||
# try to find USD by locating its config file.
|
||||
#
|
||||
# Output variables:
|
||||
# - `USD_LIBRARIES`
|
||||
# Output targets:
|
||||
# - `pxr::USD`
|
||||
|
||||
UNIFY_ENVVARS_AND_CACHE(USD_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(USD_LIBRARY_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(TBB_INCLUDE_DIR)
|
||||
UNIFY_ENVVARS_AND_CACHE(TBB_LIBRARY_DIR)
|
||||
|
||||
if("${USD_INCLUDE_DIR}" STREQUAL "")
|
||||
find_path(USD_INCLUDE_DIR pxr.h
|
||||
PATHS
|
||||
/usr/include/pxr
|
||||
/usr/local/include/pxr
|
||||
REQUIRED
|
||||
)
|
||||
if(NOT USD_LIBRARY_DIR AND NOT USD_INCLUDE_DIR)
|
||||
find_package(pxr CONFIG)
|
||||
if(pxr_FOUND)
|
||||
add_library(pxr::USD INTERFACE IMPORTED)
|
||||
target_link_libraries(pxr::USD INTERFACE ${PXR_LIBRARIES})
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(USD REQUIRED_VARS pxr_DIR)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT USD_INCLUDE_DIR)
|
||||
find_path(USD_INCLUDE_DIR pxr.h PATHS /usr/include/pxr /usr/local/include/pxr REQUIRED)
|
||||
if(USD_INCLUDE_DIR)
|
||||
message(STATUS "Found USD include files in: ${USD_INCLUDE_DIR}")
|
||||
else()
|
||||
@@ -30,19 +40,28 @@ else()
|
||||
endif()
|
||||
|
||||
set(USD_LIBRARIES
|
||||
usd_usd
|
||||
usd_usdGeom
|
||||
usd_usdShade
|
||||
usd_usdLux
|
||||
usd_vt
|
||||
usd_sdf
|
||||
usd_tf
|
||||
usd_gf
|
||||
)
|
||||
usd_usd
|
||||
usd_usdGeom
|
||||
usd_usdShade
|
||||
usd_usdLux
|
||||
usd_vt
|
||||
usd_sdf
|
||||
usd_tf
|
||||
usd_gf
|
||||
usd_kind
|
||||
usd_pcp
|
||||
usd_arch
|
||||
usd_ar
|
||||
usd_plug
|
||||
usd_js
|
||||
usd_sdr
|
||||
usd_work
|
||||
usd_trace
|
||||
usd_ndr
|
||||
usd_ts
|
||||
)
|
||||
|
||||
find_library(USD_LIBRARY
|
||||
NAMES ${USD_LIBRARIES}
|
||||
PATHS ${USD_LIBRARY_DIR})
|
||||
find_library(USD_LIBRARY NAMES ${USD_LIBRARIES} PATHS ${USD_LIBRARY_DIR})
|
||||
if(USD_LIBRARY)
|
||||
message(STATUS "USD libraries ${USD_LIBRARIES} found in: ${USD_LIBRARY_DIR}")
|
||||
link_directories(${USD_LIBRARY_DIR})
|
||||
@@ -50,5 +69,18 @@ else()
|
||||
message(FATAL_ERROR "Unable to find USD libraries in: ${USD_LIBRARY_DIR}")
|
||||
endif()
|
||||
|
||||
add_definitions(-DWITH_USD)
|
||||
add_library(pxr::USD INTERFACE IMPORTED)
|
||||
target_link_directories(pxr::USD INTERFACE ${USD_LIBRARY_DIR} ${TBB_LIBRARY_DIR})
|
||||
target_include_directories(pxr::USD INTERFACE ${USD_INCLUDE_DIR} ${TBB_INCLUDE_DIR})
|
||||
|
||||
# We don't link TBB libraries - on Windows they're provided using `pragma(lib)`.
|
||||
# On Unix there's no `pragma(lib)`, so in theory it will break.
|
||||
target_link_libraries(pxr::USD INTERFACE ${USD_LIBRARIES})
|
||||
|
||||
if(MSVC)
|
||||
target_link_libraries(pxr::USD INTERFACE debug DbgHelp.lib)
|
||||
endif()
|
||||
|
||||
target_compile_definitions(pxr::USD INTERFACE PXR_STATIC WITH_USD)
|
||||
|
||||
set(SWIG_DEFINES ${SWIG_DEFINES} -DWITH_USD)
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
#
|
||||
# Input variables:
|
||||
# - `JSON_INCLUDE_DIR`
|
||||
# If input variables are not specified, try to find nlohmann_json config.
|
||||
# Input variables could also be provided as environment variables.
|
||||
#
|
||||
# Output targets:
|
||||
# - `nlohmann_json::nlohmann_json`
|
||||
|
||||
UNIFY_ENVVARS_AND_CACHE(JSON_INCLUDE_DIR)
|
||||
|
||||
if(NOT JSON_INCLUDE_DIR)
|
||||
find_package(nlohmann_json CONFIG)
|
||||
mark_as_advanced(nlohmann_json)
|
||||
if(nlohmann_json_DIR)
|
||||
return()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
find_path(json_header_path "nlohmann/json.hpp" HINTS "${JSON_INCLUDE_DIR}")
|
||||
mark_as_advanced(json_header_path)
|
||||
|
||||
if(json_header_path)
|
||||
message(STATUS "JSON for Modern C++ header file found in '${json_header_path}'.")
|
||||
add_library(nlohmann_json::nlohmann_json INTERFACE IMPORTED)
|
||||
target_include_directories(nlohmann_json::nlohmann_json INTERFACE ${json_header_path})
|
||||
return()
|
||||
endif()
|
||||
|
||||
message(FATAL_ERROR "Unable to find JSON for Modern C++ header file / package, aborting")
|
||||
@@ -0,0 +1,59 @@
|
||||
@PACKAGE_INIT@
|
||||
|
||||
# Variable to inspect installed schema versions.
|
||||
set(IFCOPENSHELL_SCHEMA_VERSIONS @SCHEMA_VERSIONS@)
|
||||
|
||||
set(IFCOPENSHELL_WITH_OPENCASCADE @WITH_OPENCASCADE@)
|
||||
set(IFCOPENSHELL_WITH_CGAL @WITH_CGAL@)
|
||||
set(IFCOPENSHELL_IFCXML @IFCXML_SUPPORT@)
|
||||
set(IFCOPENSHELL_WITH_ROCKSDB @WITH_ROCKSDB@)
|
||||
|
||||
include(CMakeFindDependencyMacro)
|
||||
|
||||
set(Boost_USE_STATIC_LIBS ON)
|
||||
set(Boost_USE_STATIC_RUNTIME OFF)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(Boost_COMPONENTS system program_options regex thread date_time iostreams)
|
||||
find_dependency(Boost CONFIG COMPONENTS ${Boost_COMPONENTS})
|
||||
find_dependency(Eigen3 CONFIG)
|
||||
|
||||
if(IFCOPENSHELL_WITH_ROCKSDB)
|
||||
find_dependency(zstd CONFIG)
|
||||
|
||||
# Temporaily mess with CMAKE_FIND_PACKAGE_PREFER_CONFIG to help RocksDB
|
||||
# find it's zstd dependency on Windows.
|
||||
# Only do it on Windows, otherwise it might create problems as
|
||||
# findzstd and zstd-config target names do not match.
|
||||
# https://github.com/facebook/rocksdb/pull/13975
|
||||
if(WIN32)
|
||||
set(TEMP CMAKE_FIND_PACKAGE_PREFER_CONFIG)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
|
||||
endif()
|
||||
find_dependency(RocksDB CONFIG)
|
||||
if(WIN32)
|
||||
set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ${TEMP})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(IFCOPENSHELL_IFCXML)
|
||||
find_dependency(LibXml2 CONFIG)
|
||||
endif()
|
||||
|
||||
|
||||
if(IFCOPENSHELL_WITH_CGAL)
|
||||
find_dependency(CGAL CONFIG)
|
||||
endif()
|
||||
|
||||
if(IFCOPENSHELL_WITH_OPENCASCADE)
|
||||
find_dependency(OpenCASCADE CONFIG)
|
||||
if(OpenCASCADE_VERSION VERSION_LESS "7.7.0")
|
||||
# cmake configs < 7.7.0 were not adding include directories to targets automatically.
|
||||
set_target_properties(TKernel PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${OpenCASCADE_INCLUDE_DIR}"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/@CONFIG_TARGETS_FILENAME@")
|
||||
|
||||
check_required_components("@PROJECT_NAME@")
|
||||
@@ -0,0 +1,22 @@
|
||||
set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
|
||||
set(CONFIG_NAMESPACE "${PROJECT_NAME}")
|
||||
set(CONFIG_TARGETS_FILENAME ${PROJECT_NAME}Targets.cmake)
|
||||
set(CONFIG_VERSION_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake")
|
||||
set(CONFIG_PACKAGE_INPUT "${PROJECT_SOURCE_DIR}/${PROJECT_NAME}Config.cmake.in")
|
||||
set(CONFIG_PACKAGE_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake")
|
||||
|
||||
# Allow linking against build directory.
|
||||
export(EXPORT ${IFCOPENSHELL_EXPORT_TARGETS} FILE ${CONFIG_TARGETS_FILENAME} NAMESPACE ${CONFIG_NAMESPACE}::)
|
||||
|
||||
install(EXPORT ${IFCOPENSHELL_EXPORT_TARGETS} NAMESPACE ${CONFIG_NAMESPACE}:: DESTINATION "${CONFIG_PACKAGE_LOCATION}")
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(${CONFIG_VERSION_OUTPUT} COMPATIBILITY ExactVersion)
|
||||
|
||||
configure_package_config_file(
|
||||
${CONFIG_PACKAGE_INPUT}
|
||||
${CONFIG_PACKAGE_OUTPUT}
|
||||
INSTALL_DESTINATION ${CONFIG_PACKAGE_LOCATION}
|
||||
)
|
||||
|
||||
install(FILES "${CONFIG_PACKAGE_OUTPUT}" "${CONFIG_VERSION_OUTPUT}" DESTINATION ${CONFIG_PACKAGE_LOCATION})
|
||||
+26
-1
@@ -19,8 +19,9 @@
|
||||
|
||||
# Create a cache entry if absent for environment variables
|
||||
macro(UNIFY_ENVVARS_AND_CACHE VAR)
|
||||
if((NOT DEFINED ${VAR}) AND(NOT "$ENV{${VAR}}" STREQUAL ""))
|
||||
if(NOT DEFINED ${VAR} AND DEFINED ENV{${VAR}} AND NOT ENV{${VAR}} STREQUAL "")
|
||||
set(${VAR} "$ENV{${VAR}}" CACHE STRING "${VAR}" FORCE)
|
||||
mark_as_advanced(${VAR})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
@@ -113,6 +114,30 @@ function(add_debug_variants NAME LIBRARIES POSTFIX)
|
||||
set(${NAME} ${LIBRARIES} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# E.g.
|
||||
# - `get_release_variant(MYLIB "mylibd.lib" "d")` -> `MYLIB = "mylib.lib"`
|
||||
# - `get_release_variant(MYLIB "mylib.lib" "d")` -> `MYLIB = "mylib.lib"`
|
||||
function(get_release_variant NAME LIBRARY POSTFIX)
|
||||
set(RELEASE_SUFFIX ".lib")
|
||||
set(DEBUG_SUFFIX "${POSTFIX}${RELEASE_SUFFIX}")
|
||||
if("${LIBRARY}" MATCHES "${DEBUG_SUFFIX}$")
|
||||
string(REPLACE "${DEBUG_SUFFIX}" "${RELEASE_SUFFIX}" LIBRARY ${LIBRARY})
|
||||
endif()
|
||||
set(${NAME} "${LIBRARY}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# E.g.
|
||||
# - `get_debug_variant(MYLIB "mylib.lib" "d")` -> `MYLIB = "mylibd.lib"`
|
||||
# - `get_debug_variant(MYLIB "mylibd.lib" "d")` -> `MYLIB = "mylibd.lib"`
|
||||
function(get_debug_variant NAME LIBRARY POSTFIX)
|
||||
set(RELEASE_SUFFIX ".lib")
|
||||
set(DEBUG_SUFFIX "${POSTFIX}${RELEASE_SUFFIX}")
|
||||
if(NOT "${LIBRARY}" MATCHES "${DEBUG_SUFFIX}$" AND "${LIBRARY}" MATCHES "${RELEASE_SUFFIX}$")
|
||||
string(REPLACE "${RELEASE_SUFFIX}" "${DEBUG_SUFFIX}" LIBRARY ${LIBRARY})
|
||||
endif()
|
||||
set(${NAME} "${LIBRARY}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
function(files_for_ifc_version IFC_VERSION RESULT_NAME)
|
||||
set(IFC_PARSE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../src/ifcparse)
|
||||
set(${RESULT_NAME}
|
||||
|
||||
+2
-3
@@ -9,7 +9,6 @@ set LIBXML2="%LIBRARY_PREFIX%/lib/libxml2.lib"
|
||||
cmake -G "Ninja" ^
|
||||
-D SCHEMA_VERSIONS="2x3;4;4x1;4x3_add2" ^
|
||||
-D CMAKE_BUILD_TYPE:STRING=Release ^
|
||||
-D CMAKE_CXX_STANDARD=17 ^
|
||||
-D CMAKE_INSTALL_PREFIX:FILEPATH="%LIBRARY_PREFIX%" ^
|
||||
-D CMAKE_PREFIX_PATH:FILEPATH="%LIBRARY_PREFIX%" ^
|
||||
-D CMAKE_SYSTEM_PREFIX_PATH:FILEPATH="%LIBRARY_PREFIX%" ^
|
||||
@@ -43,7 +42,7 @@ cmake -G "Ninja" ^
|
||||
-D Boost_INCLUDE_DIR:FILEPATH="%LIBRARY_PREFIX%\include" ^
|
||||
-D Boost_USE_STATIC_LIBS:BOOL=OFF ^
|
||||
../cmake
|
||||
|
||||
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
ninja install -j 1
|
||||
@@ -52,4 +51,4 @@ if errorlevel 1 exit 1
|
||||
|
||||
python %RECIPE_DIR%/update_version_init.py %PKG_VERSION% %SP_DIR%/ifcopenshell/__init__.py
|
||||
|
||||
if errorlevel 1 exit 1
|
||||
if errorlevel 1 exit 1
|
||||
|
||||
@@ -16,7 +16,6 @@ cmake ${CMAKE_ARGS} -G Ninja \
|
||||
-DSCHEMA_VERSIONS="2x3;4;4x1;4x3_add2" \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_INSTALL_PREFIX=$PREFIX \
|
||||
-DCMAKE_CXX_STANDARD=17 \
|
||||
${CMAKE_PLATFORM_FLAGS[@]} \
|
||||
-DCMAKE_PREFIX_PATH=$PREFIX \
|
||||
-DCMAKE_SYSTEM_PREFIX_PATH=$PREFIX \
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import re
|
||||
import argparse
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def update_version(file_path: str, version: str) -> None:
|
||||
"""Update the version string in the given __init__.py file."""
|
||||
file_path = Path(file_path)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import textwrap
|
||||
|
||||
# The `extensions` list should already be in here from `sphinx-quickstart`
|
||||
extensions = [
|
||||
# there may be others here already, e.g. 'sphinx.ext.mathjax'
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
# This program requires doxygen, sphinx, breathe and exhale.
|
||||
|
||||
import multiprocessing
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import subprocess
|
||||
import multiprocessing
|
||||
import sys
|
||||
|
||||
# some extra check to see if we can find sphinx in pypy bin dir
|
||||
sphinx_build = os.path.join(os.path.dirname(sys.executable), 'sphinx-build')
|
||||
|
||||
+19
-36
@@ -56,8 +56,6 @@ Used environment variables:
|
||||
`SIDE_MODULE_CFLAGS`, `SIDE_MODULE_LDFLAGS`.
|
||||
Allows to build wasm without pyodide build environment, which can be useful for debugging build issues.
|
||||
Example value: 'pyodide/cpython/installs/python-3.13.2'
|
||||
- ``WASM_TOOLCHAIN_FILE`` - path to emscripten toolchain file from pyodide ('Emscripten.cmake')
|
||||
needed only if ``WASM_PYTHON_PATH`` is provided.
|
||||
- ``ADD_COMMIT_SHA`` - if defined with any non-empty value then
|
||||
`ADD_COMMIT_SHA` and `VERSION_OVERRIDE` will be set to `ON` while configuring IfcOpenShell
|
||||
|
||||
@@ -101,35 +99,36 @@ Used environment variables:
|
||||
|
||||
"""
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import glob
|
||||
import subprocess as sp
|
||||
import shutil
|
||||
import tarfile
|
||||
import logging
|
||||
import multiprocessing
|
||||
import os
|
||||
import platform
|
||||
import threading
|
||||
import sysconfig
|
||||
from datetime import datetime
|
||||
import re
|
||||
import shutil
|
||||
|
||||
# @todo temporary for expired mpfr.org certificate on 2023-04-08
|
||||
import ssl
|
||||
import subprocess as sp
|
||||
import sys
|
||||
import sysconfig
|
||||
import tarfile
|
||||
import threading
|
||||
from datetime import datetime
|
||||
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
|
||||
import time
|
||||
from urllib.request import urlretrieve
|
||||
from collections.abc import Generator, Sequence
|
||||
from pathlib import Path
|
||||
from urllib.request import urlretrieve
|
||||
|
||||
try:
|
||||
from typing import Union, Literal
|
||||
from typing import Literal, Union
|
||||
except:
|
||||
# python 3.6 compatibility for rocky 8
|
||||
from typing import Union
|
||||
|
||||
from typing_extensions import Literal
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -141,7 +140,7 @@ PROJECT_NAME = "IfcOpenShell"
|
||||
USE_CURRENT_PYTHON_VERSION = os.getenv("USE_CURRENT_PYTHON_VERSION")
|
||||
ADD_COMMIT_SHA = os.getenv("ADD_COMMIT_SHA")
|
||||
|
||||
PYTHON_VERSIONS = ["3.9.11", "3.10.3", "3.11.8", "3.12.1", "3.13.6", "3.14.0"]
|
||||
PYTHON_VERSIONS = ["3.10.3", "3.11.8", "3.12.1", "3.13.6", "3.14.0"]
|
||||
JSON_VERSION = "3.11.3"
|
||||
OCE_VERSION = "0.18.3"
|
||||
OCCT_VERSION = "7.8.1"
|
||||
@@ -350,14 +349,13 @@ dependency_tree: "dict[str, tuple[str, ...]]" = {
|
||||
"boost": (),
|
||||
"libxml2": (),
|
||||
"python": (),
|
||||
"occ": ("freetype",),
|
||||
"occ": (),
|
||||
"pcre": (),
|
||||
"pcre2": (),
|
||||
"json": (),
|
||||
"hdf5": (),
|
||||
"cgal": (),
|
||||
"eigen": (),
|
||||
"freetype": (),
|
||||
"rocksdb": ("zstd",),
|
||||
"zstd": (),
|
||||
# 'usd': ('boost', 'oneTBB')
|
||||
@@ -407,8 +405,6 @@ if any(f.startswith("py-") for f in flags):
|
||||
if any(f.startswith("occt-") for f in flags):
|
||||
OCCT_VERSION = next(f.split("-", 1)[1] for f in flags if f.startswith("occt-"))
|
||||
|
||||
print(OCCT_VERSION)
|
||||
|
||||
if explicit_targets:
|
||||
targets = {dep for target in explicit_targets for dep in gather_dependencies(target)}
|
||||
else:
|
||||
@@ -954,17 +950,6 @@ if "swig" in targets:
|
||||
revision=f"v{SWIG_VERSION}",
|
||||
)
|
||||
|
||||
if "freetype" in targets:
|
||||
build_dependency(
|
||||
name=f"freetype",
|
||||
mode="cmake",
|
||||
build_tool_args=[f"-DCMAKE_INSTALL_PREFIX={DEPS_DIR}/install/freetype"],
|
||||
download_url="https://github.com/freetype/freetype",
|
||||
download_name="freetype2",
|
||||
download_tool=download_tool_git,
|
||||
revision="VER-2-14-0",
|
||||
)
|
||||
|
||||
if USE_OCCT and "occ" in targets:
|
||||
patches = []
|
||||
if OCCT_VERSION < "7.4":
|
||||
@@ -999,7 +984,6 @@ if USE_OCCT and "occ" in targets:
|
||||
f"-DUSE_FREETYPE=OFF",
|
||||
f"-DUSE_OPENGL=OFF",
|
||||
f"-DUSE_GLES2=OFF",
|
||||
f"-D3RDPARTY_FREETYPE_DIR={DEPS_DIR}/install/freetype",
|
||||
f"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
|
||||
*MAC_CROSS_COMPILE_INTEL_ARGS,
|
||||
],
|
||||
@@ -1334,7 +1318,6 @@ os.makedirs(executables_dir, exist_ok=True)
|
||||
|
||||
|
||||
cmake_args = [
|
||||
"-DCMAKE_CXX_STANDARD=17",
|
||||
"-DUSE_MMAP=OFF",
|
||||
"-DBUILD_EXAMPLES=OFF",
|
||||
"-DBUILD_SHARED_LIBS=" + OFF_ON[not BUILD_STATIC],
|
||||
@@ -1409,11 +1392,11 @@ else:
|
||||
cmake_args.append("-DHDF5_SUPPORT=Off")
|
||||
|
||||
if "usd" in targets:
|
||||
cmake_args.extend(
|
||||
cmake_args.append("-DUSD_SUPPORT=ON")
|
||||
cmake_args_prefix_path.extend(
|
||||
[
|
||||
f"-DUSD_SUPPORT=" "On",
|
||||
f"-DUSD_INCLUDE_DIR={DEPS_DIR}/install/usd-{USD_VERSION}/include",
|
||||
f"-DUSD_LIBRARY_DIR={DEPS_DIR}/install/usd-{USD_VERSION}/lib",
|
||||
f"{DEPS_DIR}/install/tbb-{TBB_VERSION}",
|
||||
f"{DEPS_DIR}/install/usd-{USD_VERSION}",
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -8,12 +8,11 @@ or unpacks existing archives.
|
||||
Usage: python cache_dependencies.py [pack|unpack]
|
||||
"""
|
||||
|
||||
import tarfile
|
||||
import sys
|
||||
import tarfile
|
||||
from pathlib import Path
|
||||
from typing import Literal
|
||||
|
||||
|
||||
CACHE_PREFIX = "cache-"
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
WHEEL_FILENAME = next(
|
||||
p.name for p in (Path.cwd() / "pyodide").iterdir() if p.name.startswith("ifcopenshell-") and p.suffix == ".whl"
|
||||
)
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
[project]
|
||||
name = "IfcOpenShell"
|
||||
version = "0.0.0"
|
||||
dependencies = [
|
||||
"black==25.12",
|
||||
"ruff==0.14.10",
|
||||
"poethepoet",
|
||||
"gersemi==0.24",
|
||||
]
|
||||
|
||||
[tool.black]
|
||||
line-length = 120
|
||||
include = '''
|
||||
@@ -47,6 +57,7 @@ select = [
|
||||
"UP", # pyupgrade
|
||||
"RUF015", # next() > list_comprehension[0]
|
||||
"RUF022", # sort __all__
|
||||
"I", # import sorting
|
||||
]
|
||||
ignore = [
|
||||
"FA100", # Conflicts with Blender using annotations for props definitions.
|
||||
@@ -70,3 +81,5 @@ ruff.sequence = ["ruff-main", "ruff-old"]
|
||||
black = "black ."
|
||||
|
||||
format.sequence = ["black", "ruff-main", "ruff-old"]
|
||||
|
||||
cmake-format = "gersemi cmake src --in-place"
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
from dataclasses import fields
|
||||
from typing import NamedTuple, Union
|
||||
|
||||
import bcf.v2.model.extensions
|
||||
import bcf.v3.model.extensions
|
||||
from typing import NamedTuple, Union
|
||||
from dataclasses import fields
|
||||
|
||||
|
||||
class AttributeData(NamedTuple):
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from typing import Union
|
||||
|
||||
import bcf.v2.model
|
||||
import bcf.v3.model
|
||||
from typing import Union
|
||||
|
||||
BimSnippet = Union[bcf.v2.model.BimSnippet, bcf.v3.model.BimSnippet]
|
||||
BitMap = Union[bcf.v2.model.VisualizationInfoBitmap, bcf.v3.model.Bitmap]
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
from typing import Optional, Union
|
||||
|
||||
import bcf.agnostic.model as mdl
|
||||
import bcf.v2.bcfxml
|
||||
import bcf.v2.model
|
||||
import bcf.v2.topic
|
||||
import bcf.v3.bcfxml
|
||||
import bcf.v3.model
|
||||
import bcf.v3.topic
|
||||
import bcf.agnostic.model as mdl
|
||||
from pathlib import Path
|
||||
from typing import Union, Optional
|
||||
from typing_extensions import assert_never
|
||||
|
||||
TopicHandler = Union[bcf.v2.topic.TopicHandler, bcf.v3.topic.TopicHandler]
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import bcf.v2.visinfo
|
||||
import bcf.v3.visinfo
|
||||
from typing import Union
|
||||
|
||||
import bcf.v2.visinfo
|
||||
import bcf.v3.visinfo
|
||||
|
||||
VisualizationInfoHandler = Union[bcf.v2.visinfo.VisualizationInfoHandler, bcf.v3.visinfo.VisualizationInfoHandler]
|
||||
|
||||
@@ -29,7 +29,6 @@ from bcf.v3.bcfxml import BcfXml as BcfXml3
|
||||
from bcf.v3.model import Version as Version3
|
||||
from bcf.xml_parser import AbstractXmlParserSerializer, XmlParserSerializer
|
||||
|
||||
|
||||
BcfXml = Union[BcfXml2, BcfXml3]
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ original idea from https://stackoverflow.com/a/19722365/1307905
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import zipfile
|
||||
from io import BytesIO
|
||||
from os import PathLike
|
||||
@@ -26,7 +27,7 @@ class InMemoryZipFile:
|
||||
self._file_name: Optional[str | Path] = str(file_name) if hasattr(file_name, "_from_parts") else file_name
|
||||
self.in_memory_data = BytesIO()
|
||||
# Create the in-memory zipfile
|
||||
self.in_memory_zip = zipfile.ZipFile(self.in_memory_data, "w", compression, False)
|
||||
self.in_memory_zip = zipfile.ZipFile(self.in_memory_data, "w", compression, True)
|
||||
self.in_memory_zip.debug = debug
|
||||
|
||||
def writestr(self, filename_in_zip: str | zipfile.ZipInfo, file_contents: bytes | str) -> None:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""BCF XML V2 handler."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
import warnings
|
||||
import zipfile
|
||||
|
||||
@@ -14,15 +14,11 @@
|
||||
# Currently extensions support for v2 is only read-only.
|
||||
|
||||
|
||||
import sys
|
||||
from dataclasses import dataclass, field, fields
|
||||
from typing import Optional
|
||||
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsPriorities:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -39,7 +35,7 @@ class ExtensionsPriorities:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsSnippetTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -56,7 +52,7 @@ class ExtensionsSnippetTypes:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsStages:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -73,7 +69,7 @@ class ExtensionsStages:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsTopicLabels:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -90,7 +86,7 @@ class ExtensionsTopicLabels:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsTopicStatuses:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -107,7 +103,7 @@ class ExtensionsTopicStatuses:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsTopicTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -124,7 +120,7 @@ class ExtensionsTopicTypes:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsUsers:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -141,7 +137,7 @@ class ExtensionsUsers:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Extensions:
|
||||
topic_types: Optional[ExtensionsTopicTypes] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class BimSnippet:
|
||||
reference: str = field(
|
||||
metadata={
|
||||
@@ -41,7 +38,7 @@ class BimSnippet:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class CommentViewpoint:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -56,7 +53,7 @@ class CommentViewpoint:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class HeaderFile:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -112,7 +109,7 @@ class HeaderFile:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicDocumentReference:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -150,7 +147,7 @@ class TopicDocumentReference:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicRelatedTopic:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -165,7 +162,7 @@ class TopicRelatedTopic:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ViewPoint:
|
||||
viewpoint: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -201,7 +198,7 @@ class ViewPoint:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Comment:
|
||||
date: XmlDateTime = field(
|
||||
metadata={
|
||||
@@ -261,7 +258,7 @@ class Comment:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Header:
|
||||
file: list[HeaderFile] = field(
|
||||
default_factory=list,
|
||||
@@ -274,7 +271,7 @@ class Header:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Topic:
|
||||
reference_link: list[str] = field(
|
||||
default_factory=list,
|
||||
@@ -428,7 +425,7 @@ class Topic:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Markup:
|
||||
header: Optional[Header] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Project:
|
||||
name: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -24,7 +21,7 @@ class Project:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ProjectExtension:
|
||||
project: Optional[Project] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Version:
|
||||
detailed_version: Optional[str] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
class BitmapFormat(Enum):
|
||||
PNG = "PNG"
|
||||
JPG = "JPG"
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Component:
|
||||
originating_system: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -38,7 +35,7 @@ class Component:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Direction:
|
||||
x: float = field(
|
||||
metadata={
|
||||
@@ -63,7 +60,7 @@ class Direction:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Point:
|
||||
x: float = field(
|
||||
metadata={
|
||||
@@ -88,7 +85,7 @@ class Point:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ViewSetupHints:
|
||||
spaces_visible: Optional[bool] = field(
|
||||
default=None,
|
||||
@@ -113,7 +110,7 @@ class ViewSetupHints:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ClippingPlane:
|
||||
location: Point = field(
|
||||
metadata={
|
||||
@@ -131,7 +128,7 @@ class ClippingPlane:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentColoringColor:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -154,7 +151,7 @@ class ComponentColoringColor:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentSelection:
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
@@ -166,7 +163,7 @@ class ComponentSelection:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentVisibilityExceptions:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -181,7 +178,7 @@ class ComponentVisibilityExceptions:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Line:
|
||||
start_point: Point = field(
|
||||
metadata={
|
||||
@@ -199,7 +196,7 @@ class Line:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class OrthogonalCamera:
|
||||
"""
|
||||
Attributes
|
||||
@@ -239,7 +236,7 @@ class OrthogonalCamera:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class PerspectiveCamera:
|
||||
"""
|
||||
Attributes
|
||||
@@ -284,7 +281,7 @@ class PerspectiveCamera:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfoBitmap:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -333,7 +330,7 @@ class VisualizationInfoBitmap:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentColoring:
|
||||
color: list[ComponentColoringColor] = field(
|
||||
default_factory=list,
|
||||
@@ -345,7 +342,7 @@ class ComponentColoring:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentVisibility:
|
||||
exceptions: Optional[ComponentVisibilityExceptions] = field(
|
||||
default=None,
|
||||
@@ -363,7 +360,7 @@ class ComponentVisibility:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfoClippingPlanes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -377,7 +374,7 @@ class VisualizationInfoClippingPlanes:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfoLines:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -392,7 +389,7 @@ class VisualizationInfoLines:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Components:
|
||||
view_setup_hints: Optional[ViewSetupHints] = field(
|
||||
default=None,
|
||||
@@ -424,7 +421,7 @@ class Components:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfo:
|
||||
"""
|
||||
VisualizationInfo documentation.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""BCF XML V2 Topic handler."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import tempfile
|
||||
import uuid
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import uuid
|
||||
import zipfile
|
||||
from typing import Any, Optional, Literal, Union
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Literal, Optional, Union
|
||||
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.unit
|
||||
import numpy as np
|
||||
from ifcopenshell import entity_instance
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.placement
|
||||
from numpy.typing import NDArray
|
||||
|
||||
import bcf.v2.model as mdl
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""BCF XML V3 handlers."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import uuid
|
||||
import warnings
|
||||
import zipfile
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Document:
|
||||
filename: str = field(
|
||||
metadata={
|
||||
@@ -37,7 +34,7 @@ class Document:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class DocumentInfoDocuments:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -52,7 +49,7 @@ class DocumentInfoDocuments:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class DocumentInfo:
|
||||
documents: Optional[DocumentInfoDocuments] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsPriorities:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -22,7 +19,7 @@ class ExtensionsPriorities:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsSnippetTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -39,7 +36,7 @@ class ExtensionsSnippetTypes:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsStages:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -56,7 +53,7 @@ class ExtensionsStages:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsTopicLabels:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -73,7 +70,7 @@ class ExtensionsTopicLabels:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsTopicStatuses:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -90,7 +87,7 @@ class ExtensionsTopicStatuses:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsTopicTypes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -107,7 +104,7 @@ class ExtensionsTopicTypes:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ExtensionsUsers:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -124,7 +121,7 @@ class ExtensionsUsers:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Extensions:
|
||||
topic_types: Optional[ExtensionsTopicTypes] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class BimSnippet:
|
||||
reference: str = field(
|
||||
metadata={
|
||||
@@ -47,7 +44,7 @@ class BimSnippet:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class CommentViewpoint:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -62,7 +59,7 @@ class CommentViewpoint:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class DocumentReference:
|
||||
document_guid: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -103,7 +100,7 @@ class DocumentReference:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class File:
|
||||
filename: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -160,7 +157,7 @@ class File:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicLabels:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -177,7 +174,7 @@ class TopicLabels:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicReferenceLinks:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -194,7 +191,7 @@ class TopicReferenceLinks:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicRelatedTopicsRelatedTopic:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -209,7 +206,7 @@ class TopicRelatedTopicsRelatedTopic:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ViewPoint:
|
||||
viewpoint: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -249,7 +246,7 @@ class ViewPoint:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Comment:
|
||||
date: XmlDateTime = field(
|
||||
metadata={
|
||||
@@ -315,7 +312,7 @@ class Comment:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class HeaderFiles:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -330,7 +327,7 @@ class HeaderFiles:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicDocumentReferences:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -345,7 +342,7 @@ class TopicDocumentReferences:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicRelatedTopics:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -360,7 +357,7 @@ class TopicRelatedTopics:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicViewpoints:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -375,7 +372,7 @@ class TopicViewpoints:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Header:
|
||||
files: Optional[HeaderFiles] = field(
|
||||
default=None,
|
||||
@@ -387,7 +384,7 @@ class Header:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class TopicComments:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -402,7 +399,7 @@ class TopicComments:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Topic:
|
||||
reference_links: Optional[TopicReferenceLinks] = field(
|
||||
default=None,
|
||||
@@ -599,7 +596,7 @@ class Topic:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Markup:
|
||||
header: Optional[Header] = field(
|
||||
default=None,
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from typing import Optional
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Project:
|
||||
name: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -28,7 +25,7 @@ class Project:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ProjectInfo:
|
||||
project: Project = field(
|
||||
metadata={
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Version:
|
||||
version_id: str = field(
|
||||
metadata={
|
||||
|
||||
@@ -1,18 +1,14 @@
|
||||
import sys
|
||||
from dataclasses import dataclass, field
|
||||
from enum import Enum
|
||||
from typing import Optional
|
||||
|
||||
|
||||
DATACLASS_KWARGS = {} if sys.version_info < (3, 10) else {"slots": True, "kw_only": True}
|
||||
|
||||
|
||||
class BitmapFormat(Enum):
|
||||
PNG = "png"
|
||||
JPG = "jpg"
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Component:
|
||||
originating_system: Optional[str] = field(
|
||||
default=None,
|
||||
@@ -43,7 +39,7 @@ class Component:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Direction:
|
||||
x: float = field(
|
||||
metadata={
|
||||
@@ -68,7 +64,7 @@ class Direction:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Point:
|
||||
x: float = field(
|
||||
metadata={
|
||||
@@ -93,7 +89,7 @@ class Point:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ViewSetupHints:
|
||||
spaces_visible: bool = field(
|
||||
default=False,
|
||||
@@ -118,7 +114,7 @@ class ViewSetupHints:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Bitmap:
|
||||
format: BitmapFormat = field(
|
||||
metadata={
|
||||
@@ -166,7 +162,7 @@ class Bitmap:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ClippingPlane:
|
||||
location: Point = field(
|
||||
metadata={
|
||||
@@ -184,7 +180,7 @@ class ClippingPlane:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentColoringColorComponents:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -199,7 +195,7 @@ class ComponentColoringColorComponents:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentSelection:
|
||||
component: list[Component] = field(
|
||||
default_factory=list,
|
||||
@@ -210,7 +206,7 @@ class ComponentSelection:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentVisibilityExceptions:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -224,7 +220,7 @@ class ComponentVisibilityExceptions:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Line:
|
||||
start_point: Point = field(
|
||||
metadata={
|
||||
@@ -242,7 +238,7 @@ class Line:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class OrthogonalCamera:
|
||||
"""
|
||||
Attributes
|
||||
@@ -292,7 +288,7 @@ class OrthogonalCamera:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class PerspectiveCamera:
|
||||
"""
|
||||
Attributes
|
||||
@@ -348,7 +344,7 @@ class PerspectiveCamera:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentColoringColor:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -370,7 +366,7 @@ class ComponentColoringColor:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentVisibility:
|
||||
view_setup_hints: Optional[ViewSetupHints] = field(
|
||||
default=None,
|
||||
@@ -395,7 +391,7 @@ class ComponentVisibility:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfoBitmaps:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -409,7 +405,7 @@ class VisualizationInfoBitmaps:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfoClippingPlanes:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -423,7 +419,7 @@ class VisualizationInfoClippingPlanes:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfoLines:
|
||||
class Meta:
|
||||
global_type = False
|
||||
@@ -437,7 +433,7 @@ class VisualizationInfoLines:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class ComponentColoring:
|
||||
color: list[ComponentColoringColor] = field(
|
||||
default_factory=list,
|
||||
@@ -448,7 +444,7 @@ class ComponentColoring:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class Components:
|
||||
selection: Optional[ComponentSelection] = field(
|
||||
default=None,
|
||||
@@ -473,7 +469,7 @@ class Components:
|
||||
)
|
||||
|
||||
|
||||
@dataclass(**DATACLASS_KWARGS)
|
||||
@dataclass(slots=True, kw_only=True)
|
||||
class VisualizationInfo:
|
||||
"""
|
||||
VisualizationInfo documentation.
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
"""BCF XML V3 Topic handler."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import datetime
|
||||
import uuid
|
||||
import zipfile
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
import uuid
|
||||
import zipfile
|
||||
from typing import Any, Optional, Literal, Union
|
||||
from collections.abc import Iterable
|
||||
from typing import Any, Literal, Optional, Union
|
||||
|
||||
import ifcopenshell.util.placement
|
||||
import ifcopenshell.util.unit
|
||||
import numpy as np
|
||||
from ifcopenshell import entity_instance
|
||||
import ifcopenshell.util.unit
|
||||
import ifcopenshell.util.placement
|
||||
from numpy.typing import NDArray
|
||||
|
||||
import bcf.v3.model as mdl
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import pytest
|
||||
|
||||
from bcf.xml_parser import XmlParserSerializer
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ import uuid
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
import pytest
|
||||
|
||||
import bcf.v2.model as mdl
|
||||
import pytest
|
||||
from bcf.v2.bcfxml import BcfXml
|
||||
from bcf.v2.topic import TopicHandler
|
||||
from bcf.v2.visinfo import (
|
||||
|
||||
@@ -3,11 +3,10 @@ import os
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
import bcf.v2.model as mdl
|
||||
from bcf.v2.bcfxml import BcfXml
|
||||
from bcf.v2.topic import TopicHandler
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
|
||||
def test_maximum_information() -> None:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from bcf.v2.bcfxml import BcfXml
|
||||
|
||||
|
||||
|
||||
@@ -4,9 +4,8 @@ import uuid
|
||||
from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
import pytest
|
||||
|
||||
import bcf.v3.model as mdl
|
||||
import pytest
|
||||
from bcf.v3.bcfxml import BcfXml
|
||||
from bcf.v3.topic import TopicHandler
|
||||
from bcf.v3.visinfo import (
|
||||
|
||||
@@ -3,11 +3,10 @@ import os
|
||||
import zipfile
|
||||
from pathlib import Path
|
||||
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
import bcf.v3.model as mdl
|
||||
from bcf.v3.bcfxml import BcfXml
|
||||
from bcf.v3.topic import TopicHandler
|
||||
from xsdata.models.datatype import XmlDateTime
|
||||
|
||||
|
||||
def test_doc_ref_internal() -> None:
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import numpy as np
|
||||
import pytest
|
||||
|
||||
from bcf.v3.bcfxml import BcfXml
|
||||
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import bpy
|
||||
import bpy.utils.previews
|
||||
import importlib
|
||||
from bpy_extras.io_utils import ImportHelper, ExportHelper
|
||||
from . import handler, ui, prop, operator, gizmo
|
||||
from . import handler, ui, prop, operator
|
||||
from typing import Union
|
||||
from collections.abc import Callable
|
||||
|
||||
@@ -120,6 +120,7 @@ classes = [
|
||||
operator.OpenUri,
|
||||
operator.ReloadIfcFile,
|
||||
operator.RevertClippingPlaneCut,
|
||||
operator.SaveBlendMetadataFile,
|
||||
operator.SelectDir,
|
||||
operator.SelectIfcFile,
|
||||
operator.SelectURIAttribute,
|
||||
@@ -129,12 +130,21 @@ classes = [
|
||||
prop.StrProperty,
|
||||
operator.BIM_OT_enum_property_search, # /!\ Register AFTER prop.StrProperty
|
||||
operator.BIM_OT_attribute_search_values,
|
||||
operator.BIM_UL_tab_panels,
|
||||
operator.BIM_OT_toggle_panel_visibility,
|
||||
operator.BIM_OT_bookmark_panel,
|
||||
operator.BIM_OT_manage_tab_panels,
|
||||
operator.BIM_OT_manage_tab_visibility,
|
||||
operator.BIM_OT_toggle_tab_visibility,
|
||||
operator.BIM_OT_reset_ui_layout,
|
||||
prop.ObjProperty,
|
||||
prop.MultipleFileSelect,
|
||||
prop.Attribute,
|
||||
prop.ISODuration,
|
||||
prop.BIMAreaProperties,
|
||||
prop.BIMTabProperties,
|
||||
prop.BIMTabVisibility, # Must be registered before BIMProperties
|
||||
prop.BIMPanelProperties, # Must be registered before BIMProperties
|
||||
prop.BIMProperties,
|
||||
prop.IfcParameter,
|
||||
prop.PsetQto,
|
||||
@@ -206,19 +216,6 @@ classes = [
|
||||
ui.BIM_PT_section_with_cappings,
|
||||
ui.BIM_PT_decorators_overlay,
|
||||
ui.BIM_PT_snappping,
|
||||
# Gizmos
|
||||
gizmo.BIM_OT_gizmo_value_input,
|
||||
gizmo.GizmoArrow,
|
||||
gizmo.GizmoArrow2D,
|
||||
gizmo.GizmoCone,
|
||||
gizmo.GizmoLock,
|
||||
gizmo.GizmoArc,
|
||||
gizmo.GizmoPen,
|
||||
gizmo.GizmoValidate,
|
||||
gizmo.GizmoCancel,
|
||||
gizmo.GizmoPlus,
|
||||
gizmo.GizmoMinus,
|
||||
gizmo.GizmoCycle,
|
||||
]
|
||||
|
||||
for mod in modules.values():
|
||||
@@ -285,6 +282,7 @@ def register():
|
||||
bpy.types.Curve.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
|
||||
bpy.types.Camera.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
|
||||
bpy.types.PointLight.BIMMeshProperties = bpy.props.PointerProperty(type=prop.BIMMeshProperties)
|
||||
|
||||
if hasattr(bpy.types, "UI_MT_button_context_menu"):
|
||||
bpy.types.UI_MT_button_context_menu.append(ui.draw_custom_context_menu)
|
||||
bpy.types.STATUSBAR_HT_header.append(ui.draw_statusbar)
|
||||
@@ -320,6 +318,10 @@ def register():
|
||||
# RestrictedContext doesn't allow accessing scene attribute, postpone it for a bit.
|
||||
bpy.app.timers.register(tool.Blender.setup_user_data_dir, first_interval=0.1)
|
||||
|
||||
bpy.types.Scene.active_tab_name = bpy.props.StringProperty()
|
||||
bpy.types.Scene.tab_panels = bpy.props.CollectionProperty(type=bpy.types.PropertyGroup)
|
||||
bpy.types.Scene.active_tab_panel_index = bpy.props.IntProperty()
|
||||
|
||||
|
||||
def unregister():
|
||||
global icons
|
||||
@@ -361,3 +363,7 @@ def unregister():
|
||||
tool.Blender.remove_scene_panel_override(panel)
|
||||
|
||||
bpy.app.translations.unregister("bonsai")
|
||||
|
||||
del bpy.types.Scene.active_tab_name
|
||||
del bpy.types.Scene.tab_panels
|
||||
del bpy.types.Scene.active_tab_panel_index
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
|
||||
* { stroke-linecap: round; stroke-linejoin: round; }
|
||||
text, tspan { /* 2.5mm */ fill: black; stroke: none; font-family: 'OpenGost Type B TT', 'DejaVu Sans Condensed', 'Liberation Sans', 'Arial Narrow', 'Arial'; font-size: 4.13px; }
|
||||
a text, a tspan { fill: blue !important; text-decoration: underline;}
|
||||
a:hover { cursor: pointer; }
|
||||
.cut { fill: black; stroke: black; stroke-linecap: 'round'; stroke-width: 0.35; fill-rule: evenodd; }
|
||||
.projection { fill: white; stroke: black; stroke-linecap: 'round'; stroke-width: 0.25; }
|
||||
.surface { stroke: none; fill: #fff; fill-rule: evenodd; }
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -428,7 +428,11 @@ def get_enum_items(
|
||||
else:
|
||||
annotations_data = data
|
||||
|
||||
prop = annotations_data.__annotations__[prop_name]
|
||||
try:
|
||||
annotations = annotations_data.__annotations__
|
||||
except AttributeError:
|
||||
annotations = type(annotations_data).__annotations__
|
||||
prop = annotations[prop_name]
|
||||
items = prop.keywords.get("items")
|
||||
if items is None:
|
||||
return
|
||||
@@ -498,6 +502,8 @@ def draw_filter(
|
||||
if data.data["saved_searches"]:
|
||||
row.operator("bim.load_search", text="", icon="IMPORT").module = module
|
||||
row.operator("bim.save_search", text="", icon="EXPORT").module = module
|
||||
if data.data["saved_searches"]:
|
||||
row.operator("bim.remove_search", text="", icon="REMOVE").module = module
|
||||
if module != "search":
|
||||
if module == "drawing_include":
|
||||
row.operator("bim.edit_element_filter", icon="CHECKMARK", text="").filter_mode = "INCLUDE"
|
||||
@@ -505,8 +511,17 @@ def draw_filter(
|
||||
row.operator("bim.edit_element_filter", icon="CHECKMARK", text="").filter_mode = "EXCLUDE"
|
||||
row.operator("bim.enable_editing_element_filter", icon="CANCEL", text="").filter_mode = "NONE"
|
||||
row = layout.row(align=True)
|
||||
row.operator("bim.add_filter_group", text="Add Search Group", icon="ADD").module = module
|
||||
row.operator("bim.edit_filter_query", text="", icon="FILTER").module = module
|
||||
if not tool.Blender.get_addon_preferences().chain_filter_with_set_operations:
|
||||
row.operator("bim.add_filter_group", text="Add Search Group", icon="ADD").module = module
|
||||
else:
|
||||
if not filter_groups or not any(fg.filters for fg in filter_groups):
|
||||
op = row.operator("bim.add_filter", text="Add Filter", icon="ADD")
|
||||
op.type = "entity"
|
||||
op.index = 0
|
||||
op.module = module
|
||||
op = row.operator("bim.edit_filter_query", text="", icon="FILTER")
|
||||
if "module" in op.bl_rna.properties:
|
||||
op.module = module
|
||||
|
||||
for i, filter_group in enumerate(filter_groups):
|
||||
box = layout.box()
|
||||
@@ -524,43 +539,251 @@ def draw_filter(
|
||||
for j, ifc_filter in enumerate(filter_group.filters):
|
||||
if ifc_filter.type == "entity":
|
||||
row = box.row(align=True)
|
||||
preferences = tool.Blender.get_addon_preferences()
|
||||
if preferences.chain_filter_with_set_operations:
|
||||
show_mode_toggle = j > 0
|
||||
else:
|
||||
show_mode_toggle = (
|
||||
preferences.default_filter_with_set_operations_for_globalid_and_class and j > 0
|
||||
) # PR 7315 mode
|
||||
if show_mode_toggle:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="FILE_3D")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "attribute":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "name", text="", icon="COPY_ID")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
op.suggestion_type = "attribute_name"
|
||||
row.prop(ifc_filter, "value", text="")
|
||||
if ifc_filter.name:
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
op.suggestion_type = "attribute_value"
|
||||
elif ifc_filter.type == "type":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="FILE_VOLUME")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "material":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="MATERIAL")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "property":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "pset", text="", icon="PROPERTIES")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
op.suggestion_type = "pset"
|
||||
row.prop(ifc_filter, "name", text="")
|
||||
if ifc_filter.pset:
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
op.suggestion_type = "property_name"
|
||||
row.prop(ifc_filter, "comparison", text="")
|
||||
row.prop(ifc_filter, "value", text="")
|
||||
if ifc_filter.pset and ifc_filter.name:
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
op.suggestion_type = "property_value"
|
||||
elif ifc_filter.type == "classification":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="OUTLINER")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "location":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="PACKAGE")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "group":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="OUTLINER_COLLECTION")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "parent":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="FILE_PARENT")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
elif ifc_filter.type == "query":
|
||||
row = box.row(align=True)
|
||||
if tool.Blender.get_addon_preferences().chain_filter_with_set_operations and j > 0:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "name", text="", icon="POINTCLOUD_DATA")
|
||||
row.prop(ifc_filter, "comparison", text="")
|
||||
row.prop(ifc_filter, "value", text="")
|
||||
elif ifc_filter.type == "instance":
|
||||
row = box.row(align=True)
|
||||
preferences = tool.Blender.get_addon_preferences()
|
||||
if preferences.chain_filter_with_set_operations:
|
||||
show_mode_toggle = j > 0
|
||||
else:
|
||||
show_mode_toggle = (
|
||||
preferences.default_filter_with_set_operations_for_globalid_and_class and j > 0
|
||||
) # PR 7315 mode
|
||||
if show_mode_toggle:
|
||||
mode_icons = {"ADD": "ADD", "SUBTRACT": "REMOVE", "FILTER": "FILTER"}
|
||||
op = row.operator(
|
||||
"bim.toggle_filter_inclusion",
|
||||
icon=mode_icons.get(ifc_filter.filter_mode, "ADD"),
|
||||
text="",
|
||||
depress=ifc_filter.filter_mode != "ADD",
|
||||
)
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
row.prop(ifc_filter, "value", text="", icon="GRIP")
|
||||
op = row.operator("bim.filter_value_suggestions", text="", icon="VIEWZOOM")
|
||||
op.group_index = i
|
||||
op.filter_index = j
|
||||
op.module = module
|
||||
op.filter_type = ifc_filter.type
|
||||
op = row.operator("bim.select_filter_elements", text="", icon="EYEDROPPER")
|
||||
op.group_index = i
|
||||
op.index = j
|
||||
@@ -569,3 +792,149 @@ def draw_filter(
|
||||
op.group_index = i
|
||||
op.index = j
|
||||
op.module = module
|
||||
|
||||
|
||||
# ============================================================================
|
||||
# UI Panel Visibility Helpers
|
||||
# ============================================================================
|
||||
|
||||
|
||||
def get_tab_names():
|
||||
from bonsai.bim.prop import get_tab
|
||||
|
||||
enum_items = get_tab(None, None)
|
||||
# Exclude None separators and the BLENDER tab (not part of BIM tab system)
|
||||
return [item[0] for item in enum_items if item is not None and item[0] != "BLENDER"]
|
||||
|
||||
|
||||
def get_panel_tab_name(panel_class):
|
||||
if hasattr(panel_class, "bim_tab_name"):
|
||||
return panel_class.bim_tab_name
|
||||
return "PROJECT" # Default fallback
|
||||
|
||||
|
||||
def should_show_panel(panel_id, panel_tab_name, context):
|
||||
if tool.Blender.is_tab(context, "BOOKMARK"):
|
||||
return is_panel_bookmarked(panel_id) and get_panel_visibility(panel_id, "BOOKMARK")
|
||||
|
||||
if tool.Blender.is_tab(context, panel_tab_name):
|
||||
return get_tab_visibility(panel_tab_name) and get_panel_visibility(panel_id, panel_tab_name)
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def get_tab_visibility(tab_name):
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
tab_vis = bim_props.tab_visibilities.get(tab_name)
|
||||
return tab_vis.is_visible if tab_vis else True
|
||||
|
||||
|
||||
def set_tab_visibility(tab_name, visible):
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
tab_vis = bim_props.tab_visibilities.get(tab_name)
|
||||
if tab_vis:
|
||||
tab_vis.is_visible = visible
|
||||
else:
|
||||
new_tab = bim_props.tab_visibilities.add()
|
||||
new_tab.name = tab_name
|
||||
new_tab.is_visible = visible
|
||||
|
||||
|
||||
def get_panel_visibility(panel_id, current_tab=None):
|
||||
panel_config = get_panel_config(panel_id)
|
||||
if panel_config:
|
||||
if current_tab == "BOOKMARK":
|
||||
return panel_config.is_visible_in_bookmarks
|
||||
else:
|
||||
return panel_config.is_visible_in_tab
|
||||
return True
|
||||
|
||||
|
||||
def is_panel_bookmarked(panel_id):
|
||||
panel_config = get_panel_config(panel_id)
|
||||
if panel_config:
|
||||
return panel_config.is_bookmarked
|
||||
return False
|
||||
|
||||
|
||||
def get_panel_config(panel_id, create_if_missing=False):
|
||||
try:
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
except (AttributeError, AssertionError):
|
||||
return None
|
||||
|
||||
for prop in bim_props.panel_properties:
|
||||
if prop.name == panel_id:
|
||||
return prop
|
||||
|
||||
if create_if_missing:
|
||||
try:
|
||||
prop = bim_props.panel_properties.add()
|
||||
prop.name = panel_id
|
||||
prop.is_visible_in_tab = True
|
||||
prop.is_visible_in_bookmarks = True
|
||||
prop.is_bookmarked = False
|
||||
return prop
|
||||
except AttributeError:
|
||||
pass
|
||||
|
||||
return None
|
||||
|
||||
|
||||
def get_all_tab_panels(force_refresh=False):
|
||||
panels = {tab_name: [] for tab_name in get_tab_names() if tab_name != "BOOKMARK"}
|
||||
panels["BOOKMARK"] = []
|
||||
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
for prop in bim_props.panel_properties:
|
||||
panel_class = getattr(bpy.types, prop.name, None)
|
||||
if panel_class:
|
||||
tab_name = get_panel_tab_name(panel_class)
|
||||
if tab_name and tab_name != "BOOKMARK":
|
||||
bl_label = getattr(panel_class, "bl_label", prop.name)
|
||||
panels[tab_name].append({"bl_idname": prop.name, "bl_label": bl_label})
|
||||
|
||||
if prop.is_bookmarked:
|
||||
panel_class = getattr(bpy.types, prop.name, None)
|
||||
if panel_class:
|
||||
bl_label = getattr(panel_class, "bl_label", prop.name)
|
||||
panels["BOOKMARK"].append({"bl_idname": prop.name, "bl_label": bl_label})
|
||||
|
||||
if not panels["BOOKMARK"]:
|
||||
panels["BOOKMARK"] = [{}]
|
||||
|
||||
return panels
|
||||
|
||||
|
||||
def initialize_tab_visibilities():
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
|
||||
if len(bim_props.tab_visibilities) > 0:
|
||||
return
|
||||
|
||||
for tab_name in get_tab_names():
|
||||
tab_vis = bim_props.tab_visibilities.add()
|
||||
tab_vis.name = tab_name
|
||||
tab_vis.is_visible = True
|
||||
|
||||
|
||||
def initialize_panel_properties():
|
||||
|
||||
bim_props = tool.Blender.get_bim_props()
|
||||
|
||||
if len(bim_props.panel_properties) > 0:
|
||||
return
|
||||
|
||||
for attr_name in dir(bpy.types):
|
||||
if attr_name.startswith("BIM_PT_tab_"):
|
||||
panel_class = getattr(bpy.types, attr_name)
|
||||
if not hasattr(panel_class, "bl_idname"):
|
||||
continue
|
||||
|
||||
panel_id = panel_class.bl_idname
|
||||
|
||||
prop = bim_props.panel_properties.add()
|
||||
prop.name = panel_id
|
||||
prop.is_visible_in_tab = True
|
||||
prop.is_visible_in_bookmarks = True
|
||||
prop.is_bookmarked = False
|
||||
|
||||
@@ -290,6 +290,7 @@ class IfcImporter:
|
||||
self.profile_code("Load linked models")
|
||||
self.add_project_to_scene()
|
||||
self.profile_code("Add project to scene")
|
||||
self.hide_ifc_spaces()
|
||||
if self.ifc_import_settings.should_clean_mesh and len(self.file.by_type("IfcElement")) < 1000:
|
||||
self.clean_mesh()
|
||||
self.profile_code("Mesh cleaning")
|
||||
@@ -889,6 +890,48 @@ class IfcImporter:
|
||||
obj, tool.Loader.apply_blender_offset_to_matrix_world(obj, self.get_element_matrix(element))
|
||||
)
|
||||
|
||||
if element.is_a("IfcAnnotation") and getattr(element, "ObjectType", None) == "IMAGE":
|
||||
image = None
|
||||
if obj.data and obj.data.materials and obj.data.materials[0]:
|
||||
material = obj.data.materials[0]
|
||||
if material.use_nodes and material.node_tree:
|
||||
for node in material.node_tree.nodes:
|
||||
if node.type == "TEX_IMAGE" and node.image:
|
||||
image = node.image
|
||||
break
|
||||
if image:
|
||||
import bmesh
|
||||
|
||||
bm = bmesh.new()
|
||||
bm.from_mesh(obj.data)
|
||||
if not bm.loops.layers.uv:
|
||||
uv_layer = bm.loops.layers.uv.new()
|
||||
else:
|
||||
uv_layer = bm.loops.layers.uv.active
|
||||
|
||||
if bm.verts:
|
||||
min_x = min(v.co.x for v in bm.verts)
|
||||
max_x = max(v.co.x for v in bm.verts)
|
||||
min_y = min(v.co.y for v in bm.verts)
|
||||
max_y = max(v.co.y for v in bm.verts)
|
||||
|
||||
width = max_x - min_x
|
||||
height = max_y - min_y
|
||||
|
||||
for face in bm.faces:
|
||||
for loop in face.loops:
|
||||
vert = loop.vert
|
||||
u = (vert.co.x - min_x) / width if width > 0 else 0.5
|
||||
v = (vert.co.y - min_y) / height if height > 0 else 0.5
|
||||
|
||||
u = max(0.0, min(1.0, u))
|
||||
v = max(0.0, min(1.0, v))
|
||||
|
||||
loop[uv_layer].uv = (u, v)
|
||||
|
||||
bm.to_mesh(obj.data)
|
||||
bm.free()
|
||||
obj.data.update()
|
||||
return obj
|
||||
|
||||
def load_existing_meshes(self) -> None:
|
||||
@@ -1244,6 +1287,13 @@ class IfcImporter:
|
||||
properties={"Aggregate_Index": aggregate_index, "Name": name},
|
||||
)
|
||||
|
||||
def hide_ifc_spaces(self):
|
||||
"""Hide IfcSpace objects after they've been added to the scene."""
|
||||
for ifc_definition_id, obj in self.added_data.items():
|
||||
if isinstance(obj, bpy.types.Object):
|
||||
element = self.file.by_id(ifc_definition_id)
|
||||
if element.is_a("IfcSpace"):
|
||||
obj.hide_set(True)
|
||||
|
||||
class IfcImportSettings:
|
||||
"""
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user