-
Notifications
You must be signed in to change notification settings - Fork 305
/
CMakeLists.txt
854 lines (786 loc) · 18.9 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
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
cmake_minimum_required(VERSION 3.8)
include(functions.cmake)
option(WITH_ASAN "Turn ON address sanitizer build options" OFF)
if ($ENV{WITH_ASAN})
message(STATUS "ENV WITH_ASAN is set")
set (WITH_ASAN ON)
endif()
if (WITH_ASAN)
message(STATUS "Building WITH_ASAN")
endif()
option(BENCHMARK_INSTALL "Installation of benchmark test binaries" OFF)
if ($ENV{BENCHMARK_INSTALL})
message(STATUS "ENV BENCHMARK_INSTALL is set")
set (BENCHMARK_INSTALL ON)
endif()
if (BENCHMARK_INSTALL)
message(STATUS "Configured to install benchmark binaries")
endif()
option(BUILD_SAI_FAKE "Build sai binaries for fake_sai" OFF)
if ($ENV{BUILD_SAI_FAKE})
message(STATUS "ENV BUILD_SAI_FAKE is set")
set (BUILD_SAI_FAKE ON)
endif()
option(GITHUB_ACTIONS_BUILD
"Enables custom targets specific to GitHub Actions automation"
OFF)
if ($ENV{GITHUB_ACTIONS_BUILD})
message(STATUS "ENV GITHUB_ACTIONS_BUILD is set")
set (GITHUB_ACTIONS_BUILD ON)
endif()
option(BUILD_SAI_FAKE_BENCHMARKS "Build benchmarks binaries for fake_sai" OFF)
if ($ENV{BUILD_SAI_FAKE_BENCHMARKS})
message(STATUS "ENV BUILD_SAI_FAKE_BENCHMARKS is set")
set (BUILD_SAI_FAKE_BENCHMARKS ON)
endif()
if (BUILD_SAI_FAKE_BENCHMARKS)
message(STATUS "Building benchmarks binaries for fake_sai")
endif()
option(SKIP_ALL_INSTALL "Installation of fboss binaries" OFF)
if ($ENV{SKIP_ALL_INSTALL})
message(STATUS "ENV SKIP_ALL_INSTALL is set")
set (SKIP_ALL_INSTALL ON)
endif()
if (SKIP_ALL_INSTALL)
install(FILES README.md DESTINATION .)
macro (install)
message(STATUS "Skipping installing ${ARGV} fboss artifact")
_install(${ARGV} EXCLUDE_FROM_ALL)
endmacro ()
endif()
option(SAI_TAJO_IMPL "Build SAI api with tajo extensions" OFF)
if ($ENV{SAI_TAJO_IMPL})
message(STATUS "ENV SAI_TAJO_IMPL is set")
set (SAI_TAJO_IMPL ON)
endif()
option(SAI_BRCM_IMPL "Build SAI api with BRCM-SAI extensions" OFF)
if ($ENV{SAI_BRCM_IMPL})
message(STATUS "ENV SAI_BRCM_IMPL is set")
set (SAI_BRCM_IMPL ON)
endif()
option(CHENAB_SAI_SDK "Build SAI api with CHENAB-SAI extensions" OFF)
if ($ENV{CHENAB_SAI_SDK})
message(STATUS "ENV CHENAB_SAI_SDK is set")
set (CHENAB_SAI_SDK ON)
link_directories(/var/FBOSS/sai_impl/lib)
link_directories(/var/FBOSS/sdk/usr/lib64)
add_definitions (-DCHENAB_SAI_SDK)
endif()
option(BUILD_SAI_FAKE_LINK_TEST "Building of SAI Fake Link Test binaries" OFF)
if ($ENV{BUILD_SAI_FAKE_LINK_TEST})
message(STATUS "ENV BUILD_SAI_FAKE_LINK_TEST is set")
set (BUILD_SAI_FAKE_LINK_TEST ON)
endif()
if (BUILD_SAI_FAKE_LINK_TEST)
message(STATUS "Configured to build SAI Fake Link Test binaries")
endif()
if (SAI_BRCM_IMPL)
# TODO (skhare) IS_OSS_BRCM_SAI is only a short-term change to unblock.
# Refactor/fix the code and then remove this flag.
add_definitions (-DIS_OSS_BRCM_SAI=true)
# Build for BCM DNX by default. For XGS, set the ENV variable SAI_SDK_VERSION
# to build for BCM XGS.
set(SAI_SDK_VERSION "SAI_VERSION_11_0_EA_DNX_ODP")
endif()
set(SAI_VER_MAJOR "1")
set(SAI_VER_MINOR "14")
set(SAI_VER_RELEASE "0")
if (NOT "$ENV{SAI_SDK_VERSION}" STREQUAL "")
message(STATUS "ENV SAI_SDK_VERSION is set to $ENV{SAI_SDK_VERSION}")
set(SAI_SDK_VERSION "$ENV{SAI_SDK_VERSION}")
endif()
message(STATUS "Building for SAI_SDK_VERSION: ${SAI_SDK_VERSION}")
if (NOT "${SAI_SDK_VERSION}" STREQUAL "")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D${SAI_SDK_VERSION}")
endif()
message(STATUS "CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS}")
message(STATUS "Building for SAI Spec ${SAI_VER_MAJOR}.${SAI_VER_MINOR}.${SAI_VER_RELEASE}")
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/build/fbcode_builder/CMake"
${CMAKE_MODULE_PATH})
set (CMAKE_MODULE_PATH
"${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
if (POLICY CMP0054)
# Enable CMP0054 to indicate that we want the new safer if() argument behavior
cmake_policy(SET CMP0054 NEW)
endif()
project(FBOSS)
include(CMakeParseArguments)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
if (WITH_ASAN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O0 -g -static-libasan")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=all")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-omit-frame-pointer")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-common")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize-address-use-after-scope")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=alignment")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=null")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize=vptr")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libasan")
endif()
include_directories(${CMAKE_SOURCE_DIR})
include_directories(${CMAKE_BUILD_DIR})
find_package(GTest REQUIRED)
include_directories(
${GTEST_INCLUDE_DIRS}
)
find_package(GMock MODULE REQUIRED)
find_package(gflags REQUIRED)
include_directories(${GFLAGS_INCLUDE_DIR})
find_package(Glog REQUIRED)
include_directories(${GLOG_INCLUDE_DIRS})
find_package(folly CONFIG REQUIRED)
include_directories(${FOLLY_INCLUDE_DIR})
find_package(Boost REQUIRED)
include_directories(${Boost_INCLUDE_DIR})
find_package(fb303 CONFIG REQUIRED)
find_package(fizz CONFIG REQUIRED)
find_package(fmt CONFIG REQUIRED)
find_package(wangle CONFIG REQUIRED)
find_package(FBThrift CONFIG REQUIRED)
find_package(range-v3 REQUIRED)
include_directories(${FB303_INCLUDE_DIR})
find_path(FATAL_INCLUDE_DIR NAMES fatal/portability.h)
include_directories(${FATAL_INCLUDE_DIR})
find_library(NLOHMANN_JSON nlohmann-json)
find_path(NLOHMANN_JSON_INCLUDE_DIRS NAMES nlohmann/json.hpp)
include_directories(${NLOHMANN_JSON_INCLUDE_DIRS})
# (TODO): Pinning python version to 3.8 to compile in lego-linux since
# python 3.10 is causing link failures for sai test binary. Undo
# this once lego-linux is compatible with python3.10
find_package(Python3 3.8 EXACT COMPONENTS Interpreter Development)
include_directories(${Python3_INCLUDE_DIR})
find_path(SAI_INCLUDE_DIR NAMES sai.h)
include_directories(${SAI_INCLUDE_DIR})
if (SAI_BRCM_IMPL)
find_path(SAI_EXPERIMENTAL_INCLUDE_DIR NAMES saiswitchextensions.h)
include_directories(${SAI_EXPERIMENTAL_INCLUDE_DIR})
message(STATUS, "Experimental dir: ${SAI_EXPERIMENTAL_INCLUDE_DIR}")
elseif(CHENAB_SAI_SDK)
# Chenab-TODO: set experimental directories appropriately
set(SAI_EXPERIMENTAL_INCLUDE_DIR "/var/FBOSS/sai_impl_output/include")
include_directories(${SAI_EXPERIMENTAL_INCLUDE_DIR})
message(STATUS, "Experimental dir: ${SAI_EXPERIMENTAL_INCLUDE_DIR}")
else()
find_path(SAI_EXPERIMENTAL_INCLUDE_DIR
NAMES
experimental/saiswitchextensions.h)
include_directories(${SAI_EXPERIMENTAL_INCLUDE_DIR}/experimental)
message(STATUS, "Experimental Dir: ${SAI_EXPERIMENTAL_INCLUDE_DIR}")
endif()
message(STATUS "Found SAI_INCLUDE_DIR: ${SAI_INCLUDE_DIR}")
find_library(LIBNL nl-3)
find_path(LIBNL_INCLUDE_DIR NAMES libnl3/netlink/socket.h)
include_directories(${LIBNL_INCLUDE_DIR})
include_directories(${LIBNL_INCLUDE_DIR}/libnl3)
find_library(IPROUTE2 netlink)
find_path(IPROUTE2_INCLUDE_DIR NAMES libnetlink.h)
include_directories(${IPROUTE2_INCLUDE_DIR})
find_library(YAML-CPP yaml-cpp)
find_path(YAML-CPP_INCLUDE_DIR NAMES yaml-cpp/yaml.h)
include_directories(${YAML-CPP_INCLUDE_DIR})
message(STATUS "Found YAML-CPP_INCLUDE_DIR: ${YAML-CPP_INCLUDE_DIR}")
find_library(YAML yaml)
find_path(YAML_INCLUDE_DIR NAMES yaml.h)
include_directories(${YAML_INCLUDE_DIR})
message(STATUS "Found YAML_INCLUDE_DIR: ${YAML_INCLUDE_DIR}")
# Generate thrift deps and libraries
include(FBThriftCppLibrary)
# Thrift libraries
add_fbthrift_cpp_library(
fb303_cpp2
common/fb303/if/fb303.thrift
SERVICES
FacebookService
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
network_address_cpp2
common/network/if/Address.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
mpls_cpp2
fboss/agent/if/mpls.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
fboss_common_cpp2
fboss/lib/if/fboss_common.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
switch_config_cpp2
fboss/agent/switch_config.thrift
OPTIONS
json
reflection
DEPENDS
common_cpp2
fboss_common_cpp2
mpls_cpp2
)
add_fbthrift_cpp_library(
agent_config_cpp2
fboss/agent/agent_config.thrift
OPTIONS
json
reflection
DEPENDS
platform_config_cpp2
switch_config_cpp2
)
add_fbthrift_cpp_library(
platform_config_cpp2
fboss/agent/platform_config.thrift
OPTIONS
json
reflection
DEPENDS
bcm_config_cpp2
asic_config_cpp2
asic_config_v2_cpp2
phy_cpp2
)
add_fbthrift_cpp_library(
switch_reachability_cpp2
fboss/agent/switch_reachability.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
switch_state_cpp2
fboss/agent/switch_state.thrift
OPTIONS
json
reflection
DEPENDS
switch_config_cpp2
phy_cpp2
ctrl_cpp2
)
add_fbthrift_cpp_library(
prbs_cpp2
fboss/lib/phy/prbs.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
link_cpp2
fboss/lib/phy/link.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
transceiver_cpp2
fboss/qsfp_service/if/transceiver.thrift
OPTIONS
json
reflection
DEPENDS
link_cpp2
prbs_cpp2
)
add_fbthrift_cpp_library(
transceiver_validation_cpp2
fboss/qsfp_service/if/transceiver_validation.thrift
OPTIONS
json
reflection
DEPENDS
transceiver_cpp2
switch_config_cpp2
fboss_common_cpp2
)
add_fbthrift_cpp_library(
qsfp_config_cpp2
fboss/qsfp_service/if/qsfp_service_config.thrift
OPTIONS
json
reflection
DEPENDS
transceiver_cpp2
transceiver_validation_cpp2
switch_config_cpp2
)
add_fbthrift_cpp_library(
qsfp_state_cpp2
fboss/qsfp_service/if/qsfp_state.thrift
OPTIONS
json
reflection
DEPENDS
qsfp_config_cpp2
phy_cpp2
transceiver_cpp2
)
add_fbthrift_cpp_library(
qsfp_stats_cpp2
fboss/qsfp_service/if/qsfp_stats.thrift
OPTIONS
json
reflection
DEPENDS
hardware_stats_cpp2
phy_cpp2
transceiver_cpp2
)
add_fbthrift_cpp_library(
cmis_cpp2
fboss/qsfp_service/module/cmis/cmis.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
sff_cpp2
fboss/qsfp_service/module/sff/sff.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
sff8472_cpp2
fboss/qsfp_service/module/sff/sff8472.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
sensor_service_stats_cpp2
fboss/platform/sensor_service/sensor_service_stats.thrift
OPTIONS
json
reflection
DEPENDS
sensor_service_cpp2
)
add_fbthrift_cpp_library(
phy_cpp2
fboss/lib/phy/phy.thrift
SERVICES
FbossCommonPhyCtrl
OPTIONS
json
reflection
DEPENDS
switch_config_cpp2
transceiver_cpp2
fboss_cpp2
fb303_cpp2
io_stats_cpp2
)
add_fbthrift_cpp_library(
optic_cpp2
fboss/agent/if/optic.thrift
OPTIONS
json
reflection
DEPENDS
transceiver_cpp2
)
add_fbthrift_cpp_library(
fboss_cpp2
fboss/agent/if/fboss.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
sflow_cpp2
fboss/agent/if/sflow.thrift
OPTIONS
json
)
add_fbthrift_cpp_library(
common_cpp2
fboss/agent/if/common.thrift
OPTIONS
json
reflection
DEPENDS
mpls_cpp2
network_address_cpp2
)
add_fbthrift_cpp_library(
product_info_cpp2
fboss/agent/if/product_info.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
hardware_stats_cpp2
fboss/agent/hw/hardware_stats.thrift
OPTIONS
json
visitation
reflection
DEPENDS
mka_structs_cpp2
)
add_fbthrift_cpp_library(
ctrl_cpp2
fboss/agent/if/ctrl.thrift
SERVICES
FbossCtrl
NeighborListenerClient
OPTIONS
json
reflection
DEPENDS
agent_stats_cpp2
fboss_cpp2
fb303_cpp2
mpls_cpp2
network_address_cpp2
optic_cpp2
platform_config_cpp2
hardware_stats_cpp2
product_info_cpp2
transceiver_cpp2
common_cpp2
phy_cpp2
OPTIONS
json
)
add_fbthrift_cpp_library(
packet_stream_cpp2
fboss/agent/if/packet_stream.thrift
SERVICES
PacketStream
DEPENDS
fb303_cpp2
)
add_fbthrift_cpp_library(
bcm_config_cpp2
fboss/agent/hw/bcm/bcm_config.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
asic_config_cpp2
fboss/agent/hw/sai/config/asic_config.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
asic_config_v2_cpp2
fboss/agent/hw/config/asic_config_v2.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
mka_structs_cpp2
fboss/mka_service/if/mka_structs.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
agent_stats_cpp2
fboss/agent/agent_stats.thrift
OPTIONS
json
reflection
DEPENDS
hardware_stats_cpp2
phy_cpp2
)
add_fbthrift_cpp_library(
production_features_cpp2
fboss/agent/test/production_features.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
qsfp_production_features_cpp2
fboss/qsfp_service/test/hw_test/qsfp_production_features.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
link_test_production_features_cpp2
fboss/agent/test/link_tests/link_test_production_features.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
i2c_controller_stats_cpp2
fboss/lib/i2c/i2c_controller_stats.thrift
)
add_fbthrift_cpp_library(
io_stats_cpp2
fboss/lib/if/io_stats.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
led_mapping_cpp2
fboss/lib/led/led_mapping.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
bsp_platform_mapping_cpp2
fboss/lib/bsp/bsp_platform_mapping.thrift
OPTIONS
json
reflection
DEPENDS
led_mapping_cpp2
)
add_fbthrift_cpp_library(
led_config_cpp2
fboss/led_service/if/led_service_config.thrift
OPTIONS
json
reflection
)
add_fbthrift_cpp_library(
qsfp_cpp2
fboss/qsfp_service/if/qsfp.thrift
SERVICES
QsfpService
OPTIONS
json
DEPENDS
fb303_cpp2
ctrl_cpp2
fboss_cpp2
transceiver_cpp2
switch_config_cpp2
mpls_cpp2
mka_structs_cpp2
hardware_stats_cpp2
)
add_fbthrift_cpp_library(
hw_ctrl_cpp2
fboss/agent/if/hw_ctrl.thrift
SERVICES
FbossHwCtrl
DEPENDS
ctrl_cpp2
switch_state_cpp2
)
add_fbthrift_cpp_library(
sai_ctrl_cpp2
fboss/agent/hw/sai/switch/sai_ctrl.thrift
SERVICES
SaiCtrl
DEPENDS
ctrl_cpp2
hw_ctrl_cpp2
)
add_fbthrift_cpp_library(
hw_test_ctrl_cpp2
fboss/agent/hw/hw_test_ctrl.thrift
SERVICES
HwTestCtrl
DEPENDS
ctrl_cpp2
)
add_fbthrift_cpp_library(
sai_test_ctrl_cpp2
fboss/agent/hw/sai/hw_test/sai_test_ctrl.thrift
SERVICES
SaiTestCtrl
DEPENDS
ctrl_cpp2
hw_test_ctrl_cpp2
)
add_fbthrift_cpp_library(
multiswitch_ctrl_cpp2
fboss/agent/if/multiswitch_ctrl.thrift
SERVICES
MultiSwitchCtrl
DEPENDS
common_cpp2
ctrl_cpp2
fsdb_oper_cpp2
hardware_stats_cpp2
phy_cpp2
)
add_fbthrift_cpp_library(
agent_hw_test_ctrl_cpp2
fboss/agent/if/agent_hw_test_ctrl.thrift
SERVICES
AgentHwTestCtrl
OPTIONS
json
reflection
DEPENDS
common_cpp2
ctrl_cpp2
fboss_cpp2
switch_state_cpp2
network_address_cpp2
mpls_cpp2
phy_cpp2
prbs_cpp2
OPTIONS
json
)
find_library(USB usb-1.0)
find_path(USB_INCLUDE_DIR NAMES libusb-1.0/libusb.h)
include_directories(${USB_INCLUDE_DIR})
find_library(NETLINK3 nl-3)
find_library(NETLINKROUTE3 nl-route-3 libnl-route-3.a nl-route-3)
find_library(CURL curl)
find_path(CURL_INCLUDE_DIR NAMES curl/curl.h)
include_directories(${CURL_INCLUDE_DIR})
find_library(MNL mnl)
find_library(SODIUM sodium)
find_library(RE2 re2)
find_path(RE2_INCLUDE_DIR NAMES re2/re2.h)
include_directories(${RE2_INCLUDE_DIR})
find_library(EXPRTK exprtk)
find_path(EXPRTK_INCLUDE_DIR NAMES exprtk.hpp)
include_directories(${EXPRTK_INCLUDE_DIR})
find_library(LIBGPIOD gpiod)
find_path(LIBGPIOD_INCLUDE_DIR NAMES gpiod.h)
include_directories(${LIBGPIOD_INCLUDE_DIR})
find_library(SYSTEMD systemd)
find_path(SYSTEMD_INCLUDE_DIR NAMES systemd/sd-daemon.h)
include_directories(${SYSTEMD_INCLUDE_DIR})
# Unit Testing
add_definitions (-DIS_OSS=true)
find_package(Threads REQUIRED)
enable_testing()
# Build all cmake files under cmake/*cmake
file(GLOB_RECURSE cmakeFiles ${CMAKE_CURRENT_SOURCE_DIR}/cmake/*.cmake)
foreach(cmakeFile ${cmakeFiles})
message(status " INCLUDE ${cmakeFile}")
INCLUDE(${cmakeFile})
endforeach(cmakeFile)
add_custom_target(fboss_platform_services)
add_dependencies(fboss_platform_services
sensor_service
sensor_service_hw_test
sensor_service_sw_test
fan_service
fan_service_sw_test
fan_service_hw_test
rackmon
rackmon_test
platform_manager
fw_util
weutil
led_service
data_corral_service
)
add_custom_target(qsfp_targets)
add_dependencies(qsfp_targets
qsfp_service
qsfp_hw_test
wedge_qsfp_util
)
add_custom_target(fboss_other_services)
add_dependencies(fboss_other_services
qsfp_targets
fboss2
fsdb
)
if (BUILD_SAI_FAKE)
add_custom_target(fboss_agent_thrift_libs)
add_dependencies(fboss_agent_thrift_libs
mpls_cpp2
switch_config_cpp2
agent_config_cpp2
platform_config_cpp2
switch_reachability_cpp2
switch_state_cpp2
optic_cpp2
fboss_cpp2
sflow_cpp2
common_cpp2
product_info_cpp2
hardware_stats_cpp2
ctrl_cpp2
packet_stream_cpp2
bcm_config_cpp2
asic_config_cpp2
asic_config_v2_cpp2
agent_stats_cpp2
production_features_cpp2
hw_ctrl_cpp2
sai_ctrl_cpp2
hw_test_ctrl_cpp2
sai_test_ctrl_cpp2
multiswitch_ctrl_cpp2
lldp_structs_cpp2
validated_shell_commands_cpp2
)
add_custom_target(fboss_fake_agent_targets)
add_dependencies(fboss_fake_agent_targets
sai_test-fake
sai_agent_hw_test-fake
multi_switch_agent_hw_test
fboss_agent_thrift_libs
)
if (BUILD_SAI_FAKE_LINK_TEST)
add_dependencies(fboss_fake_agent_targets
sai_link_test-fake
)
endif()
endif()
if (GITHUB_ACTIONS_BUILD)
add_custom_target(github_actions_fboss_platform_services)
add_dependencies(github_actions_fboss_platform_services
# Services
sensor_service
fan_service
rackmon
platform_manager
fw_util
weutil
led_service
data_corral_service
# Unit Tests
platform_manager_device_path_resolver_test
platform_manager_platform_explorer_test
platform_data_corral_sw_test
platform_manager_utils_test
platform_helpers_platform_name_lib_test
platform_manager_data_store_test
platform_manager_config_validator_test
platform_manager_presence_checker_test
platform_manager_i2c_explorer_test
weutil_crc16_ccitt_test
weutil_fboss_eeprom_parser_test
sensor_service_sw_test
sensor_service_utils_test
rackmon_test
fan_service_sw_test
data_corral_service_hw_test
fan_service_hw_test
sensor_service_hw_test
weutil_hw_test
)
endif()