-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (90 loc) · 3.6 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
cmake_minimum_required(VERSION 3.30 FATAL_ERROR)
# Helper functions.
function(fb_setup_visual_studio_directories current_source_dir sources)
get_filename_component(LAST_DIR_NAME ${current_source_dir} NAME)
source_group(TREE ${current_source_dir} PREFIX ${LAST_DIR_NAME} FILES ${sources})
source_group(pch REGULAR_EXPRESSION "cmake_pch\.(hxx|cxx)")
endfunction()
# Configurations.
set(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configurations" FORCE)
# Project.
project(framebuffet)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Global options.
# Note: Tracy does not work if /ZI is enabled. Therefore we must use /Zi.
add_compile_options(
/MP # Multi-processor compilation
/EHs-c- # No C++ exceptions
/GR- # No RTTI
/fp:except- # No floating point exceptions
/arch:AVX2 # Enable AVX2
/openmp # Enable OpenMP
$<$<CONFIG:Debug>:/Zi> # Debug information format for Debug
$<$<CONFIG:Debug>:/MTd> # Use static runtime library for Debug
$<$<CONFIG:Release>:/Z7> # Debug information format for Release (/Zi does not work with precompiled headers)
$<$<CONFIG:Release>:/MT> # Use static runtime library for Release
$<$<CONFIG:Release>:/Oi> # Enable intrinsic functions
$<$<CONFIG:Release>:/Ot> # Favor fast code
$<$<CONFIG:Release>:/GS-> # No buffer security checks
)
add_compile_definitions(
_HAS_EXCEPTIONS=0
)
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
string(REGEX REPLACE "/Ob2" "/Ob3" CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message(STATUS "CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
# External dependencies.
add_compile_options(
/W0 # Disable warnings for external dependencies
/analyze:external- # Disable code analysis for external headers
)
include_directories(SYSTEM build external)
add_subdirectory(external)
# Framebuffet - Options.
add_compile_options(
/W4 # Warning level 4
/WX # Treat warnings as errors
/analyze # Code analysis
)
add_link_options(
/WX # Treat warnings as errors
/entry:mainCRTStartup
/SUBSYSTEM:WINDOWS
$<$<CONFIG:Release>:/DEBUG>
$<$<CONFIG:Release>:/OPT:REF>
$<$<CONFIG:Release>:/OPT:ICF>
)
add_compile_definitions(
WIN32_LEAN_AND_MEAN
NOMINMAX
_CRT_SECURE_NO_WARNINGS
)
# Framebuffet - Definitions.
add_compile_definitions(
FB_BAKER_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
FB_BAKER_SOURCE_DIR_WIDE=L"${PROJECT_SOURCE_DIR}"
FB_BAKER_BUFFET_OUTPUT_DIR="$<TARGET_FILE_DIR:fb_buffet>"
FB_BAKER_STOCKCUBE_OUTPUT_DIR="$<TARGET_FILE_DIR:fb_stockcube>"
FB_BAKER_RAYDIANCE_OUTPUT_DIR="$<TARGET_FILE_DIR:fb_raydiance>"
FB_KITCHEN_PIX_GPU_CAPTURER_NAME="WinPixGpuCapturer.dll"
FB_KITCHEN_PIX_GPU_CAPTURER_DLL_PATH="C:/Program Files/Microsoft PIX/2409.23/WinPixGpuCapturer.dll"
FB_KITCHEN_PIX_GPU_CAPTURE_FILE_NAME=L"framebuffet_gpu.wpix"
FB_KITCHEN_PIX_TIMING_CAPTURER_NAME="WinPixTimingCapturer.dll"
FB_KITCHEN_PIX_TIMING_CAPTURER_DLL_PATH="C:/Program Files/Microsoft PIX/2409.23/WinPixTimingCapturer.dll"
FB_KITCHEN_PIX_TIMING_CAPTURE_FILE_NAME=L"framebuffet_timing.wpix"
FB_STOCKCUBE_INTERMEDIATE_DIR="${CMAKE_SOURCE_DIR}/src/assets/intermediate/stockcube"
)
# Framebuffet - Libraries.
add_subdirectory(src/common)
add_subdirectory(src/baked)
add_subdirectory(src/kitchen)
# Framebuffet - Executables.
add_subdirectory(src/baker)
add_subdirectory(src/stockcube)
add_subdirectory(src/raydiance)
add_subdirectory(src/buffet)
add_subdirectory(src/sandbox)