Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -376,4 +376,4 @@ FodyWeavers.xsd

# Package artifacts
/artifacts/
/tests/integration/cmake/extracted/
/tests/integration/cmake/extracted/
16 changes: 10 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@ option(WISDOM_BUILD_SHARED "Build the dynamic lib." ON)
option(WISDOM_BUILD_PLATFORM "Build unified platform extension library." ON)
option(WISDOM_BUILD_DOCS "Build the documentation." OFF)
option(WISDOM_USE_AGILITY_SDK "Download and use DirectX 12 Agility SDK." ON)
option(WISDOM_USE_CONAN "Use Conan to manage dependencies. Only for library builds." OFF)
option(WISDOM_USE_CONAN
"Use Conan to manage dependencies. Only for library builds." OFF)

# DXC deployment options
set(WISDOM_VULKAN_HEADER_PATH
""
CACHE PATH "Path to custom Vulkan Headers (optional)")

# Conan includes Vulkan Headers.
if (WISDOM_USE_CONAN)
set(WISDOM_VULKAN ON)
if(WISDOM_USE_CONAN)
set(WISDOM_VULKAN ON)
endif()

# Load all dependencies
Expand Down Expand Up @@ -100,13 +101,16 @@ set(CPACK_PACKAGE_NAME ${PROJECT_NAME})
set(CPACK_PACKAGE_VERSION "${PROJECT_VERSION}")
set(CPACK_PACKAGE_VENDOR "Agrael")
set(CPACK_NUGET_PACKAGE_AUTHORS "Agrael")
set(CPACK_PACKAGE_DESCRIPTION "A Low-level thin multiplatform and extensible Graphics API layer over Vulkan and DX12")
set(CPACK_PACKAGE_DESCRIPTION
"A Low-level thin multiplatform and extensible Graphics API layer over Vulkan and DX12"
)
set(CPACK_PACKAGE_HOMEPAGE_URL "https://agrael1.github.io/Wisdom/")
set(CPACK_NUGET_PACKAGE_REPOSITORY_URL "https://github.com/Agrael1/Wisdom.git")
set(CPACK_NUGET_PACKAGE_ICON "favicon.png") # pulled from installed files
set(CPACK_NUGET_PACKAGE_REPOSITORY_TYPE git)
set(CPACK_NUGET_PACKAGE_LICENSE_EXPRESSION "MIT")
set(CPACK_NUGET_PACKAGE_README "README.md") # pulled from installed files
set(CPACK_PROJECT_CONFIG_FILE "${CMAKE_CURRENT_LIST_DIR}/cmake/install/cpack-options.cmake")
set(CPACK_PROJECT_CONFIG_FILE
"${CMAKE_CURRENT_LIST_DIR}/cmake/install/cpack-options.cmake")

include(CPack)
include(CPack)
2 changes: 1 addition & 1 deletion cmake/deps.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(NOT WISDOM_USE_CONAN)
set(CPM_DONT_UPDATE_MODULE_PATH ON)
set(GET_CPM_FILE "${CMAKE_CURRENT_LIST_DIR}/deps/get_cpm.cmake")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

# Set CPM source cache
if (NOT CPM_SOURCE_CACHE)
set(CPM_SOURCE_CACHE "${CMAKE_CURRENT_BINARY_DIR}/_deps_cache")
Expand Down
4 changes: 2 additions & 2 deletions cmake/deps/deps_win.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ else()
D3D12MA_USING_DIRECTX_HEADERS=1
)

# Guaranteed backwards compatibility.
# Using origin/main to ensure we get the latest headers,
# Guaranteed backwards compatibility.
# Using origin/main to ensure we get the latest headers,
# which are compatible with the latest SDKs.
CPMAddPackage(
NAME dxheaders
Expand Down
45 changes: 22 additions & 23 deletions cmake/functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ if (WIN32)
TLS_VERIFY ON
TLS_VERSION 1.2
)

# Check download status
list(GET download_status 0 status_code)
if (NOT status_code EQUAL 0)
Expand All @@ -24,13 +24,13 @@ if (WIN32)
message(STATUS "File downloaded successfully to ${FILE_PATH}")
endif ()
endfunction(_ww_load_nuget)

# Find NuGet executable
function(_ww_find_nuget)
if (NOT WISDOM_WINDOWS)
return()
endif ()

# Check provided with WISDOM_NUGET_PATH
if (WISDOM_NUGET_PATH)
find_program(
Expand All @@ -56,28 +56,28 @@ if (WIN32)
NUGET_EXE
NAMES nuget
PATHS ${CMAKE_CURRENT_BINARY_DIR}/NuGet)

if (NOT NUGET_EXE)
_ww_load_nuget()
set(NUGET_EXE "${CMAKE_CURRENT_BINARY_DIR}/NuGet/NuGet.exe" CACHE INTERNAL "Path to NuGet.exe")
endif ()
endfunction(_ww_find_nuget)

# Load a NuGet dependency
function(_ww_load_nuget_dependency NUGET PLUGIN_NAME ALIAS OUT_DIR)
if (${ALIAS}_DIR)
message("${ALIAS}_DIR already set, skipping download.")
return()
endif ()

execute_process(COMMAND ${NUGET} install "${PLUGIN_NAME}" -OutputDirectory ${OUT_DIR})
file(GLOB PLUGIN_DIRS ${OUT_DIR}/${PLUGIN_NAME}.*)
list(LENGTH PLUGIN_DIRS PLUGIN_DIRS_L)
if (${PLUGIN_DIRS_L} GREATER 1)
#Sort directories by version in descending order, so the first dir is top version
list(SORT PLUGIN_DIRS COMPARE NATURAL ORDER DESCENDING)
list(GET PLUGIN_DIRS 0 PLUGIN_DIRX)

#Remove older version
MATH(EXPR PLUGIN_DIRS_L "${PLUGIN_DIRS_L}-1")
foreach (I RANGE 1 ${PLUGIN_DIRS_L})
Expand All @@ -87,7 +87,7 @@ if (WIN32)
else ()
list(GET PLUGIN_DIRS 0 PLUGIN_DIRX)
endif ()

set(${ALIAS}_DIR ${PLUGIN_DIRX} CACHE STRING "${PLUGIN_NAME} PATH" FORCE)
endfunction(_ww_load_nuget_dependency)
endif()
Expand All @@ -100,8 +100,8 @@ function(_ww_load_latest_dxc)
endif ()

set(DXC_API_FILE "${CMAKE_CURRENT_BINARY_DIR}/dxc_latest_api.json")
file(DOWNLOAD
"https://api.github.com/repos/microsoft/DirectXShaderCompiler/releases/latest"
file(DOWNLOAD
"https://api.github.com/repos/microsoft/DirectXShaderCompiler/releases/latest"
"${DXC_API_FILE}"
STATUS api_status
)
Expand Down Expand Up @@ -135,7 +135,7 @@ function(_ww_load_latest_dxc)
set(DXC_LINK ${DXC_LINUX_LINK})
endif ()


# Download DXC using CPM
include(FetchContent)
FetchContent_Declare(
Expand Down Expand Up @@ -440,17 +440,17 @@ function(wis_load_agility_sdk)
message("Setting up DirectX 12 Agility...")
_ww_load_nuget_dependency(${NUGET_EXE} "Microsoft.Direct3D.D3D12" DXA
${CMAKE_CURRENT_BINARY_DIR})

string(REGEX MATCH "([0-9]+)\\.([0-9]+)\\.([0-9]+)$" VERSION_MATCH ${DXA_DIR})

message("Agility version: ${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}")
set(DXA_VERSION
${CMAKE_MATCH_1}.${CMAKE_MATCH_2}.${CMAKE_MATCH_3}
CACHE INTERNAL "")
set(VERSION_MINOR
${CMAKE_MATCH_2}
CACHE INTERNAL "")

set(DXA_HEADERS ${DXA_DIR}/build/native/include)
set(DXA_SRC ${DXA_DIR}/build/native/src)
set(DXA_BIN ${DXA_DIR}/build/native/bin/x64)
Expand All @@ -460,19 +460,19 @@ function(wis_load_agility_sdk)
set(DXAGILITY_DEBUG_DLL
${DXA_BIN}/d3d12SDKLayers.dll
CACHE INTERNAL "")

add_library(DX12AgilityCore MODULE IMPORTED GLOBAL)
set_property(TARGET DX12AgilityCore PROPERTY IMPORTED_LOCATION
${DXAGILITY_DLL})

add_library(DX12AgilitySDKLayers MODULE IMPORTED GLOBAL)
set_property(TARGET DX12AgilitySDKLayers PROPERTY IMPORTED_LOCATION
${DXAGILITY_DEBUG_DLL})

# Header interface library
add_library(DX12Agility STATIC)
add_library(wis::DX12Agility ALIAS DX12Agility)

target_include_directories(
DX12Agility SYSTEM BEFORE
PUBLIC $<BUILD_INTERFACE:${DXA_HEADERS}> $<INSTALL_INTERFACE:include/d3dx12>
Expand All @@ -489,7 +489,7 @@ function(wis_load_agility_sdk)
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})

install(
IMPORTED_RUNTIME_ARTIFACTS
DX12AgilityCore
Expand All @@ -500,9 +500,9 @@ function(wis_load_agility_sdk)
LIBRARY
DESTINATION
${CMAKE_INSTALL_BINDIR})

install(DIRECTORY ${DXA_HEADERS}/ DESTINATION include/d3dx12)

set_target_properties(DX12Agility PROPERTIES
DX12SDKVER ${VERSION_MINOR}
DEBUG_POSTFIX d
Expand Down Expand Up @@ -585,9 +585,8 @@ function(wis_install_agility_win32)

if (wis_install_agility_win32_PATCH_EXE)
wis_patch_agility_executable(
${wis_install_agility_win32_TARGET}
${wis_install_agility_win32_TARGET}
${CMAKE_CURRENT_BINARY_DIR}/export_agility.c
)
endif()
endfunction()

2 changes: 1 addition & 1 deletion cmake/install/cpack-options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ if(CPACK_GENERATOR MATCHES "NuGet")
elseif(CPACK_GENERATOR MATCHES "ZIP")
message(STATUS "Wisdom CPack: ZIP generator detected. Proceeding with standard layout.")
# No pre-build script needed! The CMake folders stay intact.
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/install/nuget-prepare.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ file(GLOB _wisdom_static_libs "${STAGING_DIR}/lib/*.lib")
foreach(_lib IN LISTS _wisdom_static_libs)
get_filename_component(_lib_name "${_lib}" NAME)
file(RENAME "${_lib}" "${NUGET_NATIVE_LIB_DIR}/${_lib_name}")
endforeach()
endforeach()
Loading