set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) if(MSVC) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") endif() set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Windows version information (Explorer's Details tab) for the shipped binaries. The release # script passes its version; local builds say 0.0.0. set(DINGOSDK_VERSION "0.0.0" CACHE STRING "Release version stamped into the shipped binaries") # The same version for code to show (generated/reskate_version.h). string(REPLACE "\\" "\\\\" reskate_version_escaped "${DINGOSDK_VERSION}") string(REPLACE "\"" "\\\"" reskate_version_escaped "${reskate_version_escaped}") configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/reskate_version.h.in" "${CMAKE_CURRENT_BINARY_DIR}/generated/reskate_version.h" @ONLY) function(dingosdk_version_info target description file_name file_type) if(NOT DINGOSDK_VERSION MATCHES "^([0-9]+)\\.([0-9]+)\\.([0-9]+)") message(FATAL_ERROR "DINGOSDK_VERSION must look like 1.2.3, not '${DINGOSDK_VERSION}'") endif() if(NOT WIN32) return() endif() set(version_major ${CMAKE_MATCH_1}) set(version_minor ${CMAKE_MATCH_2}) set(version_patch ${CMAKE_MATCH_3}) set(version_description "${description}") set(version_file_name "${file_name}") set(version_file_type "${file_type}") get_filename_component(version_internal_name "${file_name}" NAME_WE) configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/version.rc.in" "${CMAKE_CURRENT_BINARY_DIR}/generated/${target}_version.rc" @ONLY) target_sources(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/generated/${target}_version.rc") endfunction() function(dingosdk_configure_target target) target_include_directories(${target} PUBLIC "${PROJECT_SOURCE_DIR}" "${CMAKE_CURRENT_BINARY_DIR}/generated") if(WIN32) target_compile_definitions(${target} PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX UNICODE _UNICODE) endif() if(MSVC) target_compile_options(${target} PRIVATE /W4 /WX /MP4 /permissive- /EHsc) else() target_compile_options(${target} PRIVATE -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-function -Wno-array-bounds) endif() if(target STREQUAL "dingosdk_launcher") set_property(TARGET ${target} PROPERTY FOLDER "Apps") elseif(target MATCHES "^dingosdk_runtime$") set_property(TARGET ${target} PROPERTY FOLDER "Runtime") elseif(target MATCHES "^dingosdk_(hooks|json|storage|console_core|logging|initfs|native_db|mods|frostbite)$") set_property(TARGET ${target} PROPERTY FOLDER "Core") else() set_property(TARGET ${target} PROPERTY FOLDER "Components") endif() # Show headers beside implementation files in each target's source folders. get_target_property(sources ${target} SOURCES) if(sources) set(source_directories) foreach(source IN LISTS sources) get_filename_component(source_path "${source}" ABSOLUTE BASE_DIR "${PROJECT_SOURCE_DIR}") get_filename_component(source_directory "${source_path}" DIRECTORY) list(APPEND source_directories "${source_directory}") endforeach() list(REMOVE_DUPLICATES source_directories) foreach(directory IN LISTS source_directories) file(GLOB adjacent_headers CONFIGURE_DEPENDS "${directory}/*.h") if(adjacent_headers) target_sources(${target} PRIVATE ${adjacent_headers}) endif() endforeach() get_target_property(sources ${target} SOURCES) source_group(TREE "${PROJECT_SOURCE_DIR}" FILES ${sources}) endif() endfunction() set(DINGOSDK_TEST_GAME_ROOT "" CACHE PATH "Optional Skate folder for tests that read the installed game's data")