|
6 | 6 |
|
7 | 7 | cmake_minimum_required ( VERSION 3.1.0...3.27.0 )
|
8 | 8 |
|
9 |
| -project ( RTWeekend |
10 |
| - VERSION 3.0.0 |
11 |
| - LANGUAGES CXX |
12 |
| -) |
| 9 | +project ( RTWeekend LANGUAGES CXX ) |
13 | 10 |
|
14 |
| -# Set to c++11 |
15 |
| -set ( CMAKE_CXX_STANDARD 11 ) |
| 11 | +# Set to C++11 |
| 12 | +set ( CMAKE_CXX_STANDARD 11 ) |
| 13 | +set ( CMAKE_CXX_STANDARD_REQUIRED ON ) |
| 14 | +set ( CMAKE_CXX_EXTENSIONS OFF ) |
16 | 15 |
|
17 | 16 | # Source
|
18 |
| -set ( COMMON_ALL |
19 |
| - src/common/rtweekend.h |
20 |
| - src/common/camera.h |
21 |
| - src/common/ray.h |
22 |
| - src/common/vec3.h |
| 17 | + |
| 18 | +set ( EXTERNAL |
| 19 | + src/external/stb_image.h |
23 | 20 | )
|
24 | 21 |
|
25 | 22 | set ( SOURCE_ONE_WEEKEND
|
26 |
| - ${COMMON_ALL} |
| 23 | + src/external/stb_image.h |
| 24 | + |
| 25 | + src/InOneWeekend/camera.h |
| 26 | + src/InOneWeekend/color.h |
27 | 27 | src/InOneWeekend/hittable.h
|
28 | 28 | src/InOneWeekend/hittable_list.h
|
| 29 | + src/InOneWeekend/interval.h |
29 | 30 | src/InOneWeekend/material.h
|
| 31 | + src/InOneWeekend/ray.h |
| 32 | + src/InOneWeekend/rtw_stb_image.h |
| 33 | + src/InOneWeekend/rtweekend.h |
30 | 34 | src/InOneWeekend/sphere.h
|
| 35 | + src/InOneWeekend/vec3.h |
| 36 | + |
31 | 37 | src/InOneWeekend/main.cc
|
32 | 38 | )
|
33 | 39 |
|
34 | 40 | set ( SOURCE_NEXT_WEEK
|
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 |
| 41 | + src/external/stb_image.h |
| 42 | + |
| 43 | + src/TheNextWeek/aabb.h |
43 | 44 | src/TheNextWeek/bvh.h
|
| 45 | + src/TheNextWeek/camera.h |
| 46 | + src/TheNextWeek/color.h |
44 | 47 | src/TheNextWeek/constant_medium.h
|
45 | 48 | src/TheNextWeek/hittable.h
|
46 | 49 | src/TheNextWeek/hittable_list.h
|
| 50 | + src/TheNextWeek/interval.h |
47 | 51 | src/TheNextWeek/material.h
|
48 |
| - src/TheNextWeek/moving_sphere.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 |
49 | 57 | src/TheNextWeek/sphere.h
|
| 58 | + src/TheNextWeek/texture.h |
| 59 | + src/TheNextWeek/vec3.h |
| 60 | + |
50 | 61 | src/TheNextWeek/main.cc
|
51 | 62 | )
|
52 | 63 |
|
53 | 64 | set ( SOURCE_REST_OF_YOUR_LIFE
|
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 |
| 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 |
63 | 71 | src/TheRestOfYourLife/hittable.h
|
64 | 72 | src/TheRestOfYourLife/hittable_list.h
|
| 73 | + src/TheRestOfYourLife/interval.h |
65 | 74 | src/TheRestOfYourLife/material.h
|
66 | 75 | src/TheRestOfYourLife/onb.h
|
67 | 76 | 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 |
68 | 82 | src/TheRestOfYourLife/sphere.h
|
| 83 | + src/TheRestOfYourLife/texture.h |
| 84 | + src/TheRestOfYourLife/vec3.h |
| 85 | + |
69 | 86 | src/TheRestOfYourLife/main.cc
|
70 | 87 | )
|
71 | 88 |
|
| 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 | + |
72 | 113 | # Executables
|
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) |
| 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 ) |
0 commit comments