-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
214 changed files
with
20,688 additions
and
1,874 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,76 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
set(CMAKE_GENERATOR_PLATFORM x64) | ||
#set a debug override for the project before we change project name for Cauldron | ||
cmake_minimum_required(VERSION 3.6) | ||
|
||
project (Cauldron_${GFX_API}) | ||
option (GFX_API_DX12 "Build Cauldron with DX12" ON) | ||
option (GFX_API_VK "Build Cauldron with Vulkan" ON) | ||
|
||
if(NOT DEFINED GFX_API) | ||
project (Cauldron) | ||
else() | ||
project (Cauldron_${GFX_API}) | ||
|
||
set_property(DIRECTORY ${CMAKE_PROJECT_DIR} PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME}) | ||
|
||
if(GFX_API STREQUAL DX12) | ||
set(GFX_API_DX12 ON) | ||
set(GFX_API_VK OFF) | ||
elseif(GFX_API STREQUAL VK) | ||
set(GFX_API_DX12 OFF) | ||
set(GFX_API_VK ON) | ||
else() | ||
message(STATUS "----------------------------------------------------------------------------------------") | ||
message(STATUS "") | ||
message(STATUS "** Almost there!!") | ||
message(STATUS "") | ||
message(STATUS " This framework supports DX12 and VULKAN, you need to invoke cmake in one of these ways:") | ||
message(STATUS "") | ||
message(STATUS " Examples:") | ||
message(STATUS " Generate selected one:") | ||
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12") | ||
message(STATUS " cmake <project_root_dir> -DGFX_API=VK") | ||
message(STATUS " Generate with switches (Default is ON):") | ||
message(STATUS " cmake <project_root_dir> [-DGFX_API_DX12=ON|OFF] [-DGFX_API_VK=ON|OFF]") | ||
message(STATUS "") | ||
message(STATUS "----------------------------------------------------------------------------------------") | ||
message(FATAL_ERROR "") | ||
endif() | ||
endif() | ||
|
||
# Check MSVC toolset version, Visual Studio 2019 required | ||
if(MSVC_TOOLSET_VERSION VERSION_LESS 142) | ||
message(FATAL_ERROR "Cannot find MSVC toolset version 142 or greater. Please make sure Visual Studio 2019 or newer installed") | ||
endif() | ||
|
||
list( APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) | ||
|
||
# output exe to bin directory | ||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_HOME_DIRECTORY}/bin) | ||
# append 'd' to debug libs | ||
set(CMAKE_DEBUG_POSTFIX d) | ||
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) | ||
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG ) | ||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${CMAKE_HOME_DIRECTORY}/bin ) | ||
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES ) | ||
|
||
add_compile_options(/MP) | ||
|
||
# reference libs used by both backends | ||
add_subdirectory(src/Common) | ||
add_subdirectory(libs/json) | ||
add_subdirectory(libs/ImGUI) | ||
add_subdirectory(libs/stb) | ||
add_subdirectory(libs/DXC) | ||
add_subdirectory(libs/vectormath) | ||
|
||
if(GFX_API STREQUAL DX12) | ||
if(GFX_API_DX12) | ||
add_subdirectory(libs/d3d12x) | ||
add_subdirectory(libs/ags) | ||
add_subdirectory(src/DX12) | ||
elseif(GFX_API STREQUAL VK) | ||
add_subdirectory(libs/AGS) | ||
add_subdirectory(libs/WinPixEventRuntime) | ||
add_subdirectory(src/DX12) | ||
endif() | ||
if(GFX_API_VK) | ||
find_package(Vulkan REQUIRED) | ||
add_subdirectory(libs/VulkanMemoryAllocator) | ||
add_subdirectory(libs/VulkanMemoryAllocator) | ||
add_subdirectory(src/VK) | ||
else() | ||
message(STATUS "----------------------------------------------------------------------------------------") | ||
message(STATUS "") | ||
message(STATUS "** Almost there!!") | ||
message(STATUS "") | ||
message(STATUS " This framework supports DX12 or VULKAN, you need to invoke cmake in one of these ways:") | ||
message(STATUS "") | ||
message(STATUS " Examples:") | ||
message(STATUS " cmake <project_root_dir> -DGFX_API=DX12") | ||
message(STATUS " cmake <project_root_dir> -DGFX_API=VK") | ||
message(STATUS "") | ||
message(STATUS "----------------------------------------------------------------------------------------") | ||
message(FATAL_ERROR "") | ||
endif() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
mkdir DX12 | ||
cd DX12 | ||
cmake ..\.. -DGFX_API=DX12 | ||
cmake -A x64 ..\.. -DGFX_API=DX12 | ||
cd .. | ||
|
||
mkdir VK | ||
cd VK | ||
cmake ..\.. -DGFX_API=VK | ||
cmake -A x64 ..\.. -DGFX_API=VK | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,59 @@ | ||
# | ||
# Copies a set of files to a directory (only if they already don't exist or are different) | ||
# Usage example: | ||
# set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds ) | ||
# set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds ) | ||
# copyCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin) | ||
# | ||
# Sometimes a proper dependency between target and copied files cannot be created | ||
# and you should try copyTargetCommand() below instead | ||
# | ||
function(copyCommand list dest) | ||
foreach(fullFileName ${list}) | ||
foreach(fullFileName ${list}) | ||
get_filename_component(file ${fullFileName} NAME) | ||
message("Generating custom command for ${fullFileName}") | ||
add_custom_command( | ||
OUTPUT ${dest}/${file} | ||
PRE_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dest} | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${fullFileName} ${dest} | ||
MAIN_DEPENDENCY ${fullFileName} | ||
COMMENT "Updating ${file} into ${dest}" | ||
) | ||
list(APPEND dest_files ${dest}/${file}) | ||
endforeach() | ||
|
||
#return output file list | ||
set(copyCommand_dest_files ${dest_files} PARENT_SCOPE) | ||
endfunction() | ||
|
||
# | ||
# Same as copyCommand() but you can give a target name | ||
# This custom target will depend on all those copied files | ||
# Then the target can be properly set as a dependency of other executable or library | ||
# Usage example: | ||
# add_library(my_lib ...) | ||
# set(media_src ${CMAKE_CURRENT_SOURCE_DIR}/../../media/brdfLut.dds ) | ||
# copyTargetCommand("${media_src}" ${CMAKE_HOME_DIRECTORY}/bin copied_media_src) | ||
# add_dependencies(my_lib copied_media_src) | ||
# | ||
function(copyTargetCommand list dest returned_target_name) | ||
set_property(GLOBAL PROPERTY USE_FOLDERS ON) | ||
|
||
foreach(fullFileName ${list}) | ||
get_filename_component(file ${fullFileName} NAME) | ||
message("Generating custom command for ${fullFileName}") | ||
add_custom_command( | ||
OUTPUT ${dest}/${file} | ||
PRE_BUILD | ||
COMMAND ${CMAKE_COMMAND} -E make_directory ${dest} | ||
COMMAND ${CMAKE_COMMAND} -E copy ${fullFileName} ${dest} | ||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${fullFileName} ${dest} | ||
MAIN_DEPENDENCY ${fullFileName} | ||
COMMENT "Updating ${file} into ${dest}" | ||
) | ||
endforeach() | ||
list(APPEND dest_list ${dest}/${file}) | ||
endforeach() | ||
|
||
add_custom_target(${returned_target_name} DEPENDS "${dest_list}") | ||
|
||
set_target_properties(${returned_target_name} PROPERTIES FOLDER CopyTargets) | ||
endfunction() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
include(common) | ||
|
||
add_library(amd_ags SHARED IMPORTED GLOBAL) | ||
set_property(TARGET amd_ags PROPERTY IMPORTED_IMPLIB ${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.lib) | ||
|
||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.dll DESTINATION ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) | ||
copyTargetCommand(${CMAKE_CURRENT_SOURCE_DIR}/amd_ags_x64.dll ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_amd_ags_bin) | ||
add_dependencies(amd_ags copied_amd_ags_bin) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
project (DXC) | ||
include(common) | ||
|
||
add_library(${PROJECT_NAME} SHARED IMPORTED GLOBAL) | ||
add_library(DXC INTERFACE) | ||
target_include_directories(DXC INTERFACE BEFORE "inc/") | ||
|
||
set_property(TARGET ${PROJECT_NAME} PROPERTY IMPORTED_IMPLIB dxcompiler.lib) | ||
set(DXC_BIN | ||
"${CMAKE_CURRENT_SOURCE_DIR}/bin/x64/dxcompiler.dll" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/bin/x64/dxil.dll" | ||
) | ||
|
||
set( SC_DEST_DIR ${CMAKE_HOME_DIRECTORY}/bin) | ||
|
||
file(MAKE_DIRECTORY ${SC_DEST_DIR}) | ||
|
||
set(DXC_dlls bin/dxil.dll bin/dxcompiler.dll) | ||
file(COPY ${DXC_dlls} DESTINATION ${SC_DEST_DIR}) | ||
copyTargetCommand("${DXC_BIN}" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} copied_dxc_bin) | ||
add_dependencies(DXC copied_dxc_bin) |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Oops, something went wrong.