aboutsummaryrefslogtreecommitdiff
path: root/xM/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'xM/CMakeLists.txt')
-rw-r--r--xM/CMakeLists.txt15
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")