Skip to content

Commit 17aa706

Browse files
committed
Sigh, Apple
1 parent a932aaa commit 17aa706

4 files changed

Lines changed: 40 additions & 4 deletions

File tree

‎cmake/modules/FindSDL_gfx.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Locate SDL_mixer library
1+
# Locate SDL_gfx library
22
# This module defines
33
# SDLGFX_LIBRARY, the name of the library to link against
44
# SDLGFX_FOUND, if false, do not try to link to SDL

‎cmake/modules/FindYaml_cpp.cmake‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Locate SDL_mixer library
1+
# Locate yaml-cpp library
22
# This module defines
33
# YAMLCPP_LIBRARY, the name of the library to link against
44
# YAMLCPP_FOUND, if false, do not try to link to SDL
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Adapted from the Dolphin project: https://dolphin-emu.org/
2+
3+
# This module can be used in two different ways.
4+
#
5+
# When invoked as `cmake -P PostprocessBundle.cmake`, it fixes up an
6+
# application folder to be standalone. It bundles all required libraries from
7+
# the system and fixes up library IDs. Any additional shared libraries, like
8+
# plugins, that are found under Contents/MacOS/ will be made standalone as well.
9+
#
10+
# When called with `include(PostprocessBundle)`, it defines a helper
11+
# function `postprocess_bundle` that sets up the command form of the
12+
# module as a post-build step.
13+
14+
if(CMAKE_GENERATOR)
15+
# Being called as include(PostprocessBundle), so define a helper function.
16+
function(postprocess_bundle target path)
17+
add_custom_command(TARGET ${target}
18+
POST_BUILD
19+
COMMAND ${CMAKE_COMMAND} -DBUNDLE_PATH="${path}" -P "${CMAKE_CURRENT_LIST_FILE}"
20+
)
21+
endfunction()
22+
return()
23+
endif()
24+
25+
# Make sure to fix up any additional shared libraries (like plugins) that are
26+
# needed.
27+
file(GLOB_RECURSE BUNDLE_LIBS "${BUNDLE_PATH}/Contents/MacOS/*.dylib")
28+
29+
include(BundleUtilities)
30+
set(BU_CHMOD_BUNDLE_ITEMS ON)
31+
fixup_bundle("${BUNDLE_PATH}" "${BUNDLE_LIBS}" "")

‎src/CMakeLists.txt‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -483,8 +483,13 @@ if ( WIN32 )
483483
endif ()
484484

485485
if ( APPLE AND CREATE_BUNDLE )
486-
include ( BundleUtilities )
487-
fixup_bundle ( ${EXECUTABLE_OUTPUT_PATH}/openxcom.app "" "" )
486+
include ( PostprocessBundle )
487+
if ( "${CMAKE_GENERATOR}" STREQUAL "Xcode" )
488+
postprocess_bundle ( openxcom ${EXECUTABLE_OUTPUT_PATH}/Debug/openxcom.app )
489+
postprocess_bundle ( openxcom ${EXECUTABLE_OUTPUT_PATH}/Release/openxcom.app )
490+
else ()
491+
postprocess_bundle ( openxcom ${EXECUTABLE_OUTPUT_PATH}/openxcom.app )
492+
endif ()
488493
endif ()
489494

490495
#Setup source groups for IDE

0 commit comments

Comments
 (0)