diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-09-03 02:11:21 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-09-03 02:13:14 +0200 |
commit | 9e4692bb09742bb68a62ef79890279a9e967169a (patch) | |
tree | 4b4f19f2fb5851d301d85185ee15badad679c549 /xM/CMakeLists.txt | |
parent | 1c4343058da2a1e0c6d2fd87a9bde4ef4b378eae (diff) | |
download | xK-9e4692bb09742bb68a62ef79890279a9e967169a.tar.gz xK-9e4692bb09742bb68a62ef79890279a9e967169a.tar.xz xK-9e4692bb09742bb68a62ef79890279a9e967169a.zip |
xM: generate and use a bundle icon
Diffstat (limited to 'xM/CMakeLists.txt')
-rw-r--r-- | xM/CMakeLists.txt | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/xM/CMakeLists.txt b/xM/CMakeLists.txt index 3386926..b3484de 100644 --- a/xM/CMakeLists.txt +++ b/xM/CMakeLists.txt @@ -25,8 +25,21 @@ add_custom_command (OUTPUT xC-proto.swift COMMENT "Generating xC relay protocol code" VERBATIM) set (MACOSX_BUNDLE_GUI_IDENTIFIER name.janouch.${PROJECT_NAME}) +set (MACOSX_BUNDLE_ICON_FILE xM.icns) + +# Avoid including binary files in the repository by generating icons in code. +# sips(1) + Javascript + iconutil(1) could probably also be used. +find_program (SWIFT_EXECUTABLE swift REQUIRED) + +set (icon "${PROJECT_BINARY_DIR}/${MACOSX_BUNDLE_ICON_FILE}") +add_custom_command (OUTPUT "${icon}" + COMMAND ${SWIFT_EXECUTABLE} "${PROJECT_SOURCE_DIR}/gen-icon.swift" "${icon}" + DEPENDS gen-icon.swift + COMMENT "Generating xM application icon" VERBATIM) +set_source_files_properties ("${icon}" PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) # Other requirements: macOS 10.14 for Network, and macOS 11 for Logger. set (CMAKE_Swift_LANGUAGE_VERSION 5) add_executable (xM MACOSX_BUNDLE - main.swift ${PROJECT_BINARY_DIR}/xC-proto.swift) + main.swift "${icon}" "${PROJECT_BINARY_DIR}/xC-proto.swift") |