mirror of
https://github.com/obhq/obliteration.git
synced 2024-11-26 20:50:22 +00:00
Produces Application Bundle for macOS (#290)
This commit is contained in:
parent
af9cf74342
commit
4aa8946cef
25
.github/workflows/ci-mac.yml
vendored
25
.github/workflows/ci-mac.yml
vendored
@ -38,10 +38,33 @@ jobs:
|
||||
- name: Run CMake
|
||||
run: cmake --preset mac-release .
|
||||
- name: Build
|
||||
run: cmake --build --preset mac-release
|
||||
run: cmake --build build
|
||||
- name: Run Clippy
|
||||
run: cargo clippy --release
|
||||
working-directory: src
|
||||
- name: Create Application Bundle
|
||||
run: |
|
||||
cmake --install build --prefix .
|
||||
mkdir dist
|
||||
mv obliteration.app dist/Obliteration.app
|
||||
- name: Fix library paths
|
||||
run: |
|
||||
app="dist/Obliteration.app/Contents/MacOS/obliteration"
|
||||
krn="dist/Obliteration.app/Contents/MacOS/obkrnl"
|
||||
|
||||
install_name_tool -change '@rpath/QtWidgets.framework/Versions/A/QtWidgets' '@executable_path/../Frameworks/QtWidgets.framework/Versions/A/QtWidgets' "$app"
|
||||
install_name_tool -change '@rpath/QtGui.framework/Versions/A/QtGui' '@executable_path/../Frameworks/QtGui.framework/Versions/A/QtGui' "$app"
|
||||
install_name_tool -change '@rpath/QtCore.framework/Versions/A/QtCore' '@executable_path/../Frameworks/QtCore.framework/Versions/A/QtCore' "$app"
|
||||
|
||||
otool -L "$app"
|
||||
otool -L "$krn"
|
||||
- name: Create Apple Disk Image
|
||||
run: hdiutil create -volname Obliteration -srcfolder dist Obliteration.dmg
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: obliteration-mac-intel
|
||||
path: Obliteration.dmg
|
||||
- name: Cache build files
|
||||
uses: actions/cache/save@v3
|
||||
with:
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,3 +1,4 @@
|
||||
.DS_Store
|
||||
/.flatpak-builder/
|
||||
/.kernel-debug
|
||||
/build/
|
||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -16,7 +16,7 @@
|
||||
"program": "${workspaceFolder}/build/src/obliteration"
|
||||
},
|
||||
"osx": {
|
||||
"program": "${workspaceFolder}/build/src/Obliteration.app/Contents/MacOS/Obliteration"
|
||||
"program": "${workspaceFolder}/build/src/obliteration.app/Contents/MacOS/obliteration"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -85,22 +85,27 @@ add_executable(obliteration WIN32 MACOSX_BUNDLE
|
||||
|
||||
if(WIN32)
|
||||
target_sources(obliteration PRIVATE resources.rc)
|
||||
elseif(APPLE)
|
||||
target_sources(obliteration PRIVATE resources/obliteration.icns)
|
||||
endif()
|
||||
|
||||
add_dependencies(obliteration core)
|
||||
|
||||
set_target_properties(obliteration PROPERTIES AUTOMOC ON AUTORCC ON)
|
||||
|
||||
if(WIN32 OR APPLE)
|
||||
if(WIN32)
|
||||
set_target_properties(obliteration PROPERTIES OUTPUT_NAME Obliteration)
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(obliteration PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER io.github.obhq.obliteration)
|
||||
set_target_properties(obliteration PROPERTIES MACOSX_BUNDLE_BUNDLE_NAME Obliteration)
|
||||
set_target_properties(obliteration PROPERTIES MACOSX_BUNDLE_BUNDLE_VERSION 0.1.0)
|
||||
set_target_properties(obliteration PROPERTIES MACOSX_BUNDLE_SHORT_VERSION_STRING 0.1.0)
|
||||
set_target_properties(obliteration PROPERTIES MACOSX_BUNDLE_COPYRIGHT "Copyright © 2023 Obliteration Contributors")
|
||||
set_target_properties(obliteration PROPERTIES
|
||||
MACOSX_BUNDLE_GUI_IDENTIFIER io.github.obhq.obliteration
|
||||
MACOSX_BUNDLE_BUNDLE_NAME Obliteration
|
||||
MACOSX_BUNDLE_BUNDLE_VERSION 0.1.0
|
||||
MACOSX_BUNDLE_SHORT_VERSION_STRING 0.1.0
|
||||
MACOSX_BUNDLE_COPYRIGHT "Copyright © 2023 Obliteration Contributors"
|
||||
MACOSX_BUNDLE_ICON_FILE obliteration
|
||||
RESOURCE resources/obliteration.icns)
|
||||
endif()
|
||||
|
||||
target_compile_features(obliteration PRIVATE cxx_std_17)
|
||||
@ -119,8 +124,23 @@ endif()
|
||||
if(WIN32)
|
||||
install(TARGETS obliteration DESTINATION .)
|
||||
else()
|
||||
install(TARGETS obliteration DESTINATION bin)
|
||||
install(TARGETS obliteration BUNDLE DESTINATION . RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
endif()
|
||||
|
||||
install(PROGRAMS ${KERNEL} TYPE BIN)
|
||||
install(SCRIPT post-install.cmake)
|
||||
if(WIN32)
|
||||
install(SCRIPT deploy-win32.cmake)
|
||||
elseif(APPLE)
|
||||
qt_generate_deploy_app_script(
|
||||
TARGET obliteration
|
||||
OUTPUT_SCRIPT QT_DEPLOY_SCRIPT
|
||||
NO_TRANSLATIONS
|
||||
NO_COMPILER_RUNTIME)
|
||||
|
||||
install(SCRIPT ${QT_DEPLOY_SCRIPT})
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
install(PROGRAMS ${KERNEL} DESTINATION obliteration.app/Contents/MacOS)
|
||||
else()
|
||||
install(PROGRAMS ${KERNEL} TYPE BIN)
|
||||
endif()
|
||||
|
12
src/deploy-win32.cmake
Normal file
12
src/deploy-win32.cmake
Normal file
@ -0,0 +1,12 @@
|
||||
# On Windows qt_generate_deploy_app_script() is broken.
|
||||
find_program(WINDEPLOYQT windeployqt HINTS ${Qt6_DIR}/bin)
|
||||
|
||||
execute_process(COMMAND ${WINDEPLOYQT}
|
||||
--release # Use release built binaries.
|
||||
--no-quick-import # We don't use Qt Quick.
|
||||
--no-translations # Our application is English only so skip Qt translations.
|
||||
--no-system-d3d-compiler # --no-quick-import does not implicit enable this.
|
||||
--no-opengl-sw # Same here.
|
||||
--no-compiler-runtime # We required user to install VC redistribution by themself.
|
||||
${CMAKE_INSTALL_PREFIX}/Obliteration.exe
|
||||
COMMAND_ECHO STDOUT)
|
@ -1,14 +0,0 @@
|
||||
# On Windows we need to copy Qt runtime DLLs to the application directory.
|
||||
if(WIN32)
|
||||
# https://doc.qt.io/Qt-6/windows-deployment.html
|
||||
find_program(WINDEPLOYQT windeployqt HINTS ${Qt6_DIR}/bin)
|
||||
execute_process(COMMAND ${WINDEPLOYQT}
|
||||
--release # Use release built binaries.
|
||||
--no-quick-import # We don't use Qt Quick.
|
||||
--no-translations # Our application is English only so skip Qt translations.
|
||||
--no-system-d3d-compiler # --no-quick-import does not implicit enable this.
|
||||
--no-opengl-sw # Same here.
|
||||
--no-compiler-runtime # We required user to install VC redistribution by themself.
|
||||
${CMAKE_INSTALL_PREFIX}/Obliteration.exe
|
||||
COMMAND_ECHO STDOUT)
|
||||
endif()
|
BIN
src/resources/obliteration.icns
Normal file
BIN
src/resources/obliteration.icns
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user