Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jun 12, 2020
1 parent 52c155b commit eda680f
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 44 deletions.
63 changes: 32 additions & 31 deletions CMakeLists.txt
Expand Up @@ -429,6 +429,32 @@ foreach(REQUIRED_QT_MODULE ${REQUIRED_QT_MODULES})
find_package(Qt5${REQUIRED_QT_MODULE} REQUIRED)
endforeach()

# Common Qt libraries

set(QT_LIBRARIES
Core
Gui
Help
Multimedia
MultimediaWidgets
Network
OpenGL
Positioning
PrintSupport
Qml
Quick
Sensors
Sql
Svg
${TEST}
WebChannel
${WEBKIT}
${WEBKITWIDGETS}
Widgets
Xml
XmlPatterns
)

# On macOS, keep track of the Qt libraries against which we need to link and
# make sure that we always use their release version
# Note: indeed, from Qt 5.12.5, to build a debug version of a Qt-based
Expand All @@ -441,36 +467,11 @@ if(APPLE)
set(TEST Test)
endif()

if(USE_PREBUILT_QTWEBKIT_PACKAGE)
set(WEBKIT WebKit)
set(WEBKITWIDGETS WebKitWidgets)
endif()

set(MACOS_QT_LIBRARIES
${QT_LIBRARIES}
Concurrent
Core
DBus
Gui
Help
MacExtras
Multimedia
MultimediaWidgets
Network
OpenGL
Positioning
PrintSupport
Qml
Quick
Sensors
Sql
Svg
${TEST}
WebChannel
${WEBKIT}
${WEBKITWIDGETS}
Widgets
Xml
XmlPatterns
)

foreach(QT_LIBRARY ${MACOS_QT_LIBRARIES})
Expand Down Expand Up @@ -531,7 +532,7 @@ if(RELEASE_MODE)
if(NOT WIN32 AND NOT APPLE)
set(LINK_FLAGS_PROPERTIES "${LINK_FLAGS_PROPERTIES} -Wl,-s")
# Note #1: -Wl,-s strips all the symbols, thus reducing the final size
# of OpenCOR or one its shared libraries...
# of OpenCOR or one of its shared libraries...
# Note #2: the above linking option has become obsolete on macOS...
endif()

Expand Down Expand Up @@ -635,7 +636,7 @@ endif()

set(VERSION_DATE_FILENAME ${PROJECT_BUILD_DIR}/versiondate.txt)

file(WRITE ${VERSION_DATE_FILENAME} "${VERSION}\n${DATE}")
file(WRITE ${VERSION_DATE_FILENAME} "${VERSION}\n${DATE}\n")

track_files(${VERSION_DATE_FILENAME})

Expand Down Expand Up @@ -1164,7 +1165,7 @@ if(APPLE)
# Qt libraries required by OpenCOR

foreach(QT_LIBRARY ${MACOS_QT_LIBRARIES})
macos_deploy_qt_library(Qt${QT_LIBRARY})
macos_deploy_qt_library(${QT_LIBRARY})
endforeach()

# Qt plugins required by OpenCOR
Expand Down Expand Up @@ -1327,7 +1328,7 @@ if(WIN32)

# Qt libraries required by OpenCOR

foreach(QT_LIBRARY Core Gui Help Multimedia MultimediaWidgets Network OpenGL Positioning PrintSupport Qml Quick Sensors Sql Svg ${TEST} WebChannel ${WEBKIT} ${WEBKITWIDGETS} Widgets Xml XmlPatterns)
foreach(QT_LIBRARY ${QT_LIBRARIES})
windows_deploy_qt_library(Qt5${QT_LIBRARY})
endforeach()

Expand Down Expand Up @@ -1512,7 +1513,7 @@ else()
# unnecessarily cumbersome to use, it's better to deploy one Qt
# library at a time...

foreach(QT_LIBRARY Core DBus Gui Help Multimedia MultimediaWidgets Network OpenGL Positioning PrintSupport Qml Quick Sensors Sql Svg ${TEST} WebChannel ${WEBKIT} ${WEBKITWIDGETS} Widgets XcbQpa Xml XmlPatterns)
foreach(QT_LIBRARY ${QT_LIBRARIES} DBus XcbQpa)
if( "${QT_LIBRARY}" STREQUAL "${WEBKIT}"
OR "${QT_LIBRARY}" STREQUAL "${WEBKITWIDGETS}")
set(REAL_QT_LIBRARY_DIR ${QTWEBKIT_LIBRARIES_DIR})
Expand Down
23 changes: 10 additions & 13 deletions cmake/common.cmake
@@ -1,3 +1,7 @@
set(LANGUAGES fr)

#===============================================================================

macro(configure_clang_and_clang_tidy TARGET_NAME)
# Configure Clang and Clang-Tidy for the given target

Expand Down Expand Up @@ -87,7 +91,6 @@ macro(update_language_files TARGET_NAME)
# "errors" for our .cpp.inl files even though everything is fine with
# them...

set(LANGUAGES fr)
set(INPUT_FILES)

foreach(INPUT_FILE ${ARGN})
Expand Down Expand Up @@ -678,14 +681,7 @@ macro(windows_deploy_qt_plugins PLUGIN_CATEGORY)

set(PLUGIN_ORIG_DIRNAME ${QT_PLUGINS_DIR}/${PLUGIN_CATEGORY})
set(PLUGIN_DEST_DIRNAME plugins/${PLUGIN_CATEGORY})
set(PLUGIN_RELEASE_FILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PLUGIN_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
set(PLUGIN_DEBUG_FILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PLUGIN_NAME}d${CMAKE_SHARED_LIBRARY_SUFFIX})

if(RELEASE_MODE)
set(PLUGIN_FILENAME ${PLUGIN_RELEASE_FILENAME})
else()
set(PLUGIN_FILENAME ${PLUGIN_DEBUG_FILENAME})
endif()
set(PLUGIN_FILENAME ${CMAKE_SHARED_LIBRARY_PREFIX}${PLUGIN_NAME}${DEBUG_TAG}${CMAKE_SHARED_LIBRARY_SUFFIX})

copy_file_to_build_dir(DIRECT ${PLUGIN_ORIG_DIRNAME} ${PLUGIN_DEST_DIRNAME} ${PLUGIN_FILENAME})

Expand Down Expand Up @@ -802,18 +798,19 @@ endmacro()
macro(macos_deploy_qt_library LIBRARY_NAME)
# Deploy the Qt library

set(QT_FRAMEWORK_DIR ${LIBRARY_NAME}.framework/Versions/${QT_VERSION_MAJOR})
set(QT_LIBRARY_NAME Qt${LIBRARY_NAME})
set(QT_FRAMEWORK_DIR ${QT_LIBRARY_NAME}.framework/Versions/${QT_VERSION_MAJOR})

if( "${LIBRARY_NAME}" STREQUAL "Qt${WEBKIT}"
OR "${LIBRARY_NAME}" STREQUAL "Qt${WEBKITWIDGETS}")
if( "${QT_LIBRARY_NAME}" STREQUAL "Qt${WEBKIT}"
OR "${QT_LIBRARY_NAME}" STREQUAL "Qt${WEBKITWIDGETS}")
set(REAL_QT_LIBRARY_DIR ${QTWEBKIT_LIBRARIES_DIR})
else()
set(REAL_QT_LIBRARY_DIR ${QT_LIBRARY_DIR})
endif()

macos_deploy_qt_file(${REAL_QT_LIBRARY_DIR}/${QT_FRAMEWORK_DIR}
${PROJECT_BUILD_DIR}/${CMAKE_PROJECT_NAME}.app/Contents/Frameworks/${QT_FRAMEWORK_DIR}
${LIBRARY_NAME})
${QT_LIBRARY_NAME})
endmacro()

#===============================================================================
Expand Down

0 comments on commit eda680f

Please sign in to comment.