Add vcpkg as submodule and ref it in cmake

This commit is contained in:
2025-04-15 00:23:36 +02:00
parent 8b855edaf5
commit 12d6a1578d
4 changed files with 29 additions and 9 deletions

3
.gitmodules vendored
View File

@@ -23,3 +23,6 @@
path = ref/discord-rpc
url = https://github.com/discord/discord-rpc.git
branch = v3.4.0
[submodule "ref/vcpkg"]
path = ref/vcpkg
url = https://github.com/microsoft/vcpkg.git

View File

@@ -15,7 +15,7 @@ set(CMAKE_FIND_PACKAGE_PREFER_CONFIG TRUE)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/CMake_modules/")
set(DEPS_DIR ${DEPS_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/ref")
project("wls50")
project("eu07")
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize=undefined")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize=undefined -Wformat")
@@ -48,13 +48,19 @@ option(WITH_OPENGL_LEGACY "Compile with OpenGL legacy renderer" ON)
option(WITH_PYTHON "Compile with python2" ON)
option(WITH_UART "Compile with libserialport" ON)
option(WITH_LUA "Compile with lua scripting support" ON)
option(WITH_OPENVR "Compile with OpenVR" ON)
option(WITH_OPENVR "Compile with OpenVR" OFF)
option(WITH_ZMQ "Compile with cppzmq" OFF)
option(WITH_CRASHPAD "Compile with crashpad" OFF)
option(WITH_DISCORD_RPC "Compile with DISCORD RICH PRESENCE" OFF)
option(WITH_DISCORD_RPC "Compile with DISCORD RICH PRESENCE" ON)
option(USE_LTO "Use link-time optimization" OFF)
option(WITH_LIBMANUL "Experimental multi-backend renderer" OFF)
option(WITH_LIBMANUL "Experimental multi-backend renderer" ON)
# vcpkg init
set(VCPKG_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/ref/vcpkg")
set(VCPKG_INSTALLED_PATH "${VCPKG_ROOT}/installed/x64-windows")
list(APPEND CMAKE_PREFIX_PATH "${VCPKG_INSTALLED_PATH}")
list(APPEND CMAKE_MODULE_PATH "${VCPKG_INSTALLED_PATH}/share")
set(SOURCES
"Texture.cpp"
@@ -447,13 +453,18 @@ target_include_directories(${PROJECT_NAME} PRIVATE ${GLM_INCLUDE_DIR})
if (WITH_DISCORD_RPC)
# add ref/discord-rpc to the project in the same way other dependencies are added
add_subdirectory(ref/discord-rpc)
target_link_libraries(${PROJECT_NAME} discord-rpc)
target_compile_definitions(${PROJECT_NAME} "WITH_DISCORD_RPC=1")
elseif ()
target_compile_definitions(${PROJECT_NAME} "WITH_DISCORD_RPC=0")
endif ()
# Add the include directory so the compiler can find discord_rpc.h
target_include_directories(${PROJECT_NAME} PUBLIC
"${CMAKE_CURRENT_SOURCE_DIR}/ref/discord-rpc/include"
)
target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_DISCORD_RPC=1)
else()
target_compile_definitions(${PROJECT_NAME} PUBLIC WITH_DISCORD_RPC=0)
endif()
find_package(OpenAL REQUIRED)

1
ref/vcpkg Submodule

Submodule ref/vcpkg added at 2e2102fa4a

5
setup.bat Normal file
View File

@@ -0,0 +1,5 @@
#echo off
echo Preparing vcpkg packages
cd ref\vcpkg
call bootstrap-vcpkg.bat
vcpkg install directx-dxc:x64-windows