From a19f4c78bf89066d29a7c043e5f102ae2169c61a Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Wed, 19 Oct 2016 08:08:52 +0200 Subject: [PATCH] Fix building with precompiled QT (rpath fix), fix build-compaion.sh script --- companion/src/CMakeLists.txt | 9 ++++++++- tools/build-companion.sh | 17 ++++++++++++++++- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 829508899..6236e6ee3 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -427,6 +427,13 @@ if(APPLE) INSTALL(FILES ${DFU_UTIL_ABSOLUTE_PATH} DESTINATION ${companion_res_dir} COMPONENT Runtime) set(bundle_dfu_util_path "\${CMAKE_INSTALL_PREFIX}/${companion_res_dir}/dfu-util") + + # these needs to be relative to CMAKE_INSTALL_PREFIX + get_target_property(QT_LIBRARY_DIR Qt5::Core LOCATION) + get_filename_component(QT_LIBRARY_DIR ${QT_LIBRARY_DIR} PATH) + get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/.." ABSOLUTE) + + # Include depencies (adding frameworks, fixing the embbeded libraries) # I get write errors without setting BU_CHMOD_BUNDLE_ITEMS even though it is # technically a hack (that is already is in the Bundle library ....) @@ -434,7 +441,7 @@ if(APPLE) include(BundleUtilities) file(GLOB bundle_simulator_libs \"\${CMAKE_INSTALL_PREFIX}/${companion_res_dir}/libopentx-*${CMAKE_SHARED_LIBRARY_SUFFIX}\") set(BU_CHMOD_BUNDLE_ITEMS on) - fixup_bundle(\"${APPS}\" \"\${bundle_simulator_libs};${bundle_qt_libs};${bundle_dfu_util_path}\" \"\") + fixup_bundle(\"${APPS}\" \"\${bundle_simulator_libs};${bundle_qt_libs};${bundle_dfu_util_path}\" \"${QT_LIBRARY_DIR}\") file(RENAME \"\${CMAKE_INSTALL_PREFIX}/${COMPANION_NAME}.app\" \"\${CMAKE_INSTALL_PREFIX}/${COMPANION_OSX_FINAL_NAME}.app\") " COMPONENT Runtime) endif() diff --git a/tools/build-companion.sh b/tools/build-companion.sh index eb0fc5468..d4ae3cf31 100755 --- a/tools/build-companion.sh +++ b/tools/build-companion.sh @@ -8,8 +8,19 @@ SRCDIR=$1 OUTDIR=$2 COMMON_OPTIONS="-DALLOW_NIGHTLY_BUILDS=YES -DVERSION_SUFFIX=$3 -DGVARS=YES -DHELI=YES" + +if [ "$(uname)" = "Darwin" ]; then + COMMON_OPTIONS="${COMMON_OPTIONS} -DCMAKE_PREFIX_PATH=~/Qt/5.7/clang_64/ -DCMAKE_OSX_DEPLOYMENT_TARGET='10.9'" +fi + STM32_OPTIONS="${COMMON_OPTIONS} -DLUA=YES" +if [ "$3" == "" ]; then + echo "Usage $0 SRCDIR OUTDIR VERSION_SUFFIX" + exit 1 +fi + + rm -rf build mkdir build cd build @@ -46,4 +57,8 @@ make -j2 libsimulator make -j2 package -cp *.deb ${OUTDIR} +if [ "$(uname)" = "Darwin" ]; then + cp *.dmg ${OUTDIR} +else + cp *.deb ${OUTDIR} +fi