Commit efd64156 authored by saubatn's avatar saubatn
Browse files

UPDATED CMake configuration files for Qt5.

Configure OK (should be missing stuff for compilation and linking).
parent f2ca47fa
......@@ -15,23 +15,25 @@ set(CAMITK_VERSION_MINOR "@CAMITK_VERSION_MINOR@")
set(CAMITK_SHORT_VERSION_STRING "camitk-${CAMITK_VERSION_MAJOR}.${CAMITK_VERSION_MINOR}")
#-- Check dependencies: Qt and VTK
find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns REQUIRED)
if(NOT QT4_FOUND)
message(SEND_ERROR "Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
# Find Qt5
find_package(Qt5 COMPONENTS Core Gui Xml XmlPatterns Widgets Help UiTools OpenGL OpenGLExtensions REQUIRED)
if (Qt5_FOUND)
message(STATUS "CamiTK SDK : found Qt ${Qt5_VERSION}.")
else()
message(SEND_ERROR "Failed to find Qt 5.x. This is needed by CamiTK.")
endif()
set (QT_USE_QTXML ON)
include(${QT_USE_FILE})
# set (QT_USE_QTXML ON)
# include(${QT_USE_FILE})
# Find VTK
find_package(VTK REQUIRED)
if(NOT VTK_FOUND)
message(SEND_ERROR "Failed to find Vtk 5.8 or greater. This is needed by CamiTK.")
endif()
if("${VTK_VERSION}" VERSION_LESS 5.8)
if("${VTK_VERSION}" VERSION_LESS 6.0)
message(FATAL_ERROR "Found VTK ${VTK_VERSION} version but at least 5.8 is required. Please update your version of VTK.")
endif()
message(STATUS "Found suitable version of VTK : ${VTK_VERSION} (required is at least 5.8.0)")
message(STATUS "Found suitable version of VTK : ${VTK_VERSION} (required is at least 6.0.0)")
include(${VTK_USE_FILE})
#-- CAMITK_DIR variable
......
......@@ -28,10 +28,10 @@ macro(gather_headers_and_sources Name)
endif()
# manage Qt ui
qt4_wrap_ui (UI ${File_UI})
qt5_wrap_ui (UI ${File_UI})
# manage Qt resources
qt4_add_resources(QRC ${File_QRC})
qt5_add_resources(QRC ${File_QRC})
# find Q_OBJECT derived class
foreach(HEADER ${HEADERS})
......@@ -42,7 +42,7 @@ macro(gather_headers_and_sources Name)
endforeach(HEADER)
# manage Qt inherited sources
qt4_wrap_cpp(QT_SRCS ${MOC_SOURCES})
qt5_wrap_cpp(QT_SRCS ${MOC_SOURCES})
# On Windows, Visual Studio, organize files in subdirectories
if(MSVC)
......
......@@ -46,7 +46,7 @@
#! \param NEEDS_COMPONENT_EXTENSION list of needed component extensions
#! \param NEEDS_ACTION_EXTENSION list of needed component extensions
#! \param DEFINES list of define flags to add at compilation time
#! \param CXX_FLAGS = list of compiler flags to add (such as warning levels (-Wall ...)).
#! \param CXX_FLAGS list of compiler flags to add (such as warning levels (-Wall ...)).
#! \param ADDITIONAL_SOURCES list of additional sources (that cannot be automatically found by gather_headers_and_sources macro)
#! \param CEP_NAME specify the CEP_NAME, which is used to categorized the application for packaging purpose
#! No CEP_NAME provided will result in default categorization (generic application).
......@@ -653,19 +653,20 @@ macro(camitk_application)
endif()
endif()
# Nico : TODO remove if not necessary
# QT MODULES
set(QT_MODULES_LIBRARIES)
if(${APPLICATION_NAME_CMAKE}_NEEDS_QT_MODULES)
find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork QtTest REQUIRED)
if(NOT QT4_FOUND)
message(SEND_ERROR "${APPLICATION_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
endif()
# set(QT_MODULES_LIBRARIES)
# if(${APPLICATION_NAME_CMAKE}_NEEDS_QT_MODULES)
# find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork QtTest REQUIRED)
# if(NOT QT4_FOUND)
# message(SEND_ERROR "${APPLICATION_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
# endif()
# CMake will add the Qt modules specific include directories
include(${QT_USE_FILE})
# Qt additional modules are required for linking
set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
endif()
# # CMake will add the Qt modules specific include directories
# include(${QT_USE_FILE})
# # Qt additional modules are required for linking
# set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
# endif()
# EXTERNAL LIBRARIES
set(EXTERNAL_LIBRARIES)
......@@ -873,7 +874,8 @@ macro(camitk_application)
# #
#########################################################################
# LINKING LIBRARIES
target_link_libraries(${APPLICATION_TARGET_NAME} ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES} ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES} ${QT_MODULES_LIBRARIES} ${XERCESC_LIBRARY} ${ITK_LIBRARIES} ${PYTHON_LIBRARIES} ${EXTERNAL_LIBRARIES})
# Nico : has removed ${QT_MODULES_LIBRARIES}
target_link_libraries(${APPLICATION_TARGET_NAME} ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES} ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES} ${XERCESC_LIBRARY} ${ITK_LIBRARIES} ${PYTHON_LIBRARIES} ${EXTERNAL_LIBRARIES})
......
......@@ -907,20 +907,21 @@ macro(camitk_extension)
endif()
endif()
# Nico : On le garde ?
# ADDTIONAL QT MODULES
set(QT_MODULES_LIBRARIES)
if(${EXTENSION_NAME_CMAKE}_NEEDS_QT_MODULES)
find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork QtTest REQUIRED)
if(NOT QT4_FOUND)
message(SEND_ERROR "${EXTENSION_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
endif()
# set(QT_MODULES_LIBRARIES)
# if(${EXTENSION_NAME_CMAKE}_NEEDS_QT_MODULES)
# find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork QtTest REQUIRED)
# if(NOT QT4_FOUND)
# message(SEND_ERROR "${EXTENSION_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
# endif()
# CMake will add the Qt modules specific include directories
include(${QT_USE_FILE})
# # CMake will add the Qt modules specific include directories
# include(${QT_USE_FILE})
# Qt additional modules are required for linking
set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
endif()
# # Qt additional modules are required for linking
# set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
# endif()
# EXTERNAL LIBRARIES
set(EXTERNAL_LIBRARIES)
......@@ -1141,7 +1142,8 @@ macro(camitk_extension)
#########################################################################
# LINKING LIBRARIES
# Any component or action has to be linked with ${CAMITK_CORE_LIBRARIES} and with all its dependencies
target_link_libraries(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES} ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES} ${QT_MODULES_LIBRARIES} ${ITK_LIBRARIES} ${LIBXML2_LIBRARY} ${OpenCV_LIBRARIES} ${IGSTK_LIBRARIES} ${XERCESC_LIBRARIES} ${GDCM_LIBRARIES} ${EXTERNAL_LIBRARIES})
# Nico : a supprimé ${QT_MODULES_LIBRARIES} de l'édition de liens
target_link_libraries(${${TYPE_EXTENSION_CMAKE}_TARGET_NAME} ${CAMITK_CORE_LIBRARIES} ${CAMITK_LIBRARIES} ${COMPONENT_EXTENSION_LIBRARIES} ${ACTION_EXTENSION_LIBRARIES} ${CEP_LIBRARIES} ${ITK_LIBRARIES} ${LIBXML2_LIBRARY} ${OpenCV_LIBRARIES} ${IGSTK_LIBRARIES} ${XERCESC_LIBRARIES} ${GDCM_LIBRARIES} ${EXTERNAL_LIBRARIES})
......
......@@ -661,20 +661,21 @@ macro(camitk_library)
endif()
endif()
# Nico : Vérifier si on peut le supprimer
# ADDITIONAL QT MODULES
set(QT_MODULES_LIBRARIES)
if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_QT_MODULES)
find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork QtTest REQUIRED)
if(NOT QT4_FOUND)
message(SEND_ERROR "${DEFAULT_LIBRARY_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
endif()
# set(QT_MODULES_LIBRARIES)
# if(${DEFAULT_LIBRARY_NAME_CMAKE}_NEEDS_QT_MODULES)
# find_package(Qt4 "4.7" COMPONENTS QtCore QtGui QtXml QtXmlPatterns QtWebkit QtOpenGL QtScript QtSQL QtNetwork QtTest REQUIRED)
# if(NOT QT4_FOUND)
# message(SEND_ERROR "${DEFAULT_LIBRARY_NAME} : Failed to find Qt 4.7 or greater. This is needed by CamiTK.")
# endif()
# CMake will add the Qt modules specific include directories
include(${QT_USE_FILE})
# # CMake will add the Qt modules specific include directories
# include(${QT_USE_FILE})
# Qt additional modules are required for linking
set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
endif()
# # Qt additional modules are required for linking
# set(QT_MODULES_LIBRARIES ${QT_LIBRARIES})
# endif()
# EXTERNAL DEPENDENCIES
set(LINKER_EXTERNAL_LIBRARIES)
......@@ -792,7 +793,8 @@ macro(camitk_library)
# #
#########################################################################
# LINKING LIBRARIES
target_link_libraries(${LIBRARY_TARGET_NAME} ${CEP_LIBRARIES} ${LINKER_EXTERNAL_LIBRARIES} ${LIBXML2_LIBRARY} ${ITK_LIBRARIES} ${QT_MODULES_LIBRARIES} ${XERCESC_LIBRARIES})
#Nico : TODO has removed ${QT_MODULES_LIBRARIES}
target_link_libraries(${LIBRARY_TARGET_NAME} ${CEP_LIBRARIES} ${LINKER_EXTERNAL_LIBRARIES} ${LIBXML2_LIBRARY} ${ITK_LIBRARIES} ${XERCESC_LIBRARIES})
......
......@@ -12,13 +12,17 @@ if (NOT CEP_NAME STREQUAL "SDK")
message(SEND_ERROR "Compilation of QTPROPERTYBROWSER outside CamiTK SDK not supported yet. Please contact us.")
endif()
find_package(Qt4 4.6.0 REQUIRED)
if(NOT QT4_FOUND)
message(SEND_ERROR "Failed to find Qt 4.6 or greater. This is needed for qtpropertybrowser lib, and therefore for CamiTK.")
# Instruct CMake to run moc automatically when needed.
set(CMAKE_AUTOMOC OFF)
find_package(Qt5 COMPONENTS Core Gui Xml XmlPatterns Widgets Help UiTools OpenGL OpenGLExtensions REQUIRED)
if (Qt5_FOUND)
message(STATUS "QtPropertyBrowser : found Qt ${Qt5_VERSION}.")
else()
message(SEND_ERROR "Failed to find Qt 5.x. This is needed by QtPropertyBrowser.")
endif()
include(${QT_USE_FILE})
# include(${QT_USE_FILE})
set(qtpropertyeditor_SRCS
src/qtpropertybrowser.cpp
......@@ -37,43 +41,43 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}
${QT_INCLUDE_DIR}
)
qt4_generate_moc(
qt5_generate_moc(
src/qtpropertybrowser.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowser.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qtpropertymanager.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertymanager.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qteditorfactory.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qteditorfactory.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qtvariantproperty.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qtvariantproperty.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qttreepropertybrowser.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qttreepropertybrowser.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qtbuttonpropertybrowser.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qtbuttonpropertybrowser.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qtgroupboxpropertybrowser.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qtgroupboxpropertybrowser.cpp
)
qt4_generate_moc(
qt5_generate_moc(
src/qtpropertymanager.cpp
${CMAKE_CURRENT_BINARY_DIR}/qtpropertymanager.moc
)
qt4_generate_moc(
qt5_generate_moc(
src/qteditorfactory.cpp
${CMAKE_CURRENT_BINARY_DIR}/qteditorfactory.moc
)
qt4_generate_moc(
qt5_generate_moc(
src/qttreepropertybrowser.cpp
${CMAKE_CURRENT_BINARY_DIR}/qttreepropertybrowser.moc
)
......@@ -98,7 +102,7 @@ set_source_files_properties(
HEADER_FILE_ONLY true
)
qt4_generate_moc(
qt5_generate_moc(
src/qtpropertybrowserutils_p.h
${CMAKE_CURRENT_BINARY_DIR}/moc_qtpropertybrowserutils_p.cpp
)
......@@ -114,12 +118,12 @@ set(
${qtpropertyeditor_HEADERS_ONLY_MOC}
)
qt4_add_resources(
qt5_add_resources(
qtpropertyeditor_RESOURCES
src/qtpropertybrowser.qrc
)
qt4_add_resources(RESOURCE_SRCS src/qtpropertybrowser.qrc)
qt5_add_resources(RESOURCE_SRCS src/qtpropertybrowser.qrc)
set(SRCS ${extension_MOC}
${qtpropertyeditor_MOC}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment