Use vcpkg for dependencies.

This commit is contained in:
Skyth 2024-10-17 01:04:21 +03:00
parent b7a3bdca87
commit 8e8ce8b42f
13 changed files with 76 additions and 74 deletions

19
.gitmodules vendored
View file

@ -1,25 +1,6 @@
[submodule "thirdparty/PowerRecomp"] [submodule "thirdparty/PowerRecomp"]
path = thirdparty/PowerRecomp path = thirdparty/PowerRecomp
url = https://github.com/hedge-dev/PowerRecomp url = https://github.com/hedge-dev/PowerRecomp
[submodule "thirdparty/SDL"]
path = thirdparty/SDL
url = https://github.com/libsdl-org/SDL.git
branch = SDL2
[submodule "thirdparty/unordered_dense"]
path = thirdparty/unordered_dense
url = https://github.com/martinus/unordered_dense.git
[submodule "thirdparty/D3D12MemoryAllocator"]
path = thirdparty/D3D12MemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/D3D12MemoryAllocator.git
[submodule "thirdparty/ddspp"] [submodule "thirdparty/ddspp"]
path = thirdparty/ddspp path = thirdparty/ddspp
url = https://github.com/redorav/ddspp.git url = https://github.com/redorav/ddspp.git
[submodule "thirdparty/Vulkan-Headers"]
path = thirdparty/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers
[submodule "thirdparty/VulkanMemoryAllocator"]
path = thirdparty/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
[submodule "thirdparty/volk"]
path = thirdparty/volk
url = https://github.com/zeux/volk.git

View file

@ -1,5 +1,6 @@
cmake_minimum_required (VERSION 3.20) cmake_minimum_required (VERSION 3.20)
include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
set(SWA_THIRDPARTY_ROOT ${CMAKE_SOURCE_DIR}/thirdparty) set(SWA_THIRDPARTY_ROOT ${CMAKE_SOURCE_DIR}/thirdparty)
set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD 23)
set(BUILD_SHARED_LIBS OFF) set(BUILD_SHARED_LIBS OFF)
@ -12,8 +13,6 @@ endif()
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>") set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(SDL_STATIC ON)
add_subdirectory(${SWA_THIRDPARTY_ROOT}) add_subdirectory(${SWA_THIRDPARTY_ROOT})
project("UnleashedRecomp-ALL") project("UnleashedRecomp-ALL")

View file

@ -1,28 +1,40 @@
{ {
"configurations": [ "configurations": [
{ {
"name": "x64-Clang-Debug", "name": "x64-Clang-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}", "buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}", "installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "", "cmakeCommandArgs": "",
"buildCommandArgs": "", "buildCommandArgs": "",
"ctestCommandArgs": "", "ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ], "inheritEnvironments": [ "clang_cl_x64_x64" ],
"variables": [] "variables": [
}, {
{ "name": "VCPKG_TARGET_TRIPLET",
"name": "x64-Clang-Release", "value": "x64-windows-static",
"generator": "Ninja", "type": "STRING"
"configurationType": "RelWithDebInfo", }
"buildRoot": "${projectDir}\\out\\build\\${name}", ]
"installRoot": "${projectDir}\\out\\install\\${name}", },
"cmakeCommandArgs": "", {
"buildCommandArgs": "", "name": "x64-Clang-Release",
"ctestCommandArgs": "", "generator": "Ninja",
"inheritEnvironments": [ "clang_cl_x64_x64" ], "configurationType": "RelWithDebInfo",
"variables": [] "buildRoot": "${projectDir}\\out\\build\\${name}",
} "installRoot": "${projectDir}\\out\\install\\${name}",
] "cmakeCommandArgs": "",
} "buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "clang_cl_x64_x64" ],
"variables": [
{
"name": "VCPKG_TARGET_TRIPLET",
"value": "x64-windows-static",
"type": "STRING"
}
]
}
]
}

View file

@ -56,28 +56,36 @@ set(SWA_CXX_SOURCES
add_executable(UnleashedRecomp ${SWA_CXX_SOURCES}) add_executable(UnleashedRecomp ${SWA_CXX_SOURCES})
set_target_properties(UnleashedRecomp PROPERTIES OUTPUT_NAME ${TARGET_NAME}) set_target_properties(UnleashedRecomp PROPERTIES OUTPUT_NAME ${TARGET_NAME})
target_link_libraries(UnleashedRecomp PUBLIC find_package(d3d12-memory-allocator CONFIG REQUIRED)
UnleashedRecompLib find_package(SDL2 CONFIG REQUIRED)
PowerUtils find_package(unordered_dense CONFIG REQUIRED)
o1heap find_package(VulkanHeaders CONFIG)
xxHash::xxhash find_package(volk CONFIG REQUIRED)
unordered_dense::unordered_dense find_package(VulkanMemoryAllocator CONFIG REQUIRED)
SDL2::SDL2-static find_package(xxHash CONFIG REQUIRED)
winmm
ntdll target_link_libraries(UnleashedRecomp PRIVATE
comctl32 comctl32
d3d12 d3d12
dxgi dxgi
Vulkan::Headers
volk::volk
volk::volk_headers
GPUOpen::VulkanMemoryAllocator
ntdll
o1heap
PowerUtils
SDL2::SDL2-static
UnleashedRecompLib
unofficial::D3D12MemoryAllocator
unordered_dense::unordered_dense
winmm
xxHash::xxhash
) )
target_include_directories(UnleashedRecomp PRIVATE target_include_directories(UnleashedRecomp PRIVATE
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${SWA_THIRDPARTY_ROOT}/ddspp ${SWA_THIRDPARTY_ROOT}/ddspp
${SWA_THIRDPARTY_ROOT}/D3D12MemoryAllocator/include
${SWA_THIRDPARTY_ROOT}/D3D12MemoryAllocator/src
${SWA_THIRDPARTY_ROOT}/volk
${SWA_THIRDPARTY_ROOT}/Vulkan-Headers/include
${SWA_THIRDPARTY_ROOT}/VulkanMemoryAllocator/include
${SWA_THIRDPARTY_ROOT}/VulkanMemoryAllocator/src
) )
target_precompile_headers(UnleashedRecomp PUBLIC ${SWA_PRECOMPILED_HEADERS}) target_precompile_headers(UnleashedRecomp PUBLIC ${SWA_PRECOMPILED_HEADERS})

View file

@ -12,8 +12,6 @@
#pragma clang diagnostic ignored "-Wswitch" #pragma clang diagnostic ignored "-Wswitch"
#endif #endif
#include "D3D12MemAlloc.cpp"
#ifdef __clang__ #ifdef __clang__
#pragma clang diagnostic pop #pragma clang diagnostic pop
#endif #endif
@ -3307,7 +3305,7 @@ namespace RT64 {
D3D12MA::ALLOCATOR_DESC allocatorDesc = {}; D3D12MA::ALLOCATOR_DESC allocatorDesc = {};
allocatorDesc.pDevice = d3d; allocatorDesc.pDevice = d3d;
allocatorDesc.pAdapter = adapter; allocatorDesc.pAdapter = adapter;
allocatorDesc.Flags = D3D12MA::ALLOCATOR_FLAG_DEFAULT_POOLS_NOT_ZEROED | D3D12MA::ALLOCATOR_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED | D3D12MA::ALLOCATOR_FLAG_DONT_PREFER_SMALL_BUFFERS_COMMITTED; allocatorDesc.Flags = D3D12MA::ALLOCATOR_FLAG_DEFAULT_POOLS_NOT_ZEROED | D3D12MA::ALLOCATOR_FLAG_MSAA_TEXTURES_ALWAYS_COMMITTED;
res = D3D12MA::CreateAllocator(&allocatorDesc, &allocator); res = D3D12MA::CreateAllocator(&allocatorDesc, &allocator);
if (FAILED(res)) { if (FAILED(res)) {

View file

@ -1,4 +1,2 @@
add_subdirectory(${SWA_THIRDPARTY_ROOT}/unordered_dense)
add_subdirectory(${SWA_THIRDPARTY_ROOT}/PowerRecomp) add_subdirectory(${SWA_THIRDPARTY_ROOT}/PowerRecomp)
add_subdirectory(${SWA_THIRDPARTY_ROOT}/o1heap) add_subdirectory(${SWA_THIRDPARTY_ROOT}/o1heap)
add_subdirectory(${SWA_THIRDPARTY_ROOT}/SDL)

@ -1 +0,0 @@
Subproject commit e00c4a7c85cf9c28c6f4a6cc75032736f416410f

1
thirdparty/SDL vendored

@ -1 +0,0 @@
Subproject commit 1edaad17218d67b567c149badce9ef0fc67f65fa

@ -1 +0,0 @@
Subproject commit 14345dab231912ee9601136e96ca67a6e1f632e7

@ -1 +0,0 @@
Subproject commit 1c35ba99ce775f8342d87a83a3f0f696f99c2a39

@ -1 +0,0 @@
Subproject commit d911053e390816ecc5dedd5a9d6b4bb5ed92b4c9

1
thirdparty/volk vendored

@ -1 +0,0 @@
Subproject commit 447e21b5d92ed8d5271b0d39b071f938fcfa875f

12
vcpkg.json Normal file
View file

@ -0,0 +1,12 @@
{
"builtin-baseline": "e63bd09dc0b7204467705c1c7c71d0e2a3f8860b",
"dependencies": [
"d3d12-memory-allocator",
"sdl2",
"unordered-dense",
"volk",
"vulkan-headers",
"vulkan-memory-allocator",
"xxhash"
]
}