macOS: Build nextcloudcmd after gui and run macdeployqt with the -executable option

- src/CMakeLists.txt: Switch build order to build cmd before gui
- src/gui/CMakeLists.txt: Use the -executable option for a combined run of macdeployqt

Signed-off-by: Michael Schuster <michael@schuster.ms>
This commit is contained in:
Michael Schuster 2020-06-06 19:53:48 +02:00
parent a45c2e04e5
commit e6389959ce
3 changed files with 7 additions and 1 deletions

View file

@ -51,8 +51,8 @@ set(QML_IMPORT_PATH ${CMAKE_SOURCE_DIR}/theme CACHE STRING "" FORCE)
add_subdirectory(csync)
add_subdirectory(libsync)
if (NOT BUILD_LIBRARIES_ONLY)
add_subdirectory(gui)
add_subdirectory(cmd)
add_subdirectory(gui)
if (WITH_CRASHREPORTER)
add_subdirectory(3rdparty/libcrashreporter-qt)

View file

@ -32,6 +32,7 @@ if(NOT BUILD_LIBRARIES_ONLY)
target_include_directories(${cmd_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/src/3rdparty/qtokenizer)
endif()
# OSX: Copy nextcloudcmd to app bundle, src/gui will run macdeployqt
if(BUILD_OWNCLOUD_OSX_BUNDLE)
add_custom_command(TARGET ${cmd_NAME} POST_BUILD
COMMAND "cp"

View file

@ -388,16 +388,21 @@ install(TARGETS ${APPLICATION_EXECUTABLE}
#FIXME: find a nice solution to make the second if(BUILD_OWNCLOUD_OSX_BUNDLE) unnecessary
# currently it needs to be done because the code right above needs to be executed no matter
# if building a bundle or not and the install_qt4_executable needs to be called afterwards
#
# OSX: Run macdeployqt for src/gui and for src/cmd using the -executable option
if(BUILD_OWNCLOUD_OSX_BUNDLE AND NOT BUILD_LIBRARIES_ONLY)
get_target_property (QT_QMAKE_EXECUTABLE Qt5::qmake IMPORTED_LOCATION)
get_filename_component(QT_BIN_DIR "${QT_QMAKE_EXECUTABLE}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${QT_BIN_DIR}")
set(cmd_NAME ${APPLICATION_EXECUTABLE}cmd)
add_custom_command(TARGET ${APPLICATION_EXECUTABLE} POST_BUILD
COMMAND "${MACDEPLOYQT_EXECUTABLE}"
"$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/../.."
-qmldir=${CMAKE_SOURCE_DIR}/src/gui
-always-overwrite
-executable="$<TARGET_FILE_DIR:${APPLICATION_EXECUTABLE}>/${cmd_NAME}"
COMMENT "Running macdeployqt..."
)
endif()