Skip to content

Commit 920fcaf

Browse files
committed
Build scripts
1 parent 4127d6a commit 920fcaf

File tree

8 files changed

+581
-35
lines changed

8 files changed

+581
-35
lines changed
File renamed without changes.

.github/workflows/build_osx.yml

+150
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
name: Build Voxelization Toolkit OSX
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build_voxec:
11+
runs-on: ${{ matrix.runner }}
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
include:
16+
- os: macos
17+
runner: macos-13
18+
arch: x64
19+
oldarch:
20+
cpuarch: x86_64
21+
macosx_ver: '10_15'
22+
- os: macos
23+
runner: macos-14
24+
arch: arm64
25+
oldarch: m1
26+
cpuarch: arm64
27+
macosx_ver: '11_0'
28+
29+
steps:
30+
- name: Checkout Repository
31+
uses: actions/checkout@v3
32+
with:
33+
submodules: recursive
34+
35+
- name: Checkout IfcOpenShell
36+
uses: actions/checkout@v3
37+
with:
38+
repository: IfcOpenShell/IfcOpenShell
39+
path: IfcOpenShell
40+
token: ${{ secrets.BUILD_REPO_TOKEN }}
41+
submodules: recursive
42+
43+
- name: Checkout Build Repository
44+
uses: actions/checkout@v3
45+
with:
46+
repository: IfcOpenShell/build-outputs
47+
path: IfcOpenShell/build
48+
ref: ${{ matrix.os }}-${{ matrix.arch }}
49+
lfs: true
50+
token: ${{ secrets.BUILD_REPO_TOKEN }}
51+
52+
- name: Set up Python
53+
uses: actions/setup-python@v4
54+
with:
55+
python-version: '3.x'
56+
57+
- name: Install Dependencies
58+
run: |
59+
brew update
60+
brew install git bison autoconf automake libffi cmake findutils swig
61+
echo "$(brew --prefix findutils)/libexec/gnubin" >> $GITHUB_PATH
62+
63+
- name: Unpack IfcOpenShell Dependencies
64+
run: |
65+
install_root=$(find ./IfcOpenShell/build -maxdepth 4 -name install)
66+
find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \;
67+
68+
- name: Relocate python libraries
69+
run: |
70+
base=$(find $PWD/IfcOpenShell/build -maxdepth 4 -name install)
71+
for pybin in $(find $base -name python3); do
72+
l="$(ls $(dirname $pybin)/../lib/libpython*.dylib 2>/dev/null | head -n 1)"
73+
o="$(otool -L "$pybin" | awk '/libpython/ {print $1; exit}')"
74+
n="@executable_path/../lib/$(basename "$l")"
75+
install_name_tool -change "$o" "$n" "$pybin"
76+
otool -L "$pybin"
77+
done
78+
79+
- name: Debug
80+
run: |
81+
base=$(find $PWD/IfcOpenShell/build -maxdepth 4 -name install)
82+
$base/python-3.9.11/bin/python3 --version
83+
$base/python-3.9.11/bin/python3 -c 'import sysconfig; print(sysconfig.get_path("platlib"))'
84+
85+
- name: Run IfcOpenShell Build Script
86+
run: |
87+
if [ "${{ matrix.os }}" == "macos" ]; then
88+
DARWIN_C_SOURCE=-D_DARWIN_C_SOURCE
89+
fi
90+
CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release python3 ./IfcOpenShell/nix/build-all.py --diskcleanup IfcConvert python
91+
92+
- name: Compile voxec
93+
run: |
94+
export CFLAGS="-Wl,-flat_namespace,-undefined,suppress"
95+
export CXXFLAGS="-Wl,-flat_namespace,-undefined,suppress"
96+
export LDFLAGS="-Wl,-flat_namespace,-undefined,suppress"
97+
base=$(find $PWD/IfcOpenShell/build -maxdepth 4 -name install)
98+
mkdir build
99+
cd build
100+
for python_root in $base/python-*; do
101+
[ -f CMakeCache.txt ] && rm CMakeCache.txt
102+
cmake .. \
103+
"-DCMAKE_BUILD_TYPE=Release" \
104+
"-DENABLE_PYTHON_WRAPPER=On" \
105+
"-DENABLE_TESTS=Off" \
106+
"-DUSE_BUILD_SCRIPT_OUTPUT=Off" \
107+
"-DBoost_USE_STATIC_LIBS=On" \
108+
"-DBoost_NO_BOOST_CMAKE=On" \
109+
"-DCMAKE_INSTALL_PREFIX=../install" \
110+
"-DIFC_INCLUDE_DIR=$base/ifcopenshell/include" \
111+
"-DIFC_LIBRARY_DIR=$base/ifcopenshell/lib" \
112+
"-DOCC_INCLUDE_DIR=$base/occt-7.8.1/include/opencascade" \
113+
"-DOCC_LIBRARY_DIR=$base/occt-7.8.1/lib" \
114+
"-DPython_EXECUTABLE=$python_root/bin/python3" \
115+
"-DBOOST_ROOT=$base/boost-1.86.0" \
116+
"-DGMP_LIBRARY_DIR=$base/gmp-6.2.1/lib" \
117+
"-DMPFR_LIBRARY_DIR=$base/mpfr-3.1.6/lib"
118+
make -j4 install
119+
done
120+
121+
- name: Package .zip archives
122+
run: |
123+
base=$(find $PWD/IfcOpenShell/build -maxdepth 4 -name install)
124+
mkdir -p $GITHUB_WORKSPACE/package
125+
cd $GITHUB_WORKSPACE/package
126+
cp $GITHUB_WORKSPACE/pyproject.toml .
127+
128+
for python_root in $base/python-*; do
129+
PATH=$python_root/bin:$PATH python3 -m pip install --upgrade pip setuptools wheel
130+
PATH=$python_root/bin:$PATH python3 -m pip install build delocate
131+
132+
mm=`$python_root/bin/python3 --version | cut -c8- | cut -d. -f 1,2 | tr -d '.'`
133+
mdm=`$python_root/bin/python3 --version | cut -c8- | cut -d. -f 1,2`
134+
cp -R $python_root/lib/python$mdm/site-packages/voxec .
135+
echo '[bdist_wheel]' > setup.cfg
136+
echo 'python-tag = cp'$mm >> setup.cfg
137+
138+
PATH=$python_root/bin:$PATH python3 -m build -w
139+
PATH=$python_root/bin:$PATH delocate-wheel dist/*.whl -w audited
140+
mv audited/voxec-0.4.0-cp$mm-none-any.whl audited/voxec-0.4.0-cp$mm-none-macosx_${{ matrix.macosx_ver }}_${{ matrix.cpuarch }}.whl
141+
142+
rm -r voxec dist/*.whl
143+
done
144+
145+
- name: Publish a Python distribution to PyPI
146+
uses: ortega2247/pypi-upload-action@master
147+
with:
148+
user: __token__
149+
password: ${{ secrets.PYPI_API_TOKEN }}
150+
packages_dir: package/audited

.github/workflows/build_rocky.yml

+117
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Build Voxelization Toolkit Linux
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build_voxec:
11+
runs-on: ubuntu-20.04
12+
container: rockylinux:8
13+
14+
steps:
15+
- name: Install Dependencies
16+
run: |
17+
yum update -y
18+
yum install -y gcc gcc-c++ git autoconf automake bison make zip cmake python3 \
19+
bzip2 patch mesa-libGL-devel libffi-devel fontconfig-devel \
20+
sqlite-devel bzip2-devel zlib-devel openssl-devel xz-devel \
21+
readline-devel ncurses-devel libffi-devel libuuid-devel git-lfs \
22+
findutils swig
23+
python3 -m pip install --upgrade pip
24+
ln -s /usr/bin/python3 /usr/bin/python
25+
26+
- name: Checkout Repository
27+
uses: actions/checkout@v3
28+
with:
29+
submodules: recursive
30+
31+
- name: Checkout IfcOpenShell
32+
uses: actions/checkout@v3
33+
with:
34+
repository: IfcOpenShell/IfcOpenShell
35+
path: IfcOpenShell
36+
token: ${{ secrets.BUILD_REPO_TOKEN }}
37+
submodules: recursive
38+
39+
- name: Checkout Build Repository
40+
uses: actions/checkout@v3
41+
with:
42+
repository: IfcOpenShell/build-outputs
43+
path: IfcOpenShell/build
44+
ref: rockylinux8-x64
45+
lfs: true
46+
token: ${{ secrets.BUILD_REPO_TOKEN }}
47+
48+
- name: Unpack IfcOpenShell Dependencies
49+
run: |
50+
install_root=$(find ./IfcOpenShell/build -maxdepth 4 -name install)
51+
find "$install_root" -type f -name 'cache-*.tar.gz' -maxdepth 1 -exec tar -xzf {} -C "$install_root" \;
52+
53+
# Not supported on docker
54+
# - name: ccache
55+
# uses: hendrikmuhs/ccache-action@v1
56+
# with:
57+
# key: ${GITHUB_WORKFLOW}-rockylinux8-x64
58+
59+
- name: Run IfcOpenShell Build Script
60+
run: |
61+
CXXFLAGS="-O3" CFLAGS="-O3 ${DARWIN_C_SOURCE}" ADD_COMMIT_SHA=1 BUILD_CFG=Release python3 ./IfcOpenShell/nix/build-all.py --diskcleanup IfcConvert python
62+
63+
- name: Compile voxec
64+
run: |
65+
base=$GITHUB_WORKSPACE/IfcOpenShell/build/Linux/x86_64/install
66+
mkdir build
67+
cd build
68+
for python_root in $base/python-*; do
69+
[ -f CMakeCache.txt ] && rm CMakeCache.txt
70+
cmake .. \
71+
"-DCMAKE_BUILD_TYPE=Release" \
72+
"-DENABLE_PYTHON_WRAPPER=On" \
73+
"-DENABLE_TESTS=Off" \
74+
"-DUSE_BUILD_SCRIPT_OUTPUT=Off" \
75+
"-DBoost_USE_STATIC_LIBS=On" \
76+
"-DBoost_NO_BOOST_CMAKE=On" \
77+
"-DCMAKE_INSTALL_PREFIX=../install" \
78+
"-DIFC_INCLUDE_DIR=$base/ifcopenshell/include" \
79+
"-DIFC_LIBRARY_DIR=$base/ifcopenshell/lib64" \
80+
"-DOCC_INCLUDE_DIR=$base/occt-7.8.1/include/opencascade" \
81+
"-DOCC_LIBRARY_DIR=$base/occt-7.8.1/lib" \
82+
"-DPython_EXECUTABLE=$python_root/bin/python3" \
83+
"-DBOOST_ROOT=$base/boost-1.86.0" \
84+
"-DGMP_LIBRARY_DIR=$base/gmp-6.2.1/lib" \
85+
"-DMPFR_LIBRARY_DIR=$base/mpfr-3.1.6/lib"
86+
make -j4 install
87+
done
88+
89+
- name: Package .zip archives
90+
run: |
91+
base=$GITHUB_WORKSPACE/IfcOpenShell/build/Linux/x86_64/install
92+
mkdir -p $GITHUB_WORKSPACE/package
93+
cd $GITHUB_WORKSPACE/package
94+
cp $GITHUB_WORKSPACE/pyproject.toml .
95+
96+
for python_root in $base/python-*; do
97+
PATH=$python_root/bin:$PATH python3 -m pip install --upgrade pip setuptools wheel
98+
PATH=$python_root/bin:$PATH python3 -m pip install build auditwheel patchelf
99+
`
100+
mm=`$python_root/bin/python3 --version | cut -c8- | cut -d. -f 1,2 | tr -d '.'`
101+
mdm=`$python_root/bin/python3 --version | cut -c8- | cut -d. -f 1,2`
102+
cp -R $python_root/lib/python$mdm/site-packages/voxec .
103+
echo '[bdist_wheel]' > setup.cfg
104+
echo 'python-tag = cp$mm' >> setup.cfg
105+
106+
PATH=$python_root/bin:$PATH python3 -m build -w
107+
PATH=$python_root/bin:$PATH python3 -m auditwheel repair --plat manylinux_2_28_x86_64 dist/*.whl -w audited
108+
109+
rm -r voxec dist/*.whl
110+
done
111+
112+
- name: Publish a Python distribution to PyPI
113+
uses: ortega2247/pypi-upload-action@master
114+
with:
115+
user: __token__
116+
password: ${{ secrets.PYPI_API_TOKEN }}
117+
packages_dir: package/audited

.github/workflows/build_win.yml

+122
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: Build Voxelization Toolkit Windows
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
workflow_dispatch:
8+
9+
jobs:
10+
build_voxec:
11+
runs-on: windows-2019
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python: ['3.9.11', '3.10.3', '3.11.8', '3.12.1', '3.13.0']
16+
arch: ['x64']
17+
steps:
18+
- name: Checkout Repository
19+
uses: actions/checkout@v3
20+
with:
21+
submodules: recursive
22+
23+
- name: Checkout IfcOpenShell
24+
uses: actions/checkout@v3
25+
with:
26+
repository: IfcOpenShell/IfcOpenShell
27+
path: IfcOpenShell
28+
token: ${{ secrets.BUILD_REPO_TOKEN }}
29+
submodules: recursive
30+
31+
- name: Checkout Build Repository
32+
uses: actions/checkout@v3
33+
with:
34+
repository: IfcOpenShell/build-outputs
35+
path: IfcOpenShell\_deps-vs2019-x64-installed
36+
ref: windows-${{ matrix.arch }}
37+
lfs: true
38+
token: ${{ secrets.BUILD_REPO_TOKEN }}
39+
40+
- name: Install Dependencies
41+
run: |
42+
choco install -y sed 7zip.install awscli
43+
44+
- name: Install Python
45+
run: |
46+
$installer = "python-${{ matrix.python }}-amd64.exe"
47+
$url = "https://www.python.org/ftp/python/${{ matrix.python }}/$installer"
48+
Invoke-WebRequest -Uri $url -OutFile $installer
49+
Start-Process -Wait -FilePath .\$installer -ArgumentList '/quiet InstallAllUsers=0 PrependPath=0 Include_test=0 TargetDir=C:\Python\${{ matrix.python }}'
50+
Remove-Item .\$installer
51+
52+
- name: Unpack IfcOpenShell Dependencies
53+
run: |
54+
cd IfcOpenShell\_deps-vs2019-x64-installed
55+
Get-ChildItem -Path . -Filter 'cache-*.zip' | ForEach-Object {
56+
7z x $_.FullName
57+
}
58+
59+
- name: Run IfcOpenShell Build Script
60+
shell: cmd
61+
run: |
62+
setlocal EnableDelayedExpansion
63+
SET PYTHON_VERSION=${{ matrix.python }}
64+
for /f "tokens=1,2,3 delims=." %%a in ("%PYTHON_VERSION%") do (
65+
set PY_VER_MAJOR_MINOR=%%a%%b
66+
)
67+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
68+
SET IFCOS_INSTALL_PYTHON=FALSE
69+
cd IfcOpenShell\win
70+
echo y | call build-deps.cmd vs2019-x64 Release
71+
SET PYTHONHOME=C:\Python\${{ matrix.python }}
72+
call run-cmake.bat vs2019-x64 -DENABLE_BUILD_OPTIMIZATIONS=On -DGLTF_SUPPORT=ON -DADD_COMMIT_SHA=ON -DVERSION_OVERRIDE=ON
73+
call install-ifcopenshell.bat vs2019-x64 Release
74+
75+
- name: Compile voxec
76+
run: |
77+
mkdir build
78+
cd build
79+
$base=(Resolve-Path ../ifcopenshell/).Path
80+
cmake .. `
81+
"-DCMAKE_BUILD_TYPE=Release" `
82+
"-DENABLE_PYTHON_WRAPPER=On" `
83+
"-DENABLE_TESTS=Off" `
84+
"-DUSE_BUILD_SCRIPT_OUTPUT=Off" `
85+
"-DBoost_USE_STATIC_LIBS=On" `
86+
"-DBoost_NO_BOOST_CMAKE=On" `
87+
"-DCMAKE_INSTALL_PREFIX=../install" `
88+
"-DIFC_INCLUDE_DIR=$base/_installed-vs2019-x64/include" `
89+
"-DIFC_LIBRARY_DIR=$base/_installed-vs2019-x64/lib" `
90+
"-DOCC_INCLUDE_DIR=$base/_deps-vs2019-x64-installed/opencascade-7.8.1/inc" `
91+
"-DOCC_LIBRARY_DIR=$base/_deps-vs2019-x64-installed/opencascade-7.8.1/win64/lib" `
92+
"-DPython_EXECUTABLE=C:\Python\${{ matrix.python }}\python.exe" `
93+
"-DBOOST_ROOT=$base/_deps/boost_1_86_0" `
94+
"-DBOOST_LIBRARYDIR=$base/_deps/boost_1_86_0/stage/vs2019-x64/lib" `
95+
"-DGMP_LIBRARY_DIR=$base/_deps-vs2019-x64-installed/mpir" `
96+
"-DMPFR_LIBRARY_DIR=$base/_deps-vs2019-x64-installed/mpfr" `
97+
"-DSWIG_EXECUTABLE=$base/_deps-vs2019-x64-installed/swigwin/swig.exe"
98+
cmake --build . --target install --config Release
99+
100+
- name: Package .zip Archives
101+
run: |
102+
$SHA = ${env:GITHUB_SHA}.Substring(0, 7)
103+
$pyVersion = "${{ matrix.python }}"
104+
$pyVersionMajor = ($pyVersion -split '\.')[0..1] -join ''
105+
$OUTPUT_DIR = "$env:GITHUB_WORKSPACE\package"
106+
New-Item -ItemType Directory -Force -Path $OUTPUT_DIR
107+
108+
cd $OUTPUT_DIR
109+
110+
cp -r C:\Python\${{ matrix.python }}\Lib\site-packages\voxec .
111+
cp $env:GITHUB_WORKSPACE\pyproject.toml .
112+
113+
C:\Python\${{ matrix.python }}\python.exe -m pip install build
114+
C:\Python\${{ matrix.python }}\python.exe -m build -w
115+
mv .\dist\voxec-0.4.0-py3-none-any.whl .\dist\voxec-0.4.0-py${pyVersionMajor}-none-win_amd64.whl
116+
117+
- name: Publish a Python distribution to PyPI
118+
uses: ortega2247/pypi-upload-action@master
119+
with:
120+
user: __token__
121+
password: ${{ secrets.PYPI_API_TOKEN }}
122+
packages_dir: package\dist

0 commit comments

Comments
 (0)