From 0beeb7f9c11a4992eca0b3bea2ec0fbe4438dc92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20M=C3=B6bius?= Date: Fri, 14 Dec 2018 14:57:30 +0100 Subject: [PATCH] Reduce Qt footprint even more --- cmake/ACGQt.cmake | 76 ++++++------------- .../Decimating/DecimaterGui/CMakeLists.txt | 5 +- src/OpenMesh/Apps/ProgViewer/CMakeLists.txt | 5 +- src/OpenMesh/Apps/QtViewer/CMakeLists.txt | 5 +- .../Subdivider/SubdividerGui/CMakeLists.txt | 5 +- .../VDProgMesh/Synthesizer/CMakeLists.txt | 5 +- 6 files changed, 28 insertions(+), 73 deletions(-) diff --git a/cmake/ACGQt.cmake b/cmake/ACGQt.cmake index c5c6a5a9..0648ccc3 100644 --- a/cmake/ACGQt.cmake +++ b/cmake/ACGQt.cmake @@ -12,11 +12,6 @@ endmacro() macro (acg_qt5) - if(POLICY CMP0020) - # Automatically link Qt executables to qtmain target on Windows - cmake_policy(SET CMP0020 NEW) - endif(POLICY CMP0020) - #try to find qt5 automatically #for custom installation of qt5, dont use any of these variables set (QT5_INSTALL_PATH "" CACHE PATH "Path to Qt5 directory which contains lib and include folder") @@ -50,13 +45,12 @@ macro (acg_qt5) 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}) if (NOT WIN32 AND NOT APPLE) find_package (Qt5X11Extras QUIET PATHS ${QT_DEFAULT_PATH} ${QT5_FINDER_FLAGS}) endif () - if (Qt5Core_FOUND AND Qt5Widgets_FOUND AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND AND Qt5Network_FOUND ) + if (Qt5Core_FOUND AND Qt5Widgets_FOUND AND Qt5Gui_FOUND AND Qt5OpenGL_FOUND ) set (QT5_FOUND TRUE) endif() @@ -90,17 +84,6 @@ macro (acg_qt5) set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - include_directories(${Qt5Core_INCLUDE_DIRS}) - include_directories(${Qt5Widgets_INCLUDE_DIRS}) - include_directories(${Qt5Gui_INCLUDE_DIRS}) - include_directories(${Qt5OpenGL_INCLUDE_DIRS}) - include_directories(${Qt5Network_INCLUDE_DIRS}) - add_definitions(${Qt5Core_DEFINITIONS}) - add_definitions(${Qt5Widgets_DEFINITIONS}) - add_definitions(${Qt5Gui_DEFINITIONS}) - add_definitions(${Qt5OpenGL_DEFINITIONS}) - add_definitions(${Qt5Network_DEFINITIONS}) - if (Qt5X11Extras_FOUND) include_directories(${Qt5X11Extras_INCLUDE_DIRS}) add_definitions(${Qt5X11Extras_DEFINITIONS}) @@ -110,39 +93,26 @@ macro (acg_qt5) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") endif() - set (QT_LIBRARIES ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES} - ${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Network_LIBRARIES} ) - - if (Qt5X11Extras_FOUND) - list (APPEND QT_LIBRARIES ${Qt5X11Extras_LIBRARIES}) - endif () - - if (MSVC) - set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_QTMAIN_LIBRARIES}) - endif() - - #add_definitions(-DQT_NO_OPENGL) - - #adding QT_NO_DEBUG to all release modes. - # Note: for multi generators like msvc you cannot set this definition depending of - # the current build type, because it may change in the future inside the ide and not via cmake - if (MSVC_IDE) - set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - - set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - set(CMAKE_CXX_FLAGS_MINSITEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - - set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") - else(MSVC_IDE) - if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") - add_definitions(-DQT_NO_DEBUG) - endif() - endif(MSVC_IDE) - - # Enable automoc - set(CMAKE_AUTOMOC ON) - - endif (QT5_FOUND) + #adding QT_NO_DEBUG to all release modes. + # Note: for multi generators like msvc you cannot set this definition depending of + # the current build type, because it may change in the future inside the ide and not via cmake + if (MSVC_IDE) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + + set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + set(CMAKE_CXX_FLAGS_MINSITEREL "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /DQT_NO_DEBUG") + else(MSVC_IDE) + if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug") + add_definitions(-DQT_NO_DEBUG) + endif() + endif(MSVC_IDE) + + # Enable automoc + set(CMAKE_AUTOMOC ON) + + endif (QT5_FOUND) endmacro () diff --git a/src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt b/src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt index 5357f844..fa9f6f14 100644 --- a/src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt +++ b/src/OpenMesh/Apps/Decimating/DecimaterGui/CMakeLists.txt @@ -4,7 +4,6 @@ include_directories ( ../../../.. ${CMAKE_CURRENT_SOURCE_DIR} ${GLUT_INCLUDE_DIR} - ${QT_INCLUDE_DIR} ) # source code directories @@ -28,8 +27,6 @@ acg_drop_templates (sources) if (WIN32) acg_add_executable (DecimaterGui WIN32 ${sources} ${headers}) - # link to qtmain library to get WinMain function for a non terminal app - target_link_libraries (DecimaterGui ${QT_QTMAIN_LIBRARY}) else () acg_add_executable (DecimaterGui ${sources} ${headers} ) endif () @@ -37,7 +34,7 @@ endif () target_link_libraries (DecimaterGui OpenMeshCore OpenMeshTools - ${QT_LIBRARIES} + Qt5::OpenGL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) diff --git a/src/OpenMesh/Apps/ProgViewer/CMakeLists.txt b/src/OpenMesh/Apps/ProgViewer/CMakeLists.txt index e25a2c6b..e0cc7053 100644 --- a/src/OpenMesh/Apps/ProgViewer/CMakeLists.txt +++ b/src/OpenMesh/Apps/ProgViewer/CMakeLists.txt @@ -4,7 +4,6 @@ include_directories ( ../../.. ${CMAKE_CURRENT_SOURCE_DIR} ${GLUT_INCLUDE_DIR} - ${QT_INCLUDE_DIR} ) @@ -23,8 +22,6 @@ acg_drop_templates (sources) if (WIN32) acg_add_executable( ProgViewer WIN32 ${sources} ${headers}) - # link to qtmain library to get WinMain function for a non terminal app - target_link_libraries( ProgViewer ${QT_QTMAIN_LIBRARY}) else () acg_add_executable( ProgViewer ${sources} ${headers}) endif () @@ -32,7 +29,7 @@ endif () target_link_libraries ( ProgViewer OpenMeshCore OpenMeshTools - ${QT_LIBRARIES} + Qt5::OpenGL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) diff --git a/src/OpenMesh/Apps/QtViewer/CMakeLists.txt b/src/OpenMesh/Apps/QtViewer/CMakeLists.txt index 2cfb0fc5..0409d308 100644 --- a/src/OpenMesh/Apps/QtViewer/CMakeLists.txt +++ b/src/OpenMesh/Apps/QtViewer/CMakeLists.txt @@ -4,7 +4,6 @@ include_directories ( ../../.. ${CMAKE_CURRENT_SOURCE_DIR} ${GLUT_INCLUDE_DIR} - ${QT_INCLUDE_DIR} ) # source code directories @@ -21,8 +20,6 @@ acg_drop_templates (sources) if (WIN32) acg_add_executable (QtViewer WIN32 ${sources} ${headers}) - # link to qtmain library to get WinMain function for a non terminal app - target_link_libraries (QtViewer ${QT_QTMAIN_LIBRARY}) else () acg_add_executable (QtViewer ${sources} ${headers}) endif () @@ -30,7 +27,7 @@ endif () target_link_libraries (QtViewer OpenMeshCore OpenMeshTools - ${QT_LIBRARIES} + Qt5::OpenGL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) diff --git a/src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt b/src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt index 112eb226..62d61541 100644 --- a/src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt +++ b/src/OpenMesh/Apps/Subdivider/SubdividerGui/CMakeLists.txt @@ -4,7 +4,6 @@ include_directories ( ../../../.. ${CMAKE_CURRENT_SOURCE_DIR} ${GLUT_INCLUDE_DIR} - ${QT_INCLUDE_DIR} ) # source code directories @@ -28,8 +27,6 @@ acg_drop_templates (sources) if (WIN32) acg_add_executable (SubdividerGui WIN32 ${sources} ${headers}) - # link to qtmain library to get WinMain function for a non terminal app - target_link_libraries (SubdividerGui ${QT_QTMAIN_LIBRARY}) else () acg_add_executable (SubdividerGui ${sources} ${headers}) endif () @@ -37,7 +34,7 @@ endif () target_link_libraries (SubdividerGui OpenMeshCore OpenMeshTools - ${QT_LIBRARIES} + Qt5::OpenGL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) diff --git a/src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt b/src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt index 2beaac53..22b1ceec 100644 --- a/src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt +++ b/src/OpenMesh/Apps/VDProgMesh/Synthesizer/CMakeLists.txt @@ -4,7 +4,6 @@ include_directories ( ../../../.. ${CMAKE_CURRENT_SOURCE_DIR} ${GLUT_INCLUDE_DIR} - ${QT_INCLUDE_DIR} ) # collect all header and source files @@ -22,8 +21,6 @@ acg_drop_templates (sources) if (WIN32) acg_add_executable (Synthesizer WIN32 ${sources} ${headers}) - # link to qtmain library to get WinMain function for a non terminal app - target_link_libraries (Synthesizer ${QT_QTMAIN_LIBRARY}) else () acg_add_executable (Synthesizer ${sources} ${headers}) endif () @@ -31,7 +28,7 @@ endif () target_link_libraries (Synthesizer OpenMeshCore OpenMeshTools - ${QT_LIBRARIES} + Qt5::OpenGL ${OPENGL_LIBRARIES} ${GLUT_LIBRARIES} ) -- GitLab