tools/CreateMacBundle.cmake.in
author Wuzzy <Wuzzy2@mail.ru>
Sun, 09 Dec 2018 22:28:46 +0100
changeset 14397 f9a3cfdec1df
parent 12888 41d147eb26ea
permissions -rw-r--r--
Hide most HUD elements in cinematic mode

# 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()