$NetBSD: patch-CMakeLists.txt,v 1.1 2023/11/04 10:26:44 triaxx Exp $ Remove bundle for macOS. --- CMakeLists.txt.orig 2022-09-22 11:23:15.000000000 +0000 +++ CMakeLists.txt @@ -643,29 +643,6 @@ set(TRANSLATION_FILES ${PROJECT_SOURCE_DIR}/src/translation/translation.c ) -set(MACOSX_FILES "") -if(APPLE) - function(resource VAR SOURCE_PATH DESTINATION PATTERN) - file(GLOB_RECURSE _LIST CONFIGURE_DEPENDS ${SOURCE_PATH}/${PATTERN}) - foreach (RESOURCE ${_LIST}) - get_filename_component(_PARENT ${RESOURCE} DIRECTORY) - if (${_PARENT} STREQUAL ${SOURCE_PATH}) - set(_DESTINATION ${DESTINATION}) - else () - file(RELATIVE_PATH _DESTINATION ${SOURCE_PATH} ${_PARENT}) - set(_DESTINATION ${DESTINATION}/${_DESTINATION}) - endif () - set_property(SOURCE ${RESOURCE} PROPERTY MACOSX_PACKAGE_LOCATION ${_DESTINATION}) - endforeach (RESOURCE) - set(${VAR} ${_LIST} PARENT_SCOPE) - endfunction() - resource(ASSET_SOURCES ${ASSETS_DIR} Resources/assets *) - set(MACOSX_FILES - ${PROJECT_SOURCE_DIR}/res/augustus.icns - ${ASSET_SOURCES} - ) -endif() - set(EMSCRIPTEN_FILES "") if(${TARGET_PLATFORM} STREQUAL "emscripten") set(EMSCRIPTEN_FILES ${PROJECT_SOURCE_DIR}/res/shell.html) @@ -751,64 +728,6 @@ if(CMAKE_INSTALL_DATADIR) add_compile_definitions(CUSTOM_ASSETS_DIR="${CMAKE_INSTALL_DATADIR}") endif() -if(APPLE) - # generating a macOS icns file (see https://stackoverflow.com/a/20703594) - add_custom_command(OUTPUT ${PROJECT_SOURCE_DIR}/res/augustus.icns - COMMAND mkdir -p augustus.iconset - COMMAND sips -z 16 16 augustus_256.png --out augustus.iconset/icon_16x16.png - COMMAND sips -z 32 32 augustus_256.png --out augustus.iconset/icon_16x16@2x.png - COMMAND sips -z 32 32 augustus_256.png --out augustus.iconset/icon_32x32.png - COMMAND sips -z 64 64 augustus_256.png --out augustus.iconset/icon_32x32@2x.png - COMMAND sips -z 128 128 augustus_256.png --out augustus.iconset/icon_128x128.png - COMMAND sips -z 256 256 augustus_256.png --out augustus.iconset/icon_128x128@2x.png - COMMAND sips -z 256 256 augustus_256.png --out augustus.iconset/icon_256x256.png - COMMAND sips -z 512 512 augustus_512.png --out augustus.iconset/icon_256x256@2x.png - COMMAND iconutil -c icns augustus.iconset - COMMAND rm -R augustus.iconset - WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/res) - set_source_files_properties(${PROJECT_SOURCE_DIR}/res/augustus.icns PROPERTIES - MACOSX_PACKAGE_LOCATION "Resources") - - # setting variables that will populate Info.plist - set(MACOSX_BUNDLE_GUI_IDENTIFIER "pl.Keriew.augustus") - set(MACOSX_BUNDLE_BUNDLE_NAME ${USER_FRIENDLY_NAME}) - set(CMAKE_OSX_DEPLOYMENT_TARGET "10.10" CACHE STRING "Minimum OS X deployment version" FORCE) - set(MACOSX_BUNDLE_ICON_FILE "augustus.icns") - set(MACOSX_BUNDLE_BUNDLE_VERSION - "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}${VERSION_REVISION}") - set(MACOSX_BUNDLE_LONG_VERSION_STRING ${MACOSX_BUNDLE_BUNDLE_VERSION}) - set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${MACOSX_BUNDLE_BUNDLE_VERSION}) - - set_target_properties(${SHORT_NAME} PROPERTIES - MACOSX_BUNDLE TRUE - MACOSX_BUNDLE_INFO_PLIST "${PROJECT_SOURCE_DIR}/res/Info.plist") - - set(DIRS "") - set(LIBS "") - - # if SDL2 library is a framework, we need to indicate to CMake - # the path to its dependencies. SDL2_LIBRARY contains two parts. - # Example: /Library/Frameworks/SDL2.framework;-framework Cocoa - # So strip out everything after the ';' - string(REGEX REPLACE ";.*$" "" SDL2_LIB_DIR "${SDL2_LIBRARY}") - if(EXISTS "${SDL2_LIB_DIR}/Versions/A/Frameworks") - list(APPEND DIRS "${SDL2_LIB_DIR}/Versions/A/Frameworks") - endif() - - # if SDL2_mixer library is a framework, we need to indicate to CMake - # the path to its dependencies (Ogg.framework etc): - if(EXISTS "${SDL2_MIXER_LIBRARY}/Versions/A/Frameworks") - list(APPEND DIRS "${SDL2_MIXER_LIBRARY}/Versions/A/Frameworks") - endif() - - # when installing, "fixup" automatically copies libraries inside the - # bundle and links the binary against them - install(CODE " - include(BundleUtilities) - fixup_bundle(${CMAKE_BINARY_DIR}/${PROJECT_NAME}.app \"${LIBS}\" \"${DIRS}\") - " BUNDLE DESTINATION ${CMAKE_BINARY_DIR}) -endif() - if(SDL2_INCLUDE_DIR) include_directories(${SDL2_INCLUDE_DIR}) endif() @@ -955,7 +874,7 @@ elseif (${TARGET_PLATFORM} STREQUAL "swi COMMAND ${DEVKITPRO}/tools/bin/elf2nro ${SHORT_NAME} ${SHORT_NAME}.nro --icon=${CMAKE_SOURCE_DIR}/res/switch/icon0.jpg --nacp=${SHORT_NAME}.nacp --romfsdir="${ASSETS_DIR}" ) else() - if (UNIX AND NOT APPLE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")) + if (UNIX AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")) target_link_libraries(${SHORT_NAME} m) endif() if(${TARGET_PLATFORM} STREQUAL "android") @@ -968,7 +887,7 @@ else() target_link_libraries(${SHORT_NAME} ${MPG123_LIBRARY}) endif() target_link_libraries (${SHORT_NAME} ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY}) - if(NOT APPLE AND NOT ${TARGET_PLATFORM} STREQUAL "android") + if(NOT ${TARGET_PLATFORM} STREQUAL "android") install(TARGETS ${SHORT_NAME} RUNTIME DESTINATION bin) endif() @@ -976,7 +895,7 @@ else() target_link_libraries(${SHORT_NAME} dbghelp shlwapi) endif() - if(UNIX AND NOT APPLE) + if(UNIX) install(FILES "res/augustus.desktop" DESTINATION "share/applications" RENAME "com.github.keriew.augustus.desktop") install(FILES "res/augustus.metainfo.xml" DESTINATION "share/metainfo" RENAME "com.github.keriew.augustus.metainfo.xml") install(FILES "res/augustus_32.png" DESTINATION "share/icons/hicolor/32x32/apps" RENAME "com.github.keriew.augustus.png")