Skip to content

Commit

Permalink
[vtk,vtk-dicom,paraview] Fix/simplify python setup (#42717)
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt authored Jan 9, 2025
1 parent ac79fa3 commit 1420fe2
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 32 deletions.
10 changes: 4 additions & 6 deletions ports/paraview/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,15 @@ file(COPY "${QTTESTING_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/ThirdParty/QtT
file(COPY "${ICET_SOURCE_PATH}/" DESTINATION "${SOURCE_PATH}/ThirdParty/IceT/vtkicet")

if("python" IN_LIST FEATURES)
# This sections relies on target package python3.
set(python_ver "")
if(NOT VCPKG_TARGET_IS_WINDOWS)
file(GLOB _py3_include_path "${CURRENT_INSTALLED_DIR}/include/python3*")
string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp ${_py3_include_path})
set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}")
set(python_ver "3.${PYTHON_VERSION_MINOR}")
set(python_ver "3")
endif()
list(APPEND ADDITIONAL_OPTIONS
-DPython3_FIND_REGISTRY=NEVER
"-DPython3_EXECUTABLE:PATH=${CURRENT_INSTALLED_DIR}/tools/python3/python${python_ver}${VCPKG_EXECUTABLE_SUFFIX}"
-DPARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX=${PYTHON3_SITE}
"-DPython3_EXECUTABLE:PATH=${CURRENT_INSTALLED_DIR}/tools/python3/python${python_ver}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
"-DPARAVIEW_PYTHON_SITE_PACKAGES_SUFFIX=${PYTHON3_SITE}" # from vcpkg-port-config.cmake
-DVTK_MODULE_ENABLE_ParaView_PythonCatalyst:STRING=YES
)
endif()
Expand Down
2 changes: 1 addition & 1 deletion ports/paraview/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "paraview",
"version": "5.12.1",
"port-version": 2,
"port-version": 3,
"description": "VTK-based Data Analysis and Visualization Application",
"homepage": "https://www.paraview.org/",
"license": "BSD-3-Clause",
Expand Down
9 changes: 3 additions & 6 deletions ports/vtk-dicom/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO dgobbi/vtk-dicom
REF cfeceadfa68d2cc3172632bd1fd3ea8a38b6c609 # v0.8.16
REF cfeceadfa68d2cc3172632bd1fd3ea8a38b6c609 # v0.8.16
SHA512 0715ef91a1c585c9c819efd2bd6e2b73d3bff73a626b89f4877812fa6587e8379fb55ad99a376fb4d8dfa46c438e7a7052ba02ae61feb950cafb00c95df09b3f
HEAD_REF master
)
Expand All @@ -21,18 +21,15 @@ endif()

set(python_ver "")
if(NOT VCPKG_TARGET_IS_WINDOWS)
file(GLOB _py3_include_path "${CURRENT_HOST_INSTALLED_DIR}/include/python3*")
string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp ${_py3_include_path})
set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}")
set(python_ver "3.${PYTHON_VERSION_MINOR}")
set(python_ver "3")
endif()

vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DBUILD_PROGRAMS=OFF
-DBUILD_EXAMPLES=OFF
"-DPython3_EXECUTABLE:PATH=${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${python_ver}${VCPKG_EXECUTABLE_SUFFIX}"
"-DPython3_EXECUTABLE:PATH=${CURRENT_HOST_INSTALLED_DIR}/tools/python3/python${python_ver}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
${ADDITIONAL_OPTIONS}
)

Expand Down
2 changes: 1 addition & 1 deletion ports/vtk-dicom/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "vtk-dicom",
"version": "0.8.16",
"port-version": 1,
"port-version": 2,
"description": "DICOM for VTK",
"homepage": "https://github.com/dgobbi/vtk-dicom",
"license": "BSD-3-Clause",
Expand Down
25 changes: 12 additions & 13 deletions ports/vtk/portfile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -172,21 +172,19 @@ if("qt" IN_LIST FEATURES)
endif()

if("python" IN_LIST FEATURES)
# This sections relies on target package python3.
set(python_ver "")
if(NOT VCPKG_TARGET_IS_WINDOWS)
file(GLOB _py3_include_path "${CURRENT_INSTALLED_DIR}/include/python3*")
string(REGEX MATCH "python3\\.([0-9]+)" _python_version_tmp ${_py3_include_path})
set(PYTHON_VERSION_MINOR "${CMAKE_MATCH_1}")
set(python_ver "3.${PYTHON_VERSION_MINOR}")
set(python_ver "3")
endif()
list(APPEND ADDITIONAL_OPTIONS
-DVTK_WRAP_PYTHON=ON
-DPython3_FIND_REGISTRY=NEVER
"-DPython3_EXECUTABLE:PATH=${CURRENT_INSTALLED_DIR}/tools/python3/python${python_ver}${VCPKG_EXECUTABLE_SUFFIX}"
"-DPython3_EXECUTABLE:PATH=${CURRENT_INSTALLED_DIR}/tools/python3/python${python_ver}${VCPKG_TARGET_EXECUTABLE_SUFFIX}"
-DVTK_MODULE_ENABLE_VTK_Python=YES
-DVTK_MODULE_ENABLE_VTK_PythonContext2D=YES # TODO: recheck
-DVTK_MODULE_ENABLE_VTK_PythonInterpreter=YES
-DVTK_PYTHON_SITE_PACKAGES_SUFFIX=${PYTHON3_SITE}
"-DVTK_PYTHON_SITE_PACKAGES_SUFFIX=${PYTHON3_SITE}" # from vcpkg-port-config.cmake
)
#VTK_PYTHON_SITE_PACKAGES_SUFFIX should be set to the install dir of the site-packages
endif()
Expand Down Expand Up @@ -418,15 +416,16 @@ endforeach()
# Use vcpkg provided find method
file(REMOVE "${CURRENT_PACKAGES_DIR}/share/${PORT}/FindEXPAT.cmake")

file(RENAME "${CURRENT_PACKAGES_DIR}/share/licenses" "${CURRENT_PACKAGES_DIR}/share/${PORT}/licenses")

if(EXISTS "${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION}/vtkChemistryConfigure.h")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/vtk-${VTK_SHORT_VERSION}/vtkChemistryConfigure.h" "${SOURCE_PATH}" "not/existing" IGNORE_UNCHANGED)
endif()
# =============================================================================
# Usage
configure_file("${CMAKE_CURRENT_LIST_DIR}/usage" "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" COPYONLY)
# Handle copyright
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/Copyright.txt")

vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/vtk/VTK-vtk-module-properties.cmake" "_vtk_module_import_prefix}/lib/vtk-9.3/hierarchy" "_vtk_module_import_prefix}$<$<CONFIG:Debug>:/debug>/lib/vtk-9.3/hierarchy")

file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")

file(RENAME "${CURRENT_PACKAGES_DIR}/share/licenses" "${CURRENT_PACKAGES_DIR}/share/${PORT}/licenses")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/Copyright.txt" COMMENT [[
This file presents the top-level Copyright.txt.
Additional licenses and notes are located in the licenses directory.
]])
4 changes: 2 additions & 2 deletions ports/vtk/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "vtk",
"version-semver": "9.3.0-pv5.12.1",
"port-version": 5,
"port-version": 6,
"description": "Software system for 3D computer graphics, image processing, and visualization",
"homepage": "https://github.com/Kitware/VTK",
"license": "BSD-3-Clause",
"license": null,
"dependencies": [
"double-conversion",
"eigen3",
Expand Down
6 changes: 3 additions & 3 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -6910,7 +6910,7 @@
},
"paraview": {
"baseline": "5.12.1",
"port-version": 2
"port-version": 3
},
"parmetis": {
"baseline": "2022-07-27",
Expand Down Expand Up @@ -9538,11 +9538,11 @@
},
"vtk": {
"baseline": "9.3.0-pv5.12.1",
"port-version": 5
"port-version": 6
},
"vtk-dicom": {
"baseline": "0.8.16",
"port-version": 1
"port-version": 2
},
"vtk-m": {
"baseline": "2.1.0",
Expand Down
5 changes: 5 additions & 0 deletions versions/p-/paraview.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "3938963da98238ff1f7d2054bfb8e7fae41fc55b",
"version": "5.12.1",
"port-version": 3
},
{
"git-tree": "44f6c15c7d9d433dd86de5546560c598e7922ec8",
"version": "5.12.1",
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vtk-dicom.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "e53703532b0212513a8604e7d613665841c307b5",
"version": "0.8.16",
"port-version": 2
},
{
"git-tree": "73df27ee23b96ebb4d9caad96c39f567f99ceb6f",
"version": "0.8.16",
Expand Down
5 changes: 5 additions & 0 deletions versions/v-/vtk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "5727b06657959909b4ffe7608c3d849acb38f286",
"version-semver": "9.3.0-pv5.12.1",
"port-version": 6
},
{
"git-tree": "99581eb538d39550007d25865540db2a368e3edb",
"version-semver": "9.3.0-pv5.12.1",
Expand Down

0 comments on commit 1420fe2

Please sign in to comment.