diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 5264ebe..0ab47a8 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,6 +1,6 @@ name: macOS CI -on: [push, pull_request] +on: [push, pull_request, workflow_dispatch] jobs: build: @@ -10,10 +10,18 @@ jobs: steps: - uses: actions/checkout@v4 - name: Install Qt - uses: jurplel/install-qt-action@v3 + uses: jurplel/install-qt-action@v4 with: - version: '6.4.2' + version: '6.8.1' - name: Run a qt project run: | - cmake ./ -DPREFER_QT_5=OFF - make + cmake . -Bbuild + cmake --build build + - name: Deploy + run: | + macdeployqt ./build/ppic.app -dmg + ls + - uses: actions/upload-artifact@v4 + with: + name: "macos-bundle" + path: build/*.dmg diff --git a/.gitignore b/.gitignore index f9808e7..31e07a2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ *.user *.user.* +# Why, macOS, why? +.DS_Store + # Translation files *.qm *.mo diff --git a/CMakeLists.txt b/CMakeLists.txt index cc9bcf4..f8a9051 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -107,7 +107,7 @@ if (WIN32) list(APPEND PPIC_RC_FILES assets/pineapple-pictures.rc) endif () -add_executable (${EXE_NAME} WIN32 +add_executable (${EXE_NAME} ${PPIC_HEADER_FILES} ${PPIC_CPP_FILES} ${PPIC_QRC_FILES} @@ -201,8 +201,24 @@ endif () # Install settings if (WIN32) - # TODO: try to avoid install to a "bin" subfolder under windows... - # when fixed, don't forget to update the CI config file... + set_target_properties(${EXE_NAME} PROPERTIES + 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 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) if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX /usr) @@ -229,6 +245,7 @@ elseif (UNIX) endif() set (INSTALL_TARGETS_DEFAULT_ARGS + BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT Devel diff --git a/assets/icons/app-icon.icns b/assets/icons/app-icon.icns new file mode 100644 index 0000000..a6c8400 Binary files /dev/null and b/assets/icons/app-icon.icns differ diff --git a/dist/MacOSXBundleInfo.plist.in b/dist/MacOSXBundleInfo.plist.in new file mode 100644 index 0000000..d3c91f0 --- /dev/null +++ b/dist/MacOSXBundleInfo.plist.in @@ -0,0 +1,116 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleExecutable + ${MACOSX_BUNDLE_EXECUTABLE_NAME} + CFBundleGetInfoString + ${MACOSX_BUNDLE_INFO_STRING} + CFBundleIconFile + ${MACOSX_BUNDLE_ICON_FILE} + CFBundleIdentifier + ${MACOSX_BUNDLE_GUI_IDENTIFIER} + CFBundleInfoDictionaryVersion + 6.0 + CFBundleLongVersionString + ${MACOSX_BUNDLE_LONG_VERSION_STRING} + CFBundleName + ${MACOSX_BUNDLE_BUNDLE_NAME} + CFBundlePackageType + APPL + CFBundleShortVersionString + ${MACOSX_BUNDLE_SHORT_VERSION_STRING} + CFBundleSignature + ???? + CFBundleVersion + ${MACOSX_BUNDLE_BUNDLE_VERSION} + CSResourcesFileMapped + + NSHumanReadableCopyright + ${MACOSX_BUNDLE_COPYRIGHT} + + + CFBundleDocumentTypes + + + + CFBundleTypeName + JPEG Image + CFBundleTypeExtensions + + jpg + jpeg + jfif + + CFBundleTypeMIMETypes + + image/jpeg + + CFBundleTypeRole + Viewer + + + + CFBundleTypeName + PNG Image + CFBundleTypeExtensions + + png + + CFBundleTypeMIMETypes + + image/png + + CFBundleTypeRole + Viewer + + + + CFBundleTypeName + WebP Image + CFBundleTypeExtensions + + webp + + CFBundleTypeMIMETypes + + image/webp + + CFBundleTypeRole + Viewer + + + + CFBundleTypeName + GIF Image + CFBundleTypeExtensions + + gif + + CFBundleTypeMIMETypes + + image/gif + + CFBundleTypeRole + Viewer + + + + CFBundleTypeName + SVG Image + CFBundleTypeExtensions + + svg + + CFBundleTypeMIMETypes + + image/svg+xml + + CFBundleTypeRole + Viewer + + + +