Skip to content
Open
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ jobs:
if: ${{ matrix.qt-major-version == 5 }}
run: |
sudo apt-get install -y \
python3-dev \
qtbase5-dev \
qtmultimedia5-dev \
qttools5-dev \
Expand Down
2 changes: 1 addition & 1 deletion CMake/ctkBlockCheckDependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ set(${Log4Qt_enabling_variable}_INCLUDE_DIRS Log4Qt_INCLUDE_DIRS)
set(${Log4Qt_enabling_variable}_FIND_PACKAGE_CMD Log4Qt)

set(PythonQt_enabling_variable PYTHONQT_LIBRARIES)
set(${PythonQt_enabling_variable}_INCLUDE_DIRS PYTHONQT_INCLUDE_DIR PYTHON_INCLUDE_DIRS)
set(${PythonQt_enabling_variable}_INCLUDE_DIRS PYTHONQT_INCLUDE_DIR Python3_INCLUDE_DIRS)
set(${PythonQt_enabling_variable}_FIND_PACKAGE_CMD PythonQt)

set(QtSOAP_enabling_variable QtSOAP_LIBRARIES)
Expand Down
6 changes: 3 additions & 3 deletions CMake/ctkMacroBuildLibWrapper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ macro(ctkMacroBuildLibWrapper)
# Since the PythonQt decorator depends on PythonQt, Python and VTK, let's link against
# these ones to avoid complaints of MSVC
# Note: "LINK_DIRECTORIES" has to be invoked before "ADD_LIBRARY"
ctkFunctionExtractOptimizedLibrary(PYTHON_LIBRARIES PYTHON_LIBRARY)
set(my_EXTRA_PYTHON_LIBRARIES ${PYTHON_LIBRARY} ${PYTHONQT_LIBRARIES})
ctkFunctionExtractOptimizedLibrary(Python3_LIBRARIES PYTHON_LIBRARY)
set(my_EXTRA_Python3_LIBRARIES ${PYTHON_LIBRARY} ${PYTHONQT_LIBRARIES})

# Does a header having the expected filename exists ?
string(REGEX REPLACE "^CTK" "ctk" lib_name_lc_ctk ${lib_name})
Expand All @@ -122,7 +122,7 @@ macro(ctkMacroBuildLibWrapper)
list(APPEND KIT_PYTHONQT_SRCS ${DECORATOR_HEADER})
endif()
add_library(${lib_name}PythonQt ${MY_WRAPPER_LIBRARY_TYPE} ${KIT_PYTHONQT_SRCS})
target_link_libraries(${lib_name}PythonQt ${lib_name} ${my_EXTRA_PYTHON_LIBRARIES})
target_link_libraries(${lib_name}PythonQt ${lib_name} ${my_EXTRA_Python3_LIBRARIES})
if(MY_WRAPPER_LIBRARY_TYPE STREQUAL "STATIC")
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64-bit
set_target_properties(${lib_name}PythonQt PROPERTIES COMPILE_FLAGS "-fPIC")
Expand Down
10 changes: 5 additions & 5 deletions CMake/ctkMacroCompilePythonScript.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -164,15 +164,15 @@ function(_ctk_add_compile_python_directories_target target keep_only_pyc)
endif()
endforeach()

if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp REQUIRED)
if(NOT Python3_Interpreter_FOUND)
find_package(Python3 COMPONENTS Interpreter REQUIRED)
endif()
if(NOT PYTHONLIBS_FOUND)
find_package(PythonLibs REQUIRED)
if(NOT Python3_Development_FOUND)
find_package(Python3 COMPONENTS Development REQUIRED)
endif()

# Extract python lib path
ctkFunctionExtractOptimizedLibrary(PYTHON_LIBRARIES PYTHON_LIBRARY)
ctkFunctionExtractOptimizedLibrary(Python3_LIBRARIES PYTHON_LIBRARY)
get_filename_component(PYTHON_LIBRARY_PATH "${PYTHON_LIBRARY}" PATH)

# Configure cmake script associated with the custom command
Expand Down
12 changes: 6 additions & 6 deletions CMake/ctkMacroWrapPythonQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ macro(ctkMacroWrapPythonQt WRAPPING_NAMESPACE TARGET SRCS_LIST_NAME SOURCES IS_W
# TODO: this find package seems not to work when called form a superbuild, but the call is needed
# in general to find the python interpreter. In CTK, the toplevel CMakeLists.txt does the find
# package so this is a no-op. Other uses of this file may need to have this call so it is still enabled.
if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "PYTHON_EXECUTABLE not specified or inexistent when calling ctkMacroWrapPythonQt")
if(NOT Python3_Interpreter_FOUND)
find_package(Python3 COMPONENTS Interpreter)
if(NOT Python3_Interpreter_FOUND)
message(FATAL_ERROR "Python3_EXECUTABLE not specified or inexistent when calling ctkMacroWrapPythonQt")
endif()
endif()

Expand Down Expand Up @@ -157,7 +157,7 @@ macro(ctkMacroWrapPythonQt WRAPPING_NAMESPACE TARGET SRCS_LIST_NAME SOURCES IS_W
DEPENDS
${SOURCES_TO_WRAP}
${CTK_CMAKE_DIR}/ctkWrapPythonQt.py
COMMAND ${PYTHON_EXECUTABLE} ${CTK_CMAKE_DIR}/ctkWrapPythonQt.py
COMMAND ${Python3_EXECUTABLE} ${CTK_CMAKE_DIR}/ctkWrapPythonQt.py
--target=${TARGET}
--namespace=${WRAPPING_NAMESPACE}
--output-dir=${CMAKE_CURRENT_BINARY_DIR}/${wrap_int_dir} ${extra_args}
Expand Down Expand Up @@ -188,6 +188,6 @@ macro(ctkMacroWrapPythonQt WRAPPING_NAMESPACE TARGET SRCS_LIST_NAME SOURCES IS_W
if(NOT PYTHONQT_FOUND)
message(FATAL_ERROR "error: PythonQt package is required to build ${TARGET}PythonQt")
endif()
include_directories(${PYTHON_INCLUDE_DIRS} ${PYTHONQT_INCLUDE_DIR})
include_directories(${Python3_INCLUDE_DIRS} ${PYTHONQT_INCLUDE_DIR})

endmacro()
2 changes: 1 addition & 1 deletion CMake/ctk_compile_python_scripts.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ else()
endif()

execute_process(
COMMAND "@PYTHON_EXECUTABLE@" "@compile_all_script@"
COMMAND "@Python3_EXECUTABLE@" "@compile_all_script@"
RESULT_VARIABLE result_var
)
if(NOT result_var STREQUAL 0)
Expand Down
10 changes: 5 additions & 5 deletions CMakeExternals/PythonQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,9 @@ if(NOT DEFINED PYTHONQT_INSTALL_DIR)
endif()

# Python is required
if(NOT PYTHONLIBS_FOUND)
find_package(PythonLibs)
if(NOT PYTHONLIBS_FOUND)
if(NOT Python3_Development_FOUND)
find_package(Python3 COMPONENTS Development)
if(NOT Python3_Development_FOUND)
message(FATAL_ERROR "error: Python is required to build ${PROJECT_NAME}")
endif()
endif()
Expand All @@ -89,7 +89,7 @@ if(NOT DEFINED PYTHONQT_INSTALL_DIR)
set(Python3_LIBRARY_RELEASE ${PYTHON_LIBRARY})
find_package(Python3 COMPONENTS Development REQUIRED)

ctkFunctionExtractOptimizedLibrary(PYTHON_LIBRARIES PYTHON_LIBRARY)
ctkFunctionExtractOptimizedLibrary(Python3_LIBRARY PYTHON_LIBRARY)

set(revision_tag 74dcd675e1515324cd7467a328d63dd25d263679) # patched-v4.1.0-2026-06-05-9992368e9
if(${proj}_REVISION_TAG)
Expand Down Expand Up @@ -299,7 +299,7 @@ set(PythonQt_DIR ${PYTHONQT_INSTALL_DIR})
mark_as_superbuild(
VARS
PYTHONQT_INSTALL_DIR:PATH
PYTHON_EXECUTABLE:FILEPATH # FindPythonInterp expects PYTHON_EXECUTABLE variable to be defined
Python3_EXECUTABLE:FILEPATH # FindPythonInterp expects Python3_EXECUTABLE variable to be defined
PYTHON_INCLUDE_DIR:PATH # FindPythonQt expects PYTHON_INCLUDE_DIR variable to be defined
PYTHON_INCLUDE_DIR2:PATH
PYTHON_LIBRARY:FILEPATH # FindPythonQt expects PYTHON_LIBRARY variable to be defined
Expand Down
6 changes: 3 additions & 3 deletions CMakeExternals/VTK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ if(NOT DEFINED VTK_DIR AND NOT ${CMAKE_PROJECT_NAME}_USE_SYSTEM_${proj})

if(CTK_LIB_Scripting/Python/Core_PYTHONQT_USE_VTK)

set(Python3_EXECUTABLE ${PYTHON_EXECUTABLE})
set(Python3_EXECUTABLE ${Python3_EXECUTABLE})
set(Python3_INCLUDE_DIR ${PYTHON_INCLUDE_DIR})
set(Python3_LIBRARY ${PYTHON_LIBRARY})
set(Python3_LIBRARY_DEBUG ${PYTHON_LIBRARY})
set(Python3_LIBRARY_RELEASE ${PYTHON_LIBRARY})
find_package(Python3 COMPONENTS Interpreter Development)

ctkFunctionExtractOptimizedLibrary(PYTHON_LIBRARIES PYTHON_LIBRARY)
ctkFunctionExtractOptimizedLibrary(Python3_LIBRARIES PYTHON_LIBRARY)
list(APPEND additional_vtk_cmakevars
# FindPythonInterp, FindPythonLibs
-DPYTHON_EXECUTABLE:PATH=${PYTHON_EXECUTABLE}
-DPython3_EXECUTABLE:PATH=${Python3_EXECUTABLE}
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
-DPYTHON_DEBUG_LIBRARIES:FILEPATH=${PYTHON_DEBUG_LIBRARIES}
Expand Down
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -965,16 +965,16 @@ endif()

# Check if dependencies are satisfied
if(CTK_LIB_Scripting/Python/Core)
if(NOT PYTHONINTERP_FOUND)
find_package(PythonInterp)
if(NOT PYTHONINTERP_FOUND)
message(FATAL_ERROR "PYTHON_EXECUTABLE variable should be set to build CTK_LIB_Scripting/Python")
if(NOT Python3_Interpreter_FOUND)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
if(NOT Python3_Interpreter_FOUND)
message(FATAL_ERROR "Python3_EXECUTABLE variable should be set to build CTK_LIB_Scripting/Python")
endif()
endif()
if(NOT PYTHONLIBS_FOUND)
find_package(PythonLibs)
if(NOT PYTHONLIBS_FOUND)
message(FATAL_ERROR "PYTHON_LIBRARIES and PYTHON_INCLUDE_DIRS should be set to build CTK_LIB_Scripting/Python")
if(NOT Python3_Development_FOUND)
find_package(Python3 COMPONENTS Interpreter Development REQUIRED)
if(NOT Python3_Development_FOUND)
message(FATAL_ERROR "Python3_LIBRARIES and Python3_INCLUDE_DIRS should be set to build CTK_LIB_Scripting/Python")
endif()
endif()
endif()
Expand Down
2 changes: 1 addition & 1 deletion Libs/Scripting/Python/Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ configure_file(

# Target libraries - See CMake/ctkFunctionGetTargetLibraries.cmake
# The following macro will read the target libraries from the file 'target_libraries.cmake'
ctkFunctionExtractOptimizedLibrary(PYTHON_LIBRARIES PYTHON_LIBRARY)
ctkFunctionExtractOptimizedLibrary(Python3_LIBRARIES PYTHON_LIBRARY)
ctkFunctionGetTargetLibraries(KIT_target_libraries)

ctkMacroBuildLib(
Expand Down
Loading