From 1ee98a7cffef06fc5b304e9a9922a8ce8afc782e Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Wed, 15 May 2024 17:54:13 +0200 Subject: [PATCH] Allow optionally using system libslirp --- src/frontend/qt_sdl/CMakeLists.txt | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/frontend/qt_sdl/CMakeLists.txt b/src/frontend/qt_sdl/CMakeLists.txt index d6fd9af2..f48a490e 100644 --- a/src/frontend/qt_sdl/CMakeLists.txt +++ b/src/frontend/qt_sdl/CMakeLists.txt @@ -89,14 +89,21 @@ pkg_check_modules(Zstd REQUIRED IMPORTED_TARGET libzstd) fix_interface_includes(PkgConfig::SDL2 PkgConfig::LibArchive) -add_subdirectory("../libslirp" - "${CMAKE_BINARY_DIR}/libslirp" - EXCLUDE_FROM_ALL) - add_compile_definitions(ARCHIVE_SUPPORT_ENABLED) add_executable(melonDS ${SOURCES_QT_SDL}) +option(USE_SYSTEM_LIBSLIRP "Use system libslirp instead of the bundled version" OFF) +if (USE_SYSTEM_LIBSLIRP) + pkg_check_modules(Slirp REQUIRED IMPORTED_TARGET slirp) + target_link_libraries(melonDS PRIVATE PkgConfig::Slirp) +else() + add_subdirectory("../libslirp" + "${CMAKE_BINARY_DIR}/libslirp" + EXCLUDE_FROM_ALL) + target_link_libraries(melonDS PRIVATE slirp) +endif() + if (WIN32) target_link_libraries(melonDS PUBLIC opengl32) @@ -165,7 +172,6 @@ endif() target_link_libraries(melonDS PRIVATE core) target_link_libraries(melonDS PRIVATE PkgConfig::SDL2 PkgConfig::LibArchive PkgConfig::Zstd) target_link_libraries(melonDS PRIVATE ${QT_LINK_LIBS} ${CMAKE_DL_LIBS}) -target_link_libraries(melonDS PRIVATE slirp) if (WIN32) option(PORTABLE "Make a portable build that looks for its configuration in the current directory" ON)