Skip to content

Commit

Permalink
VCPKG: do not use bundled plog and SDL
Browse files Browse the repository at this point in the history
Before, when using VCPKG for 3rd parties, the plog/SDL used were the ones we bundle and not the ones built by VCPKG as we intended
  • Loading branch information
Lgt2x committed Dec 29, 2024
1 parent 2d36b42 commit 46a3a6f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 20 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ endif()
set(USE_VCPKG "DEFAULT" CACHE STRING "Use vcpkg for dependency management. DEFAULT defers to existence of $VCPKG_ROOT environment variable.")
set_property(CACHE USE_VCPKG PROPERTY STRINGS "DEFAULT" "ON" "OFF")

if(USE_VCPKG)
if(NOT USE_VCPKG STREQUAL "OFF")
if(DEFINED ENV{VCPKG_ROOT})
set(USING_VCPKG true)

if (CMAKE_TOOLCHAIN_FILE)
cmake_path(ABSOLUTE_PATH CMAKE_TOOLCHAIN_FILE NORMALIZE OUTPUT_VARIABLE VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
endif()
Expand Down Expand Up @@ -157,11 +159,11 @@ endif()

find_package(glm REQUIRED)

if (USE_EXTERNAL_SDL)
if (USE_EXTERNAL_SDL OR DEFINED USING_VCPKG)
find_package(SDL3 REQUIRED CONFIG REQUIRED COMPONENTS SDL3)
endif()

if(USE_EXTERNAL_PLOG)
if(USE_EXTERNAL_PLOG OR DEFINED USING_VCPKG)
find_package(plog REQUIRED)
endif()

Expand Down
27 changes: 15 additions & 12 deletions third_party/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,21 @@ set(CMAKE_FOLDER "third_party")
add_subdirectory(libacm)
add_subdirectory(stb)

if(NOT USE_EXTERNAL_PLOG)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plog/CMakeLists.txt)
message(FATAL_ERROR "plog third-party directory could not be found. "
"Please run 'git submodule update --init --recursive' in the source directory.")
if (NOT DEFINED USING_VCPKG) # VCPKG has ports for SDL3 and plog
message("USING BUNDLED SDL")
if(NOT USE_EXTERNAL_PLOG)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/plog/CMakeLists.txt)
message(FATAL_ERROR "plog third-party directory could not be found. "
"Please run 'git submodule update --init --recursive' in the source directory.")
endif()
add_subdirectory(plog)
endif()
add_subdirectory(plog)
endif()

if (NOT USE_EXTERNAL_SDL)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/SDL/CMakeLists.txt)
message(FATAL_ERROR "SDL third-party directory could not be found. "
"Please run 'git submodule update --init --recursive' in the source directory.")
if (NOT USE_EXTERNAL_SDL)
if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/SDL/CMakeLists.txt)
message(FATAL_ERROR "SDL third-party directory could not be found. "
"Please run 'git submodule update --init --recursive' in the source directory.")
endif()
add_subdirectory(SDL)
endif()
add_subdirectory(SDL)
endif()
endif()
10 changes: 5 additions & 5 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"builtin-baseline": "e60236ee051183f1122066bee8c54a0b47c43a60",
"builtin-baseline": "80d54ff62d528339c626a6fbc3489a7f25956ade",
"dependencies": [
"glm",
"gtest",
"plog",
"zlib",
{
"name": "sdl3",
"version>=": "v3.1.6-preview#2",
"version>=": "3.1.6-preview",
"features": ["x11", "wayland", "alsa"],
"default-features": false,
"platform": "linux & !native"
},
{
"name": "sdl3",
"version>=": "v3.1.6-preview#2",
"version>=": "3.1.6-preview",
"features": ["x11","wayland", "alsa"],
"platform": "linux & native"
},
{
"name": "sdl3",
"version>=": "v3.1.6-preview#2",
"version>=": "3.1.6-preview",
"platform": "!linux"
}
],
"overrides": [
{
"name": "sdl3",
"version": "v3.1.6-preview#2"
"version": "3.1.6-preview"
}
]
}

0 comments on commit 46a3a6f

Please sign in to comment.