Skip to content

Commit

Permalink
chore: Simplify msvc build using vcpkg.
Browse files Browse the repository at this point in the history
  • Loading branch information
iphydf committed Dec 26, 2023
1 parent 4eae3b5 commit 5da0fd7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 12 deletions.
6 changes: 3 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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()
Expand Down
7 changes: 7 additions & 0 deletions cmake/Dependencies.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
18 changes: 9 additions & 9 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

0 comments on commit 5da0fd7

Please sign in to comment.