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 all 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
107 changes: 107 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: Python wheels

# TODO: use sscache to speed up this workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

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

# 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'

# TODO: We are currently building wheels for master, it should be possible to select a tag
- name: Checkout f3d
uses: actions/checkout@v3
with:
repository: 'f3d-app/f3d'
ref: 'master'
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: Escaping backslashes Windows
if: runner.os == 'Windows'
shell: bash
run: echo "ESCAPED_WS=${{github.workspace}}" | tr '\\' '/' >> $GITHUB_ENV

- 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: '*-musl*'
# TODO: cross-compile ARM too
CIBW_ARCHS: native
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: >
CMAKE_PREFIX_PATH=../f3d-superbuild-build/install
SKBUILD_CMAKE_ARGS="
-DF3D_DEPENDENCIES_DIR=${{ env.ESCAPED_WS }}/f3d-superbuild-build/install/bin;
-DF3D_PLUGIN_BUILD_ALEMBIC=ON;
-DF3D_PLUGIN_BUILD_ASSIMP=ON;
-DF3D_PLUGIN_BUILD_DRACO=ON;
-DF3D_PLUGIN_BUILD_OCCT=ON;
-DF3D_PLUGIN_OCCT_COLORING_SUPPORT=ON;
-DF3D_MODULE_EXR=ON;
-DF3D_MODULE_EXTERNAL_RENDERING=ON"
CIBW_ENVIRONMENT_PASS_LINUX: >
CMAKE_PREFIX_PATH
SKBUILD_CMAKE_ARGS
CIBW_REPAIR_WHEEL_COMMAND: ''
CIBW_BEFORE_ALL: >
cmake -S f3d-superbuild -B f3d-superbuild-build
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Release
-DENABLE_f3d=OFF
-DENABLE_alembic=ON
-DENABLE_assimp=ON
-DENABLE_draco=ON
-DENABLE_occt=ON
-DENABLE_openexr=ON
-DENABLE_ospray=OFF
-DENABLE_pybind11=ON
-DENABLE_tbb=ON
-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
3 changes: 2 additions & 1 deletion projects/assimp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ superbuild_add_project(assimp
BUILD_SHARED_LIBS_INDEPENDENT
LICENSE_FILES
LICENSE
DEPENDS zlib
CMAKE_ARGS
-DASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT=OFF
-DASSIMP_BUILD_ASSIMP_TOOLS=OFF
Expand All @@ -11,7 +12,7 @@ superbuild_add_project(assimp
-DASSIMP_BUILD_OFF_IMPORTER=ON
-DASSIMP_BUILD_SAMPLES=OFF
-DASSIMP_BUILD_TESTS=OFF
-DASSIMP_BUILD_ZLIB=ON
-DASSIMP_BUILD_ZLIB=OFF
-DASSIMP_NO_EXPORT=ON
-DASSIMP_WARNINGS_AS_ERRORS=OFF
-DCMAKE_BUILD_TYPE=Release
Expand Down
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