forked from NVIDIA-AI-IOT/torch2trt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
57 lines (44 loc) · 1.32 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
cmake_minimum_required(VERSION 3.0.0)
project(torch2trt_plugins VERSION 0.1.0)
# VARIABLES
set(CUDA_ARCHITECTURES 53 62 72 87)
# BUILD PLUGINS LIBRARY
find_package(CUDA REQUIRED)
enable_language(CUDA)
include_directories("${CUDA_INCLUDE_DIRS}")
add_library(torch2trt_plugins SHARED
plugins/src/example_plugin.cu
plugins/src/reflection_pad_2d_plugin.cu
)
set_property(TARGET torch2trt_plugins PROPERTY CUDA_ARCHITECTURES ${CUDA_ARCHITECTURES})
target_link_libraries(
torch2trt_plugins
nvinfer
${CUDA_LIBRARIES}
)
install (TARGETS torch2trt_plugins
LIBRARY DESTINATION lib)
# BUILD TESTS
find_package(Catch2 QUIET)
if(Catch2_FOUND)
include(CTest)
include(CPack)
include(Catch)
enable_testing()
add_executable(torch2trt_plugins_test
plugins/src/tests.cpp
plugins/src/example_plugin_test.cpp
plugins/src/reflection_pad_2d_plugin_test.cpp
)
set_property(TARGET torch2trt_plugins_test PROPERTY CUDA_ARCHITECTURES ${CUDA_ARCHITECTURES})
target_link_libraries(torch2trt_plugins_test
PRIVATE
Catch2::Catch2WithMain
torch2trt_plugins
nvinfer
${CUDA_LIBRARIES}
)
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
catch_discover_tests(torch2trt_plugins_test)
endif()