-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
76 lines (58 loc) · 1.85 KB
/
Copy pathCMakeLists.txt
File metadata and controls
76 lines (58 loc) · 1.85 KB
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
cmake_minimum_required(VERSION 3.20)
project(photon_mapping LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 23)
option(BUILD_TESTS "build c++ tests" OFF)
option(BUILD_CXX_EXAMPLE "build c++ example" OFF)
# --- Build setup
find_package(TBB CONFIG REQUIRED)
find_package(Threads REQUIRED)
find_package(OpenMP REQUIRED)
if(NOT OpenMP_CXX_FOUND)
message(WARNING "failed to find OpenMP")
endif()
# apple newer C++ features with old SDK
if(APPLE)
set(CMAKE_CXX_FLAGS "${CXXFLAGS} -D_LIBCPP_DISABLE_AVAILABILITY")
endif()
# Embree4
find_package(embree 4.0 REQUIRED)
if (${embree_FOUND})
message(STATUS "Found Embree")
set("EMBREE_MAX_ISA" ON)
else()
message(FATAL_ERROR "Could not find Embree")
endif()
# externals
add_subdirectory("externals")
add_subdirectory("src/cpp/include")
# pm(photon_mapping)
add_library(pm INTERFACE src/python/ext_photonmapping_nano.cpp)
# target_include_directories(pm INTERFACE "src/cpp/include")
set_target_properties(pm
PROPERTIES
CXX_STANDARD 23
CXX_STANDARD_REQUIRED YES
CXX_EXTENSIONS YES
)
target_link_libraries(pm INTERFACE TBB::tbb OpenMP::OpenMP_CXX tinyobjloader embree Threads::Threads photon_map primitive triangle image)
# wrapper
add_subdirectory("src/python/")
# tests
if(BUILD_TESTS)
add_subdirectory("src/cpp/test")
endif()
# examples
if(BUILD_CXX_EXAMPLE)
add_subdirectory("examples")
endif ()
# building lib
find_package(Python COMPONENTS Interpreter Development REQUIRED)
# find_package(pybind11 CONFIG REQUIRED)
# Detect the installed nanobind package and import it into CMake
execute_process(
COMMAND "${Python_EXECUTABLE}" -m nanobind --cmake_dir
OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE nanobind_ROOT)
find_package(nanobind CONFIG REQUIRED)
install(TARGETS libspice
COMPONENT python
LIBRARY DESTINATION "${SKBUILD_PLATLIB_DIR}/openalea/spice/")