-
Notifications
You must be signed in to change notification settings - Fork 38
/
CMakeLists.txt
70 lines (53 loc) · 2.09 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
cmake_minimum_required(VERSION 3.10)
project(BPRVulkan)
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
foreach (OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${PROJECT_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ${PROJECT_BINARY_DIR}/lib)
endforeach ()
set(CMAKE_CXX_STANDARD 17)
if (MSVC)
foreach (flag_var CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if (${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif ()
endforeach ()
add_compile_options("/MP")
endif ()
if (UNIX)
add_definitions(-DUNIX)
add_compile_options("-Wall")
add_compile_options("-fvisibility=hidden")
find_package(Backtrace REQUIRED)
string(COMPARE EQUAL ${Backtrace_HEADER} "backtrace.h" BacktraceRequired)
if (BacktraceRequired)
add_compile_definitions(BOOST_STACKTRACE_USE_BACKTRACE)
endif (BacktraceRequired)
endif ()
find_package(glfw3 CONFIG REQUIRED)
find_package(glm CONFIG REQUIRED)
find_package(imgui CONFIG REQUIRED)
find_package(tinyobjloader CONFIG REQUIRED)
find_package(Vulkan REQUIRED)
find_path(STB_INCLUDE_DIRS "stb.h")
add_definitions(-DIMGUI_DISABLE_OBSOLETE_FUNCTIONS)
IF (NOT Vulkan_FOUND)
message(FATAL_ERROR "Could not find Vulkan library!")
ELSE ()
message(STATUS ${Vulkan_LIBRARY})
ENDIF ()
find_program(Vulkan_GLSLANG_VALIDATOR
NAMES glslangValidator
HINTS ENV VULKAN_SDK
PATH_SUFFIXES bin)
if (NOT Vulkan_GLSLANG_VALIDATOR)
message(FATAL_ERROR "glslangValidator not found!")
endif ()
set(MAIN_PROJECT "PBRVulkan")
add_subdirectory(PBRVulkan/RayTracer/src)
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${MAIN_PROJECT})