-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
96 lines (72 loc) · 2.53 KB
/
CMakeLists.txt
File metadata and controls
96 lines (72 loc) · 2.53 KB
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
cmake_minimum_required(VERSION 3.22)
project(PathTracer)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/$<CONFIG>")
set(BUILD_SHARED_LIBS OFF)
set(ASSIMP_BUILD_TESTS OFF)
add_subdirectory(assimp)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
message(STATUS "C++ compiler: ${CMAKE_CXX_COMPILER}")
message(STATUS "C++ standard: ${CMAKE_CXX_STANDARD}")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type" FORCE)
endif()
set(INTERPROCEDURAL_OPTIMIZATION TRUE)
add_executable(PathTracer
stb_image.cpp
stb_image_write.cpp
main.cpp
Model.cpp
Texture.cpp
ResourceManager.cpp
Primitive.cpp
Shape.cpp
Light.cpp
LightSampler.cpp
Scene.cpp
Integrators.cpp
PhaseFunction.cpp)
target_include_directories(PathTracer PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(PathTracer PRIVATE assimp)
if (MSVC)
target_compile_options(PathTracer PRIVATE
$<$<CONFIG:Debug>:/FS /Zi /Od /W3 /MDd>
$<$<CONFIG:RelWithDebInfo>:/FS /Zi /O2 /W2 /MD>
$<$<CONFIG:Release>:/FS /Ox /MD>
)
else()
target_compile_options(PathTracer PRIVATE
$<$<CONFIG:Debug>:-O0;-g;-march=native;-Wall;-Wunreachable-code;-Wuninitialized;-Winit-self;-Wfloat-equal>
$<$<CONFIG:RelWithDebInfo>:-O2;-g;-march=native;-Wall>
$<$<CONFIG:Release>:-O3;-g;-march=native>
)
endif()
add_executable(example1
stb_image.cpp
stb_image_write.cpp
examples/example_1.cpp
Model.cpp
Texture.cpp
ResourceManager.cpp
Primitive.cpp
Shape.cpp
Light.cpp
LightSampler.cpp
Scene.cpp
Integrators.cpp
PhaseFunction.cpp)
target_include_directories(example1 PRIVATE ${CMAKE_SOURCE_DIR})
target_link_libraries(example1 PRIVATE assimp)
if (MSVC)
target_compile_options(example1 PRIVATE
$<$<CONFIG:Debug>:/FS /Zi /Od /W3 /MDd>
$<$<CONFIG:RelWithDebInfo>:/FS /Zi /O2 /W2 /MD>
$<$<CONFIG:Release>:/FS /Ox /MD>
)
else()
target_compile_options(example1 PRIVATE
$<$<CONFIG:Debug>:-O0;-g;-march=native;-Wall;-Wunreachable-code;-Wuninitialized;-Winit-self;-Wfloat-equal>
$<$<CONFIG:RelWithDebInfo>:-O2;-g;-march=native;-Wall>
$<$<CONFIG:Release>:-O3;-g;-march=native;-fno-math-errno;-fno-trapping-math>
)
endif()