diff options
author | WaluigiWare64 <68647953+WaluigiWare64@users.noreply.github.com> | 2021-03-21 15:32:23 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-21 15:32:23 +0000 |
commit | 6b431a6664e6eb040729c648cffc5e31f655bbcf (patch) | |
tree | b2b98e9c8a088a73eef4d18b2792f6f989bd99c7 /src/frontend/qt_sdl | |
parent | f7347b1f7ac71d11bf48d9e98a79a41aece669c9 (diff) |
Allow bundling libraries on macOS (#1013)
Diffstat (limited to 'src/frontend/qt_sdl')
-rw-r--r-- | src/frontend/qt_sdl/CMakeLists.txt | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index f61e0ca..5ccab7d 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -54,14 +54,6 @@ find_package(PkgConfig REQUIRED) find_package(Iconv REQUIRED) pkg_check_modules(SDL2 REQUIRED sdl2) pkg_check_modules(SLIRP REQUIRED slirp) - -if (APPLE) - # Find libarchive on macOS, because macOS only provides the library, not the headers - execute_process(COMMAND brew --prefix libarchive - OUTPUT_VARIABLE LIBARCHIVE_DIR - OUTPUT_STRIP_TRAILING_WHITESPACE) - list(APPEND CMAKE_PREFIX_PATH "${LIBARCHIVE_DIR}") -endif() pkg_check_modules(LIBARCHIVE REQUIRED libarchive) add_compile_definitions(ARCHIVE_SUPPORT_ENABLED) @@ -74,7 +66,11 @@ endif() target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT}) target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS} ${SLIRP_INCLUDE_DIRS} ${LIBARCHIVE_INCLUDE_DIRS}) -target_link_directories(melonDS PRIVATE ${SDL2_LIBRARY_DIRS} ${SLIRP_LIBRARY_DIRS} ${LIBARCHIVE_LIBRARY_DIRS}) +target_link_directories(melonDS PRIVATE ${SDL2_LIBRARY_DIRS} ${SLIRP_LIBRARY_DIRS}) +if (NOT APPLE) + target_link_directories(melonDS PRIVATE ${LIBARCHIVE_LIBRARY_DIRS}) +endif() + target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..") target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../..") @@ -87,7 +83,7 @@ else() endif() if (NOT Iconv_IS_BUILT_IN) - target_link_libraries(melonDS iconv) + target_link_libraries(melonDS ${Iconv_LIBRARIES}) endif() if (UNIX) @@ -124,6 +120,18 @@ if (APPLE) target_sources(melonDS PRIVATE "${CMAKE_SOURCE_DIR}/melon.icns") set_source_files_properties("${CMAKE_SOURCE_DIR}/melon.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources) + option(MACOS_BUNDLE_LIBS "Bundle libraries with the app on macOS" OFF) + + if (MACOS_BUNDLE_LIBS) + # Copy Qt plugins into the bundle + get_target_property(qtcocoa_location Qt5::QCocoaIntegrationPlugin LOCATION) + target_sources(melonDS PRIVATE "${qtcocoa_location}") + set_source_files_properties("${qtcocoa_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/platforms) + + get_target_property(qtmacstyle_location Qt5::QMacStylePlugin LOCATION) + target_sources(melonDS PRIVATE "${qtmacstyle_location}") + set_source_files_properties("${qtmacstyle_location}" PROPERTIES MACOSX_PACKAGE_LOCATION MacOS/styles) + endif() endif() install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications) |