forked from KhronosGroup/ANARI-SDK
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
84 lines (58 loc) · 2.4 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
## Copyright 2021-2024 The Khronos Group
## SPDX-License-Identifier: Apache-2.0
cmake_minimum_required(VERSION 3.11)
message(STATUS "CMake version: ${CMAKE_VERSION}")
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
set(IN_SDK_SOURCE_TREE FALSE)
else()
set(IN_SDK_SOURCE_TREE TRUE)
endif()
## Language setup
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED ON)
set(CMAKE_C_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 11)
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_MESSAGE LAZY)
## Establish project
project(anari_examples LANGUAGES C 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)
if (NOT IN_SDK_SOURCE_TREE)
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../../external/stb_image stb_image)
endif()
## Example apps
add_executable(anariTutorial anariTutorial.c)
target_link_libraries(anariTutorial PRIVATE anari::anari stb_image)
add_executable(anariTutorialCpp anariTutorial.cpp)
target_link_libraries(anariTutorialCpp PRIVATE anari::anari stb_image)
add_executable(anariTutorialDebug anariTutorialDebug.c)
target_link_libraries(anariTutorialDebug PRIVATE anari::anari stb_image)
add_executable(anariTutorialInitFromEnv anariTutorialInitFromEnv.c)
target_link_libraries(anariTutorialInitFromEnv PRIVATE anari::anari)
add_executable(anariInfo anariInfo.cpp)
target_link_libraries(anariInfo PRIVATE anari::anari_static)
if (IN_SDK_SOURCE_TREE)
install(TARGETS anariInfo RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if (TARGET anari_library_helide)
# This app links to the include 'helide' device library directly to use its
# direct device creation function. Vendors can choose to ship a header with
# such a direct function in it.
add_executable(anariTutorialDirectLink anariTutorialDirectLink.c)
target_link_libraries(anariTutorialDirectLink PRIVATE anari_library_helide)
endif()
if (BUILD_TESTING)
add_test(NAME anariTutorial COMMAND anariTutorial)
add_test(NAME anariTutorialCpp COMMAND anariTutorialCpp)
add_test(NAME anariTutorialDebug COMMAND anariTutorialDebug)
endif()
endif()