Skip to content

Commit cba5f7a

Browse files
authored
Merge pull request #658 from elbeno/lib-split
Split off a few libraries
2 parents ba5f67c + 448122d commit cba5f7a

File tree

17 files changed

+154
-76
lines changed

17 files changed

+154
-76
lines changed

CMakeLists.txt

Lines changed: 80 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,85 @@ add_versioned_package("gh:intel/cpp-baremetal-concurrency#7c5b26c")
2828
add_versioned_package("gh:intel/cpp-std-extensions#2512bcf")
2929
add_versioned_package("gh:intel/cpp-baremetal-senders-and-receivers#73d95bc")
3030

31+
add_library(cib_sc INTERFACE)
32+
target_compile_features(cib_sc INTERFACE cxx_std_20)
33+
target_link_libraries_system(cib_sc INTERFACE fmt::fmt-header-only stdx)
34+
35+
target_sources(
36+
cib_sc
37+
INTERFACE FILE_SET
38+
sc
39+
TYPE
40+
HEADERS
41+
BASE_DIRS
42+
include
43+
FILES
44+
include/sc/format.hpp
45+
include/sc/fwd.hpp
46+
include/sc/lazy_string_format.hpp
47+
include/sc/string_constant.hpp)
48+
49+
add_library(cib_match INTERFACE)
50+
target_compile_features(cib_match INTERFACE cxx_std_20)
51+
target_link_libraries_system(cib_match INTERFACE cib_sc stdx)
52+
53+
target_sources(
54+
cib_match
55+
INTERFACE FILE_SET
56+
match
57+
TYPE
58+
HEADERS
59+
BASE_DIRS
60+
include
61+
FILES
62+
include/match/and.hpp
63+
include/match/bin_op.hpp
64+
include/match/concepts.hpp
65+
include/match/constant.hpp
66+
include/match/cost.hpp
67+
include/match/implies.hpp
68+
include/match/negate.hpp
69+
include/match/not.hpp
70+
include/match/ops.hpp
71+
include/match/or.hpp
72+
include/match/predicate.hpp
73+
include/match/simplify.hpp
74+
include/match/sum_of_products.hpp)
75+
76+
add_library(cib_interrupt INTERFACE)
77+
target_compile_features(cib_interrupt INTERFACE cxx_std_20)
78+
target_link_libraries_system(cib_interrupt INTERFACE cib_sc concurrency stdx)
79+
80+
target_sources(
81+
cib_interrupt
82+
INTERFACE FILE_SET
83+
interrupt
84+
TYPE
85+
HEADERS
86+
BASE_DIRS
87+
include
88+
FILES
89+
include/interrupt/concepts.hpp
90+
include/interrupt/config.hpp
91+
include/interrupt/dynamic_controller.hpp
92+
include/interrupt/fwd.hpp
93+
include/interrupt/hal.hpp
94+
include/interrupt/impl.hpp
95+
include/interrupt/manager.hpp
96+
include/interrupt/policies.hpp)
97+
3198
add_library(cib INTERFACE)
3299
target_compile_features(cib INTERFACE cxx_std_20)
33-
target_link_libraries_system(cib INTERFACE async concurrency
34-
fmt::fmt-header-only stdx)
100+
target_link_libraries_system(
101+
cib
102+
INTERFACE
103+
async
104+
cib_interrupt
105+
cib_match
106+
cib_sc
107+
concurrency
108+
fmt::fmt-header-only
109+
stdx)
35110

36111
target_sources(
37112
cib
@@ -80,24 +155,6 @@ target_sources(
80155
include/flow/run.hpp
81156
include/flow/step.hpp)
82157

83-
target_sources(
84-
cib
85-
INTERFACE FILE_SET
86-
interrupt
87-
TYPE
88-
HEADERS
89-
BASE_DIRS
90-
include
91-
FILES
92-
include/interrupt/concepts.hpp
93-
include/interrupt/config.hpp
94-
include/interrupt/dynamic_controller.hpp
95-
include/interrupt/fwd.hpp
96-
include/interrupt/hal.hpp
97-
include/interrupt/impl.hpp
98-
include/interrupt/manager.hpp
99-
include/interrupt/policies.hpp)
100-
101158
target_sources(
102159
cib
103160
INTERFACE FILE_SET
@@ -131,29 +188,6 @@ target_sources(
131188
include/lookup/strategies.hpp
132189
include/lookup/strategy_failed.hpp)
133190

134-
target_sources(
135-
cib
136-
INTERFACE FILE_SET
137-
match
138-
TYPE
139-
HEADERS
140-
BASE_DIRS
141-
include
142-
FILES
143-
include/match/and.hpp
144-
include/match/bin_op.hpp
145-
include/match/concepts.hpp
146-
include/match/constant.hpp
147-
include/match/cost.hpp
148-
include/match/implies.hpp
149-
include/match/negate.hpp
150-
include/match/not.hpp
151-
include/match/ops.hpp
152-
include/match/or.hpp
153-
include/match/predicate.hpp
154-
include/match/simplify.hpp
155-
include/match/sum_of_products.hpp)
156-
157191
target_sources(
158192
cib
159193
INTERFACE FILE_SET
@@ -179,20 +213,6 @@ target_sources(
179213
include/msg/send.hpp
180214
include/msg/service.hpp)
181215

182-
target_sources(
183-
cib
184-
INTERFACE FILE_SET
185-
sc
186-
TYPE
187-
HEADERS
188-
BASE_DIRS
189-
include
190-
FILES
191-
include/sc/format.hpp
192-
include/sc/fwd.hpp
193-
include/sc/lazy_string_format.hpp
194-
include/sc/string_constant.hpp)
195-
196216
target_sources(
197217
cib
198218
INTERFACE FILE_SET
@@ -209,6 +229,9 @@ target_sources(
209229
if(PROJECT_IS_TOP_LEVEL)
210230
add_docs(docs)
211231
clang_tidy_interface(cib)
232+
clang_tidy_interface(cib_interrupt)
233+
clang_tidy_interface(cib_match)
234+
clang_tidy_interface(cib_sc)
212235

213236
# Enable functional and performance test suites.
214237
add_subdirectory(test)

include/log/log.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,6 @@ struct config {
3232

3333
template <typename...> inline auto config = null::config{};
3434

35-
template <typename T>
36-
concept loggable = requires(T const &t) {
37-
t.apply([]<typename StringType>(StringType, auto const &...) {});
38-
};
39-
4035
struct default_flavor_t;
4136

4237
template <typename Flavor, typename... Ts>

include/match/concepts.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#pragma once
22

3-
#include <log/log.hpp>
3+
#include <sc/fwd.hpp>
44

55
#include <concepts>
66
#include <type_traits>
@@ -12,7 +12,7 @@ concept matcher = requires { typename std::remove_cvref_t<T>::is_matcher; };
1212
template <typename T, typename Event>
1313
concept matcher_for = matcher<T> and requires(T const &t, Event const &e) {
1414
{ t(e) } -> std::convertible_to<bool>;
15-
{ t.describe() } -> logging::loggable;
16-
{ t.describe_match(e) } -> logging::loggable;
15+
{ t.describe() } -> sc::sc_like;
16+
{ t.describe_match(e) } -> sc::sc_like;
1717
};
1818
} // namespace match

include/msg/detail/separate_sum_terms.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <stdx/concepts.hpp>
99
#include <stdx/tuple.hpp>
10+
#include <stdx/tuple_algorithms.hpp>
1011
#include <stdx/type_traits.hpp>
1112

1213
#include <type_traits>

include/sc/fwd.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,10 @@ template <stdx::ct_string S> CONSTEVAL auto operator""_sc() {
3737
return stdx::ct_string_to_type<S, string_constant>();
3838
}
3939
} // namespace literals
40+
41+
template <typename T>
42+
concept sc_like = requires(T const &t) {
43+
t.apply([]<typename StringType>(StringType, auto const &...) {});
44+
};
4045
} // namespace sc
4146
using sc::literals::operator""_sc;

test/CMakeLists.txt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
function(add_tests)
2+
set(multiValueArgs FILES LIBRARIES)
3+
cmake_parse_arguments(AT "" "" "${multiValueArgs}" ${ARGN})
4+
25
get_filename_component(prefix ${CMAKE_CURRENT_SOURCE_DIR} NAME)
3-
foreach(name ${ARGN})
6+
foreach(name ${AT_FILES})
47
string(REPLACE "/" "_" test ${name})
58
add_unit_test(
69
"${prefix}_${test}_test"
@@ -9,7 +12,7 @@ function(add_tests)
912
"${name}.cpp"
1013
LIBRARIES
1114
warnings
12-
cib)
15+
${AT_LIBRARIES})
1316
endforeach()
1417
endfunction()
1518

test/cib/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,8 @@
1-
add_tests(builder_meta callback nexus readme_hello_world)
1+
add_tests(
2+
FILES
3+
builder_meta
4+
callback
5+
nexus
6+
readme_hello_world
7+
LIBRARIES
8+
cib)

test/flow/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,15 @@ add_unit_test(
88
warnings
99
cib)
1010

11-
add_tests(flow graph graph_builder logging log_levels custom_log_levels)
11+
add_tests(
12+
FILES
13+
flow
14+
graph
15+
graph_builder
16+
logging
17+
log_levels
18+
custom_log_levels
19+
LIBRARIES
20+
cib)
1221

1322
add_subdirectory(fail)

test/interrupt/CMakeLists.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
add_tests(
2+
FILES
23
dynamic_controller
34
irq_impl
45
manager
56
shared_irq_impl
67
shared_sub_irq_impl
78
sub_irq_impl
8-
policies)
9+
policies
10+
LIBRARIES
11+
cib_interrupt)

test/log/CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
add_tests(fmt_logger log mipi_encoder mipi_logger module_id)
1+
add_tests(
2+
FILES
3+
fmt_logger
4+
log
5+
mipi_encoder
6+
mipi_logger
7+
module_id
8+
LIBRARIES
9+
cib)
210

311
add_library(catalog1_lib STATIC catalog1_lib.cpp)
412
add_library(catalog2_lib OBJECT catalog2a_lib.cpp catalog2b_lib.cpp)

0 commit comments

Comments
 (0)