From 3305063f55263d7915e2193493ce5fc36ee47fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 13 Jan 2022 03:01:15 +0100 Subject: [PATCH] Add options to discover munt and slirp locally --- src/network/CMakeLists.txt | 13 +++++++++++-- src/sound/CMakeLists.txt | 13 +++++++++++-- src/win/CMakeLists.txt | 2 +- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 434daa407..5cfa87d91 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -16,5 +16,14 @@ add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c503.c net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c) -add_subdirectory(slirp) -target_link_libraries(86Box slirp) \ No newline at end of file +option(SLIRP_EXTERNAL "Link against the system-provided libslirp library" OFF) +mark_as_advanced(SLIRP_EXTERNAL) + +if(SLIRP_EXTERNAL) + find_package(PkgConfig REQUIRED) + pkg_check_modules(SLIRP REQUIRED IMPORTED_TARGET slirp) + target_link_libraries(86Box PkgConfig::SLIRP) +else() + add_subdirectory(slirp) + target_link_libraries(86Box slirp) +endif() \ No newline at end of file diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt index 464e5c45a..e815d7329 100644 --- a/src/sound/CMakeLists.txt +++ b/src/sound/CMakeLists.txt @@ -33,8 +33,17 @@ if(MUNT) target_compile_definitions(snd PRIVATE USE_MUNT) target_sources(snd PRIVATE midi_mt32.c) - add_subdirectory(munt) - target_link_libraries(86Box mt32emu) + option(MUNT_EXTERNAL "Link against the system-provided MUNT library" OFF) + mark_as_advanced(MUNT_EXTERNAL) + + if(MUNT_EXTERNAL) + find_package(PkgConfig REQUIRED) + pkg_check_modules(MT32EMU REQUIRED IMPORTED_TARGET mt32emu) + target_link_libraries(86Box PkgConfig::MT32EMU) + else() + add_subdirectory(munt) + target_link_libraries(86Box mt32emu) + endif() endif() if(PAS16) diff --git a/src/win/CMakeLists.txt b/src/win/CMakeLists.txt index 0e8300946..b12d8523b 100644 --- a/src/win/CMakeLists.txt +++ b/src/win/CMakeLists.txt @@ -54,4 +54,4 @@ else() endif() target_link_libraries(86Box advapi32 comctl32 comdlg32 gdi32 shell32 iphlpapi - dxguid imm32 hid setupapi uxtheme version winmm psapi) + dxguid imm32 hid setupapi uxtheme version winmm psapi ws2_32)