feat: macOS bundle support
This commit is contained in:
parent
06af632914
commit
e64b871a2f
19
.github/workflows/macos.yml
vendored
19
.github/workflows/macos.yml
vendored
@ -1,6 +1,6 @@
|
|||||||
name: macOS CI
|
name: macOS CI
|
||||||
|
|
||||||
on: [push, pull_request]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
@ -10,10 +10,19 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v3
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
version: '6.4.2'
|
version: '6.8.1'
|
||||||
|
modules: 'qtimageformats'
|
||||||
- name: Run a qt project
|
- name: Run a qt project
|
||||||
run: |
|
run: |
|
||||||
cmake ./ -DPREFER_QT_5=OFF
|
cmake . -Bbuild
|
||||||
make
|
cmake --build build
|
||||||
|
- name: Deploy
|
||||||
|
run: |
|
||||||
|
macdeployqt ./build/ppic.app -dmg
|
||||||
|
ls
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: "macos-bundle"
|
||||||
|
path: build/*.dmg
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -2,6 +2,9 @@
|
|||||||
*.user
|
*.user
|
||||||
*.user.*
|
*.user.*
|
||||||
|
|
||||||
|
# Why, macOS, why?
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
# Translation files
|
# Translation files
|
||||||
*.qm
|
*.qm
|
||||||
*.mo
|
*.mo
|
||||||
|
@ -107,7 +107,7 @@ if (WIN32)
|
|||||||
list(APPEND PPIC_RC_FILES assets/pineapple-pictures.rc)
|
list(APPEND PPIC_RC_FILES assets/pineapple-pictures.rc)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
add_executable (${EXE_NAME} WIN32
|
add_executable (${EXE_NAME}
|
||||||
${PPIC_HEADER_FILES}
|
${PPIC_HEADER_FILES}
|
||||||
${PPIC_CPP_FILES}
|
${PPIC_CPP_FILES}
|
||||||
${PPIC_QRC_FILES}
|
${PPIC_QRC_FILES}
|
||||||
@ -201,8 +201,24 @@ endif ()
|
|||||||
|
|
||||||
# Install settings
|
# Install settings
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# TODO: try to avoid install to a "bin" subfolder under windows...
|
set_target_properties(${EXE_NAME} PROPERTIES
|
||||||
# when fixed, don't forget to update the CI config file...
|
WIN32_EXECUTABLE TRUE
|
||||||
|
)
|
||||||
|
elseif (APPLE)
|
||||||
|
set_source_files_properties(assets/icons/app-icon.icns PROPERTIES
|
||||||
|
MACOSX_PACKAGE_LOCATION "Resources"
|
||||||
|
)
|
||||||
|
target_sources(${EXE_NAME} PUBLIC assets/icons/app-icon.icns)
|
||||||
|
# See https://cmake.org/cmake/help/v3.15/prop_tgt/MACOSX_BUNDLE_INFO_PLIST.html
|
||||||
|
set_target_properties(${EXE_NAME} PROPERTIES
|
||||||
|
MACOSX_BUNDLE TRUE
|
||||||
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_CURRENT_SOURCE_DIR}/dist/MacOSXBundleInfo.plist.in
|
||||||
|
MACOSX_BUNDLE_BUNDLE_NAME "Pineapple Pictures"
|
||||||
|
MACOSX_BUNDLE_GUI_IDENTIFIER net.blumia.pineapple-pictures
|
||||||
|
MACOSX_BUNDLE_ICON_FILE app-icon.icns # contains the .icns file name, *without* the path.
|
||||||
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
|
)
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
set(CMAKE_INSTALL_PREFIX /usr)
|
set(CMAKE_INSTALL_PREFIX /usr)
|
||||||
@ -229,6 +245,7 @@ elseif (UNIX)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
set (INSTALL_TARGETS_DEFAULT_ARGS
|
set (INSTALL_TARGETS_DEFAULT_ARGS
|
||||||
|
BUNDLE DESTINATION .
|
||||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Devel
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Devel
|
||||||
|
BIN
assets/icons/app-icon.icns
Normal file
BIN
assets/icons/app-icon.icns
Normal file
Binary file not shown.
114
dist/MacOSXBundleInfo.plist.in
vendored
Normal file
114
dist/MacOSXBundleInfo.plist.in
vendored
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
<key>CFBundleDocumentTypes</key>
|
||||||
|
<array>
|
||||||
|
<!-- JPEG -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>JPEG Image</string>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>jpg</string>
|
||||||
|
<string>jpeg</string>
|
||||||
|
<string>jfif</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>image/jpeg</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<!-- PNG -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>PNG Image</string>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>png</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>image/png</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<!-- WebP -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>WebP Image</string>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>webp</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>image/webp</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<!-- GIF -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>GIF Image</string>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>gif</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>image/gif</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
<!-- SVG -->
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleTypeName</key>
|
||||||
|
<string>SVG Image</string>
|
||||||
|
<key>CFBundleTypeExtensions</key>
|
||||||
|
<array>
|
||||||
|
<string>svg</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeMIMETypes</key>
|
||||||
|
<array>
|
||||||
|
<string>image/svg+xml</string>
|
||||||
|
</array>
|
||||||
|
<key>CFBundleTypeRole</key>
|
||||||
|
<string>Viewer</string>
|
||||||
|
</dict>
|
||||||
|
</array>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
Loading…
Reference in New Issue
Block a user