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 14, 2020
1 parent eda680f commit afd9993
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
14 changes: 1 addition & 13 deletions CMakeLists.txt
Expand Up @@ -1507,21 +1507,9 @@ else()
endforeach()

# Qt libraries required by OpenCOR
# Note: unlike for Windows and macOS, we don't have a macro for deploying
# all of our Qt libraries at once. Indeed, on Linux, the version of a
# file is appended to its suffix, so unless making the macro
# unnecessarily cumbersome to use, it's better to deploy one Qt
# library at a time...

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})
else()
set(REAL_QT_LIBRARY_DIR ${QT_LIBRARY_DIR})
endif()

linux_deploy_qt_library(DIRECT ${REAL_QT_LIBRARY_DIR} ${CMAKE_SHARED_LIBRARY_PREFIX}Qt${QT_VERSION_MAJOR}${QT_LIBRARY}${CMAKE_SHARED_LIBRARY_SUFFIX}.${QT_VERSION_MAJOR})
linux_deploy_qt_library(${QT_LIBRARY})
endforeach()

# Qt plugins required by OpenCOR
Expand Down
34 changes: 25 additions & 9 deletions cmake/common.cmake
Expand Up @@ -712,26 +712,42 @@ endmacro()

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

macro(linux_deploy_qt_library PROJECT_TARGET DIRNAME FILENAME)
# Copy the Qt library to the build/lib folder, so we can test things without
# first having to deploy OpenCOR
macro(linux_deploy_binary_file PROJECT_TARGET ORIG_DIRNAME DEST_DIRNAME FILENAME)
# Copy the binary file to the build/lib folder, so we can test things
# without first having to deploy OpenCOR
# Note: this is particularly useful when the Linux machine has different
# versions of Qt...

copy_file_to_build_dir(${PROJECT_TARGET} ${DIRNAME} lib ${FILENAME})
copy_file_to_build_dir(${PROJECT_TARGET} ${ORIG_DIRNAME} ${DEST_DIRNAME} ${FILENAME})

# Make sure that the RUNPATH value is converted to an RPATH value

runpath2rpath(${PROJECT_TARGET} ${PROJECT_BUILD_DIR}/lib/${FILENAME})
runpath2rpath(${PROJECT_TARGET} ${PROJECT_BUILD_DIR}/${DEST_DIRNAME}/${FILENAME})

# Strip the binary file of all its local symbols

# Strip the Qt library of all its local symbols
strip_file(${PROJECT_TARGET} ${PROJECT_BUILD_DIR}/${DEST_DIRNAME}/${FILENAME})

strip_file(${PROJECT_TARGET} ${PROJECT_BUILD_DIR}/lib/${FILENAME})
# Deploy the binary file

install(FILES ${PROJECT_BUILD_DIR}/${DEST_DIRNAME}/${FILENAME}
DESTINATION ${DEST_DIRNAME}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
endmacro()

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

macro(linux_deploy_qt_library LIBRARY_NAME)
# Deploy the Qt library

install(FILES ${PROJECT_BUILD_DIR}/lib/${FILENAME}
DESTINATION lib)
if( "${LIBRARY_NAME}" STREQUAL "${WEBKIT}"
OR "${LIBRARY_NAME}" STREQUAL "${WEBKITWIDGETS}")
set(ORIG_DIRNAME ${QTWEBKIT_LIBRARIES_DIR})
else()
set(ORIG_DIRNAME ${QT_LIBRARY_DIR})
endif()

linux_deploy_binary_file(DIRECT ${ORIG_DIRNAME} lib ${LIBRARY_NAME})
endmacro()

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

0 comments on commit afd9993

Please sign in to comment.