-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
109 lines (91 loc) · 3.64 KB
/
CMakeLists.txt
File metadata and controls
109 lines (91 loc) · 3.64 KB
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
101
102
103
104
105
106
107
108
109
# Copyright (c) 2024, International Business Machines
# SPDX-License-Identifier: BSD-2-Clause-Patent
cmake_minimum_required(VERSION 3.20 FATAL_ERROR)
project(CommonLowLevelTracingKit LANGUAGES C CXX)
include(GNUInstallDirs)
include(cmake/Toolchain.cmake)
include(cmake/ToolchainVersionCheck.cmake)
include(cmake/CreateVersion.cmake)
include(cmake/CheckPICEnabled.cmake)
include(cmake/CodeCoverage.cmake)
include(cmake/ASAN.cmake)
include(cmake/StaticAnalysis.cmake)
include(cmake/CompileWarnings.cmake)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
# We're in the root, define additional targets for developers.
message(STATUS "clltk is standalone")
option(STANDALONE_PROJECT "Build as standalone project" ON)
else()
message(STATUS "clltk is imported")
option(STANDALONE_PROJECT "Build as standalone project" OFF)
endif()
set(CLLTK_TRACING_LIB_TYPE "STATIC" CACHE STRING "make target clltk_tracing alias for clltk_tracing_shared with \"SHARED\" or clltk_tracing_static with \"STATIC\"")
option(CLLTK_TRACING "select tracing lib for build and packaging" ON)
if(CLLTK_TRACING)
message(STATUS "add tracing_library")
add_subdirectory(./tracing_library)
check_pic_enabled(clltk_tracing_static)
check_pic_enabled(clltk_tracing_shared)
check_pic_enabled(clltk_tracing)
endif()
option(CLLTK_SNAPSHOT "select snapshot lib for build and packaging" ON)
if(CLLTK_SNAPSHOT)
message(STATUS "add snapshot_library")
add_subdirectory(./snapshot_library)
check_pic_enabled(clltk_snapshot_static)
check_pic_enabled(clltk_snapshot_shared)
endif()
option(CLLTK_COMMAND_LINE_TOOL "select clltk_cmd for packaging" ON)
if(CLLTK_COMMAND_LINE_TOOL)
message(STATUS "add command_line_tool")
add_subdirectory(./command_line_tool)
endif()
option(CLLTK_PYTHON_DECODER "select python decoder for packaging" ON)
option(CLLTK_CPP_DECODER "select cpp decoder for packaging" ON)
add_subdirectory(./decoder_tool)
option(CLLTK_KERNEL_TRACING "select kernel tracing module for build" ${STANDALONE_PROJECT})
if(CLLTK_KERNEL_TRACING AND EXISTS ./kernel_tracing_library )
message(STATUS "add kernel_tracing")
add_subdirectory(./kernel_tracing_library EXCLUDE_FROM_ALL)
endif()
option(CLLTK_EXAMPLES "Also configure and build examples" ${STANDALONE_PROJECT})
if(CLLTK_EXAMPLES AND EXISTS ./examples )
message(STATUS "add examples")
add_subdirectory(./examples)
endif()
option(CLLTK_TESTS "Also configure and build tests" ${STANDALONE_PROJECT})
if(CLLTK_TESTS AND EXISTS ./tests/)
message(STATUS "add tests")
enable_testing()
add_subdirectory(./tests/)
endif()
# Generate build info header (for command line tool)
# Note: Must be after all CLLTK_* options are defined since build_info uses them
include(cmake/CreateBuildInfo.cmake)
# --- CMake package config for find_package(CLLTK) ---
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
install(EXPORT CLLTKTracingTargets
FILE CLLTKTracingTargets.cmake
NAMESPACE clltk::
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CLLTK
COMPONENT devel
)
configure_package_config_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/CLLTKConfig.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CLLTKConfig.cmake"
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CLLTK
)
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/CLLTKConfigVersion.cmake"
VERSION ${CLLTK_VERSION_STRING}
COMPATIBILITY SameMajorVersion
)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/CLLTKConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/CLLTKConfigVersion.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/CLLTK
COMPONENT devel
)
# CPack packaging (must be last)
include(cmake/CreatePackage.cmake)