xM: generate and use a bundle icon
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user