-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
100 lines (84 loc) · 4.23 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
100
cmake_minimum_required(VERSION 3.10)
project(embedLIC)
include(ExternalProject)
set(CMAKE_CXX_STANDARD 17)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g -Wno-subobject-linkage -Wno-attributes")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wno-subobject-linkage -Wno-attributes")
add_custom_target(vendor)
ExternalProject_Add(
argparse
URL https://github.com/p-ranav/argparse/archive/refs/tags/v2.2.zip
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/vendor/argparse
)
add_dependencies(vendor argparse)
find_package(CUDA)
find_package(Threads REQUIRED)
find_package(OpenCV)
find_library(TensorRT_LIB nvinfer)
if (WIN32)
find_library(SetupAPI_LIB setupapi)
endif()
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
link_libraries(OpenMP::OpenMP_CXX)
endif()
include_directories(
${CMAKE_SOURCE_DIR}
$ENV{INCLUDE_DIR}
${CMAKE_BINARY_DIR}/vendor/argparse/include
)
link_directories(
$ENV{LINK_DIR}
${CMAKE_BINARY_DIR}/vendor/argparse/lib
)
if(OpenCV_FOUND)
include_directories(${OpenCV_INCLUDE_DIRS})
link_libraries(${OpenCV_LIBS})
endif()
add_custom_target(main)
if(CUDA_FOUND AND TensorRT_LIB)
include_directories(${CUDA_INCLUDE_DIRS})
link_libraries(${CMAKE_THREAD_LIBS_INIT} ${CUDA_LIBRARIES} nvinfer)
add_executable(bmshj2018_factorized_compressor bmshj2018_factorized_compressor.cpp entropy_coder/entropy_coder.cpp
libs/tensorrt_wrapper.cpp libs/tensorrt_logger.cpp libs/utils.cpp libs/network.cpp libs/img_utils.cpp
libs/memory.cpp libs/prealloc_pool.cpp
pipelines/bmshj2018_factorized_pipelines.cpp entropy_coder/rans_interface.cpp)
add_dependencies(bmshj2018_factorized_compressor vendor)
add_dependencies(main bmshj2018_factorized_compressor)
add_executable(bmshj2018_hyperprior_compressor bmshj2018_hyperprior_compressor.cpp entropy_coder/entropy_coder.cpp
libs/tensorrt_wrapper.cpp libs/tensorrt_logger.cpp libs/utils.cpp libs/network.cpp libs/img_utils.cpp
libs/memory.cpp libs/prealloc_pool.cpp
pipelines/bmshj2018_hyperprior_pipelines.cpp entropy_coder/rans_interface.cpp)
add_dependencies(bmshj2018_hyperprior_compressor vendor)
add_dependencies(main bmshj2018_hyperprior_compressor)
add_executable(bmshj2018_factorized_decompressor bmshj2018_factorized_decompressor.cpp entropy_coder/entropy_coder.cpp
libs/tensorrt_wrapper.cpp libs/tensorrt_logger.cpp libs/utils.cpp libs/network.cpp libs/img_utils.cpp
libs/memory.cpp libs/prealloc_pool.cpp
pipelines/bmshj2018_factorized_pipelines.cpp entropy_coder/rans_interface.cpp)
add_dependencies(bmshj2018_factorized_decompressor vendor)
add_dependencies(main bmshj2018_factorized_decompressor)
add_executable(bmshj2018_hyperprior_decompressor bmshj2018_hyperprior_decompressor.cpp entropy_coder/entropy_coder.cpp
libs/tensorrt_wrapper.cpp libs/tensorrt_logger.cpp libs/utils.cpp libs/network.cpp libs/img_utils.cpp
libs/memory.cpp libs/prealloc_pool.cpp
pipelines/bmshj2018_hyperprior_pipelines.cpp entropy_coder/rans_interface.cpp)
add_dependencies(bmshj2018_hyperprior_decompressor vendor)
add_dependencies(main bmshj2018_hyperprior_decompressor)
add_executable(cam_encoder cam_encoder.cpp entropy_coder/entropy_coder.cpp
libs/tensorrt_wrapper.cpp libs/tensorrt_logger.cpp libs/utils.cpp libs/network.cpp libs/img_utils.cpp
libs/memory.cpp libs/prealloc_pool.cpp
pipelines/bmshj2018_factorized_pipelines.cpp entropy_coder/rans_interface.cpp)
add_dependencies(cam_encoder vendor)
add_dependencies(main cam_encoder)
add_executable(cam_decoder cam_decoder.cpp entropy_coder/entropy_coder.cpp
libs/tensorrt_wrapper.cpp libs/tensorrt_logger.cpp libs/utils.cpp libs/network.cpp libs/img_utils.cpp
libs/memory.cpp libs/prealloc_pool.cpp
pipelines/bmshj2018_factorized_pipelines.cpp entropy_coder/rans_interface.cpp)
add_dependencies(cam_decoder vendor)
add_dependencies(main cam_decoder)
else()
message(WARNING "Unable to compile main module since one ore more dependencies are not satisfied!")
add_compile_definitions(NO_GPU_LIBRARIES=1)
endif()