Skip to content

Commit

Permalink
Merge pull request #69 from jspanchu/fix-opengl-cmake
Browse files Browse the repository at this point in the history
Fix opengl cmake for latest VTK
  • Loading branch information
psavery authored Oct 8, 2024
2 parents 6ea6bfb + a47c29d commit 89b4ded
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 23 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,21 @@ on:
workflow_dispatch:

env:
# Only support 64-bit CPython >= 3.7

# Supply options to `pip` to affect how it downloads vtk nightly
# wheels from VTK gitlab package registry.
PIP_EXTRA_INDEX_URL: https://wheels.vtk.org

# Only support 64-bit CPython >= 3.8 && <= 3.12
# VTK does not currently build python 3.8 arm64 wheels, so skip it too
CIBW_SKIP: "cp27-* cp35-* cp36-* cp311-* cp312-* pp* *-manylinux_i686 *-musllinux_* *-win32 cp38-macosx_arm64"
CIBW_SKIP: "cp27-* cp35-* cp36-* cp37-* cp311-* cp312-* cp313-* pp* *-manylinux_i686 *-musllinux_* *-win32 cp38-macosx_arm64"

# Need to match the version used by VTK
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.10

# In the Linux docker container, install the wheel SDKs to this location
CIBW_ENVIRONMENT_LINUX: VTK_WHEEL_SDK_INSTALL_PATH=/vtk-wheel-sdk

# NOTE: cross-compilation is not currently working for us for arm64.
# We are going to turn it off and build them manually until GitHub Actions
# makes arm64 runners available.
# Build both x86_64 and arm64 (through cross-compilation) wheels on Mac
# CIBW_ARCHS_MACOS: x86_64 arm64

# VTK already fixes the rpaths, so we can skip this step for MacOS
CIBW_REPAIR_WHEEL_COMMAND_MACOS:

Expand All @@ -42,7 +41,7 @@ env:
CIBW_REPAIR_WHEEL_COMMAND_LINUX: .github/scripts/linux_repair_wheel.py {wheel} {dest_dir}

# Pass these variables into the Linux docker containers
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS VTK_WHEEL_SDK_INSTALL_PATH
CIBW_ENVIRONMENT_PASS_LINUX: RUNNER_OS VTK_WHEEL_SDK_INSTALL_PATH PIP_EXTRA_INDEX_URL

# Run this before every build
CIBW_BEFORE_BUILD: bash .github/scripts/cibw_before_build.sh
Expand Down Expand Up @@ -81,13 +80,14 @@ jobs:

- name: Upload skbuild if an error occurred (for debugging)
if: ${{ failure() }}
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: skbuild
path: ${{ github.workspace }}/_skbuild

- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: "artifacts-${{ matrix.os }}"
path: ./wheelhouse/*.whl

upload_pypi:
Expand Down
2 changes: 0 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ elseif (WIN32)
elseif (VTK_USE_COCOA)
list(APPEND sources vtkCocoaLookingGlassRenderWindow.mm)
list(APPEND headers vtkCocoaLookingGlassRenderWindow.h)
# For some reason, this isn't being added automatically, so add it now
add_definitions(-DVTK_USE_COCOA)
endif()


Expand Down
11 changes: 3 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def auto_download_vtk_wheel_sdk():

base_url = 'https://vtk.org/files/wheel-sdks/'
prefix = 'vtk-wheel-sdk'
default_sdk_version = '9.2.2'
default_sdk_version = '9.3.20241005.dev0'
# The user can set the sdk version via an environment variable
sdk_version = os.getenv('VTK_WHEEL_SDK_VERSION', default_sdk_version)
py_version_short = ''.join(map(str, sys.version_info[:2]))
Expand All @@ -30,7 +30,7 @@ def auto_download_vtk_wheel_sdk():
py_version += 'm'

platform_suffixes = {
'linux': 'manylinux_2_17_x86_64.manylinux2014_x86_64',
'linux': 'linux_x86_64',
'darwin': 'macosx_10_10_x86_64',
'win32': 'win_amd64',
}
Expand Down Expand Up @@ -150,11 +150,6 @@ def auto_download_vtk_external_module():
# We currently have to add this for the render window to get compiled
cmake_args.append('-DVTK_USE_COCOA:BOOL=ON')

if os.getenv('ARCHFLAGS') == '-arch arm64':
# We are cross-compiling and need to set CMAKE_SYSTEM_NAME as well.
# NOTE: we haven't actually succeeded in cross-compiling this module.
cmake_args.append('-DCMAKE_SYSTEM_NAME=Darwin')

setup(
name='vtk-lookingglass',
description='Looking Glass support for VTK Python.',
Expand All @@ -171,5 +166,5 @@ def auto_download_vtk_external_module():
packages=['vtkmodules'],
package_dir={'vtkmodules': 'lib/vtkmodules'},
cmake_args=cmake_args,
install_requires=['vtk==9.2.2'],
install_requires=['vtk==9.3.20241005.dev0'],
)
1 change: 0 additions & 1 deletion vtk.module
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ DEPENDS
PRIVATE_DEPENDS
VTK::IOImage
VTK::IOMovie
VTK::opengl
OPTIONAL_DEPENDS
VTK::IOFFMPEG
VTK::IOOggTheora
Expand Down
2 changes: 1 addition & 1 deletion vtkLookingGlassInterface.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ IN THE SOFTWARE.
#include "vtkTextureObject.h"
#include "vtkVectorOperators.h"

#include "vtk_glew.h"
#include "vtk_glad.h"

#include "vtkRenderingOpenGLConfigure.h"

Expand Down
1 change: 1 addition & 0 deletions vtkLookingGlassRenderWindowImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "vtkLookingGlassInterface.h"
#include "vtkObjectFactory.h"
#include "vtkRenderingOpenGLConfigure.h" // for VTK_USE_COCOA

vtkStandardNewMacro(className);

Expand Down

0 comments on commit 89b4ded

Please sign in to comment.