|
6 | 6 |
|
7 | 7 | cmake_minimum_required ( VERSION 3.1.0...3.27.0 ) |
8 | 8 |
|
9 | | -project ( RTWeekend LANGUAGES CXX ) |
| 9 | +project ( RTWeekend |
| 10 | + VERSION 3.0.0 |
| 11 | + LANGUAGES CXX |
| 12 | +) |
10 | 13 |
|
11 | | -# Set to C++11 |
12 | | -set ( CMAKE_CXX_STANDARD 11 ) |
13 | | -set ( CMAKE_CXX_STANDARD_REQUIRED ON ) |
14 | | -set ( CMAKE_CXX_EXTENSIONS OFF ) |
| 14 | +# Set to c++11 |
| 15 | +set ( CMAKE_CXX_STANDARD 11 ) |
15 | 16 |
|
16 | 17 | # Source |
17 | | - |
18 | | -set ( EXTERNAL |
19 | | - src/external/stb_image.h |
| 18 | +set ( COMMON_ALL |
| 19 | + src/common/rtweekend.h |
| 20 | + src/common/camera.h |
| 21 | + src/common/ray.h |
| 22 | + src/common/vec3.h |
20 | 23 | ) |
21 | 24 |
|
22 | 25 | set ( SOURCE_ONE_WEEKEND |
23 | | - src/external/stb_image.h |
24 | | - |
25 | | - src/InOneWeekend/camera.h |
26 | | - src/InOneWeekend/color.h |
| 26 | + ${COMMON_ALL} |
27 | 27 | src/InOneWeekend/hittable.h |
28 | 28 | src/InOneWeekend/hittable_list.h |
29 | | - src/InOneWeekend/interval.h |
30 | 29 | src/InOneWeekend/material.h |
31 | | - src/InOneWeekend/ray.h |
32 | | - src/InOneWeekend/rtw_stb_image.h |
33 | | - src/InOneWeekend/rtweekend.h |
34 | 30 | src/InOneWeekend/sphere.h |
35 | | - src/InOneWeekend/vec3.h |
36 | | - |
37 | 31 | src/InOneWeekend/main.cc |
38 | 32 | ) |
39 | 33 |
|
40 | 34 | set ( SOURCE_NEXT_WEEK |
41 | | - src/external/stb_image.h |
42 | | - |
43 | | - src/TheNextWeek/aabb.h |
| 35 | + ${COMMON_ALL} |
| 36 | + src/common/aabb.h |
| 37 | + src/common/external/stb_image.h |
| 38 | + src/common/perlin.h |
| 39 | + src/common/rtw_stb_image.h |
| 40 | + src/common/texture.h |
| 41 | + src/TheNextWeek/aarect.h |
| 42 | + src/TheNextWeek/box.h |
44 | 43 | src/TheNextWeek/bvh.h |
45 | | - src/TheNextWeek/camera.h |
46 | | - src/TheNextWeek/color.h |
47 | 44 | src/TheNextWeek/constant_medium.h |
48 | 45 | src/TheNextWeek/hittable.h |
49 | 46 | src/TheNextWeek/hittable_list.h |
50 | | - src/TheNextWeek/interval.h |
51 | 47 | src/TheNextWeek/material.h |
52 | | - src/TheNextWeek/perlin.h |
53 | | - src/TheNextWeek/quad.h |
54 | | - src/TheNextWeek/ray.h |
55 | | - src/TheNextWeek/rtw_stb_image.h |
56 | | - src/TheNextWeek/rtweekend.h |
| 48 | + src/TheNextWeek/moving_sphere.h |
57 | 49 | src/TheNextWeek/sphere.h |
58 | | - src/TheNextWeek/texture.h |
59 | | - src/TheNextWeek/vec3.h |
60 | | - |
61 | 50 | src/TheNextWeek/main.cc |
62 | 51 | ) |
63 | 52 |
|
64 | 53 | set ( SOURCE_REST_OF_YOUR_LIFE |
65 | | - src/external/stb_image.h |
66 | | - |
67 | | - src/TheRestOfYourLife/aabb.h |
68 | | - src/TheRestOfYourLife/camera.h |
69 | | - src/TheRestOfYourLife/color.h |
70 | | - src/TheRestOfYourLife/constant_medium.h |
| 54 | + ${COMMON_ALL} |
| 55 | + src/common/aabb.h |
| 56 | + src/common/external/stb_image.h |
| 57 | + src/common/perlin.h |
| 58 | + src/common/rtw_stb_image.h |
| 59 | + src/common/texture.h |
| 60 | + src/TheRestOfYourLife/aarect.h |
| 61 | + src/TheRestOfYourLife/box.h |
| 62 | + src/TheRestOfYourLife/bvh.h |
71 | 63 | src/TheRestOfYourLife/hittable.h |
72 | 64 | src/TheRestOfYourLife/hittable_list.h |
73 | | - src/TheRestOfYourLife/interval.h |
74 | 65 | src/TheRestOfYourLife/material.h |
75 | 66 | src/TheRestOfYourLife/onb.h |
76 | 67 | src/TheRestOfYourLife/pdf.h |
77 | | - src/TheRestOfYourLife/perlin.h |
78 | | - src/TheRestOfYourLife/quad.h |
79 | | - src/TheRestOfYourLife/ray.h |
80 | | - src/TheRestOfYourLife/rtw_stb_image.h |
81 | | - src/TheRestOfYourLife/rtweekend.h |
82 | 68 | src/TheRestOfYourLife/sphere.h |
83 | | - src/TheRestOfYourLife/texture.h |
84 | | - src/TheRestOfYourLife/vec3.h |
85 | | - |
86 | 69 | src/TheRestOfYourLife/main.cc |
87 | 70 | ) |
88 | 71 |
|
89 | | -include_directories(src) |
90 | | - |
91 | | -# Specific compiler flags below. We're not going to add options for all possible compilers, but if |
92 | | -# you're new to CMake (like we are), the following may be a helpful example if you're using a |
93 | | -# different compiler or want to set different compiler options. |
94 | | - |
95 | | -message (STATUS "Compiler ID: " ${CMAKE_CXX_COMPILER_ID}) |
96 | | - |
97 | | -if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") |
98 | | - add_compile_options("/we 4265") # Class has virtual functions, but its non-trivial destructor is not virtual |
99 | | - add_compile_options("/w3 5038") # Data member will be initialized after [other] data member |
100 | | - add_compile_options("/we 5204") # Class has virtual functions, but its trivial destructor is not virtual |
101 | | -elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") |
102 | | - add_compile_options(-Wnon-virtual-dtor) # Class has virtual functions, but its destructor is not virtual |
103 | | - add_compile_options(-Wreorder) # Data member will be initialized after [other] data member |
104 | | - add_compile_options(-Wmaybe-uninitialized) # Variable improperly initialized |
105 | | - add_compile_options(-Wunused-variable) # Variable is defined but unused |
106 | | -elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang") |
107 | | - add_compile_options(-Wnon-virtual-dtor) # Class has virtual functions, but its destructor is not virtual |
108 | | - add_compile_options(-Wreorder) # Data member will be initialized after [other] data member |
109 | | - add_compile_options(-Wsometimes-uninitialized) # Variable improperly initialized |
110 | | - add_compile_options(-Wunused-variable) # Variable is defined but unused |
111 | | -endif() |
112 | | - |
113 | 72 | # Executables |
114 | | -add_executable(inOneWeekend ${EXTERNAL} ${SOURCE_ONE_WEEKEND}) |
115 | | -add_executable(theNextWeek ${EXTERNAL} ${SOURCE_NEXT_WEEK}) |
116 | | -add_executable(theRestOfYourLife ${EXTERNAL} ${SOURCE_REST_OF_YOUR_LIFE}) |
117 | | -add_executable(cos_cubed src/TheRestOfYourLife/cos_cubed.cc ) |
118 | | -add_executable(cos_density src/TheRestOfYourLife/cos_density.cc ) |
119 | | -add_executable(integrate_x_sq src/TheRestOfYourLife/integrate_x_sq.cc ) |
120 | | -add_executable(pi src/TheRestOfYourLife/pi.cc ) |
121 | | -add_executable(estimate_halfway src/TheRestOfYourLife/estimate_halfway.cc ) |
122 | | -add_executable(sphere_importance src/TheRestOfYourLife/sphere_importance.cc ) |
123 | | -add_executable(sphere_plot src/TheRestOfYourLife/sphere_plot.cc ) |
| 73 | +add_executable(inOneWeekend ${SOURCE_ONE_WEEKEND}) |
| 74 | +add_executable(theNextWeek ${SOURCE_NEXT_WEEK}) |
| 75 | +add_executable(theRestOfYourLife ${SOURCE_REST_OF_YOUR_LIFE}) |
| 76 | +add_executable(cos_cubed src/TheRestOfYourLife/cos_cubed.cc ${COMMON_ALL}) |
| 77 | +add_executable(cos_density src/TheRestOfYourLife/cos_density.cc ${COMMON_ALL}) |
| 78 | +add_executable(integrate_x_sq src/TheRestOfYourLife/integrate_x_sq.cc ${COMMON_ALL}) |
| 79 | +add_executable(pi src/TheRestOfYourLife/pi.cc ${COMMON_ALL}) |
| 80 | +add_executable(sphere_importance src/TheRestOfYourLife/sphere_importance.cc ${COMMON_ALL}) |
| 81 | +add_executable(sphere_plot src/TheRestOfYourLife/sphere_plot.cc ${COMMON_ALL}) |
| 82 | + |
| 83 | +include_directories(src/common) |
0 commit comments