From 5da0fd75b992aebd4bf4659bb11b3a4c6a53a708 Mon Sep 17 00:00:00 2001 From: iphydf Date: Mon, 25 Dec 2023 12:45:19 +0000 Subject: [PATCH] chore: Simplify msvc build using vcpkg. --- CMakeLists.txt | 6 +++--- cmake/Dependencies.cmake | 7 +++++++ vcpkg.json | 18 +++++++++--------- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 287070af939..3ebdddcf660 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,7 @@ set(toxcore_SOURCES toxcore/util.c toxcore/util.h) if(MSVC) - set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} PkgConfig::LIBSODIUM) + set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} unofficial-sodium::sodium) else() set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${LIBSODIUM_LIBRARIES}) set(toxcore_LINK_DIRECTORIES ${toxcore_LINK_DIRECTORIES} ${LIBSODIUM_LIBRARY_DIRS}) @@ -351,7 +351,7 @@ if(BUILD_TOXAV) ${toxcore_SOURCE_DIR}/toxav/toxav.h^toxav) if(MSVC) - set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} PkgConfig::OPUS PkgConfig::VPX) + set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} Opus::opus unofficial::libvpx::libvpx) else() set(toxcore_LINK_LIBRARIES ${toxcore_LINK_LIBRARIES} ${OPUS_LIBRARIES} ${VPX_LIBRARIES}) set(toxcore_LINK_DIRECTORIES ${toxcore_LINK_DIRECTORIES} ${OPUS_LIBRARY_DIRS} ${VPX_LIBRARY_DIRS}) @@ -503,7 +503,7 @@ if(DHT_BOOTSTRAP) endif() target_link_libraries(DHT_bootstrap PRIVATE misc_tools) if(MSVC) - target_link_libraries(DHT_bootstrap PRIVATE PThreads4W::PThreads4W) + target_link_libraries(DHT_bootstrap PRIVATE unofficial-sodium::sodium PThreads4W::PThreads4W) endif() install(TARGETS DHT_bootstrap RUNTIME DESTINATION bin) endif() diff --git a/cmake/Dependencies.cmake b/cmake/Dependencies.cmake index baf7af67759..cd06e887841 100644 --- a/cmake/Dependencies.cmake +++ b/cmake/Dependencies.cmake @@ -31,4 +31,11 @@ pkg_search_module(LIBCONFIG libconfig IMPORTED_TARGET) if(MSVC) # For toxcore. find_package(PThreads4W REQUIRED) + find_package(unofficial-sodium REQUIRED) + if(OPUS_FOUND) + find_package(Opus REQUIRED) + endif() + if(VPX_FOUND) + find_package(unofficial-libvpx REQUIRED) + endif() endif() diff --git a/vcpkg.json b/vcpkg.json index 0b24cca5a53..96eb8e72a47 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,11 +1,11 @@ { - "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", - "dependencies": [ - "gtest", - "libsodium", - "libvpx", - "opus", - "pthreads", - "winsock2" - ] + "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", + "dependencies": [ + "gtest", + "libsodium", + "libvpx", + "opus", + "pthreads", + "winsock2" + ] }