Skip to content
Draft
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
4 changes: 2 additions & 2 deletions Applications/ctkEventBusDemo/ctkEventBusDemoMainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class ctkEventDemo : public QObject {
Q_OBJECT

Q_SIGNALS:
void receiveEventSignal(QVariantList l);
void updateMessageSignal(QString message);
void receiveEventSignal(const QVariantList &l);
void updateMessageSignal(const QString & message);

public Q_SLOTS:
void receiveEvent(QVariantList l);
Expand Down
1 change: 1 addition & 0 deletions CMake/ctkFunctionGeneratePluginManifest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ function(ctkFunctionGeneratePluginManifest MANIFEST_QRC_FILEPATH_VAR)

configure_file("${CTK_CMAKE_DIR}/MANIFEST.MF.in" "${_manifest_filepath}" @ONLY)
configure_file("${CTK_CMAKE_DIR}/plugin_manifest.qrc.in" "${_manifest_qrc_filepath}" @ONLY)
set(${QRC_SRCS} ${${QRC_SRCS}} ${_qrc_src} PARENT_SCOPE)

if(MY_SKIP_QT5_ADD_RESOURCES)
set(${MANIFEST_QRC_FILEPATH_VAR} ${_manifest_qrc_filepath} PARENT_SCOPE)
Expand Down
32 changes: 10 additions & 22 deletions CMake/ctkMacroBuildApp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -70,37 +70,25 @@ macro(ctkMacroBuildApp)
${my_library_dirs}
)

# Make sure variable are cleared

if( CTK_QT_VERSION EQUAL "5" )
add_definitions(-DHAVE_QT5)
elseif(CTK_QT_VERSION EQUAL "6")
add_definitions(-DHAVE_QT6)
endif()
source_group("Resources" FILES
${MY_MOC_SRCS}
${MY_RESOURCES}
${MY_UI_FORMS}
)

# Create executable
ctk_add_executable_utf8(${proj_name}
${MY_SRCS}
${MY_MOC_SRCS}
${MY_RESOURCES}
)

target_compile_definitions(${proj_name} PRIVATE
HAVE_QT${CTK_QT_VERSION}
)

# Configure CMake Qt automatic code generation
set(uic_search_paths)
foreach(ui_src IN LISTS MY_UI_FORMS)
if(NOT IS_ABSOLUTE ${ui_src})
set(ui_src "${CMAKE_CURRENT_SOURCE_DIR}/${ui_src}")
endif()
get_filename_component(ui_path ${ui_src} PATH)
list(APPEND uic_search_paths ${ui_path})
endforeach()
list(REMOVE_DUPLICATES uic_search_paths)

set_target_properties(${proj_name} PROPERTIES
AUTOMOC ON
AUTORCC ON
AUTOUIC ON
AUTOUIC_SEARCH_PATHS "${uic_search_paths}"
${MY_UI_FORMS}
)

# Set labels associated with the target.
Expand Down
28 changes: 16 additions & 12 deletions CMake/ctkMacroBuildLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -101,26 +101,30 @@ ${${MY_EXPORT_CUSTOM_CONTENT_FROM_VARIABLE}}
set(dynamicHeaders
"${dynamicHeaders};${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h")

# Make sure variable are cleared

# Wrap
if(MY_GENERATE_MOC_SRCS)
set(CMAKE_AUTOMOC ON)
endif()

source_group("Resources" FILES
${MY_RESOURCES}
${MY_UI_FORMS}
)

add_library(${lib_name} ${MY_LIBRARY_TYPE}
${MY_SRCS}
source_group("Generated" FILES
${MY_RESOURCES}
${MY_MOC_SRCS}
${MY_UI_FORMS}
${MOC_CPP_DECORATOR}
)

target_compile_definitions(${lib_name} PRIVATE
HAVE_QT${CTK_QT_VERSION}
)

# Configure CMake Qt automatic code generation
set_target_properties(${lib_name} PROPERTIES
AUTOMOC ON
AUTORCC ON
AUTOUIC ON
AUTOUIC_SEARCH_PATHS "${CMAKE_CURRENT_SOURCE_DIR}/Resources/UI"
add_library(${lib_name} ${MY_LIBRARY_TYPE}
${MY_SRCS}
${MY_MOC_SRCS}
${MY_UI_FORMS}
${MY_RESOURCES}
)

# Set labels associated with the target.
Expand Down
6 changes: 6 additions & 0 deletions CMake/ctkMacroBuildLibWrapper.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ macro(ctkMacroBuildLibWrapper)
KIT_PYTHONQT_SRCS "${MY_SRCS}" FALSE ${HAS_DECORATOR})
if(HAS_DECORATOR)
list(APPEND KIT_PYTHONQT_SRCS ${DECORATOR_HEADER})
if(NOT CMAKE_AUTOMOC)
message(FATAL_ERROR "qt5_wrap_cpp is deprecated in CMakified Qt5\n"
"versions and removed in Qt6. CMAKE_AUTOMOC must be turned ON.\n"
"and ${DECORATOR_HEADER} must be added to the sources."
)
endif()
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})
Expand Down
28 changes: 21 additions & 7 deletions CMake/ctkMacroBuildPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,11 @@ macro(ctkMacroBuildPlugin)
set(dynamicHeaders
"${dynamicHeaders};${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h")

# Make sure variable are cleared
set(MY_RESOURCES)

if( CTK_QT_VERSION EQUAL "5" )
add_definitions(-DHAVE_QT5)
elseif(CTK_QT_VERSION EQUAL "6")
add_definitions(-DHAVE_QT6)
endif()
# Add the generated manifest qrc file
set(manifest_qrc_filepath )
ctkFunctionGeneratePluginManifest(manifest_qrc_filepath
Expand All @@ -186,15 +188,23 @@ macro(ctkMacroBuildPlugin)
${manifest_qrc_filepath}
)

if(manifest_headers_dep)
set_property(SOURCE ${manifest_qrc_src} APPEND
PROPERTY OBJECT_DEPENDS ${manifest_headers_dep})
endif()
list(APPEND MY_RESOURCES ${manifest_qrc_src})

# Create translation files (.ts and .qm)
set(_plugin_qm_files )
set(_plugin_cached_resources_in_binary_tree )
set(_translations_dir "${CMAKE_CURRENT_BINARY_DIR}/CTK-INF/l10n")
if(MY_TRANSLATIONS)
set_source_files_properties(${MY_TRANSLATIONS}
PROPERTIES OUTPUT_LOCATION ${_translations_dir})
if(CTK_QT_VERSION MATCHES "^(5|6)$")
qt_create_translation(_plugin_qm_files ${MY_SRCS} ${MY_UI_FORMS} ${MY_TRANSLATIONS})
if(CTK_QT_VERSION VERSION_EQUAL "5")
qt5_create_translation(_plugin_qm_files ${MY_SRCS} ${MY_UI_FORMS} ${MY_TRANSLATIONS})
elseif(CTK_QT_VERSION VERSION_EQUAL "6")
qt6_create_translation(_plugin_qm_files ${MY_SRCS} ${MY_UI_FORMS} ${MY_TRANSLATIONS})
else()
message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented")
endif()
Expand Down Expand Up @@ -224,8 +234,7 @@ macro(ctkMacroBuildPlugin)
# Add any other additional resource files
if(_plugin_cached_resources_in_source_tree OR _plugin_cached_resources_in_binary_tree)
string(REPLACE "." "_" _plugin_symbolicname ${Plugin-SymbolicName})
set(plugin_qrc_filepath)
ctkMacroGeneratePluginResourcefile(plugin_qrc_filepath
ctkMacroGeneratePluginResourcefile(MY_RESOURCES
NAME ${_plugin_symbolicname}_cached.qrc
PREFIX ${Plugin-SymbolicName}
RESOURCES ${_plugin_cached_resources_in_source_tree}
Expand All @@ -244,11 +253,16 @@ macro(ctkMacroBuildPlugin)
)

source_group("Generated" FILES
${MY_RESOURCES}
${MY_MOC_SRCS}
${MY_UI_FORMS}
${_plugin_qm_files}
)

add_library(${lib_name} ${MY_LIBRARY_TYPE}
${MY_SRCS}
${MY_MOC_SRCS}
${MY_UI_FORMS}
${MY_RESOURCES}
${_plugin_qm_files}
)
Expand Down
53 changes: 23 additions & 30 deletions CMake/ctkMacroBuildQtPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -80,37 +80,29 @@ macro(ctkMacroBuildQtPlugin)
set(dynamicHeaders
"${dynamicHeaders};${CMAKE_CURRENT_BINARY_DIR}/${MY_EXPORT_HEADER_PREFIX}Export.h")

if( CTK_QT_VERSION EQUAL "5" )
add_definitions(-DHAVE_QT5)
elseif(CTK_QT_VERSION EQUAL "6")
add_definitions(-DHAVE_QT6)
endif()

source_group("Resources" FILES
${MY_RESOURCES}
${MY_UI_FORMS}
)

add_library(${lib_name} ${MY_LIBRARY_TYPE}
${MY_SRCS}
source_group("Generated" FILES
${MY_MOC_SRCS}
${MY_RESOURCES}
${MY_UI_FORMS}
)

target_compile_definitions(${lib_name} PRIVATE
HAVE_QT${CTK_QT_VERSION}
)

# Configure CMake Qt automatic code generation
set(uic_search_paths)
foreach(ui_src IN LISTS MY_UI_FORMS)
if(NOT IS_ABSOLUTE ${ui_src})
set(ui_src "${CMAKE_CURRENT_SOURCE_DIR}/${ui_src}")
endif()
get_filename_component(ui_path ${ui_src} PATH)
list(APPEND uic_search_paths ${ui_path})
endforeach()
list(REMOVE_DUPLICATES uic_search_paths)

set_target_properties(${lib_name} PROPERTIES
AUTOMOC ON
AUTORCC ON
AUTOUIC ON
AUTOUIC_SEARCH_PATHS "${uic_search_paths}"
)
add_library(${lib_name} ${MY_LIBRARY_TYPE}
${MY_SRCS}
${MY_MOC_SRCS}
${MY_UI_FORMS}
${MY_RESOURCES}
)

# Extract library name associated with the plugin and use it as label
string(REGEX REPLACE "(.*)Plugin[s]?" "\\1" label ${lib_name})
Expand Down Expand Up @@ -189,14 +181,15 @@ macro(ctkMacroBuildQtDesignerPlugin)
endif()
ctkMacroBuildQtPlugin(
PLUGIN_DIR designer
${ARGN})
cmake_parse_arguments(MY
"" # no options
"NAME;EXPORT_DIRECTIVE;FOLDER;PLUGIN_DIR" # one value args
"SRCS;MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;RESOURCES" # multi value args
${ARGN}
)
target_link_libraries(${MY_NAME} Qt${CTK_QT_VERSION}::Designer)
)
cmake_parse_arguments(MY
"" # no options
"NAME;EXPORT_DIRECTIVE;FOLDER;PLUGIN_DIR" # one value args
"SRCS;MOC_SRCS;UI_FORMS;INCLUDE_DIRECTORIES;TARGET_LIBRARIES;RESOURCES" # multi value args
${ARGN}
)
target_link_libraries(${MY_NAME} Qt5::Designer)
endmacro()

macro(ctkMacroBuildQtIconEnginesPlugin)
Expand Down
66 changes: 0 additions & 66 deletions CMake/ctkMacroGenerateMocs.cmake
Original file line number Diff line number Diff line change
@@ -1,66 +0,0 @@

# QT5_GENERATE_MOCS(inputfile1 [inputfile2 ...] [USE_MOC_EXTENSION])

include(MacroAddFileDependencies)

function(_ctk_generate_mocs)
set(options
USE_MOC_EXTENSION
)
set(oneValueArgs
)
set(multiValueArgs
)
cmake_parse_arguments(CTK_GENERATE_MOCS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(CTK_QT_VERSION VERSION_EQUAL "5")
if(Qt5_VERSION VERSION_LESS "5.15.0")
QT5_GET_MOC_FLAGS(_moc_flags)
else()
# _moc_flags is not needed because it is internally handled
# by qt5_generate_moc called below.
endif()
else()
message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented")
endif()
foreach(file IN LISTS CTK_GENERATE_MOCS_UNPARSED_ARGUMENTS)

get_filename_component(abs_file ${file} ABSOLUTE)

get_filename_component(source_name ${file} NAME_WE)

if(CTK_GENERATE_MOCS_USE_MOC_EXTENSION)
set(moc_file "${CMAKE_CURRENT_BINARY_DIR}/${source_name}.moc")
else()
get_filename_component(source_ext ${file} EXT)
if(${source_ext} MATCHES "\\.[hH]")
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source_name}.cpp)
set(source_ext .cpp)
elseif(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${source_name}.cxx)
set(source_ext .cxx)
endif()
endif()
set(moc_file "${CMAKE_CURRENT_BINARY_DIR}/moc_${source_name}${source_ext}")
endif()

if(CTK_QT_VERSION VERSION_EQUAL "5")
if(Qt5_VERSION VERSION_LESS "5.6")
QT5_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "")
elseif(Qt5_VERSION VERSION_LESS "5.15.0")
QT5_CREATE_MOC_COMMAND(${abs_file} ${moc_file} "${_moc_flags}" "" "" "")
else()
# qt5_generate_moc internally calls qt5_get_moc_flags and ensure
# no warnings are reported.
qt5_generate_moc(${abs_file} ${moc_file})
endif()
else()
message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented")
endif()
MACRO_ADD_FILE_DEPENDENCIES(${abs_file} ${moc_file})
endforeach()
endfunction()

# create a Qt5 alias
macro(QT5_GENERATE_MOCS)
_ctk_generate_mocs(${ARGN})
endmacro()
14 changes: 1 addition & 13 deletions CMake/ctkMacroGeneratePluginResourceFile.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -43,16 +43,4 @@ function(ctkMacroGeneratePluginResourceFile PLUGIN_RESOURCES_FILEPATH_VAR)
</RCC>
")
configure_file("${CTK_CMAKE_DIR}/plugin_resources_cached.qrc.in" "${_qrc_filepath}" @ONLY)

if(MY_SKIP_QT5_ADD_RESOURCES)
set(${PLUGIN_RESOURCES_FILEPATH_VAR} "${_qrc_filepath}" PARENT_SCOPE)
else()
if(CTK_QT_VERSION VERSION_EQUAL "5")
QT5_ADD_RESOURCES(_qrc_src ${_qrc_filepath})
else()
message(FATAL_ERROR "Support for Qt${CTK_QT_VERSION} is not implemented")
endif()
set(QRC_SRCS_VAR "${PLUGIN_RESOURCES_FILEPATH_VAR}")
set(${QRC_SRCS_VAR} ${_qrc_src} PARENT_SCOPE)
endif()
endfunction()
endmacro()
4 changes: 3 additions & 1 deletion CMake/ctkMacroWrapPythonQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ macro(ctkMacroWrapPythonQt WRAPPING_NAMESPACE TARGET SRCS_LIST_NAME SOURCES IS_W
${${SRCS_LIST_NAME}}
${wrapper_init_cpp_filename}
${wrapper_module_init_cpp_filename}
${wrapper_h_filename}
${${TARGET}_MOC_CXX}
# Assume CMAKE_AUTOMOC ON
${CMAKE_CURRENT_BINARY_DIR}/${wrapper_h_filename}
)

#
Expand Down
4 changes: 0 additions & 4 deletions CMakeExternals/PythonQt.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,6 @@ if(NOT DEFINED PYTHONQT_INSTALL_DIR)
)
endif()
list(APPEND qtlibs qml quick)
if(CTK_QT_VERSION VERSION_LESS "5.6.0")
list(APPEND qtlibs webkit)
endif()
set(_qt_version_string "${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR}.${Qt5_VERSION_PATCH}")
elseif(CTK_QT_VERSION VERSION_EQUAL "6")
list(APPEND ep_PythonQt_args
-DQt6_DIR:PATH=${Qt6_DIR}
Expand Down
Loading
Loading