From dd776700073d4de3cdafc514ba49b9044cbc963c Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Thu, 8 Dec 2016 21:22:12 +0100 Subject: [PATCH] Also bundle avrdude in addition to dfu-util and default to the executables in the bundle (#4106) --- companion/src/CMakeLists.txt | 11 ++++++----- companion/src/burnconfigdialog.cpp | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/companion/src/CMakeLists.txt b/companion/src/CMakeLists.txt index 4a30cae08..f411c9691 100644 --- a/companion/src/CMakeLists.txt +++ b/companion/src/CMakeLists.txt @@ -16,6 +16,7 @@ set(COMPANION_OSX_APP_BUNDLE_NAME "OpenTX Companion ${VERSION_MAJOR}.${VERSION_M # On OS X we copy dfu-util to the application bundle. This the path from which we copy # the binary (default homebrew path) set(DFU_UTIL_PATH "/usr/local/bin/dfu-util") +set(AVRDUDE_PATH "/usr/local/bin/avrdude") option(ALLOW_NIGHTLY_BUILDS "Allow nightly builds download / update") # Disabled by default if(ALLOW_NIGHTLY_BUILDS) @@ -417,11 +418,11 @@ if(APPLE) set(${COMPANION_SOURCES} ${COMPANION_SOURCES} ${PROJECT_SOURCE_DIR}/images/${MACOSX_BUNDLE_ICON_FILE}) install(FILES ${MAC_ICON_FILE} DESTINATION ${companion_res_dir} COMPONENT Runtime) - - # Copy dfu-util, resolve symlink first + # Copy dfu-util and avrdude, resolve symlink first get_filename_component(DFU_UTIL_ABSOLUTE_PATH ${DFU_UTIL_PATH} REALPATH) - 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") + get_filename_component(AVRDUDE_ABSOLUTE_PATH ${AVRDUDE_PATH} REALPATH) + install(PROGRAMS ${DFU_UTIL_ABSOLUTE_PATH} ${AVRDUDE_ABSOLUTE_PATH} DESTINATION ${companion_res_dir} COMPONENT Runtime) + set(bundle_tools_path "\${CMAKE_INSTALL_PREFIX}/${companion_res_dir}/dfu-util;\${CMAKE_INSTALL_PREFIX}/${companion_res_dir}/avrdude") # These needs to be relative to CMAKE_INSTALL_PREFIX get_target_property(QT_LIBRARY_DIR Qt5::Core LOCATION) @@ -435,7 +436,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}\" \"${QT_LIBRARY_DIR}\") + fixup_bundle(\"${APPS}\" \"\${bundle_simulator_libs};${bundle_qt_libs};${bundle_tools_path}\" \"${QT_LIBRARY_DIR}\") file(RENAME \"\${CMAKE_INSTALL_PREFIX}/${COMPANION_NAME}.app\" \"\${CMAKE_INSTALL_PREFIX}/${COMPANION_OSX_APP_BUNDLE_NAME}.app\") " COMPONENT Runtime) endif() diff --git a/companion/src/burnconfigdialog.cpp b/companion/src/burnconfigdialog.cpp index ffabc9ca3..3590a3756 100644 --- a/companion/src/burnconfigdialog.cpp +++ b/companion/src/burnconfigdialog.cpp @@ -120,11 +120,11 @@ void burnConfigDialog::getSettings() dfuLoc = QFileInfo("dfu-util.exe").absoluteFilePath(); #elif defined __APPLE__ if ( avrLoc.isEmpty()) - avrLoc = "/usr/local/bin/avrdude"; + avrLoc = QFileInfo(QApplication::applicationDirPath() + "/../Resources/avrdude").absoluteFilePath(); if ( sambaLoc.isEmpty()) sambaLoc = "/usr/local/bin/sam-ba"; if ( dfuLoc.isEmpty()) - dfuLoc = QFileInfo("/opt/local/bin/dfu-util").absoluteFilePath(); + dfuLoc = QFileInfo(QApplication::applicationDirPath() + "/../Resources/dfu-util").absoluteFilePath(); #else if ( avrLoc.isEmpty()) avrLoc = "/usr/bin/avrdude";