Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add python wheels #76

Merged
merged 26 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: Python wheels

on:
workflow_dispatch:
inputs:
f3d_version:
description: 'F3D version to build'
required: true
default: 'master'
enable_alembic:
type: boolean
description: 'Enable Alembic plugin'
default: true
enable_assimp:
type: boolean
description: 'Enable Assimp plugin'
default: true
enable_draco:
type: boolean
description: 'Enable Draco plugin'
default: true
enable_occt:
type: boolean
description: 'Enable OpenCASCADE plugin'
default: true
enable_exr:
type: boolean
description: 'Enable OpenEXR module'
default: true

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019, macOS-11]

# fetch-depth: 0 is required to get the tags used to determine f3d version
steps:
- name: Checkout f3d-superbuild
uses: actions/checkout@v3
with:
submodules: true
path: 'f3d-superbuild'

- name: Checkout f3d
uses: actions/checkout@v3
with:
repository: 'f3d-app/f3d'
ref: ${{github.event.inputs.f3d_version}}
fetch-depth: 0
path: 'f3d'

- name: Recover VTK version to build
working-directory: ${{github.workspace}}
shell: bash
run: |
echo VTK_COMMIT_SHA=`cat ./f3d/.github/actions/vtk_commit_sha` >> $GITHUB_ENV

- name: Setup Ninja Windows
if: runner.os == 'Windows'
shell: bash
run: |
choco install ninja
echo CMAKE_GENERATOR=Ninja >> $GITHUB_ENV

- name: Setup MSVC Windows
if: runner.os == 'Windows'
uses: TheMrMilchmann/setup-msvc-dev@v2
with:
arch: x64

- name: Build wheels
uses: pypa/cibuildwheel@v2.13.1
with:
package-dir: ${{github.workspace}}/f3d
output-dir: ${{github.workspace}}/wheelhouse
config-file: ${{github.workspace}}/f3d/pyproject.toml
env:
CIBW_SKIP: 'pp-* *-musl*'
CIBW_ARCHS: native
CIBW_ENVIRONMENT: "\
CMAKE_PREFIX_PATH=../f3d-superbuild-build/install \
SKBUILD_CMAKE_ARGS=\"\
-DF3D_PLUGIN_BUILD_ALEMBIC=${{ github.event.inputs.enable_alembic == 'true' && 'ON' || 'OFF' }};\
-DF3D_PLUGIN_BUILD_ASSIMP=${{ github.event.inputs.enable_assimp == 'true' && 'ON' || 'OFF' }};\
-DF3D_PLUGIN_BUILD_DRACO=${{ github.event.inputs.enable_draco == 'true' && 'ON' || 'OFF' }};\
-DF3D_PLUGIN_BUILD_OCCT=${{ github.event.inputs.enable_occt == 'true' && 'ON' || 'OFF' }};\
-DF3D_PLUGIN_OCCT_COLORING_SUPPORT=ON;\
-DF3D_MODULE_EXR=${{ github.event.inputs.enable_exr == 'true' && 'ON' || 'OFF' }};\
-DF3D_MODULE_EXTERNAL_RENDERING=ON\""
CIBW_ENVIRONMENT_PASS_LINUX: >
CMAKE_PREFIX_PATH
SKBUILD_CMAKE_ARGS
CIBW_BEFORE_ALL: >
echo $SKBUILD_CMAKE_ARGS &&
cmake -S f3d-superbuild -B f3d-superbuild-build
-DCMAKE_BUILD_TYPE=Release
-DBUILD_SHARED_LIBS=OFF
-DENABLE_f3d=OFF
-DENABLE_alembic=${{ github.event.inputs.enable_alembic == 'true' && 'ON' || 'OFF' }}
-DENABLE_assimp=${{ github.event.inputs.enable_assimp == 'true' && 'ON' || 'OFF' }}
-DENABLE_draco=${{ github.event.inputs.enable_draco == 'true' && 'ON' || 'OFF' }}
-DENABLE_occt=${{ github.event.inputs.enable_occt == 'true' && 'ON' || 'OFF' }}
-DENABLE_openexr=${{ github.event.inputs.enable_exr == 'true' && 'ON' || 'OFF' }}
-DENABLE_ospray=OFF
-DENABLE_pybind11=ON
-DENABLE_tbb=OFF
-DENABLE_vtk=ON
-DOCCT_ENABLE_COLORING=ON
-Dvtk_SOURCE_SELECTION=git
-Dvtk_GIT_TAG=${{ env.VTK_COMMIT_SHA }} &&
cmake --build f3d-superbuild-build

- uses: actions/upload-artifact@v3
with:
name: ${{ runner.os }}-wheels
path: ./wheelhouse/*.whl
10 changes: 5 additions & 5 deletions projects/vtk.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ if (UNIX)
endif ()
endif ()

set(vtk_smp_type "STDThread")
set(vtk_smp_enable_stdthread OFF)
set(vtk_smp_type "Sequential")
set(vtk_smp_enable_sequential OFF)
if (tbb_enabled)
set(vtk_smp_type "TBB")
else ()
set(vtk_smp_enable_stdthread ON)
set(vtk_smp_enable_sequential ON)
endif ()

superbuild_add_project(vtk
Expand Down Expand Up @@ -58,8 +58,8 @@ superbuild_add_project(vtk
-DVTK_MODULE_ENABLE_VTK_RenderingVolumeOpenGL2=YES
-DVTK_MODULE_ENABLE_VTK_TestingCore=YES
-DVTK_OPENGL_HAS_EGL=${egl_enabled}
-DVTK_SMP_ENABLE_SEQUENTIAL=OFF
-DVTK_SMP_ENABLE_STDTHREAD=${vtk_smp_enable_stdthread}
-DVTK_SMP_ENABLE_SEQUENTIAL=${vtk_smp_enable_sequential}
-DVTK_SMP_ENABLE_STDTHREAD=OFF
-DVTK_SMP_ENABLE_TBB=${tbb_enabled}
-DVTK_SMP_IMPLEMENTATION_TYPE=${vtk_smp_type}
-DVTK_VERSIONED_INSTALL=OFF
Expand Down