diff --git a/.github/workflows/build-ocp.yml b/.github/workflows/build-ocp.yml index 5829b67..15eabe9 100644 --- a/.github/workflows/build-ocp.yml +++ b/.github/workflows/build-ocp.yml @@ -24,7 +24,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["macos-13", "macos-14", "ubuntu-20.04", "windows-2019"] + os: ["macos-13", "macos-14", "ubuntu-20.04", "ubuntu-22.04-arm", "windows-2019"] python-version: ["3.10", "3.11", "3.12", "3.13"] use-vtk: ["vtk", "novtk"] @@ -50,6 +50,13 @@ jobs: sed_i: "sed -i" env: "DUMMY=0" shells: "bash" + - os: "ubuntu-22.04-arm" + vtk_libs: "libvtk*.so" + vtk_suffix: "/vtk-9.3/" + vtk_prefix: "" + sed_i: "sed -i" + env: "DUMMY=0" + shells: "bash" - os: "windows-2019" vtk_libs: "vtk*.dll" vtk_suffix: "/" @@ -127,24 +134,31 @@ jobs: # - - - - - - - - - - - - - - - - - - - - - - name: Download wheel artifact - if: matrix.python-version == '3.13' && matrix.use-vtk == 'vtk' && steps.cache-vtk-restore.outputs.cache-hit != 'true' + if: (matrix.python-version == '3.13' || matrix.os == 'ubuntu-22.04-arm') && matrix.use-vtk == 'vtk' && steps.cache-vtk-restore.outputs.cache-hit != 'true' shell: bash -l {0} run: | - if [[ "${{ matrix.os }}" == "macos-14" ]]; then - echo "Downloading cadquery_vtk-${{ env.VTK }}-cp313-cp313-macosx_11_0_arm64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-cp313-cp313-macosx_11_0_arm64.whl + PY_VER=${{ matrix.python-version }} + PY_TAG="cp${PY_VER/./}" + + if [[ "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_aarch64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_aarch64.whl + + elif [[ "${{ matrix.os }}" == "macos-14" ]]; then + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_arm64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_arm64.whl elif [[ "${{ matrix.os }}" == "macos-13" ]]; then - echo "Downloading cadquery_vtk-9.3.1-cp313-cp313-macosx_11_0_x86_64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-9.3.1-cp313-cp313-macosx_11_0_x86_64.whl + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_x86_64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_x86_64.whl elif [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then - echo "Downloading cadquery_vtk-9.3.1-cp313-cp313-linux_x86_64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-9.3.1-cp313-cp313-linux_x86_64.whl + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_x86_64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_x86_64.whl - else - echo "Downloading cadquery_vtk-9.3.1-cp313-cp313-win_amd64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-9.3.1-cp313-cp313-win_amd64.whl + else + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-win_amd64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-win_amd64.whl fi ls -l @@ -183,8 +197,8 @@ jobs: micromamba create -y -n vtk-$PY_VER python=$PY_VER micromamba activate vtk-$PY_VER - if [[ $PY_VER == 3.13 ]]; then - pip install cadquery_vtk-9.3.1*.whl + if [[ $PY_VER == 3.13 || "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then + pip install cadquery_vtk-*.whl else pip install vtk==${{ env.VTK }} fi @@ -194,7 +208,8 @@ jobs: cp $CONDA_PREFIX/lib/python$PY_VER/site-packages/vtkmodules/${{ matrix.vtk_libs }} $DEST/lib/ cp $CONDA_PREFIX/lib/python$PY_VER/site-packages/vtk.py $DEST - if [[ "$RUNNER_OS" == "Linux" && "$PY_VER" != "3.13" ]]; then + # vtk.libs only exists in official PyPI VTK wheels, not in custom cadquery_vtk wheels + if [[ "$RUNNER_OS" == "Linux" && "$PY_VER" != "3.13" && "${{ matrix.os }}" != "ubuntu-22.04-arm" ]]; then cp $CONDA_PREFIX/lib/python$PY_VER/site-packages/vtk.libs/* $DEST/lib/ fi @@ -278,7 +293,7 @@ jobs: patch --posix -p1 < ../patches/occt-${{ env.OCCT }}/0017-ChFi3d_Builder-Fix-blend-across-seam.-See-following.patch # see https://tracker.dev.opencascade.org/view.php?id=33576 and https://github.com/FreeCAD/FreeCAD/issues/9760 patch --posix -p1 < ../patches/occt-${{ env.OCCT }}/0018-Fix-0033576-BRepTools_NurbsConvertModification-NewPo.patch - + if [[ "$RUNNER_OS" == "Windows" ]]; then echo vtkCommonTransforms >> src/TKIVtk/EXTERNLIB echo vtkCommonMath >> src/TKIVtk/EXTERNLIB @@ -305,8 +320,9 @@ jobs: fi if [[ "${{ matrix.use-vtk }}" == "vtk" ]]; then - + env ${{ matrix.env }} cmake -S . -B build -G Ninja \ + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 \ -D CMAKE_INSTALL_PREFIX=$HOME/opt/local/occt-${{ env.OCCT }}-${{ matrix.use-vtk }} \ \ -D USE_VTK=ON \ @@ -335,6 +351,7 @@ jobs: else env ${{ matrix.env }} cmake -S . -B build -G Ninja \ + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 \ -D CMAKE_INSTALL_PREFIX=$HOME/opt/local/occt-${{ env.OCCT }}-${{ matrix.use-vtk }} \ \ -D USE_VTK=OFF \ @@ -360,7 +377,7 @@ jobs: if: runner.os == 'Windows' && steps.cache-occt-restore.outputs.cache-hit != 'true' shell: cmd run: | - call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate build-ocp + call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate build-ocp cd OCCT call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" @@ -369,6 +386,7 @@ jobs: if "${{ matrix.use-vtk }}"=="vtk" ( cmake -S . -B build -G Ninja ^ + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 ^ -D USE_VTK=ON ^ -D USE_TBB=OFF ^ -D USE_FREEIMAGE=ON ^ @@ -395,6 +413,7 @@ jobs: ) else ( cmake -S . -B build -G Ninja ^ + -D CMAKE_POLICY_VERSION_MINIMUM=3.5 ^ -D USE_VTK=OFF ^ -D USE_TBB=OFF ^ -D USE_FREEIMAGE=ON ^ @@ -447,7 +466,7 @@ jobs: strategy: fail-fast: false matrix: - os: ["macos-13", "macos-14", "ubuntu-20.04", "windows-2019"] + os: ["macos-13", "macos-14", "ubuntu-20.04", "ubuntu-22.04-arm", "windows-2019"] python-version: ["3.11"] include: @@ -463,6 +482,10 @@ jobs: sed_i: "sed -i" env: "DUMMY=0" shells: "bash" + - os: "ubuntu-22.04-arm" + sed_i: "sed -i" + env: "DUMMY=0" + shells: "bash" - os: "windows-2019" sed_i: "sed -i" shells: "bash cmd.exe" @@ -494,7 +517,7 @@ jobs: run: | micromamba activate build-ocp - cpu_count=$(python -c "import multiprocessing; print(multiprocessing.cpu_count())") + cpu_count=$(python -c "import multiprocessing; print(multiprocessing.cpu_count())") echo "cpu_count=$cpu_count" >> $GITHUB_OUTPUT echo "=> Using $cpu_count CPUs" @@ -640,6 +663,9 @@ jobs: if [[ ${{ matrix.os }} == "macos-13" || ${{ matrix.os }} == "macos-14" ]]; then curl -L -O https://github.com/CadQuery/OCP/releases/download/${{ env.OCP }}/OCP_src_stubs_macOS-latest.zip + elif [[ ${{ matrix.os }} == "ubuntu-22.04-arm" ]]; then + # Use ubuntu-20.04 sources for ARM build (sources are architecture-independent) + curl -L -O https://github.com/CadQuery/OCP/releases/download/${{ env.OCP }}/OCP_src_stubs_ubuntu-20.04.zip else curl -L -O https://github.com/CadQuery/OCP/releases/download/${{ env.OCP }}/OCP_src_stubs_${{ matrix.os }}.zip fi @@ -674,7 +700,8 @@ jobs: strategy: fail-fast: false matrix: - os: ["macos-13", "macos-14", "ubuntu-20.04", "windows-2019"] + os: ["macos-13", "macos-14", "ubuntu-20.04", "ubuntu-22.04-arm", "windows-2019"] + python-version: ["3.10", "3.11", "3.12", "3.13"] use-vtk: ["vtk", "novtk"] @@ -701,6 +728,14 @@ jobs: module: "OCP.*.so" env: "DUMMY=0" shells: "bash" + - os: "ubuntu-22.04-arm" + delocate: auditwheel patchelf + plat: manylinux_2_35_aarch64 + sed_i: "sed -i" + compilers: "" + module: "OCP.*.so" + env: "DUMMY=0" + shells: "bash" - os: "windows-2019" delocate: delvewheel plat: win_amd64 @@ -717,7 +752,7 @@ jobs: run: | micromamba activate build-ocp - cpu_count=$(python -c "import multiprocessing; print(multiprocessing.cpu_count())") + cpu_count=$(python -c "import multiprocessing; print(multiprocessing.cpu_count())") echo "cpu_count=$cpu_count" >> $GITHUB_OUTPUT echo "=> Using $cpu_count CPUs" @@ -983,7 +1018,7 @@ jobs: if [[ "${{ matrix.use-vtk }}" == "vtk" ]]; then PKG_NAME="cadquery_ocp" - if [[ ${{ matrix.python-version }} == 3.13 ]]; then + if [[ ${{ matrix.python-version }} == 3.13 || "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then ${{ matrix.sed_i }} '/requires-python/a\dependencies = [ "cadquery_vtk==${{ env.VTK }}" ]' pyproject.toml else ${{ matrix.sed_i }} '/requires-python/a\dependencies = [ "vtk==${{ env.VTK }}" ]' pyproject.toml @@ -1006,9 +1041,9 @@ jobs: if [[ "$RUNNER_OS" == "Windows" ]]; then if [[ "${{ matrix.use-vtk }}" == "vtk" ]]; then - python ocp-tree.py occt-${{ env.OCCT }}-vtk vtk-${{ env.VTK }} + python ocp-tree.py occt-${{ env.OCCT }}-vtk vtk-${{ env.VTK }} else - python ocp-tree.py occt-${{ env.OCCT }}-novtk + python ocp-tree.py occt-${{ env.OCCT }}-novtk fi mv *.pyd OCP @@ -1019,7 +1054,7 @@ jobs: ls -l OCP/*.so strip -x OCP/*.so ls -l OCP/*.so - + else LD_LIBRARY_PATH=$HOME/opt/local/vtk-${{ env.VTK }}/lib:$HOME/opt/local/occt-${{ env.OCCT }}-${{ matrix.use-vtk }}/lib \ python ocp-tree.py @@ -1172,24 +1207,31 @@ jobs: pip install pytest docutils ipython - name: Download wheel artifact - if: matrix.python-version == '3.13' && matrix.use-vtk == 'vtk' + if: (matrix.python-version == '3.13' || matrix.os == 'ubuntu-22.04-arm') && matrix.use-vtk == 'vtk' shell: bash -l {0} run: | + PY_TAG="cp${{ matrix.python-version }}" + PY_TAG="${PY_TAG/./}" # Remove dot: cp3.13 -> cp313 + if [[ "${{ matrix.os }}" == "macos-14" ]]; then - echo "Downloading cadquery_vtk-${{ env.VTK }}-cp313-cp313-macosx_11_0_arm64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-cp313-cp313-macosx_11_0_arm64.whl + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_arm64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_arm64.whl elif [[ "${{ matrix.os }}" == "macos-13" ]]; then - echo "Downloading cadquery_vtk-9.3.1-cp313-cp313-macosx_11_0_x86_64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-cp313-cp313-macosx_11_0_x86_64.whl + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_x86_64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-macosx_11_0_x86_64.whl elif [[ "${{ matrix.os }}" == "ubuntu-20.04" ]]; then - echo "Downloading cadquery_vtk-9.3.1-cp313-cp313-linux_x86_64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-cp313-cp313-linux_x86_64.whl + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_x86_64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_x86_64.whl - else - echo "Downloading cadquery_vtk-9.3.1-cp313-cp313-win_amd64.whl" - curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-cp313-cp313-win_amd64.whl + elif [[ "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_aarch64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-linux_aarch64.whl + + else + echo "Downloading cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-win_amd64.whl" + curl -L -O ${{ env.VTK313_URL }}/cadquery_vtk-${{ env.VTK }}-${PY_TAG}-${PY_TAG}-win_amd64.whl fi ls -l @@ -1201,7 +1243,7 @@ jobs: micromamba activate test if [[ "${{ matrix.use-vtk }}" == "vtk" ]]; then - if [[ ${{ matrix.python-version }} == 3.13 ]]; then + if [[ ${{ matrix.python-version }} == 3.13 || "${{ matrix.os }}" == "ubuntu-22.04-arm" ]]; then pip install ./cadquery_vtk*.whl else pip install vtk==${{ env.VTK }} @@ -1253,7 +1295,7 @@ jobs: micromamba install -y nlopt=2.9 fi - # workaround for pypi opt and casadi throwing a seg fault on exit + # workaround for pypi opt and casadi throwing a seg fault on exit if [[ "$RUNNER_OS" == "Windows" ]]; then micromamba install -y nlopt casadi fi diff --git a/.github/workflows/build-vtk.yml b/.github/workflows/build-vtk.yml index 8e64224..ecdb1ba 100644 --- a/.github/workflows/build-vtk.yml +++ b/.github/workflows/build-vtk.yml @@ -15,8 +15,8 @@ jobs: strategy: fail-fast: false matrix: - os: ["ubuntu-20.04", "macos-13", "macos-14", "windows-2019"] - python-version: ["3.13"] + os: ["ubuntu-20.04", "ubuntu-22.04-arm", "macos-13", "macos-14", "windows-2019"] + python-version: ["3.10", "3.11", "3.12", "3.13"] include: - os: "macos-13" sed_i: "sed -i '.bak'" @@ -27,6 +27,9 @@ jobs: - os: "ubuntu-20.04" sed_i: "sed -i" shells: "bash" + - os: "ubuntu-22.04-arm" + sed_i: "sed -i" + shells: "bash" - os: "windows-2019" sed_i: "sed -i" shells: "bash cmd.exe" @@ -153,10 +156,10 @@ jobs: shell: cmd if: runner.os == 'Windows' && steps.cache-vtk-restore.outputs.cache-hit != 'true' run: | - call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate build-vtk + call C:\Users\runneradmin\micromamba\condabin\micromamba.bat activate build-vtk call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat" - cd VTK-${{ env.VTK }}\build + cd VTK-${{ env.VTK }}\build cmake -G Ninja ^ -D VTK_VERSIONED_INSTALL=ON ^ -D VTK_CUSTOM_LIBRARY_SUFFIX="9.3" -DVTK_VERSION_SUFFIX="" ^ @@ -194,7 +197,7 @@ jobs: run: | set -euo pipefail - micromamba activate build-vtk + micromamba activate build-vtk pip install delvewheel cd VTK-${{ env.VTK }}/build diff --git a/cmake/vtk-config-ubuntu-22.04-arm.cmake b/cmake/vtk-config-ubuntu-22.04-arm.cmake new file mode 100644 index 0000000..e88fad4 --- /dev/null +++ b/cmake/vtk-config-ubuntu-22.04-arm.cmake @@ -0,0 +1,273 @@ +# vtk-config.cmake + +# Set VTK version +set(VTK_MAJOR_VERSION 9) +set(VTK_MINOR_VERSION 3) +set(VTK_BUILD_VERSION 1) + +# Set full VTK version +set(VTK_VERSION "${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}.${VTK_BUILD_VERSION}") + +# Set include and library directories +if(WIN32) + set(HOME_DIR "$ENV{USERPROFILE}") +else() + set(HOME_DIR "$ENV{HOME}") +endif() + +set(VTK_INCLUDE_DIRS "${HOME_DIR}/opt/local/vtk-${VTK_VERSION}/include/vtk-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}") +set(VTK_LIBRARY_DIRS "${HOME_DIR}/opt/local/vtk-${VTK_VERSION}/lib") + +# Find Python interpreter and get version +find_package(Python3 REQUIRED COMPONENTS Interpreter) +set(PYTHON_VERSION "${Python3_VERSION_MAJOR}.${Python3_VERSION_MINOR}") + +set(SUFFIX "-${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION}") + +# Define the components +set(VTK_MODULES_ENABLED + AcceleratorsVTKmCore + AcceleratorsVTKmDataModel + AcceleratorsVTKmFilters + cgns + ChartsCore + CommonColor + CommonComputationalGeometry + CommonCore + CommonDataModel + CommonExecutionModel + CommonMath + CommonMisc + CommonPython + CommonSystem + CommonTransforms + DICOMParser + DomainsChemistry + DomainsChemistryOpenGL2 + doubleconversion + exodusII + expat + FiltersAMR + FiltersCellGrid + FiltersCore + FiltersExtraction + FiltersFlowPaths + FiltersGeneral + FiltersGeneric + FiltersGeometry + FiltersGeometryPreview + FiltersHybrid + FiltersHyperTree + FiltersImaging + FiltersModeling + FiltersParallel + FiltersParallelDIY2 + FiltersParallelImaging + FiltersParallelStatistics + FiltersPoints + FiltersProgrammable + FiltersPython + FiltersReduction + FiltersSelection + FiltersSMP + FiltersSources + FiltersStatistics + FiltersTensor + FiltersTexture + FiltersTopology + FiltersVerdict + fmt + freetype + GeovisCore + gl2ps + glew + h5part + hdf5 + hdf5_hl + ImagingColor + ImagingCore + ImagingFourier + ImagingGeneral + ImagingHybrid + ImagingMath + ImagingMorphological + ImagingOpenGL2 + ImagingSources + ImagingStatistics + ImagingStencil + InfovisCore + InfovisLayout + InteractionImage + InteractionStyle + InteractionWidgets + IOAMR + IOAsynchronous + IOCellGrid + IOCesium3DTiles + IOCGNSReader + IOChemistry + IOCityGML + IOCONVERGECFD + IOCore + IOEnSight + IOExodus + IOExport + IOExportGL2PS + IOExportPDF + IOFLUENTCFF + IOGeoJSON + IOGeometry + IOH5part + IOH5Rage + IOHDF + IOImage + IOImport + IOInfovis + IOIOSS + IOLegacy + IOLSDyna + IOMINC + IOMotionFX + IOMovie + IONetCDF + IOOggTheora + IOOMF + IOParallel + IOParallelExodus + IOParallelLSDyna + IOParallelXML + IOPIO + IOPLY + IOSegY + IOSQL + ioss + IOTecplotTable + IOTRUCHAS + IOVeraOut + IOVideo + IOVPIC + IOXdmf2 + IOXML + IOXMLParser + jpeg + jsoncpp + kissfft + libharu + libproj + libxml2 + loguru + lz4 + lzma + m_cont + m_cont_testing + mdiympi_nompi.so + metaio + m_filter_clean_grid + m_filter_connected_components + m_filter_contour + m_filter_core + m_filter_density_estimate + m_filter_entity_extraction + m_filter_field_conversion + m_filter_field_transform + m_filter_flow + m_filter_geometry_refinement + m_filter_image_processing + m_filter_mesh_info + m_filter_multi_block + m_filter_resampling + m_filter_scalar_topology + m_filter_vector_analysis + m_filter_zfp + m_io + m_source + m_worklet + netcdf + ogg + ParallelCore + ParallelDIY + png + pugixml + PythonContext2D + PythonInterpreter + RenderingAnnotation + RenderingCellGrid + RenderingContext2D + RenderingContextOpenGL2 + RenderingCore + RenderingExternal + RenderingFreeType + RenderingGL2PSOpenGL2 + RenderingHyperTreeGrid + RenderingImage + RenderingLabel + RenderingLICOpenGL2 + RenderingLOD + RenderingMatplotlib + RenderingOpenGL2 + RenderingParallel + RenderingSceneGraph + RenderingUI + RenderingVolume + RenderingVolumeAMR + RenderingVolumeOpenGL2 + RenderingVR + RenderingVtkJS + sqlite + sys + TestingDataModel + TestingGenericBridge + TestingIOSQL + TestingRendering + theora + tiff + UtilitiesBenchmarks + verdict + ViewsContext2D + ViewsCore + ViewsInfovis + vpic + WebCore + WebGLExporter + WrappingPythonCore + WrappingTools + xdmf2 + zfp + zlib +) + +# Create imported targets for each module +foreach(module ${VTK_MODULES_ENABLED}) + if(NOT TARGET VTK::${module}) + add_library(VTK::${module} SHARED IMPORTED) + if(${module} STREQUAL "WrappingPythonCore") + set_target_properties(VTK::${module} PROPERTIES + IMPORTED_LOCATION "${VTK_LIBRARY_DIRS}/libvtkWrappingPythonCore${PYTHON_VERSION}${SUFFIX}.so" + INTERFACE_INCLUDE_DIRECTORIES "${VTK_INCLUDE_DIRS}" + ) + else() + set_target_properties(VTK::${module} PROPERTIES + IMPORTED_LOCATION "${VTK_LIBRARY_DIRS}/libvtk${module}${SUFFIX}.so" + INTERFACE_INCLUDE_DIRECTORIES "${VTK_INCLUDE_DIRS}" + ) + endif() + endif() +endforeach() + +# Set VTK_LIBRARIES +set(VTK_LIBRARIES "") +foreach(module ${VTK_MODULES_ENABLED}) + list(APPEND VTK_LIBRARIES VTK::${module}) +endforeach() + +# Set VTK_FOUND +set(VTK_FOUND TRUE) + +# Set VTK_USE_FILE (for backward compatibility) +set(VTK_USE_FILE "${CMAKE_CURRENT_LIST_DIR}/UseVTK.cmake") + +# Print status +message(STATUS "Found VTK ${VTK_VERSION}") +message(STATUS " Includes: ${VTK_INCLUDE_DIRS}") +message(STATUS " Libraries: ${VTK_LIBRARIES}") +message(STATUS " Python Version: ${Python3_VERSION}")