Commit f3428ce1 authored by Patric Schmitz's avatar Patric Schmitz

include QtQuick for Qt 5.6+ and remove some redundancy

parent 7b190e8c
......@@ -34,66 +34,72 @@ macro (acg_qt5)
# compute default search paths
set(SUPPORTED_QT_VERSIONS 5.9 5.8 5.7 5.6)
foreach (suffix gcc_64 clang_64)
foreach(version ${SUPPORTED_QT_VERSIONS})
list(APPEND QT_DEFAULT_PATH "~/sw/Qt/${version}/${suffix}")
endforeach()
foreach(version ${SUPPORTED_QT_VERSIONS})
list(APPEND QT_DEFAULT_PATH "~/sw/Qt/${version}/${suffix}")
endforeach()
endforeach()
set(QT5_REQUIRED_PACKAGES
Qt5Core
Qt5Widgets
Qt5Gui
Qt5OpenGL
Qt5Network
Qt5Sql
Qt5Script
Qt5ScriptTools
Qt5Xml
Qt5XmlPatterns
Qt5Help
Qt5UiTools
Qt5Svg
Qt5PrintSupport
Qt5Concurrent
)
find_package (Qt5Core PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
if(Qt5Core_FOUND)
if(Qt5Core_VERSION) # use the new version variable if it is set
set(Qt5Core_VERSION_STRING ${Qt5Core_VERSION})
endif(Qt5Core_VERSION)
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}")
find_package (Qt5Widgets QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Gui QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5OpenGL QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Network QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Sql QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Script QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5ScriptTools QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Xml QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5XmlPatterns QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Help QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5UiTools QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Svg QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5PrintSupport QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5Concurrent QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
#do noot look for Webkit and qt declarative on qt version 5.6 or newer
if(Qt5Core_VERSION) # use the new version variable if it is set
set(Qt5Core_VERSION_STRING ${Qt5Core_VERSION})
endif(Qt5Core_VERSION)
string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1"
QT_VERSION_MAJOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1"
QT_VERSION_MINOR "${Qt5Core_VERSION_STRING}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1"
QT_VERSION_PATCH "${Qt5Core_VERSION_STRING}")
# QtWebkit and QtDeclarative deprecated in 5.6
if(${QT_VERSION_MINOR} LESS 6)
find_package (Qt5Declarative QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
find_package (Qt5WebKit QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
list(APPEND QT5_REQUIRED_PACKAGES
Qt5Declarative
Qt5WebKit
)
# QtDeclarative renamed to QtQuick starting from 5.6
else(${QT_VERSION_MINOR} LESS 6)
list(APPEND QT5_REQUIRED_PACKAGES
Qt5Quick
)
endif(${QT_VERSION_MINOR} LESS 6)
if (NOT WIN32 AND NOT APPLE)
find_package (Qt5X11Extras QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
endif ()
# QtX11Extras only on Linux
if(NOT WIN32 AND NOT APPLE)
list(APPEND QT5_REQUIRED_PACKAGES
Qt5X11Extras
)
endif(NOT WIN32 AND NOT APPLE)
set(QT5_FOUND TRUE)
foreach(QT_PACKAGE IN LISTS QT5_REQUIRED_PACKAGES)
find_package ("${QT_PACKAGE}" QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS})
if(NOT "${${QT_PACKAGE}_FOUND}")
set(QT5_FOUND FALSE)
message("${QT_PACKAGE} not found!")
endif()
endforeach(QT_PACKAGE)
if(${QT_VERSION_MINOR} GREATER 5)
if (Qt5Core_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
set (QT5_FOUND TRUE)
endif()
else(${QT_VERSION_MINOR} GREATER 5)
if (Qt5Core_FOUND AND Qt5Declarative_FOUND AND Qt5Widgets_FOUND
AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND
AND Qt5Script_FOUND AND Qt5ScriptTools_FOUND AND Qt5Sql_FOUND
AND Qt5Xml_FOUND AND Qt5XmlPatterns_FOUND AND Qt5Help_FOUND
AND Qt5WebKit_FOUND AND Qt5UiTools_FOUND AND Qt5Concurrent_FOUND
AND Qt5PrintSupport_FOUND)
set (QT5_FOUND TRUE)
endif()
endif(${QT_VERSION_MINOR} GREATER 5)
endif(Qt5Core_FOUND)
if (QT5_FOUND)
......@@ -124,60 +130,18 @@ macro (acg_qt5)
set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
include_directories(${Qt5Core_INCLUDE_DIRS})
include_directories(${Qt5Declarative_INCLUDE_DIRS})
include_directories(${Qt5Widgets_INCLUDE_DIRS})
include_directories(${Qt5Gui_INCLUDE_DIRS})
include_directories(${Qt5OpenGL_INCLUDE_DIRS})
include_directories(${Qt5Network_INCLUDE_DIRS})
include_directories(${Qt5Script_INCLUDE_DIRS})
include_directories(${Qt5ScriptTools_INCLUDE_DIRS})
include_directories(${Qt5Sql_INCLUDE_DIRS})
include_directories(${Qt5Xml_INCLUDE_DIRS})
include_directories(${Qt5XmlPatterns_INCLUDE_DIRS})
include_directories(${Qt5Help_INCLUDE_DIRS})
include_directories(${Qt5WebKit_INCLUDE_DIRS})
include_directories(${Qt5UiTools_INCLUDE_DIRS})
include_directories(${Qt5Concurrent_INCLUDE_DIRS})
include_directories(${Qt5PrintSupport_INCLUDE_DIRS})
add_definitions(${Qt5Core_DEFINITIONS})
add_definitions(${Qt5Widgets_DEFINITIONS})
add_definitions(${Qt5Gui_DEFINITIONS})
add_definitions(${Qt5OpenGL_DEFINITIONS})
add_definitions(${Qt5Network_DEFINITIONS})
add_definitions(${Qt5Script_DEFINITIONS})
add_definitions(${Qt5ScriptTools_DEFINITIONS})
add_definitions(${Qt5Sql_DEFINITIONS})
add_definitions(${Qt5Xml_DEFINITIONS})
add_definitions(${Qt5XmlPatterns_DEFINITIONS})
add_definitions(${Qt5Help_DEFINITIONS})
add_definitions(${Qt5WebKit_DEFINITIONS})
add_definitions(${Qt5UiTools_DEFINITIONS})
add_definitions(${Qt5Concurrent_DEFINITIONS})
add_definitions(${Qt5PrintSupport_DEFINITIONS})
foreach(QT_PACKAGE IN LISTS QT5_REQUIRED_PACKAGES)
include_directories(${${QT_PACKAGE}_INCLUDE_DIRS})
add_definitions(${${QT_PACKAGE}_DEFINITIONS})
list(APPEND QT_LIBRARIES ${${QT_PACKAGE}_LIBRARIES})
endforeach(QT_PACKAGE)
if (Qt5X11Extras_FOUND)
include_directories(${Qt5X11Extras_INCLUDE_DIRS})
add_definitions(${Qt5X11Extras_DEFINITIONS})
endif ()
if ( NOT MSVC )
if(NOT MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
endif()
set (QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Declarative_LIBRARIES} ${Qt5Widgets_LIBRARIES}
${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Network_LIBRARIES}
${Qt5Script_LIBRARIES} ${Qt5ScriptTools_LIBRARIES} ${Qt5Sql_LIBRARIES}
${Qt5Xml_LIBRARIES} ${Qt5XmlPatterns_LIBRARIES} ${Qt5Help_LIBRARIES}
${Qt5WebKit_LIBRARIES} ${Qt5UiTools_LIBRARIES} ${Qt5Concurrent_LIBARIES}
${Qt5PrintSupport_LIBRARIES})
if (Qt5X11Extras_FOUND)
list (APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES})
endif ()
if (MSVC)
set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES})
if(MSVC)
set(QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES})
endif()
#add_definitions(-DQT_NO_OPENGL)
......
Markdown is supported
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