CMakeLists
CMakeLists
#
# Copyright (C) 2024 Advanced Micro Devices, Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files(the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and /or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions :
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
cmake_minimum_required(VERSION 3.23)
# Configuration setup
if (CMAKE_GENERATOR_PLATFORM STREQUAL x64 OR
CMAKE_GENERATOR_PLATFORM STREQUAL ARM64 OR
CMAKE_GENERATOR_PLATFORM STREQUAL ARM64EC)
message(STATUS "Creating sample configs ...")
set(CMAKE_CONFIGURATION_TYPES "")
if (CAULDRON_DX12)
createConfig(DX12 DebugDX12 DEBUG)
createConfig(DX12 RelWithDebInfoDX12 RELWITHDEBINFO)
createConfig(DX12 ReleaseDX12 RELEASE)
list(APPEND CMAKE_CONFIGURATION_TYPES
"DebugDX12;RelWithDebInfoDX12;ReleaseDX12;")
endif()
if (CAULDRON_VK)
createConfig(VK DebugVK DEBUG)
createConfig(VK RelWithDebInfoVK RELWITHDEBINFO)
createConfig(VK ReleaseVK RELEASE)
list(APPEND CMAKE_CONFIGURATION_TYPES
"DebugVK;RelWithDebInfoVK;ReleaseVK;")
endif()
else()
message(FATAL_ERROR "Requested architecture ${CMAKE_GENERATOR_PLATFORM} not yet
supported!)")
endif()
if (RUNTIME_SHADER_RECOMPILE EQUAL 1)
set(FFX_BUILD_AS_DLL 1)
set(SUPPORT_RUNTIME_SHADER_RECOMPILE 1)
endif()
if (FFX_BUILD_AS_DLL)
file(GLOB SDK_DLLS "${SDK_ROOT}/bin/ffx_sdk/*.dll")
message(STATUS "Copying ${SDK_DLLS} to bin.")
copyTargetCommand("${SDK_DLLS}" ${CMAKE_HOME_DIRECTORY}/bin copied_sdk_dlls)
add_dependencies(ffx_backend_native copied_sdk_dlls)
endif()
# Pull in cauldron
add_subdirectory(${CAULDRON_ROOT})
set_target_properties(Framework PROPERTIES FOLDER Framework)
if (CAULDRON_DX12)
set_target_properties(memoryallocator_dx12 PROPERTIES FOLDER Framework)
endif()
if (CAULDRON_VK)
set_target_properties(memoryallocator_vk PROPERTIES FOLDER Framework)
endif()
set_target_properties(backend_shader_reloader_impl PROPERTIES FOLDER Framework)
set_target_properties(backend_shader_reloader_stub PROPERTIES FOLDER Framework)
# If this is a cauldron build, we are just building the framework for standalone
work
if( BUILD_TYPE STREQUAL CAULDRON)
# Set as startup project
set_property(DIRECTORY ${CMAKE_PROJECT_DIR} PROPERTY VS_STARTUP_PROJECT
Cauldron)
return()
endif()