Skip to content

Commit

Permalink
chore: create MACOSX_BUNDLE
Browse files Browse the repository at this point in the history
this results in a GUI instead of a CMD application on macOS
  • Loading branch information
codeflorist committed Nov 21, 2024
1 parent c90bf56 commit 6696dcf
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/macos-x86-64-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@ jobs:
- name: Bundle libs
run: ./scripts/bundle-libs-macos.sh

- name: Move data-directories to app-folder
run: mv ./dist/data ./dist/campaign ./dist/gfx ./dist/music ./dist/dunedynasty.app/Contents/MacOS

- name: Copy OS specific files
run: cp -r ./dist-os-specific/macos/* ./dist
run: cp -rf ./dist-os-specific/macos/* ./dist

- name: Test executable
run: |
brew uninstall --force --ignore-dependencies argtable sdl2 dumb libogg flac libpng freetype libvorbis ca-certificates openssl@3 opus opusfile physfs theora giflib jpeg-turbo xz lz4 zstd libtiff webp pcre2 gettext glib lame mpg123 libsndfile portaudio readline allegro fluid-synth mad enet
cd dist
cd dist/dunedynasty.app/Contents/MacOS
./dunedynasty | grep "data directory"
- name: Zip dist folder
Expand Down
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
cmake_minimum_required(VERSION 2.6 FATAL_ERROR)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version")

project(dunedynasty)
set(DUNE_DYNASTY_VERSION 1.6.3)
Expand Down Expand Up @@ -140,9 +141,16 @@ configure_file("${CMAKE_SOURCE_DIR}/include/buildcfg.h.in" "${PROJECT_BINARY_DIR
include(cmake/FileList.cmake)
include_directories("include" "${PROJECT_BINARY_DIR}/include")

add_executable(dunedynasty WIN32
add_executable(dunedynasty WIN32 MACOSX_BUNDLE
${DUNEDYNASTY_SRC_FILES} ${CMAKE_SOURCE_DIR}/src/icon/icon.rc)

set_target_properties(dunedynasty PROPERTIES
MACOSX_BUNDLE_BUNDLE_NAME "Dune Dynasty"
MACOSX_BUNDLE_GUI_IDENTIFIER "io.github.gameflorist.dunedynasty"
MACOSX_BUNDLE_BUNDLE_VERSION "${DUNE_DYNASTY_VERSION}"
MACOSX_BUNDLE_SHORT_VERSION_STRING "${DUNE_DYNASTY_VERSION}"
)

target_link_libraries(dunedynasty
${OPTIONAL_LIBRARIES}
${ALLEGRO5_AUDIO_LDFLAGS}
Expand Down
2 changes: 1 addition & 1 deletion scripts/bundle-libs-macos.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/bash -e
dylibbundler -od -cd -x ./dist/dunedynasty -b -d ./dist/libs -p @executable_path/libs/
dylibbundler -od -cd -x ./dist/dunedynasty.app/Contents/MacOS/dunedynasty -b -d ./dist/dunedynasty.app/Contents/MacOS/libs -p @executable_path/libs/

0 comments on commit 6696dcf

Please # to comment.