This repository was archived by the owner on Apr 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
56 lines (42 loc) · 1.55 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
cmake_minimum_required(VERSION 3.14)
project(RayTracer VERSION 1.0.0 LANGUAGES C CXX)
set(CMAKE_VERBOSE_MAKEFILE OFF) # Turn on to debug cmake/make
set(CMAKE_C_STANDARD 11)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD_REQUIRED ON 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON 17)
set(JSON_URL https://github.com/nlohmann/json/releases/download/v3.7.3/json.hpp)
set(JSON_TARGET ${CMAKE_CURRENT_SOURCE_DIR}/Dependencies/json/json.hpp)
if (NOT EXISTS ${JSON_TARGET})
message(STATUS "Downloading JSON dependency")
file(DOWNLOAD ${JSON_URL} ${JSON_TARGET})
message(STATUS "Downloading JSON dependency - done")
endif ()
set(OpenGL_GL_PREFERENCE LEGACY)
include(Dependencies/raygui/cmake/FindRaylib.cmake)
if (UNIX)
add_compile_options(-Wall -Wextra -Weffc++)
if (RAYTRACER_ERROR)
add_compile_options(-Werror)
endif ()
elseif (WIN32 OR WIN64)
add_compile_options(/wd4244 /wd4267)
endif ()
if (CMAKE_BUILD_TYPE MATCHES Debug)
add_compile_definitions(RAYTRACER_DEBUG=1)
elseif (CMAKE_BUILD_TYPE MATCHES Release)
add_compile_definitions(RAYTRACER_RELEASE=1)
endif ()
include_directories(Dependencies/json)
include_directories(Dependencies/raylib/src)
add_subdirectory(Engine)
add_subdirectory(RayTracer)
if (RAYTRACER_TESTS)
message(STATUS "Setting up tests")
set(CMAKE_BUILD_TYPE Debug)
add_subdirectory(Tests)
message(STATUS "Setting up tests - done")
endif ()
file(COPY Resources DESTINATION ${CMAKE_BINARY_DIR})
message(STATUS "Resources files copied to ${CMAKE_BINARY_DIR}")
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")