This repository has been archived by the owner on Mar 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 13
/
CMakeLists.txt
128 lines (108 loc) · 4.14 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
cmake_minimum_required(VERSION 3.12)
project(MiyukiRenderer)
option(USE_EMBREE "Use Embree as ray intersection backend" ON)
option(USE_OIDN "Use OIDN as denoiser" ON)
option(EMBREE_FROM_SOURCE "Download and compile embree from source" OFF)
set(CMAKE_CXX_STANDARD 17)
if(${CMAKE_BUILD_TYPE} EQUAL "Release")
add_compile_definitions(MYK_RELEASE)
endif()
if(MSVC)
if(NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2 /std:c++17 /GL")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LTCG:INCREMENTAL")
set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /LTCG:INCREMENTAL")
endif()
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
IF(WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ")
set(CXX_FS_LIBS)
ENDIF()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread -mavx2")
set(CXX_FS_LIBS stdc++fs)
endif()
#find_package(Python3 REQUIRED)
#find_package(PythonLibs 3 REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
include_directories(include)
add_subdirectory(external/gl3w)
include_directories(external/sobol)
include_directories(external/pybind11/include)
include_directories(external/tinyobjloader/)
include_directories(external/cxxopts/include)
include_directories(external/gl3w/include)
include_directories(external/imgui/)
include_directories(external/PerlinNoise)
include_directories(external/miyuki.foundation/external/miyuki.serialize/include)
include_directories(external/nanort/)
include_directories(external/stb/)
include_directories(external/lodepng/)
include_directories(external/fmt/include)
add_subdirectory(external/fmt)
file(GLOB MiyukiFoundationSRC src/foundation/*.*)
file(GLOB MiyukiAPI include/*/*.* include/*/*/*.*)
file(GLOB libcoreSource src/core/*.cpp
src/core/accelerators/*.*
src/core/shaders/*.*
src/core/shapes/*.*
src/core/cameras/*.*
src/core/bsdfs/*.*
src/core/lights/*.*
src/core/integrators/*.*
src/core/samplers/*.*
src/core/mesh-importers/*.*
src/core/lightdistributions/*.*
src/core/denoisers/*.*
external/tinyobjloader/tiny_obj_loader.cc
external/lodepng/lodepng.cpp
)
IF(USE_EMBREE)
IF(EMBREE_FROM_SOURCE)
include(ExternalProject)
include(${PROJECT_SOURCE_DIR}/cmake/cmake-embree)
include_directories(${EMBREE_INCLUDE_DIRS})
add_compile_definitions(MYK_USE_EMBREE)
ELSE()
IF(WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "C:/Program Files/Intel/Embree3 x64")
ELSE()
# set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "/usr/lib64/cmake/")
ENDIF()
find_package(embree 3.6)
IF(NOT embree_FOUND)
message("Embree 3.6 not found; Falling back to custom BVH backend")
ELSE()
add_compile_definitions(MYK_USE_EMBREE)
include_directories(${EMBREE_INCLUDE_DIRS})
ENDIF()
ENDIF()
ENDIF()
#
#IF(USE_OIDN)
# link_libraries(tbb)
# add_subdirectory(external/oidn)
# include_directories(external/oidn/include)
# add_compile_definitions(MYK_USE_OIDN)
# set(OIDN_LIBRARIES OpenImageDenoise)
#ENDIF()
add_library(foundation ${MiyukiFoundationSRC})
target_link_libraries(foundation fmt)
add_library(core ${MiyukiAPI} ${libcoreSource})
target_link_libraries(core foundation ${CXX_FS_LIBS} ${OIDN_LIBRARIES} ${EMBREE_LIBRARY})
add_executable(myk.cli src/standalone-renderer/main.cpp ${MiyukiAPI})
target_link_libraries(myk.cli core)
add_executable(mesh-importer src/mesh-importer/importer.cpp ${MiyukiAPI})
target_link_libraries(mesh-importer core)
file(GLOB serverSRC src/miyuki.server/*.*)
add_executable(miyuki.server ${serverSRC} ${MiyukiAPI})
if (WIN32)
target_compile_definitions(miyuki.server PUBLIC _WIN32_WINNT=0x0601)
endif ()
target_include_directories(miyuki.server PRIVATE external/cpp-httplib)
target_link_libraries(miyuki.server asio wsock32 ws2_32 core)
add_executable(test-sdtree tests/test-sdtree.cpp)
target_link_libraries(test-sdtree core)
add_executable(test-adt tests/test-adt.cpp )
target_link_libraries(test-adt foundation)