forked from KhronosGroup/ANARI-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
133 lines (105 loc) · 3.37 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
129
130
131
132
133
## Copyright 2022-2024 The Khronos Group
## SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.11)
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
set(STANDALONE_SOURCE_TREE TRUE)
else()
set(STANDALONE_SOURCE_TREE FALSE)
endif()
if (STANDALONE_SOURCE_TREE)
message(STATUS "CMake version: ${CMAKE_VERSION}")
endif()
## Language setup ##
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_BUILD_TYPE_INIT Release)
set(CMAKE_INSTALL_RPATH "$ORIGIN")
set(CMAKE_INSTALL_MESSAGE LAZY)
## Establish project ##
project(anari_library_helide LANGUAGES CXX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
include(GNUInstallDirs)
## Dependencies ##
find_package(anari REQUIRED)
add_subdirectory(external/embree EXCLUDE_FROM_ALL)
## Code generation ##
anari_generate_queries(
NAME helide_queries
PREFIX HelideDevice
CPP_NAMESPACE helide
JSON_DEFINITIONS_FILE ${CMAKE_CURRENT_SOURCE_DIR}/HelideDefinitions.json
)
if (TARGET generate_all AND TARGET generate_helide_queries)
add_dependencies(generate_all generate_helide_queries)
endif()
## Core device target ##
project_add_library(SHARED)
project_sources(PRIVATE
HelideDevice.cpp
HelideDeviceQueries.cpp
HelideGlobalState.cpp
HelideLibrary.cpp
Object.cpp
camera/Camera.cpp
camera/Orthographic.cpp
camera/Perspective.cpp
frame/Frame.cpp
renderer/Renderer.cpp
scene/Group.cpp
scene/Instance.cpp
scene/World.cpp
scene/light/Light.cpp
scene/surface/Surface.cpp
scene/surface/geometry/Cone.cpp
scene/surface/geometry/Curve.cpp
scene/surface/geometry/Cylinder.cpp
scene/surface/geometry/Geometry.cpp
scene/surface/geometry/Quad.cpp
scene/surface/geometry/Sphere.cpp
scene/surface/geometry/Triangle.cpp
scene/surface/material/Material.cpp
scene/surface/material/Matte.cpp
scene/surface/material/PBM.cpp
scene/surface/material/sampler/Image1D.cpp
scene/surface/material/sampler/Image2D.cpp
scene/surface/material/sampler/Image3D.cpp
scene/surface/material/sampler/PrimitiveSampler.cpp
scene/surface/material/sampler/Sampler.cpp
scene/surface/material/sampler/TransformSampler.cpp
scene/volume/TransferFunction1D.cpp
scene/volume/Volume.cpp
scene/volume/spatial_field/SpatialField.cpp
scene/volume/spatial_field/StructuredRegularField.cpp
)
include(GenerateExportHeader)
generate_export_header(${PROJECT_NAME} EXPORT_MACRO_NAME "HELIDE_EXPORT")
project_include_directories(
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
project_link_libraries(PUBLIC anari::helium PRIVATE local_embree)
if(WIN32)
project_compile_definitions(PRIVATE _USE_MATH_DEFINES)
endif()
## Installation ##
install(TARGETS ${PROJECT_NAME}
EXPORT anari_Exports
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
FILES
${PROJECT_BINARY_DIR}/${PROJECT_NAME}_export.h
${CMAKE_CURRENT_LIST_DIR}/include/anari/ext/helide/anariNewHelideDevice.h
DESTINATION
${CMAKE_INSTALL_INCLUDEDIR}/anari/ext/helide
)