CMakeLists.txt 2.4 KB

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