Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ jobs:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install SVG renderer
run: brew install librsvg
- name: Build
run: |
cmake --preset release
Expand Down
36 changes: 36 additions & 0 deletions assets/simstore.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions cmake/Info.plist.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
<key>CFBundleIconFile</key>
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand Down
26 changes: 26 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,31 @@ add_executable(SimStore MACOSX_BUNDLE
SimStoreApp.swift
ContentView.swift
)

find_program(RSVG_CONVERT_EXECUTABLE rsvg-convert REQUIRED)
find_program(ICONUTIL_EXECUTABLE iconutil REQUIRED)
set(ICONSET_DIR "${CMAKE_CURRENT_BINARY_DIR}/simstore.iconset")
set(ICON_FILE "${CMAKE_CURRENT_BINARY_DIR}/simstore.icns")
set(ICON_COMMANDS)
foreach(SIZE 16 32 128 256 512)
math(EXPR RETINA_SIZE "${SIZE} * 2")
list(APPEND ICON_COMMANDS
COMMAND "${RSVG_CONVERT_EXECUTABLE}" --width "${SIZE}" --height "${SIZE}"
--output "${ICONSET_DIR}/icon_${SIZE}x${SIZE}.png" "${PROJECT_SOURCE_DIR}/assets/simstore.svg"
COMMAND "${RSVG_CONVERT_EXECUTABLE}" --width "${RETINA_SIZE}" --height "${RETINA_SIZE}"
--output "${ICONSET_DIR}/icon_${SIZE}x${SIZE}@2x.png" "${PROJECT_SOURCE_DIR}/assets/simstore.svg"
)
endforeach()
add_custom_command(OUTPUT "${ICON_FILE}"
COMMAND "${CMAKE_COMMAND}" -E make_directory "${ICONSET_DIR}"
${ICON_COMMANDS}
COMMAND "${ICONUTIL_EXECUTABLE}" --convert icns --output "${ICON_FILE}" "${ICONSET_DIR}"
DEPENDS "${PROJECT_SOURCE_DIR}/assets/simstore.svg"
VERBATIM
)
set_source_files_properties("${ICON_FILE}" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
target_sources(SimStore PRIVATE "${ICON_FILE}")

# Preserve the SDK version in LC_BUILD_VERSION when invoking swiftc directly.
target_link_options(SimStore PRIVATE
"SHELL:-Xclang-linker -isysroot -Xclang-linker \"${CMAKE_OSX_SYSROOT}\""
Expand All @@ -10,6 +35,7 @@ set_target_properties(SimStore PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/cmake/Info.plist.in"
MACOSX_BUNDLE_BUNDLE_NAME SimStore
MACOSX_BUNDLE_GUI_IDENTIFIER io.simstore.SimStore
MACOSX_BUNDLE_ICON_FILE simstore.icns
MACOSX_BUNDLE_SHORT_VERSION_STRING "${PROJECT_VERSION}"
MACOSX_BUNDLE_BUNDLE_VERSION "${PROJECT_VERSION}"
RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}"
Expand Down