-
Notifications
You must be signed in to change notification settings - Fork 350
/
CMakeLists.txt
41 lines (33 loc) · 1.27 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
cmake_minimum_required(VERSION 3.17)
project(Torch-TensorRT LANGUAGES CXX)
# use c++17 like PyTorch
set(CMAKE_CXX_STANDARD 17)
# Build the libraries with -fPIC
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
if (DEFINED CMAKE_MODULE_PATH)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} CACHE PATH "Path to the folder containing finders")
endif()
include(cmake/build_options.cmake)
include(cmake/paths.cmake)
include(cmake/dependencies.cmake)
if(MSVC)
add_compile_options(/wd4624 /wd4067 /permissive-)
# When using Ninja generator, suppress the warning D9025
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
endif()
# -----------------------------------------
# compilation
# -----------------------------------------
add_subdirectory(core)
add_subdirectory(cpp)
include(CMakePackageConfigHelpers)
configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/torchtrtConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/torchtrt
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/torchtrtConfig.cmake"
# "${CMAKE_CURRENT_BINARY_DIR}/torchtrtConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/torchtrt
)