-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
123 lines (110 loc) · 4.5 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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# CMake Build Configuration for the Ray Tracing Weekend Series
#
# See README.md for guidance.
#---------------------------------------------------------------------------------------------------
cmake_minimum_required ( VERSION 3.1.0...3.27.0 )
project ( RTWeekend LANGUAGES CXX )
# Set to C++11
set ( CMAKE_CXX_STANDARD 11 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
set ( CMAKE_CXX_EXTENSIONS OFF )
# Source
set ( EXTERNAL
src/external/stb_image.h
)
set ( SOURCE_ONE_WEEKEND
src/main.cpp
src/camera.h
src/color.h
src/hittable.h
src/hittable_list.h
src/interval.h
src/material.h
src/ray.h
src/rt_common.h
src/sphere.h
src/vec3.h
src/aabb.h
src/bvh.h
src/texture.h
src/perlin.h
src/quad.h
src/constant_medium.h
)
# set ( SOURCE_NEXT_WEEK
# src/TheNextWeek/main.cc
# src/TheNextWeek/aabb.h
# src/TheNextWeek/bvh.h
# src/TheNextWeek/camera.h
# src/TheNextWeek/color.h
# src/TheNextWeek/constant_medium.h
# src/TheNextWeek/hittable.h
# src/TheNextWeek/hittable_list.h
# src/TheNextWeek/interval.h
# src/TheNextWeek/material.h
# src/TheNextWeek/perlin.h
# src/TheNextWeek/quad.h
# src/TheNextWeek/ray.h
# src/TheNextWeek/rtw_stb_image.h
# src/TheNextWeek/rtweekend.h
# src/TheNextWeek/sphere.h
# src/TheNextWeek/texture.h
# src/TheNextWeek/vec3.h
# )
# set ( SOURCE_REST_OF_YOUR_LIFE
# src/TheRestOfYourLife/main.cc
# src/TheRestOfYourLife/aabb.h
# src/TheRestOfYourLife/camera.h
# src/TheRestOfYourLife/color.h
# src/TheRestOfYourLife/constant_medium.h
# src/TheRestOfYourLife/hittable.h
# src/TheRestOfYourLife/hittable_list.h
# src/TheRestOfYourLife/interval.h
# src/TheRestOfYourLife/material.h
# src/TheRestOfYourLife/onb.h
# src/TheRestOfYourLife/pdf.h
# src/TheRestOfYourLife/perlin.h
# src/TheRestOfYourLife/quad.h
# src/TheRestOfYourLife/ray.h
# src/TheRestOfYourLife/rtw_stb_image.h
# src/TheRestOfYourLife/rtweekend.h
# src/TheRestOfYourLife/sphere.h
# src/TheRestOfYourLife/texture.h
# src/TheRestOfYourLife/vec3.h
# )
include_directories(src)
# Specific compiler flags below. We're not going to add options for all possible compilers, but if
# you're new to CMake (like we are), the following may be a helpful example if you're using a
# different compiler or want to set different compiler options.
message (STATUS "Compiler ID: " ${CMAKE_CXX_COMPILER_ID})
message (STATUS "Release flags: " ${CMAKE_CXX_FLAGS_RELEASE})
message (STATUS "Debug flags: " ${CMAKE_CXX_FLAGS_DEBUG})
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# /wd #### - Disable warning
# /we #### - treat warning as error
add_compile_options("/W4") # Enable level-4 warnings
add_compile_options("/we 4265") # Class has virtual functions, but its non-trivial destructor is not virtual
add_compile_options("/we 5204") # Class has virtual functions, but its trivial destructor is not virtual
add_compile_options("/wd 4100") # unreferenced formal parameter
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wnon-virtual-dtor) # Class has virtual functions, but its destructor is not virtual
add_compile_options(-Wreorder) # Data member will be initialized after [other] data member
add_compile_options(-Wmaybe-uninitialized) # Variable improperly initialized
add_compile_options(-Wunused-variable) # Variable is defined but unused
elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wnon-virtual-dtor) # Class has virtual functions, but its destructor is not virtual
add_compile_options(-Wreorder) # Data member will be initialized after [other] data member
add_compile_options(-Wsometimes-uninitialized) # Variable improperly initialized
add_compile_options(-Wunused-variable) # Variable is defined but unused
endif()
# Executables
add_executable(inOneWeekend ${EXTERNAL} ${SOURCE_ONE_WEEKEND})
# add_executable(theNextWeek ${EXTERNAL} ${SOURCE_NEXT_WEEK})
# add_executable(theRestOfYourLife ${EXTERNAL} ${SOURCE_REST_OF_YOUR_LIFE})
# add_executable(cos_cubed src/TheRestOfYourLife/cos_cubed.cc )
# add_executable(cos_density src/TheRestOfYourLife/cos_density.cc )
# add_executable(integrate_x_sq src/TheRestOfYourLife/integrate_x_sq.cc )
# add_executable(pi src/TheRestOfYourLife/pi.cc )
# add_executable(estimate_halfway src/TheRestOfYourLife/estimate_halfway.cc )
# add_executable(sphere_importance src/TheRestOfYourLife/sphere_importance.cc )
# add_executable(sphere_plot src/TheRestOfYourLife/sphere_plot.cc )