tools/CreateMacBundle.cmake.in
author Wuzzy <Wuzzy2@mail.ru>
Wed, 11 Jul 2018 19:14:11 +0200
changeset 13475 2a0df4705849
parent 12888 41d147eb26ea
permissions -rw-r--r--
ACF5: Fix Tribe not being in same clan as Natives Clan color was off-by-one, this was probably a hack.

# check for a well known-framework
execute_process(COMMAND stat ${frameworks_dir}/QtCore.framework RESULT_VARIABLE doBundle OUTPUT_QUIET ERROR_QUIET)
# prepare Frameworks directory
execute_process(COMMAND mkdir -p ${frameworks_dir})
# macdeployqt will convert safely any absolute path library for 'hedgewars'
execute_process(COMMAND ${macdeployqt_executable} ${CMAKE_BINARY_DIR}/Hedgewars.app OUTPUT_QUIET ERROR_QUIET)

# but macdeployqt will not work for a second executable, so employ this series of ridiculous commands to work around it
execute_process(COMMAND mv ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/hedgewars ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/tmp)
execute_process(COMMAND mv ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/hwengine ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/hedgewars)
execute_process(COMMAND ${macdeployqt_executable} ${CMAKE_BINARY_DIR}/Hedgewars.app OUTPUT_QUIET ERROR_QUIET)
execute_process(COMMAND mv ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/hedgewars ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/hwengine)
execute_process(COMMAND mv ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/tmp ${CMAKE_BINARY_DIR}/Hedgewars.app/Contents/MacOS/hedgewars)

if(doBundle EQUAL 1)
    if(${SPARKLE_FOUND})
        execute_process(COMMAND cp -pPR ${SPARKLE_LIBRARY} ${frameworks_dir})
    endif()
    message(STATUS "Frameworks and libraries successfully copied...")
else()
    message(STATUS "Frameworks already present, skipping...")
endif()