forked from KhronosGroup/ANARI-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
100 lines (82 loc) · 2 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
## Copyright 2024 The Khronos Group
## SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.20)
set(CMAKE_INSTALL_MESSAGE LAZY)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
project(hdAnari LANGUAGES CXX)
find_package(USD REQUIRED NAMES pxr)
find_package(anari REQUIRED)
if(GCC OR CLANG)
project_add_compile_options(-Wl,--no-undefined)
endif()
project_add_library(SHARED
anariExtensionUtilityImpl.cpp
anariTokens.cpp
debugCodes.cpp
geometry.cpp
instancer.cpp
material.cpp
material/matte.cpp
material/physicallyBased.cpp
material/textureLoader.cpp
material/usdPreviewSurfaceConverter.cpp
materialTokens.cpp
materialTokens.h
mesh.cpp
meshUtil.cpp
points.cpp
renderBuffer.cpp
renderDelegate.cpp
rendererPlugin.cpp
renderPass.cpp
sampler.cpp
)
option(USE_INSTANCE_ARRAYS "Toggle on the use of instance arrays" OFF)
if (USE_INSTANCE_ARRAYS)
target_compile_definitions(${PROJECT_NAME} PRIVATE "USE_INSTANCE_ARRAYS=1")
else()
target_compile_definitions(${PROJECT_NAME} PRIVATE "USE_INSTANCE_ARRAYS=0")
endif()
set_target_properties(${PROJECT_NAME}
PROPERTIES
# The other libs in the plugin dir have no "lib" prefix, so let's match this
PREFIX ""
)
project_link_libraries(PUBLIC anari::anari ${PXR_LIBRARIES})
## Configure plugInfo file ##
set(PLUGINFO_PATH "${CMAKE_CURRENT_BINARY_DIR}/plugInfo.json")
file(READ plugInfo.json.in PLUGINFO)
file(
GENERATE
OUTPUT
${PLUGINFO_PATH}
CONTENT
${PLUGINFO}
)
## Installation ##
set(OPENUSD_INSTALL_PREFIX
"${USD_DIR}/plugin/usd"
CACHE
PATH
"OpenUSD location to install hdAnari plugin"
)
if (OPENUSD_INSTALL_PREFIX)
install(
FILES
${PLUGINFO_PATH}
DESTINATION
${OPENUSD_INSTALL_PREFIX}/${PROJECT_NAME}/resources
)
install(
TARGETS
${PROJECT_NAME}
LIBRARY
DESTINATION ${OPENUSD_INSTALL_PREFIX}
RUNTIME
DESTINATION ${OPENUSD_INSTALL_PREFIX}
ARCHIVE
DESTINATION ${OPENUSD_INSTALL_PREFIX}
)
endif()