| 1 |
set(STORYBOARDS Main.storyboard) |
| 2 |
|
| 3 |
set(SOURCES |
| 4 |
main.m |
| 5 |
AppDelegate.h |
| 6 |
AppDelegate.mm |
| 7 |
ViewController.h |
| 8 |
ViewController.m |
| 9 |
MacUI.mm |
| 10 |
${STORYBOARDS} |
| 11 |
) |
| 12 |
|
| 13 |
add_executable(MacUpdater ${SOURCES}) |
| 14 |
|
| 15 |
add_dependencies(MacUpdater dolphin_scmrev) |
| 16 |
|
| 17 |
set_target_properties(MacUpdater PROPERTIES |
| 18 |
MACOSX_BUNDLE true |
| 19 |
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/Info.plist.in" |
| 20 |
OUTPUT_NAME "Dolphin Updater") |
| 21 |
|
| 22 |
# Copy icon into the bundle |
| 23 |
target_sources(MacUpdater PRIVATE "${CMAKE_SOURCE_DIR}/Data/Dolphin.icns") |
| 24 |
set_source_files_properties("${CMAKE_SOURCE_DIR}/Data/Dolphin.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) |
| 25 |
|
| 26 |
target_link_libraries(MacUpdater PRIVATE |
| 27 |
"-framework Cocoa" |
| 28 |
"-framework AppKit" |
| 29 |
"-framework CoreData" |
| 30 |
"-framework Foundation" |
| 31 |
uicommon |
| 32 |
updatercommon |
| 33 |
) |
| 34 |
|
| 35 |
# Compile storyboards (Adapted from https://gitlab.kitware.com/cmake/community/wikis/doc/tutorials/OSX-InterfaceBuilderFiles) |
| 36 |
|
| 37 |
# Make sure we can find the 'ibtool' program. If we can NOT find it we |
| 38 |
# skip generation of this project |
| 39 |
find_program(IBTOOL ibtool HINTS "/usr/bin" "${OSX_DEVELOPER_ROOT}/usr/bin") |
| 40 |
if (${IBTOOL} STREQUAL "IBTOOL-NOTFOUND") |
| 41 |
message(SEND_ERROR "ibtool can not be found and is needed to compile the .storyboard files. It should have been installed with |
| 42 |
the Apple developer tools. The default system paths were searched in addition to ${OSX_DEVELOPER_ROOT}/usr/bin") |
| 43 |
endif() |
| 44 |
|
| 45 |
foreach(sb ${STORYBOARDS}) |
| 46 |
set(output $<TARGET_BUNDLE_DIR:MacUpdater>/Contents/Resources/${sb}c) |
| 47 |
set(input ${CMAKE_CURRENT_SOURCE_DIR}/${sb}) |
| 48 |
add_custom_command(TARGET MacUpdater POST_BUILD |
| 49 |
COMMAND ${IBTOOL} --errors --warnings --notices --output-format human-readable-text --compile ${output} ${input} |
| 50 |
COMMENT "Compiling Storyboard ${sb}...") |
| 51 |
endforeach() |
| 52 |
|
| 53 |
include(DolphinInjectVersionInfo) |
| 54 |
dolphin_inject_version_info(MacUpdater) |
| 55 |
|
| 56 |
if(POSTPROCESS_BUNDLE) |
| 57 |
# Update library references to make the bundle portable |
| 58 |
include(DolphinPostprocessBundle) |
| 59 |
dolphin_postprocess_bundle(MacUpdater) |
| 60 |
|
| 61 |
# Fix rpath |
| 62 |
add_custom_command(TARGET MacUpdater |
| 63 |
POST_BUILD COMMAND |
| 64 |
${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/" |
| 65 |
$<TARGET_FILE:MacUpdater>) |
| 66 |
endif() |
| 67 |
|
| 68 |
if(MACOS_CODE_SIGNING) |
| 69 |
add_custom_command(TARGET MacUpdater |
| 70 |
POST_BUILD |
| 71 |
COMMAND "${CMAKE_SOURCE_DIR}/Tools/mac-codesign.sh" |
| 72 |
"${MACOS_CODE_SIGNING_IDENTITY}" |
| 73 |
"$<TARGET_BUNDLE_DIR:MacUpdater>" |
| 74 |
) |
| 75 |
endif() |