mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
Allow bundling libraries on macOS (#1013)
This commit is contained in:
parent
f7347b1f7a
commit
6b431a6664
@ -97,6 +97,7 @@ If everything went well, melonDS should now be in the `dist` folder.
|
|||||||
```
|
```
|
||||||
4. Compile:
|
4. Compile:
|
||||||
```zsh
|
```zsh
|
||||||
|
export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig"
|
||||||
cmake .. -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5
|
cmake .. -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5
|
||||||
make -j$(sysctl -n hw.ncpu)
|
make -j$(sysctl -n hw.ncpu)
|
||||||
mkdir dist && cp -r melonDS.app dist
|
mkdir dist && cp -r melonDS.app dist
|
||||||
|
@ -54,14 +54,6 @@ find_package(PkgConfig REQUIRED)
|
|||||||
find_package(Iconv REQUIRED)
|
find_package(Iconv REQUIRED)
|
||||||
pkg_check_modules(SDL2 REQUIRED sdl2)
|
pkg_check_modules(SDL2 REQUIRED sdl2)
|
||||||
pkg_check_modules(SLIRP REQUIRED slirp)
|
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)
|
pkg_check_modules(LIBARCHIVE REQUIRED libarchive)
|
||||||
add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
|
add_compile_definitions(ARCHIVE_SUPPORT_ENABLED)
|
||||||
|
|
||||||
@ -74,7 +66,11 @@ endif()
|
|||||||
target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT})
|
target_link_libraries(melonDS ${CMAKE_THREAD_LIBS_INIT})
|
||||||
|
|
||||||
target_include_directories(melonDS PRIVATE ${SDL2_INCLUDE_DIRS} ${SLIRP_INCLUDE_DIRS} ${LIBARCHIVE_INCLUDE_DIRS})
|
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}/..")
|
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()
|
endif()
|
||||||
|
|
||||||
if (NOT Iconv_IS_BUILT_IN)
|
if (NOT Iconv_IS_BUILT_IN)
|
||||||
target_link_libraries(melonDS iconv)
|
target_link_libraries(melonDS ${Iconv_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
@ -124,6 +120,18 @@ if (APPLE)
|
|||||||
target_sources(melonDS PRIVATE "${CMAKE_SOURCE_DIR}/melon.icns")
|
target_sources(melonDS PRIVATE "${CMAKE_SOURCE_DIR}/melon.icns")
|
||||||
set_source_files_properties("${CMAKE_SOURCE_DIR}/melon.icns" PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
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()
|
endif()
|
||||||
|
|
||||||
install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
install(FILES ../../../net.kuribo64.melonDS.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/share/applications)
|
||||||
|
Loading…
Reference in New Issue
Block a user