cmake_minimum_required(VERSION 3.25)
project(FenixTexturePack LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(REXGLUE_USE_D3D12 ON)
set(REXGLUE_USE_VULKAN OFF)
if(NOT REXGLUE_ROOT OR NOT REXGLUE_DIST)
  message(FATAL_ERROR "Specify REXGLUE_ROOT and REXGLUE_DIST")
endif()
add_compile_definitions(REX_PLATFORM_WINDOWS=1 REXGLUE_BUILD_CONFIG="Release" SPDLOG_FMT_EXTERNAL=1 REX_HAS_D3D12=1 REX_HAS_VULKAN=0)
add_compile_options(-fno-strict-aliasing -msse4.1)
add_library(rexruntime SHARED IMPORTED)
set_target_properties(rexruntime PROPERTIES IMPORTED_IMPLIB "${REXGLUE_DIST}/lib/rexruntime.lib" IMPORTED_LOCATION "${REXGLUE_DIST}/bin/rexruntime.dll")
add_library(xxHash::xxhash STATIC IMPORTED)
set_target_properties(xxHash::xxhash PROPERTIES IMPORTED_LOCATION "${REXGLUE_DIST}/lib/xxhash.lib")
function(rex_target_pch name)
  target_precompile_headers(${name} PRIVATE ${ARGN})
endfunction()
add_subdirectory("${REXGLUE_ROOT}/src/graphics" graphics)
target_include_directories(rexgpu-xenos PRIVATE "${CMAKE_CURRENT_LIST_DIR}" "${REXGLUE_ROOT}/include" "${REXGLUE_DIST}/include" "${REXGLUE_DIST}/include/dxc")
target_link_libraries(rexgpu-xenos PRIVATE "${REXGLUE_DIST}/lib/fmt.lib" "${REXGLUE_DIST}/lib/spdlog.lib")
set_target_properties(rexgpu-xenos PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/bin")
