-
Notifications
You must be signed in to change notification settings - Fork 47
/
CMakeLists.txt
52 lines (47 loc) · 2.06 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
cmake_minimum_required(VERSION 3.5)
Project(nvpro-samples)
# setting the base directory will also inform sub-cmake files
# that they are included and not the first entry point
SET(BASE_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/..)
SET(HAS_NVPRO_CORE ON)
INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/../nvpro_core/cmake/setup.cmake)
# These samples don't build on Linux as of today
# Use a syntax like below to turn off a sample:
# SET(BUILD_gl_cuda_interop_pingpong_st OFF)
if(UNIX)
SET(BUILD_dx12_present_barrier OFF)
SET(BUILD_gl_render_vk_direct_display OFF)
SET(BUILD_gl_render_vk_ddisplay OFF)
SET(BUILD_vk_ddisplay OFF)
SET(BUILD_vk_streamline OFF)
endif(UNIX)
macro(_addFolder _PATH)
FILE (GLOB samples "${_PATH}/*")
FOREACH( sample ${samples} )
if( IS_DIRECTORY ${sample} )
if( EXISTS ${sample}/CMakeLists.txt )
# extract the name from the path
string( REGEX REPLACE "^.*/([^/]*)$" "\\1" SAMPLE_NAME ${sample} )
if( (NOT (${SAMPLE_NAME} MATCHES "^__"))
AND (NOT(${SAMPLE_NAME} MATCHES "^build_all")) # Avoid infinite recursion if this build_all folder has a suffix
AND (NOT(${SAMPLE_NAME} STREQUAL "nvpro_core"))
AND (NOT(${SAMPLE_NAME} STREQUAL "shared_sources")) # OBSOLETE folder : renamed as nvpro_core. But we still want to avoid it, in case someone left it by mistake
AND (NOT(${SAMPLE_NAME} STREQUAL "downloaded_resources"))
AND (NOT (BUILD_${SAMPLE_NAME} STREQUAL "OFF")))
# build the option to include the project or not
set( "BUILD_${SAMPLE_NAME}" TRUE CACHE BOOL "Include the ${SAMPLE_NAME} sample" )
# add the project
if( BUILD_${SAMPLE_NAME})
add_subdirectory( ${_PATH}/${SAMPLE_NAME} ./${SAMPLE_NAME})
endif()
endif()
endif()
endif()
ENDFOREACH( sample ${samples} )
endmacro(_addFolder)
##############################
#### projects ###
##############################
_addFolder("..")
_addFolder("../shipped")
add_subdirectory(../nvpro_core ${CMAKE_BINARY_DIR}/nvpro_core)