From bbbac656eea3fddad14e5bf3be23ec62a110d091 Mon Sep 17 00:00:00 2001 From: Peter Lama Date: Sat, 26 Aug 2017 12:07:57 -0400 Subject: [PATCH] Fix macOS Qt4 build - Dereference qt plugin symlinks - Remove qt postgresql plugin because of missing dependency --- .travis.yml | 4 +++- src/MacAppBundle/CMakeLists.txt | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5e9c5896ac..24e919c54a 100755 --- a/.travis.yml +++ b/.travis.yml @@ -186,7 +186,9 @@ before_install: brew install --verbose --only-dependencies freecad --with-qt4 --with-packaging-utils brew install --verbose --only-dependencies freecad --with-qt4 --with-packaging-utils #Ensure all dependencies are satisfied - + # qt4 bottle contains postgresql plugin even when --with-postgresql option is not specified + # and so postgresql dep is not installed. Delete it because the plugin is not included with qt5 bottle. + sudo rm -f /usr/local/lib/qt4/plugins/sqldrivers/libqsqlpsql.dylib elif [ "${QT}" == "Qt5" ]; then # Qt5: Replace Qt4 in ports-cache with Qt5, if necessary brew ls --versions cartr/qt4/qt > /dev/null && \ diff --git a/src/MacAppBundle/CMakeLists.txt b/src/MacAppBundle/CMakeLists.txt index 5843f6a6c6..36a1c2a130 100644 --- a/src/MacAppBundle/CMakeLists.txt +++ b/src/MacAppBundle/CMakeLists.txt @@ -50,7 +50,22 @@ if(BUILD_QT5) set(XCTEST_PATH "${XCODE_PATH}/Platforms/MacOSX.platform/Developer/Library/Frameworks/XCTest.framework/Versions/Current") endif(BUILD_QT5) -install(DIRECTORY ${QT_PLUGINS_DIR}/ DESTINATION ${CMAKE_INSTALL_LIBDIR}/qtplugins ) +# Ensure the actual plugin files are installed instead of symlinks. +file(GLOB _subdirs RELATIVE "${QT_PLUGINS_DIR}" "${QT_PLUGINS_DIR}/*") + +foreach(_subdir ${_subdirs}) + if(IS_DIRECTORY "${QT_PLUGINS_DIR}/${_subdir}") + set(_resolved_files "") + file(GLOB _plugin_files RELATIVE "${QT_PLUGINS_DIR}/${_subdir}" "${QT_PLUGINS_DIR}/${_subdir}/*") + + foreach(_plugin_file ${_plugin_files}) + get_filename_component(_resolved_file "${QT_PLUGINS_DIR}/${_subdir}/${_plugin_file}" REALPATH) + list(APPEND _resolved_files ${_resolved_file}) + endforeach() + + install(FILES ${_resolved_files} DESTINATION "${CMAKE_INSTALL_LIBDIR}/qtplugins/${_subdir}") + endif() +endforeach() #files installed by homebrew do not have write permission for regular user install(CODE "execute_process(COMMAND chmod -R a+w ${CMAKE_INSTALL_LIBDIR})")