]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/fiber/CMakeLists.txt
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / libs / fiber / CMakeLists.txt
1 # Copyright 2020, 2021 Peter Dimov
2 # Distributed under the Boost Software License, Version 1.0.
3 # https://www.boost.org/LICENSE_1_0.txt
4
5 cmake_minimum_required(VERSION 3.8...3.20)
6
7 project(boost_fiber VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX)
8
9 if(WIN32 AND NOT CMAKE_CXX_PLATFORM_ID MATCHES "Cygwin")
10 set(_default_target windows)
11 elseif(CMAKE_SYSTEM_NAME STREQUAL Linux)
12 set(_default_target linux)
13 else()
14 set(_default_target none)
15 endif()
16
17 set(BOOST_FIBER_NUMA_TARGET_OS "${_default_target}" CACHE STRING "Boost.Fiber target OS (aix, freebsd, hpux, linux, solaris, windows, none)")
18 set_property(CACHE BOOST_FIBER_NUMA_TARGET_OS PROPERTY STRINGS aix freebsd hpux linux solaris windows none)
19
20 unset(_default_target)
21
22 message(STATUS "Boost.Fiber: NUMA target OS is ${BOOST_FIBER_NUMA_TARGET_OS}")
23
24 # boost_fiber
25
26 add_library(boost_fiber
27 src/algo/algorithm.cpp
28 src/algo/round_robin.cpp
29 src/algo/shared_work.cpp
30 src/algo/work_stealing.cpp
31 src/barrier.cpp
32 src/condition_variable.cpp
33 src/context.cpp
34 src/fiber.cpp
35 src/future.cpp
36 src/mutex.cpp
37 src/properties.cpp
38 src/recursive_mutex.cpp
39 src/recursive_timed_mutex.cpp
40 src/scheduler.cpp
41 src/timed_mutex.cpp
42 src/waker.cpp
43 )
44
45 add_library(Boost::fiber ALIAS boost_fiber)
46
47 target_include_directories(boost_fiber PUBLIC include)
48
49 target_link_libraries(boost_fiber
50 PUBLIC
51 Boost::assert
52 Boost::config
53 Boost::context
54 Boost::core
55 Boost::intrusive
56 Boost::predef
57 Boost::smart_ptr
58 )
59
60 target_compile_features(boost_fiber PUBLIC cxx_std_11)
61
62 target_compile_definitions(boost_fiber
63 PUBLIC BOOST_FIBER_NO_LIB
64 PRIVATE BOOST_FIBER_SOURCE BOOST_FIBERS_SOURCE
65 )
66
67 if(BUILD_SHARED_LIBS)
68 target_compile_definitions(boost_fiber PUBLIC BOOST_FIBER_DYN_LINK BOOST_FIBERS_DYN_LINK)
69 else()
70 target_compile_definitions(boost_fiber PUBLIC BOOST_FIBER_STATIC_LINK)
71 endif()
72
73 # boost_fiber_numa
74
75 if(BOOST_FIBER_NUMA_TARGET_OS STREQUAL none)
76 set(NUMA_SOURCES
77 src/numa/pin_thread.cpp
78 src/numa/topology.cpp
79 )
80 else()
81 set(NUMA_SOURCES
82 src/numa/${BOOST_FIBER_NUMA_TARGET_OS}/pin_thread.cpp
83 src/numa/${BOOST_FIBER_NUMA_TARGET_OS}/topology.cpp
84 )
85 endif()
86
87 add_library(boost_fiber_numa
88 ${NUMA_SOURCES}
89 src/numa/algo/work_stealing.cpp
90 )
91
92 add_library(Boost::fiber_numa ALIAS boost_fiber_numa)
93
94 target_include_directories(boost_fiber_numa PUBLIC include)
95
96 target_link_libraries(boost_fiber_numa
97 PUBLIC
98 Boost::assert
99 Boost::config
100 Boost::context
101 Boost::fiber
102 Boost::smart_ptr
103 PRIVATE
104 Boost::algorithm
105 Boost::filesystem
106 Boost::format
107 )
108
109 target_compile_definitions(boost_fiber_numa
110 PUBLIC BOOST_FIBER_NO_LIB
111 PRIVATE BOOST_FIBER_SOURCE BOOST_FIBERS_SOURCE
112 )
113
114 if(BUILD_SHARED_LIBS)
115 target_compile_definitions(boost_fiber_numa PUBLIC BOOST_FIBER_DYN_LINK BOOST_FIBERS_DYN_LINK)
116 else()
117 target_compile_definitions(boost_fiber_numa PUBLIC BOOST_FIBER_STATIC_LINK)
118 endif()
119
120 # Install
121
122 if(BOOST_SUPERPROJECT_VERSION AND NOT CMAKE_VERSION VERSION_LESS 3.13)
123 boost_install(TARGETS boost_fiber boost_fiber_numa VERSION ${BOOST_SUPERPROJECT_VERSION} HEADER_DIRECTORY include)
124 endif()
125
126 # Test
127
128 if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
129
130 add_subdirectory(test)
131
132 endif()