Skip to content

Commit d220600

Browse files
committed
Cauldron v1.4
1 parent 5f1bc5f commit d220600

214 files changed

Lines changed: 20688 additions & 1874 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,18 @@ bld/
3232

3333
# Visual Studio 2015/2017 cache/options directory
3434
.vs/
35+
# Visual Studio code cache/options directory
36+
.vscode/
3537
# Uncomment if you have tasks that create the project's static files in wwwroot
3638
#wwwroot/
3739

3840
# Visual Studio 2017 auto generated files
3941
Generated\ Files/
4042

43+
# Visual Studio 2019 Open Folder default output folder
44+
out/
45+
CMakeSettings.json
46+
4147
# MSTest test Results
4248
[Tt]est[Rr]esult*/
4349
[Bb]uild[Ll]og.*
@@ -346,4 +352,4 @@ ASALocalRun/
346352
healthchecksdb
347353

348354
# Backup folder for Package Reference Convert tool in Visual Studio 2017
349-
MigrationBackup/
355+
MigrationBackup/

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
variables:
2-
CMakeConfig: -G "Visual Studio 15 2017" -A x64
2+
CMakeConfig: -G "Visual Studio 16 2019" -A x64
33

44
stages:
55
- build

CMakeLists.txt

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,76 @@
1-
cmake_minimum_required(VERSION 3.4)
2-
set(CMAKE_GENERATOR_PLATFORM x64)
1+
#set a debug override for the project before we change project name for Cauldron
2+
cmake_minimum_required(VERSION 3.6)
33

4-
project (Cauldron_${GFX_API})
4+
option (GFX_API_DX12 "Build Cauldron with DX12" ON)
5+
option (GFX_API_VK "Build Cauldron with Vulkan" ON)
6+
7+
if(NOT DEFINED GFX_API)
8+
project (Cauldron)
9+
else()
10+
project (Cauldron_${GFX_API})
11+
12+
set_property(DIRECTORY ${CMAKE_PROJECT_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})
13+
14+
if(GFX_API STREQUAL DX12)
15+
set(GFX_API_DX12 ON)
16+
set(GFX_API_VK OFF)
17+
elseif(GFX_API STREQUAL VK)
18+
set(GFX_API_DX12 OFF)
19+
set(GFX_API_VK ON)
20+
else()
21+
message(STATUS "----------------------------------------------------------------------------------------")
22+
message(STATUS "")
23+
message(STATUS "** Almost there!!")
24+
message(STATUS "")
25+
message(STATUS " This framework supports DX12 and VULKAN, you need to invoke cmake in one of these ways:")
26+
message(STATUS "")
27+
message(STATUS " Examples:")
28+
message(STATUS " Generate selected one:")
29+
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12")
30+
message(STATUS " cmake <project_root_dir> -DGFX_API=VK")
31+
message(STATUS " Generate with switches (Default is ON):")
32+
message(STATUS " cmake <project_root_dir> [-DGFX_API_DX12=ON|OFF] [-DGFX_API_VK=ON|OFF]")
33+
message(STATUS "")
34+
message(STATUS "----------------------------------------------------------------------------------------")
35+
message(FATAL_ERROR "")
36+
endif()
37+
endif()
38+
39+
# Check MSVC toolset version, Visual Studio 2019 required
40+
if(MSVC_TOOLSET_VERSION VERSION_LESS 142)
41+
message(FATAL_ERROR "Cannot find MSVC toolset version 142 or greater. Please make sure Visual Studio 2019 or newer installed")
42+
endif()
543

644
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} )
745

846
# output exe to bin directory
947
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin)
48+
# append 'd' to debug libs
49+
set(CMAKE_DEBUG_POSTFIX d)
1050
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
1151
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
1252
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_HOME_DIRECTORY}/bin )
1353
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
1454

55+
add_compile_options(/MP)
56+
1557
# reference libs used by both backends
1658
add_subdirectory(src/Common)
1759
add_subdirectory(libs/json)
1860
add_subdirectory(libs/ImGUI)
1961
add_subdirectory(libs/stb)
2062
add_subdirectory(libs/DXC)
63+
add_subdirectory(libs/vectormath)
2164

22-
if(GFX_API STREQUAL DX12)
65+
if(GFX_API_DX12)
2366
add_subdirectory(libs/d3d12x)
24-
add_subdirectory(libs/ags)
25-
add_subdirectory(src/DX12)
26-
elseif(GFX_API STREQUAL VK)
67+
add_subdirectory(libs/AGS)
68+
add_subdirectory(libs/WinPixEventRuntime)
69+
add_subdirectory(src/DX12)
70+
endif()
71+
if(GFX_API_VK)
2772
find_package(Vulkan REQUIRED)
28-
add_subdirectory(libs/VulkanMemoryAllocator)
73+
add_subdirectory(libs/VulkanMemoryAllocator)
2974
add_subdirectory(src/VK)
30-
else()
31-
message(STATUS "----------------------------------------------------------------------------------------")
32-
message(STATUS "")
33-
message(STATUS "** Almost there!!")
34-
message(STATUS "")
35-
message(STATUS " This framework supports DX12 or VULKAN, you need to invoke cmake in one of these ways:")
36-
message(STATUS "")
37-
message(STATUS " Examples:")
38-
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12")
39-
message(STATUS " cmake <project_root_dir> -DGFX_API=VK")
40-
message(STATUS "")
41-
message(STATUS "----------------------------------------------------------------------------------------")
42-
message(FATAL_ERROR "")
4375
endif()
4476

build/GenerateSolutions.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
mkdir DX12
22
cd DX12
3-
cmake ..\.. -DGFX_API=DX12
3+
cmake -A x64 ..\.. -DGFX_API=DX12
44
cd ..
55

66
mkdir VK
77
cd VK
8-
cmake ..\.. -DGFX_API=VK
8+
cmake -A x64 ..\.. -DGFX_API=VK
99
cd ..

common.cmake

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,59 @@
11
#
22
# Copies a set of files to a directory (only if they already don't exist or are different)
33
# Usage example:
4-
# set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds )
4+
# set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds )
55
# copyCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin)
66
#
7+
# Sometimes a proper dependency between target and copied files cannot be created
8+
# and you should try copyTargetCommand() below instead
9+
#
710
function(copyCommand list dest)
8-
foreach(fullFileName ${list})
11+
foreach(fullFileName ${list})
12+
get_filename_component(file ${fullFileName} NAME)
13+
message("Generating custom command for ${fullFileName}")
14+
add_custom_command(
15+
OUTPUT ${dest}/${file}
16+
PRE_BUILD
17+
COMMAND ${CMAKE_COMMAND} -E make_directory ${dest}
18+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${fullFileName} ${dest}
19+
MAIN_DEPENDENCY ${fullFileName}
20+
COMMENT "Updating ${file} into ${dest}"
21+
)
22+
list(APPEND dest_files ${dest}/${file})
23+
endforeach()
24+
25+
#return output file list
26+
set(copyCommand_dest_files ${dest_files} PARENT_SCOPE)
27+
endfunction()
28+
29+
#
30+
# Same as copyCommand() but you can give a target name
31+
# This custom target will depend on all those copied files
32+
# Then the target can be properly set as a dependency of other executable or library
33+
# Usage example:
34+
# add_library(my_lib ...)
35+
# set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds )
36+
# copyTargetCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin copied_media_src)
37+
# add_dependencies(my_lib copied_media_src)
38+
#
39+
function(copyTargetCommand list dest returned_target_name)
40+
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
41+
42+
foreach(fullFileName ${list})
943
get_filename_component(file ${fullFileName} NAME)
1044
message("Generating custom command for ${fullFileName}")
1145
add_custom_command(
1246
OUTPUT ${dest}/${file}
1347
PRE_BUILD
1448
COMMAND ${CMAKE_COMMAND} -E make_directory ${dest}
15-
COMMAND ${CMAKE_COMMAND} -E copy ${fullFileName} ${dest}
49+
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${fullFileName} ${dest}
1650
MAIN_DEPENDENCY ${fullFileName}
1751
COMMENT "Updating ${file} into ${dest}"
1852
)
19-
endforeach()
53+
list(APPEND dest_list ${dest}/${file})
54+
endforeach()
55+
56+
add_custom_target(${returned_target_name} DEPENDS "${dest_list}")
57+
58+
set_target_properties(${returned_target_name} PROPERTIES FOLDER CopyTargets)
2059
endfunction()

libs/AGS/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
include(common)
2+
13
add_library(amd_ags SHARED IMPORTED GLOBAL)
24
set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.lib)
35

4-
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
6+
copyTargetCommand(${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_amd_ags_bin)
7+
add_dependencies(amd_ags copied_amd_ags_bin)

libs/DXC/CMakeLists.txt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
project (DXC)
1+
include(common)
22

3-
add_library(${PROJECT_NAME} SHARED IMPORTED GLOBAL)
3+
add_library(DXC INTERFACE)
4+
target_include_directories(DXC INTERFACE BEFORE "inc/")
45

5-
set_property(TARGET ${PROJECT_NAME} PROPERTY IMPORTED_IMPLIB dxcompiler.lib)
6+
set(DXC_BIN
7+
"${CMAKE_CURRENT_SOURCE_DIR}/bin/x64/dxcompiler.dll"
8+
"${CMAKE_CURRENT_SOURCE_DIR}/bin/x64/dxil.dll"
9+
)
610

7-
set( SC_DEST_DIR ${CMAKE_HOME_DIRECTORY}/bin)
8-
9-
file(MAKE_DIRECTORY ${SC_DEST_DIR})
10-
11-
set(DXC_dlls bin/dxil.dll bin/dxcompiler.dll)
12-
file(COPY ${DXC_dlls} DESTINATION ${SC_DEST_DIR})
11+
copyTargetCommand("${DXC_BIN}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_dxc_bin)
12+
add_dependencies(DXC copied_dxc_bin)

libs/DXC/bin/x64/dxc.exe

503 KB
Binary file not shown.

libs/DXC/bin/x64/dxcompiler.dll

17.7 MB
Binary file not shown.

libs/DXC/bin/x64/dxil.dll

1.78 MB
Binary file not shown.

0 commit comments

Comments
 (0)