-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
883 lines (782 loc) · 22 KB
/
Copy pathCMakeLists.txt
File metadata and controls
883 lines (782 loc) · 22 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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
# Copyright (c) Meta Platforms, Inc. and affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 3.9)
project(bgp)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(BUILD_WITH_LTO "BUILD_WITH_LTO" OFF)
if (BUILD_WITH_LTO)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BINARY_DIR})
set(
CMAKE_MODULE_PATH
"${CMAKE_SOURCE_DIR}/build/fbcode_builder/CMake"
"${CMAKE_SOURCE_DIR}"
${CMAKE_MODULE_PATH}
)
include(FBThriftCppLibrary)
include(FBGenCMakeBuildInfo)
#
# Find dependencies
#
set(REQ_BOOST_COMPONENTS
${REQ_BOOST_COMPONENTS}
system thread context filesystem program_options regex
)
find_package(Boost REQUIRED COMPONENTS ${REQ_BOOST_COMPONENTS})
find_package(folly CONFIG REQUIRED)
find_package(fb303 CONFIG REQUIRED)
find_package(fizz REQUIRED)
find_package(fmt REQUIRED)
find_package(Gflags REQUIRED)
find_package(Glog REQUIRED)
find_package(FBThrift CONFIG REQUIRED)
find_package(wangle REQUIRED)
find_package(Threads REQUIRED)
find_package(magic_enum CONFIG REQUIRED)
find_package(GTest REQUIRED)
find_library(DOUBLE-CONVERSION double-conversion)
find_library(RE2 re2)
find_library(ZSTD zstd)
find_library(CFGR_FBOSS_COMMON cfgr_fboss_common_cpp2 REQUIRED)
find_library(FBOSS_ALERT_LOGGER alert_logger)
find_library(FBOSS_LOG_THRIFT_CALL log_thrift_call)
find_path(RE2_INCLUDE_DIR re2/re2.h)
# FBOSS install (D104850229 deposits headers under installed/fboss/include and
# static libs under installed/fboss/lib). fboss does not ship a
# fbossConfig.cmake, so we wire it manually via find_path/find_library.
find_path(FBOSS_INCLUDE_DIR fboss/agent/AddressUtil.h REQUIRED)
include_directories(SYSTEM ${FBOSS_INCLUDE_DIR})
# FBOSS headers include <gtest/gtest_prod.h> for FRIEND_TEST macros;
# make the GTest include path available globally. GTestConfig.cmake
# provides imported targets but may not set GTEST_INCLUDE_DIRS;
# extract the include directory from the imported target.
get_target_property(GTEST_INCLUDE_DIR
GTest::gtest INTERFACE_INCLUDE_DIRECTORIES)
include_directories(SYSTEM ${GTEST_INCLUDE_DIR})
set(_fboss_lib_names
address_utils
nodebase
radix_tree
exponential_back_off
# ctrl_cpp2 and its transitive thrift dependencies. FBOSS ships no
# fbossConfig.cmake so the consumer must list every transitive static
# lib explicitly. Order matters for one-pass linkers: dependents
# before their dependencies (deepest leaf libs last).
ctrl_cpp2
agent_stats_cpp2
hardware_stats_cpp2
asic_temp_cpp2
mka_structs_cpp2
transceiver_cpp2
product_info_cpp2
prbs_cpp2
link_cpp2
phy_cpp2
platform_config_cpp2
bcm_config_cpp2
asic_config_cpp2
asic_config_v2_cpp2
switch_config_cpp2
fboss_cpp2
optic_cpp2
mpls_cpp2
io_stats_cpp2
common_cpp2
fboss_common_cpp2
fboss_error
fboss_types
# FSDB client libraries for FsdbSyncer. Same pattern as ctrl_cpp2 above:
# dependents before dependencies for one-pass linkers.
fsdb_syncer
fsdb_pub_sub
fsdb_sub_mgr
fsdb_stream_client
fsdb_flags
fsdb_utils
fsdb_model_cpp2
thriftpath_lib
fsdb_common_cpp2
fsdb_oper_cpp2
fsdb_cpp2
cow_storage_mgr
oper_path_helpers
common_thrift_utils
thrift_service_client
# COW subscription instantiations (FsdbCowStateSubManager for NeighborWatcher)
fsdb_cow_state_sub_mgr
fsdb_cow_storage
fsdb_cow_root
# FSDB model transitive thrift deps (agent state/config/info types)
switch_state_cpp2
agent_config_cpp2
agent_info_cpp2
switch_reachability_cpp2
qsfp_state_cpp2
qsfp_stats_cpp2
sensor_service_stats_cpp2
# Leaf thrift deps pulled in by qsfp_state/sensor_service above.
qsfp_config_cpp2
port_state_cpp2
pim_state_cpp2
sensor_service_cpp2
# thrift_cow C++ libraries backing the FsdbOperStateRoot COW storage
# (CowStorage::parse*Result, PatchApplier::decompressPatch, etc.).
# Ordering between these and the BGP++/FSDB thrift libs is handled by the
# --start-group wrapper in the bgp_bin link rule below.
patch_cpp2
cow_visitor_results_cpp2
storage
cow_storage
thrift_cow_serializer
thrift_cow_nodes
thrift_cow_visitors_common
thrift_cow_visitors
# FsdbOperStateRoot extern-template instantiation libs (declared deps of
# fsdb_cow_storage). Provide the PathVisitor (visitNode), PatchApplier, and
# ThriftStructNode instantiations over the oper-state tree.
fsdb_cow_root_path_visitor
fsdb_path_visitor_oper_state_instantiations
fsdb_patch_applier_oper_state_instantiations
fsdb_thrift_struct_oper_instantiations
# thrift_cow_nodes depends on cfgr_fboss_common_cpp2; keep it inside the
# link group so any references emitted by the COW node/visitor template
# instantiations above resolve regardless of one-pass ordering.
cfgr_fboss_common_cpp2
# Leaf thrift libs reached through the qsfp_state / sensor / service-client
# parts of the FsdbOperStateRoot model:
# - transceiver_validation_cpp2: FirmwarePair/TransceiverAttributes/VendorConfig
# - sensor_config_cpp2: sensor_config::Thresholds (dep of sensor_service.thrift)
# - qsfp_cpp2: Client<QsfpService> vtable (thrift_service_client createPlaintextClient)
transceiver_validation_cpp2
sensor_config_cpp2
qsfp_cpp2
)
set(FBOSS_LIBS)
foreach(_fboss_lib IN LISTS _fboss_lib_names)
find_library(FBOSS_${_fboss_lib}_LIB ${_fboss_lib} REQUIRED)
list(APPEND FBOSS_LIBS ${FBOSS_${_fboss_lib}_LIB})
endforeach()
# FBOSS's OSS fsdb_model.thrift includes bgp_config.thrift via the
# public_tld-prefixed path (neteng/fboss/bgp/public_tld/configerator/...).
# BGP++ builds bgp_config from the canonical configerator/ path (since
# public_tld IS our repo root). Create a symlink so FBOSS-installed
# headers that use the public_tld prefix resolve against our locally
# generated bgp_config headers.
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/neteng/fboss/bgp/public_tld)
file(CREATE_LINK
${CMAKE_BINARY_DIR}/configerator
${CMAKE_BINARY_DIR}/neteng/fboss/bgp/public_tld/configerator
SYMBOLIC)
# OpenR is NOT pulled via getdeps. The minimal slice BGP++ needs
# (Network.thrift, Platform.thrift, common/NetworkUtil) is vendored under
# public_tld/openr/. See public_tld/openr/PROVENANCE.md for the removal trigger.
set(FOLLY_EXCEPTION_TRACER)
if (TARGET Folly::folly_exception_tracer)
set(FOLLY_EXCEPTION_TRACER Folly::folly_exception_tracer)
endif()
add_compile_definitions(NO_FOLLY_EXCEPTION_TRACER)
add_compile_definitions(IS_OSS)
#
# Build thrift libs
#
set(BGP_THRIFT_LIBS)
add_fbthrift_cpp_library(
fb303_cpp2
common/fb303/if/fb303.thrift
SERVICES
FacebookService
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} fb303_cpp2)
# Vendored openr thrift IDL — see public_tld/openr/PROVENANCE.md
add_fbthrift_cpp_library(
openr_network_cpp2
openr/if/Network.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} openr_network_cpp2)
add_fbthrift_cpp_library(
openr_platform_cpp2
openr/if/Platform.thrift
SERVICES
FibService
OPTIONS
json
DEPENDS
openr_network_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} openr_platform_cpp2)
# Layer 0 — no inter-project dependencies
add_fbthrift_cpp_library(
network_address_cpp2
common/network/if/Address.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} network_address_cpp2)
add_fbthrift_cpp_library(
routing_policy_cpp2
configerator/structs/neteng/bgp_policy/thrift/routing_policy.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} routing_policy_cpp2)
add_fbthrift_cpp_library(
nsf_policy_cpp2
configerator/structs/neteng/bgp_policy/thrift/nsf_policy.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} nsf_policy_cpp2)
add_fbthrift_cpp_library(
bgp_attr_cpp2
configerator/structs/neteng/fboss/bgp/if/bgp_attr.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_attr_cpp2)
add_fbthrift_cpp_library(
netwhoami_cpp2
configerator/structs/neteng/netwhoami/netwhoami.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} netwhoami_cpp2)
add_fbthrift_cpp_library(
bgp_cpp2
neteng/fboss/bgp/if/bgp.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_cpp2)
# bgp_thrift.thrift includes neteng/fboss/bgp/if/policy_thrift.thrift, so the
# OSS build needs a thrift target for policy_thrift to generate
# policy_thrift_types.h that bgp_thrift_types.h #includes.
add_fbthrift_cpp_library(
bgp_policy_thrift_cpp2
neteng/fboss/bgp/if/policy_thrift.thrift
OPTIONS
json
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_policy_thrift_cpp2)
# Layer 1 — depends on Layer 0
add_fbthrift_cpp_library(
bgp_policy_cpp2
configerator/structs/neteng/bgp_policy/thrift/bgp_policy.thrift
OPTIONS
json
DEPENDS
nsf_policy_cpp2
routing_policy_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_policy_cpp2)
add_fbthrift_cpp_library(
bgp_structs_cpp2
neteng/fboss/bgp/if/BgpStructs.thrift
OPTIONS
json
DEPENDS
network_address_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_structs_cpp2)
# Layer 2 — depends on Layer 0+1
add_fbthrift_cpp_library(
rib_policy_cpp2
configerator/structs/neteng/bgp_policy/thrift/rib_policy.thrift
OPTIONS
json
DEPENDS
bgp_policy_cpp2
routing_policy_cpp2
bgp_attr_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} rib_policy_cpp2)
add_fbthrift_cpp_library(
bgp_route_types_cpp2
neteng/fboss/bgp/if/bgp_route_types.thrift
OPTIONS
json
DEPENDS
bgp_attr_cpp2
rib_policy_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_route_types_cpp2)
add_fbthrift_cpp_library(
bgp_config_cpp2
configerator/structs/neteng/fboss/bgp/bgp_config.thrift
OPTIONS
json
DEPENDS
bgp_policy_cpp2
bgp_attr_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_config_cpp2)
# Layer 3 — service thrift files
add_fbthrift_cpp_library(
bgp_thrift_cpp2
neteng/fboss/bgp/if/bgp_thrift.thrift
SERVICES
TBgpService
OPTIONS
json
DEPENDS
rib_policy_cpp2
bgp_policy_cpp2
bgp_policy_thrift_cpp2
bgp_config_cpp2
bgp_attr_cpp2
fb303_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_thrift_cpp2)
add_fbthrift_cpp_library(
bgp_stream_cpp2
neteng/fboss/bgp/if/bgp_stream.thrift
SERVICES
TBgpServiceStream
OPTIONS
json
DEPENDS
bgp_structs_cpp2
fb303_cpp2
)
set(BGP_THRIFT_LIBS ${BGP_THRIFT_LIBS} bgp_stream_cpp2)
add_build_info(build_info)
install(TARGETS
${BGP_THRIFT_LIBS}
DESTINATION lib
)
#
# Common external dependencies
#
set(BGP_BASE_LIBS
Folly::folly
glog::glog
gflags
Threads::Threads
${Boost_LIBRARIES}
magic_enum::magic_enum
)
# NOTE: ${FBOSS_LIBS} is intentionally NOT part of BGP_BASE_LIBS. The FBOSS
# static archives and the BGP++/FSDB thrift libs (${BGP_THRIFT_LIBS}) have
# bidirectional dependencies (e.g. FBOSS fsdb_model.thrift includes
# bgp_config.thrift, while BGP++ links the FsdbOperStateRoot COW model), so
# they must be linked together inside a single --start-group on the final
# bgp_bin executable (see below). Intermediate static libs only need the
# headers, which come from the include path.
#
# OpenR libraries (vendored — see public_tld/openr/PROVENANCE.md).
# Satisfies Network_types / Platform_types / NetworkUtil references that
# leak into core BGP++ code via nexthopTracker headers.
#
add_library(openr_networkutil openr/common/NetworkUtil.cpp)
target_link_libraries(openr_networkutil
${BGP_BASE_LIBS}
openr_network_cpp2
)
# Vendored openr::SystemMetrics — used by cpp/watchdog/Watchdog.h.
add_library(openr_systemmetrics openr/monitor/SystemMetrics.cpp)
target_link_libraries(openr_systemmetrics
${BGP_BASE_LIBS}
${RE2}
)
set(OPENR_LIBS
openr_networkutil
openr_systemmetrics
openr_platform_cpp2
openr_network_cpp2
)
#
# Tier 0: Leaf libraries (no bgp/cpp cross-module deps)
#
add_library(bgp_routelib
neteng/fboss/bgp/cpp/routelib/RouteFilter.cpp
neteng/fboss/bgp/cpp/routelib/RouteSelector.cpp
)
target_link_libraries(bgp_routelib
${BGP_BASE_LIBS}
)
add_library(bgp_lib_core
neteng/fboss/bgp/cpp/lib/BgpAttributesSmartSet.cpp
neteng/fboss/bgp/cpp/lib/BgpAttributesWrapper.cpp
neteng/fboss/bgp/cpp/lib/BgpMessageSerializer.cpp
neteng/fboss/bgp/cpp/lib/BgpStructs.cpp
neteng/fboss/bgp/cpp/lib/BgpUtil.cpp
)
target_link_libraries(bgp_lib_core
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
)
#
# Tier 1: Foundation
#
add_library(bgp_stats_base
neteng/fboss/bgp/cpp/stats/StatsBase.cpp
)
target_link_libraries(bgp_stats_base
fb303::fb303
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
)
add_library(bgp_stats_dc
neteng/fboss/bgp/cpp/stats/StatsDC.cpp
)
target_link_libraries(bgp_stats_dc
bgp_stats_base
fb303::fb303
${BGP_BASE_LIBS}
)
add_library(bgp_common
neteng/fboss/bgp/cpp/common/BuildInfo.cpp
neteng/fboss/bgp/cpp/common/BgpModuleBase.cpp
neteng/fboss/bgp/cpp/common/BgpPath.cpp
neteng/fboss/bgp/cpp/common/FeatureFlags.cpp
neteng/fboss/bgp/cpp/common/RouteInfo.cpp
neteng/fboss/bgp/cpp/common/Utils.cpp
neteng/fboss/bgp/cpp/lib/BgpMessageParser.cpp
neteng/fboss/bgp/cpp/lib/detail/BgpMessageParserUtils.cpp
)
target_link_libraries(bgp_common
bgp_lib_core
bgp_routelib
bgp_stats_base
build_info
fb303::fb303
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
${OPENR_LIBS}
${RE2}
)
add_library(bgp_changetracker
neteng/fboss/bgp/cpp/changeTracker/ChangeTrackerDebug.cpp
neteng/fboss/bgp/cpp/changeTracker/ConsumerBitManager.cpp
)
target_link_libraries(bgp_changetracker
bgp_common
)
#
# Tier 2: Infrastructure
#
add_library(bgp_config_policy
neteng/fboss/bgp/cpp/config/Config.cpp
neteng/fboss/bgp/cpp/config/ConfigManager.cpp
neteng/fboss/bgp/cpp/config/ConfigStructs.cpp
neteng/fboss/bgp/cpp/config/ConfigUtils.cpp
neteng/fboss/bgp/cpp/policy/Policy.cpp
neteng/fboss/bgp/cpp/policy/PolicyAction.cpp
neteng/fboss/bgp/cpp/policy/PolicyManager.cpp
neteng/fboss/bgp/cpp/policy/PolicyMatch.cpp
neteng/fboss/bgp/cpp/policy/PolicyTerm.cpp
neteng/fboss/bgp/cpp/policy/PolicyUtils.cpp
neteng/fboss/bgp/cpp/policy/base/PolicyMatchBase.cpp
neteng/fboss/bgp/cpp/policy/base/PolicyUtils.cpp
)
target_link_libraries(bgp_config_policy
bgp_lib_core
bgp_common
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
)
add_library(bgp_watchdog
neteng/fboss/bgp/cpp/watchdog/MemProfiler.cpp
neteng/fboss/bgp/cpp/watchdog/MonitoredModule.cpp
neteng/fboss/bgp/cpp/watchdog/QueryTree.cpp
neteng/fboss/bgp/cpp/watchdog/Watchdog.cpp
)
target_link_libraries(bgp_watchdog
bgp_lib_core
bgp_common
bgp_config_policy
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
)
#
# Tier 3: Transport
#
add_library(bgp_lib_transport
neteng/fboss/bgp/cpp/lib/fibers/BgpPeerDisplayInfo.cpp
neteng/fboss/bgp/cpp/lib/fibers/BgpSerializer.cpp
neteng/fboss/bgp/cpp/lib/fibers/FiberBgpParser.cpp
neteng/fboss/bgp/cpp/lib/fibers/FiberBgpPeer.cpp
neteng/fboss/bgp/cpp/lib/fibers/FiberBgpPeerManager.cpp
neteng/fboss/bgp/cpp/lib/fibers/FiberServerSocket.cpp
neteng/fboss/bgp/cpp/lib/fibers/FiberSocket.cpp
neteng/fboss/bgp/cpp/lib/fibers/Utils.cpp
)
target_link_libraries(bgp_lib_transport
bgp_lib_core
bgp_common
bgp_watchdog
bgp_config_policy
)
add_library(bgp_nexthop
neteng/fboss/bgp/cpp/nexthopTracker/InterfaceEntry.cpp
neteng/fboss/bgp/cpp/nexthopTracker/NexthopCache.cpp
neteng/fboss/bgp/cpp/nexthopTracker/NexthopHandler.cpp
)
# NOTE: NetlinkWrapper.cpp is intentionally excluded from the OSS build. It
# pulls openr/messaging + openr/nl which are not vendored (BGP++ doesn't
# need them in OSS — netlink-based nexthop tracking is BB-only). The
# corresponding header is filtered from the install set below.
target_link_libraries(bgp_nexthop
bgp_common
bgp_lib_core
bgp_lib_transport
bgp_watchdog
FBThrift::thriftcpp2
${OPENR_LIBS}
)
add_library(bgp_fsdb_fib_watcher
neteng/fboss/bgp/cpp/nexthopTracker/FsdbFibWatcher.cpp
)
target_link_libraries(bgp_fsdb_fib_watcher
bgp_common
bgp_nexthop
bgp_stats_dc
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
FBThrift::thriftcpp2
)
#
# Tier 4: Core routing
#
# FIB implementations — separated per code boundary rules (DC / EBB / Dev)
add_library(bgp_fib_holddown
neteng/fboss/bgp/cpp/rib/FibProgrammingHolddown.cpp
)
target_link_libraries(bgp_fib_holddown
${BGP_BASE_LIBS}
)
add_library(bgp_fib_dev
neteng/fboss/bgp/cpp/rib/FibDev.cpp
)
target_link_libraries(bgp_fib_dev
bgp_common
bgp_lib_core
${CFGR_FBOSS_COMMON}
${BGP_BASE_LIBS}
)
add_library(bgp_fib_fboss
neteng/fboss/bgp/cpp/rib/FibFboss.cpp
)
target_link_libraries(bgp_fib_fboss
bgp_common
bgp_fib_holddown
bgp_lib_core
${CFGR_FBOSS_COMMON}
FBThrift::thriftcpp2
${BGP_BASE_LIBS}
)
add_library(bgp_fsdb_syncer
neteng/fboss/bgp/cpp/fsdb/FsdbSyncer.cpp
)
target_link_libraries(bgp_fsdb_syncer
fb303::fb303
${BGP_THRIFT_LIBS}
${BGP_BASE_LIBS}
FBThrift::thriftcpp2
)
add_library(bgp_rib
neteng/fboss/bgp/cpp/rib/CanonicalConvert.cpp
neteng/fboss/bgp/cpp/rib/CanonicalRibBuilder.cpp
neteng/fboss/bgp/cpp/rib/RibBase.cpp
neteng/fboss/bgp/cpp/rib/RibDC.cpp
neteng/fboss/bgp/cpp/rib/RibEntry.cpp
neteng/fboss/bgp/cpp/rib/RibPolicy.cpp
neteng/fboss/bgp/cpp/rib/RibPolicyLogger.cpp
neteng/fboss/bgp/cpp/rib/RouteInfoFilter.cpp
neteng/fboss/bgp/cpp/rib/RouteInfoSelector.cpp
neteng/fboss/bgp/cpp/rib/Utils.cpp
)
target_link_libraries(bgp_rib
bgp_common
bgp_config_policy
bgp_fib_dev
bgp_fib_fboss
bgp_fsdb_syncer
bgp_lib_core
bgp_nexthop
bgp_routelib
bgp_stats_dc
bgp_watchdog
FBThrift::thriftcpp2
${OPENR_LIBS}
)
add_library(bgp_adjrib
neteng/fboss/bgp/cpp/adjrib/AdjRib.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibCommon.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibGroup.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibGroupSerializer.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibIn.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibOut.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibPolicyCache.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibShow.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibStats.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibStructs.cpp
neteng/fboss/bgp/cpp/adjrib/AdjRibUtil.cpp
neteng/fboss/bgp/cpp/adjrib/LegacyV4NlriEncoding.cpp
neteng/fboss/bgp/cpp/adjrib/PathIdGenerator.cpp
neteng/fboss/bgp/cpp/adjrib/RouteFilterLogger.cpp
neteng/fboss/bgp/cpp/adjrib/UpdateGroupManager.cpp
neteng/fboss/bgp/cpp/adjrib/WellKnownCommunityFilter.cpp
)
target_link_libraries(bgp_adjrib
bgp_changetracker
bgp_common
bgp_config_policy
bgp_lib_core
bgp_lib_transport
bgp_rib
bgp_watchdog
${FBOSS_ALERT_LOGGER}
${OPENR_LIBS}
)
add_library(bgp_peer
neteng/fboss/bgp/cpp/peer/PeerManagerBase.cpp
neteng/fboss/bgp/cpp/peer/PeerManagerUtils.cpp
neteng/fboss/bgp/cpp/peer/SessionManager.cpp
neteng/fboss/bgp/cpp/peer/NeighborWatcher.cpp
)
target_link_libraries(bgp_peer
bgp_adjrib
bgp_changetracker
bgp_common
bgp_config_policy
bgp_fsdb_fib_watcher
bgp_lib_core
bgp_lib_transport
bgp_nexthop
bgp_rib
bgp_stats_base
bgp_watchdog
FBThrift::thriftcpp2
${OPENR_LIBS}
)
#
# Tier 5: Application
#
add_library(bgp_service
neteng/fboss/bgp/cpp/BgpServiceBase.cpp
neteng/fboss/bgp/cpp/BgpServiceDC.cpp
neteng/fboss/bgp/cpp/BgpServiceStream.cpp
neteng/fboss/bgp/cpp/BgpServiceEventHandler.cpp
neteng/fboss/bgp/cpp/BgpServiceUtil.cpp
neteng/fboss/bgp/cpp/BgpConfigValidator.cpp
neteng/fboss/bgp/cpp/BgpProfiler.cpp
neteng/fboss/bgp/cpp/health/HealthValidator.cpp
)
target_link_libraries(bgp_service
${FBOSS_ALERT_LOGGER}
${FBOSS_LOG_THRIFT_CALL}
bgp_common
bgp_config_policy
bgp_lib_core
bgp_peer
bgp_rib
bgp_stats_dc
bgp_watchdog
${RE2}
FBThrift::thriftcpp2
fb303::fb303
${OPENR_LIBS}
)
install(TARGETS
bgp_stats_base
bgp_stats_dc
bgp_routelib
bgp_lib_core
bgp_common
bgp_changetracker
bgp_config_policy
bgp_watchdog
bgp_lib_transport
bgp_nexthop
bgp_fsdb_fib_watcher
bgp_fib_holddown
bgp_fib_dev
bgp_fib_fboss
bgp_fsdb_syncer
bgp_rib
bgp_adjrib
bgp_peer
bgp_service
DESTINATION lib
)
#
# BGP++ binary
#
add_executable(bgp_bin
neteng/fboss/bgp/cpp/MainOSS.cpp
)
# The BGP++/FSDB thrift libs and the FBOSS static archives cross-reference
# each other (FBOSS fsdb_model.thrift -> bgp_config.thrift; BGP++ ->
# FsdbOperStateRoot COW model; thrift_cow_nodes <-> thrift_cow_visitors), so a
# single one-pass scan cannot resolve them. Wrap both sets in a RESCAN link
# group (--start-group/--end-group) so the linker iterates until all
# cross-references are satisfied. LINK_GROUP also consolidates the same
# archives reached transitively, avoiding duplicate/out-of-group placement.
set(_bgp_grouped_libs ${BGP_THRIFT_LIBS} ${FBOSS_LIBS})
list(JOIN _bgp_grouped_libs "," _bgp_grouped_libs_csv)
target_link_libraries(bgp_bin
bgp_service
bgp_stats_base
bgp_stats_dc
build_info
"$<LINK_GROUP:RESCAN,${_bgp_grouped_libs_csv}>"
${BGP_BASE_LIBS}
FBThrift::thriftcpp2
${FOLLY_EXCEPTION_TRACER}
)
set_target_properties(bgp_bin PROPERTIES OUTPUT_NAME bgp)
install(TARGETS
bgp_bin
DESTINATION sbin
)
#
# Install files
#
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/neteng
DESTINATION include
FILES_MATCHING
PATTERN "*.h"
# facebook/ subdirs hold Meta-internal-only code (MainBB, FibEbb,
# MemProfiler) and must not ship in OSS.
PATTERN "facebook" EXCLUDE
# RibBB lives in cpp/rib/ (not facebook/) but is BB-only.
PATTERN "RibBB.h" EXCLUDE
# StatsBB is linked only into the Meta-internal backbone binary.
PATTERN "StatsBB.h" EXCLUDE
# NetlinkWrapper.h pulls openr/messaging + openr/nl, neither vendored.
PATTERN "NetlinkWrapper.h" EXCLUDE
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/neteng
DESTINATION include
FILES_MATCHING PATTERN "*.thrift"
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/configerator
DESTINATION include
FILES_MATCHING PATTERN "*.thrift"
)
install(
DIRECTORY ${CMAKE_SOURCE_DIR}/common
DESTINATION include
FILES_MATCHING PATTERN "*.thrift"
)