-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
34 lines (28 loc) · 1.14 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
cmake_minimum_required(VERSION 3.1)
project(runtime_compiler)
find_package(CUDA)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -w -fPIC")
set(PROJECT_DIR "${PROJECT_SOURCE_DIR}")
set(GENERATED_FILES_DIR ${CMAKE_BINARY_DIR}/runtime_compiler_generated)
file(MAKE_DIRECTORY ${GENERATED_FILES_DIR})
set(SourceDir "src")
file(GLOB_RECURSE FilesInDir "${PROJECT_SOURCE_DIR}/${SourceDir}/*")
foreach(FilePath ${FilesInDir})
get_filename_component(FileExt ${FilePath} EXT)
get_filename_component(FileNameWe ${FilePath} NAME_WE)
if (FileExt STREQUAL ".cpp")
list(APPEND RTC_SOURCES "${FilePath}")
elseif(FileExt STREQUAL ".cu")
list(APPEND RTC_CUDA_SOURCES "${FilePath}")
elseif(FileExt STREQUAL ".h")
list(APPEND RTC_HEADERS "${FilePath}")
elseif(FileExt STREQUAL ".h.in")
configure_file("${FilePath}" "${GENERATED_FILES_DIR}/${FileNameWe}.h")
endif()
endforeach()
add_library(rtc_lib ${RTC_SOURCES})
include_directories(${GENERATED_FILES_DIR})
cuda_add_executable(simple_rtc_nvcc ${RTC_CUDA_SOURCES})
cuda_include_directories(${GENERATED_FILES_DIR})
add_dependencies(simple_rtc_nvcc rtc_lib)
target_link_libraries(simple_rtc_nvcc rtc_lib)