-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
99 lines (83 loc) · 3.77 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
# Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR)
#-------------------------------------------------------------------------------
# Set basic configurations
#-------------------------------------------------------------------------------
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
include(SamplesSetBuildType) # Set the build type before project is created
set(SDK_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(SDK_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
#-------------------------------------------------------------------------------
# Root project
#-------------------------------------------------------------------------------
project(DriveworksSDK-Samples C CXX)
#-------------------------------------------------------------------------------
# System packages
#-------------------------------------------------------------------------------
find_package(CUDA REQUIRED)
find_package(Threads REQUIRED)
find_package(TensorRT REQUIRED)
find_package(CuDNN REQUIRED)
#-------------------------------------------------------------------------------
# Basic configuration
#-------------------------------------------------------------------------------
include(ArchConfiguration)
include(CommonConfiguration)
include(SamplesConfiguration)
include(Samples3rdparty)
include(SamplesInstallConfiguration)
include(ExpandDependencyTree)
include(IncludeTargetDirectories)
include(UploadVibrante)
set(SDK_BINARY_DIR ${CMAKE_BINARY_DIR})
#-------------------------------------------------------------------------------
# Driveworks SDK
#-------------------------------------------------------------------------------
find_package(Driveworks REQUIRED)
include_directories(${Driveworks_INCLUDE_DIR})
list(APPEND Driveworks_LIBRARIES ${CUDA_LIBRARIES} ${CUDA_cublas_LIBRARY})
if(LINUX)
list(APPEND Driveworks_LIBRARIES ${CMAKE_THREAD_LIBS_INIT} dl rt)
elseif(VIBRANTE)
set(VIBRANTE TRUE)
add_definitions(-DVIBRANTE)
list(APPEND Driveworks_LIBRARIES ${vibrante_LIBRARIES} ${vibrante_Xlibs_LIBRARIES} nvmedia ${EGL_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
endif()
#-------------------------------------------------------------------------------
# Samples
#-------------------------------------------------------------------------------
if(CMAKE_CROSSCOMPILING)
set(DRIVEWORKS_DATAPATH "../data")
else()
set(DRIVEWORKS_DATAPATH "${CMAKE_CURRENT_LIST_DIR}/../data")
endif()
include_directories(${SDK_BINARY_DIR}/configured/samples)
configure_file(src/framework/DataPath.hpp.in
${SDK_BINARY_DIR}/configured/samples/framework/DataPath.hpp)
set(SAMPLES framework;dnn;drivenet;laneDetection;freespace;pilotnet)
file(GLOB ADDITIONAL_SAMPLES "CMakeListsSamples*.txt")
foreach(ADDITIONAL_SAMPLE ${ADDITIONAL_SAMPLES})
include(${ADDITIONAL_SAMPLE})
endforeach()
foreach(SAMPLE ${SAMPLES})
add_subdirectory(src/${SAMPLE})
endforeach()
if(WIN32)
# Handle runtime library dependence
get_filename_component(DriveworksLibPath ${Driveworks_LIBRARY} DIRECTORY)
set(LIBRARY_DIR ${DriveworksLibPath}/../bin)
file(GLOB dll_files "${LIBRARY_DIR}/*.dll")
foreach(file ${dll_files})
file(COPY "${file}" DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Debug")
file(COPY "${file}" DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Release")
install(FILES ${LIBRARY_DIR}/${file}
DESTINATION "${CMAKE_INSTALL_PREFIX}/${SDK_SAMPLE_DESTINATION}"
)
endforeach()
endif()
#-------------------------------------------------------------------------------
# Cuda dependencies
#-------------------------------------------------------------------------------
# Create a target to update cuda dependencies
add_cuda_dependencies_target(update_cuda_deps ON)
set_property(TARGET update_cuda_deps PROPERTY FOLDER "Support")