aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md1
-rw-r--r--src/frontend/qt_sdl/CMakeLists.txt28
2 files changed, 19 insertions, 10 deletions
diff --git a/README.md b/README.md
index 147d3ee..63f25d4 100644
--- a/README.md
+++ b/README.md
@@ -97,6 +97,7 @@ If everything went well, melonDS should now be in the `dist` folder.
```
4. Compile:
```zsh
+ export PKG_CONFIG_PATH="$(brew --prefix libarchive)/lib/pkgconfig"
cmake .. -DQt5_DIR=$(brew --prefix qt5)/lib/cmake/Qt5
make -j$(sysctl -n hw.ncpu)
mkdir dist && cp -r melonDS.app dist
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)