-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
32 lines (28 loc) · 1.08 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
cmake_minimum_required(VERSION 3.28)
project(raytracer CXX)
include(FetchContent)
FetchContent_Declare(SFML GIT_REPOSITORY https://github.com/SFML/SFML.git SYSTEM EXCLUDE_FROM_ALL)
FetchContent_MakeAvailable(SFML)
if(CMAKE_CXX_COMPILER_ID MATCHES "(GNU|Clang)")
add_compile_options(-Werror -Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wsign-conversion -Wold-style-cast -ffast-math)
elseif(MSVC)
add_compile_options(/WX /W4 /permissive-)
endif()
add_executable(raytracer
src/Camera.cpp
src/Hittable.cpp
src/Material.cpp
src/Random.cpp
src/Raytracer.cpp
src/Sphere.cpp
)
target_link_libraries(raytracer PRIVATE SFML::Graphics)
target_compile_definitions(raytracer PRIVATE FONT_PATH="${CMAKE_SOURCE_DIR}/data")
target_compile_features(raytracer PRIVATE cxx_std_20)
add_custom_target(format
COMMAND clang-format -i `git ls-files *.hpp *.cpp`
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_custom_target(tidy
COMMAND run-clang-tidy -p ${CMAKE_BINARY_DIR} `git ls-files *.cpp`
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
add_custom_target(run COMMAND raytracer)