-
Notifications
You must be signed in to change notification settings - Fork 28
/
CMakeLists.txt
88 lines (72 loc) · 2.49 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
cmake_minimum_required(VERSION 3.16.3)
project(tensorboard_logger)
option(BUILD_TEST "Build test" OFF)
find_package(Protobuf REQUIRED)
# -----------------------------------------------------------------------------
# Building the tensorboard_logger library
# -----------------------------------------------------------------------------
file(GLOB protos "proto/*.proto")
protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS ${protos})
add_library(tensorboard_logger
"src/crc.cc"
"src/tensorboard_logger.cc"
${PROTO_SRCS}
)
target_compile_features(tensorboard_logger PRIVATE cxx_std_11)
target_compile_options(tensorboard_logger PRIVATE -Wall -O2)
target_include_directories(tensorboard_logger
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROTOBUF_INCLUDE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
target_link_libraries(tensorboard_logger PUBLIC ${Protobuf_LIBRARIES})
if (BUILD_TEST)
add_executable(tensorboard_logger_test tests/test_tensorboard_logger.cc)
target_compile_features(tensorboard_logger_test PRIVATE cxx_std_11)
target_compile_options(tensorboard_logger_test PRIVATE -Wall -O2)
target_include_directories(tensorboard_logger_test
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
)
target_link_libraries(tensorboard_logger_test tensorboard_logger)
endif()
# -----------------------------------------------------------------------------
# Installing the tensorboard_logger library
# -----------------------------------------------------------------------------
install(
TARGETS tensorboard_logger
EXPORT tensorboard_logger_Targets
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
INCLUDES DESTINATION include
)
include(CMakePackageConfigHelpers)
configure_package_config_file(
"${PROJECT_SOURCE_DIR}/cmake/tensorboard_loggerConfig.cmake.in"
"${PROJECT_BINARY_DIR}/tensorboard_loggerConfig.cmake"
INSTALL_DESTINATION
${CMAKE_INSTALL_PREFIX}/cmake
)
install(
EXPORT tensorboard_logger_Targets
FILE tensorboard_loggerTargets.cmake
NAMESPACE tensorboard_logger::
DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
)
install(
FILES "${PROJECT_BINARY_DIR}/tensorboard_loggerConfig.cmake"
DESTINATION ${CMAKE_INSTALL_PREFIX}/cmake
)
install(
DIRECTORY include/
DESTINATION include
)
install(
DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/"
DESTINATION include
FILES_MATCHING
PATTERN "*.pb.h"
PATTERN "CMakeFiles" EXCLUDE
)