|
| 1 | +name: Build IfcOpenShell Windows |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - v0.8.0 |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build_ifcopenshell: |
| 11 | + runs-on: windows-2019 |
| 12 | + strategy: |
| 13 | + fail-fast: false |
| 14 | + matrix: |
| 15 | + python: ['3.9.11'] |
| 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 | + |
| 29 | + - name: Checkout Build Repository |
| 30 | + uses: actions/checkout@v3 |
| 31 | + with: |
| 32 | + repository: IfcOpenShell/build-outputs |
| 33 | + path: IfcOpenShell\_deps-vs2019-x64-installed |
| 34 | + ref: windows-${{ matrix.arch }} |
| 35 | + lfs: true |
| 36 | + token: ${{ secrets.BUILD_REPO_TOKEN }} |
| 37 | + |
| 38 | + - name: Install Dependencies |
| 39 | + run: | |
| 40 | + choco install -y sed 7zip.install awscli |
| 41 | +
|
| 42 | + - name: Install Python |
| 43 | + run: | |
| 44 | + $installer = "python-${{ matrix.python }}-amd64.exe" |
| 45 | + $url = "https://www.python.org/ftp/python/${{ matrix.python }}/$installer" |
| 46 | + Invoke-WebRequest -Uri $url -OutFile $installer |
| 47 | + Start-Process -Wait -FilePath .\$installer -ArgumentList '/quiet InstallAllUsers=0 PrependPath=0 Include_test=0 TargetDir=C:\Python\${{ matrix.python }}' |
| 48 | + Remove-Item .\$installer |
| 49 | +
|
| 50 | + - name: Unpack IfcOpenShell Dependencies |
| 51 | + run: | |
| 52 | + cd IfcOpenShell\_deps-vs2019-x64-installed |
| 53 | + Get-ChildItem -Path . -Filter 'cache-*.zip' | ForEach-Object { |
| 54 | + 7z x $_.FullName |
| 55 | + } |
| 56 | +
|
| 57 | + - name: Run IfcOpenShell Build Script |
| 58 | + shell: cmd |
| 59 | + run: | |
| 60 | + setlocal EnableDelayedExpansion |
| 61 | + SET PYTHON_VERSION=${{ matrix.python }} |
| 62 | + for /f "tokens=1,2,3 delims=." %%a in ("%PYTHON_VERSION%") do ( |
| 63 | + set PY_VER_MAJOR_MINOR=%%a%%b |
| 64 | + ) |
| 65 | + call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" |
| 66 | + SET IFCOS_INSTALL_PYTHON=FALSE |
| 67 | + cd IfcOpenShell\win |
| 68 | + echo y | call build-deps.cmd vs2019-x64 Release |
| 69 | + SET PYTHONHOME=C:\Python\${{ matrix.python }} |
| 70 | + call run-cmake.bat vs2019-x64 -DENABLE_BUILD_OPTIMIZATIONS=On -DGLTF_SUPPORT=ON -DADD_COMMIT_SHA=ON -DVERSION_OVERRIDE=ON |
| 71 | + call install-ifcopenshell.bat vs2019-x64 Release |
| 72 | +
|
| 73 | + - name: Compile voxec |
| 74 | + run: | |
| 75 | + mkdir build |
| 76 | + cd build |
| 77 | + cmake .. ` |
| 78 | + -DCMAKE_BUILD_TYPE=Release ` |
| 79 | + -DENABLE_PYTHON_WRAPPER=On ` |
| 80 | + -DENABLE_TESTS=Off ` |
| 81 | + -DUSE_BUILD_SCRIPT_OUTPUT=Off ` |
| 82 | + -DBoost_USE_STATIC_LIBS=On ` |
| 83 | + -DBoost_NO_BOOST_CMAKE=On ` |
| 84 | + -DCMAKE_INSTALL_PREFIX=../install ` |
| 85 | + -DIFC_INCLUDE_DIR=../IfcOpenShell/_installed-vs2019-x64/include ` |
| 86 | + -DIFC_LIBRARY_DIR=../IfcOpenShell/_installed-vs2019-x64/ifcopenshell/lib ` |
| 87 | + -DOCC_INCLUDE_DIR=../IfcOpenShell/_deps-vs2022-x64-installed/opencascade-7.8.1/inc ` |
| 88 | + -DOCC_LIBRARY_DIR=../IfcOpenShell/_deps-vs2022-x64-installed/opencascade-7.8.1/win64/lib ` |
| 89 | + -DPython_EXECUTABLE=C:\Python\${{ matrix.python }}\python.exe ` |
| 90 | + -DBOOST_ROOT=../IfcOpenShell/_deps/boost_1_86_0 ` |
| 91 | + -DSWIG_DIR=../IfcOpenShell/_installed-vs2019-x64/swigwin |
| 92 | + cmake --build . --target install --config Release |
| 93 | +
|
| 94 | + - name: Package .zip Archives |
| 95 | + run: | |
| 96 | + $SHA = ${env:GITHUB_SHA}.Substring(0, 7) |
| 97 | + $pyVersion = "${{ matrix.python }}" |
| 98 | + $pyVersionMajor = ($pyVersion -split '\.')[0..1] -join '.' |
| 99 | + $OUTPUT_DIR = "$env:USERPROFILE\output" |
| 100 | + New-Item -ItemType Directory -Force -Path $OUTPUT_DIR |
| 101 | +
|
| 102 | + cd $OUTPUT_DIR |
| 103 | +
|
| 104 | + cp -r C:\Python\${{ matrix.python }}\Lib\site-packages\voxec . |
| 105 | + cp $env:GITHUB_WORKSPACE\voxelization_toolkit\pyproject.toml . |
| 106 | +
|
| 107 | + C:\Python\${{ matrix.python }}\python.exe -m pip install build |
| 108 | + C:\Python\${{ matrix.python }}\python.exe -m build |
0 commit comments