-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
604 lines (500 loc) · 20.7 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
# To use this, do the following the first time:
# % mkdir build
# % cd build
# % cmake .. -DBUILD_SIMPLE=1 -DBUILD_CLAS=1 -DBUILD_OLD=1 -DBUILD_BACKEND=1
# % make (install)
#
#
# After doing this once can do the following to recompile
# % cd <top level dir>
# % cmake --build build (--target install)
#
#
# The installation will default to the cmake flag INSTALL_DIR.
# If that's not defined, it will use the env var EJFAT_ERSAP_INSTALL_DIR:
# % cmake -DINSTALL_dir=<my_dir> ..
# This file came from ejfat project
cmake_minimum_required(VERSION 3.10)
project(ejfat VERSION 0.1)
# define where we put Find<*>.cmake files so various packages can be found
# set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_DEBUG_POSTFIX -dbg)
# Make executables
set(MAKE_EXEC 1)
# Test code build is optional and set it to OFF by default
option(BUILD_TEST "Build test code" OFF)
# uncomment to put in debug symbols or do on command line with:
# cmake -DCMAKE_BUILD_TYPE=Debug ..
#set(CMAKE_BUILD_TYPE Debug)
#add_compile_options(-Wall)
add_compile_options(-O3)
# Place libs & binaries in build/lib and bin (this is not for installation)
set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib)
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin)
# Set architecture-related string for installation consistent with scons file
set(ARCH ${CMAKE_HOST_SYSTEM_NAME}-${CMAKE_HOST_SYSTEM_PROCESSOR})
message(STATUS "ARCH = " ${ARCH})
# CMAKE_INSTALL_PREFIX defaults to /usr/local on unix
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
Debug Release MinSizeRel RelWithDebInfo)
endif()
if (NOT DEFINED INSTALL_DIR)
if (NOT DEFINED ENV{EJFAT_ERSAP_INSTALL_DIR})
message(FATAL_ERROR "Define EJFAT_ERSAP_INSTALL_DIR or specify -DINSTALL_DIR=<...> for installation & lib/header location")
else()
set(INSTALL_DIR $ENV{EJFAT_ERSAP_INSTALL_DIR})
endif()
endif()
message(STATUS "Installing into " ${INSTALL_DIR})
set(INSTALL_DIR_DEFINED 1)
set(CMAKE_INSTALL_PREFIX ${INSTALL_DIR})
set(CMAKE_INSTALL_INCLUDEDIR ${INSTALL_DIR}/include)
message(STATUS "CMAKE_INSTALL_PREFIX set to " ${CMAKE_INSTALL_PREFIX})
if (NOT DEFINED CMAKE_INSTALL_PLUGINDIR)
set(CMAKE_INSTALL_PLUGINDIR plugins CACHE PATH "Ersap plugins directory (plugins)")
endif()
mark_as_advanced(CMAKE_INSTALL_PLUGINDIR)
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules)
# Michael's old files used with static LB, now obsolete, not compiled by default,
# no dependencies
set(EMU_EXEC_FILES
emulation/lb_emu.cc
emulation/lb_rcv.cc
emulation/lb_rcv-roc.cc
emulation/pktzr_md.cc
emulation/lb_send.cc
)
# Carl's old files used with static LB, now obsolete, not compiled by default,
# no dependencies
set(STATIC_EXEC_FILES
staticLB/udp_rcv_order.cc
staticLB/udp_send_order.cc
staticLB/packetAnalyzer.cc
staticLB/packetBlastee.cc
staticLB/packetBlasterSmall.cc
staticLB/packetBlasterOld.cc
)
# Executables with no dependencies
set(NODEP_EXEC_FILES
simulation/packetBlaster.cc
simulation/packetBlasteeFastDirect.cc
)
# Regular backends: boost, grpc, ejfat_grpc, protobuf
set(BACKEND_EXEC_FILES
simulation/packetBlasteeFastMP.cc
simulation/packetBlasteeFullNewMP.cc
)
# To be used with other utilities files (and therefore disruptor) and ET for use in backends
set(BACKEND_SRC_FILES
simulation/EtFifoEntryItem.cpp
)
# Backend with extras: ET, boost, grpc, ejfa_grpc, protobuf, Disruptor, Prometheus, asio, crow dependencies. Basically everything.
set(BACKEND_EXEC_FILES_2
#set(ERSAP_EXEC_FILES
simulation/packetBlasteeEtMT.cc
simulation/packetBlasteeEtMTPRT.cc
simulation/ersap_et_consumer.cc
)
# Utility files all using Disruptor, fast ring-buffer based object supplies
set(UTIL_FILES
util/ByteOrder.cpp
util/ByteBuffer.cpp
util/BufferSupplyItem.cpp
util/BufferSupply.cpp
util/BufferItem.cpp
util/PacketsItem.cpp
util/PacketsItemN.cpp
util/SupplyItem.cpp
util/PacketStoreItem.cpp
util/PacketRefItem.cpp
)
# Files for sending clas 12 data: hipo lib
set(CLAS_EXEC_FILES
clas_source/clasBlaster.cc
clas_source/clasBlasterNTP.cc
)
# List of all test files
set(TEST_FILES
)
# List of all util directory header files
set(UTIL_HEADER_FILES
util/ByteOrder.h
util/ByteBuffer.h
util/BufferSupplyItem.h
util/BufferSupply.h
util/SupplierN.h
util/Supplier.h
util/SupplyItem.h
util/BufferItem.h
util/PacketsItem.h
util/PacketsItemN.h
util/PacketStoreItem.h
util/PacketRefItem.h
util/ejfatUtil.h
)
# List of all header files
set(CPP_HEADER_FILES
simulation/ejfat.hpp
simulation/ejfat_packetize.hpp
simulation/ejfat_assemble_ersap.hpp
simulation/EtFifoEntryItem.h
${UTIL_HEADER_FILES}
)
# For doxygen purposes, list of all simple API files
set(SIMPLE_API_FILES
simpleAPI/EjfatException.h
simpleAPI/EjfatConsumer.cpp
simpleAPI/EjfatConsumer.h
simpleAPI/EjfatProducer.cpp
simpleAPI/EjfatProducer.h
)
# Make the doxygen documentation
find_package( Doxygen )
if ( DOXYGEN_FOUND )
set( DOXYGEN_OUTPUT_DIRECTORY ../docs/doxygen )
set( DOXYGEN_COLLABORATION_GRAPH YES )
set( DOXYGEN_EXTRACT_ALL YES )
set( DOXYGEN_CLASS_DIAGRAMS YES )
set( DOXYGEN_HIDE_UNDOC_RELATIONS NO )
set( DOXYGEN_HAVE_DOT YES )
set( DOXYGEN_CLASS_GRAPH YES )
set( DOXYGEN_CALL_GRAPH YES )
set( DOXYGEN_CALLER_GRAPH YES )
set( DOXYGEN_COLLABORATION_GRAPH YES )
set( DOXYGEN_BUILTIN_STL_SUPPORT YES )
# set( DOXYGEN_EXTRACT_PRIVATE YES )
# set( DOXYGEN_EXTRACT_PACKAGE YES )
set( DOXYGEN_EXTRACT_STATIC YES )
# set( DOXYGEN_EXTRACT_LOCALMETHODS YES )
set( DOXYGEN_UML_LOOK YES )
set( DOXYGEN_UML_LIMIT_NUM_FIELDS 50 )
set( DOXYGEN_TEMPLATE_RELATIONS YES )
set( DOXYGEN_DOT_GRAPH_MAX_NODES 100 )
set( DOXYGEN_MAX_DOT_GRAPH_DEPTH 0 )
set( DOXYGEN_DOT_TRANSPARENT YES )
doxygen_add_docs( doxygen ${SIMPLE_API_FILES} ${UTIL_FILES} ${CPP_HEADER_FILES})
else()
message( "Doxygen need to be installed to generate the doxygen documentation" )
endif()
# List the files with no dependencies, made by default
set(EXEC_FILES ${NODEP_EXEC_FILES})
# OLD code build is optional, set it to OFF by default
option(BUILD_OLD "Build old static-LB code" OFF)
if (BUILD_OLD)
list(APPEND EXEC_FILES ${EMU_EXEC_FILES} ${STATIC_EXEC_FILES})
endif()
# Simple API build is optional and set it to OFF by default.
option(BUILD_SIMPLE "Build simple api library and executables" OFF)
if (BUILD_SIMPLE)
# Need boost for Simple API
if (NOT DEFINED Boost_FOUND)
find_package(Boost REQUIRED system thread chrono)
endif()
if (NOT Boost_FOUND)
message(FATAL_ERROR "Boost cannot be found, cmake will exit." )
endif()
# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
if (NOT DEFINED Protobuf_FOUND)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
endif()
if (NOT Protobuf_FOUND)
message(FATAL_ERROR "Protobuf cannot be found, cmake will exit." )
endif()
# Find gRPC installation
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
if (NOT DEFINED gRPC_FOUND)
find_package(gRPC)
endif()
if (NOT gRPC_FOUND)
# Grpc cannot be found, let's try again by using env var
if (NOT DEFINED ENV{GRPC_INSTALL_DIR})
if (NOT DEFINED ENV{EJFAT_ERSAP_INSTALL_DIR})
message(FATAL_ERROR "Define GRPC_INSTALL_DIR or EJFAT_ERSAP_INSTALL_DIR so gRPC can be found")
else()
set(GRPC_INSTALL_DIR $ENV{EJFAT_ERSAP_INSTALL_DIR})
endif()
else()
set(GRPC_INSTALL_DIR $ENV{GRPC_INSTALL_DIR})
endif()
find_package(gRPC REQUIRED CONFIG PATHS ${GRPC_INSTALL_DR}/lib/cmake/grpc)
endif()
if (NOT gRPC_FOUND)
message(FATAL_ERROR "grpc cannot be found, cmake will exit." )
endif()
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_REFLECTION gRPC::grpc++_reflection)
set(_GRPC_GRPCPP gRPC::grpc++)
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
# Find where ejfat_grpc lib and includes are installed
if (NOT DEFINED Ejfat_grpc_FOUND)
find_package(Ejfat_grpc)
endif()
if (NOT Ejfat_grpc_FOUND)
message(STATUS "ejfat_grpc lib cannot be found, compile without it")
endif()
# Go to the cmake file in simpleAPI directory
add_subdirectory(simpleAPI)
endif()
# Building regular EJFAT backends is optional and set it to OFF by default
option(BUILD_BACKEND "Build EJFAT backend related code" OFF)
if (BUILD_BACKEND)
# Need boost for Disruptor
if (NOT DEFINED Boost_FOUND)
find_package(Boost REQUIRED system thread chrono)
endif()
if (NOT Boost_FOUND)
message(FATAL_ERROR "Boost cannot be found, cmake will exit." )
endif()
# Find where Disruptor libs and includes are installed for ejfat use
if (NOT DEFINED DISRUPTOR_FOUND)
find_package(DISRUPTOR)
endif()
if (NOT DISRUPTOR_FOUND)
message(FATAL_ERROR "Disruptor cannot be found, cmake will exit." )
endif()
# Find Protobuf installation
# Looks for protobuf-config.cmake file installed by Protobuf's cmake installation.
if (NOT DEFINED Protobuf_FOUND)
find_package(Protobuf CONFIG REQUIRED)
message(STATUS "Using protobuf ${Protobuf_VERSION}")
set(_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf)
endif()
if (NOT Protobuf_FOUND)
message(FATAL_ERROR "Protobuf cannot be found, cmake will exit." )
endif()
# Find gRPC installation
# Looks for gRPCConfig.cmake file installed by gRPC's cmake installation.
if (NOT DEFINED gRPC_FOUND)
find_package(gRPC CONFIG REQUIRED)
endif()
if (NOT gRPC_FOUND)
# Grpc cannot be found, let's try again by using env var
if (NOT DEFINED ENV{GRPC_INSTALL_DIR})
if (NOT DEFINED ENV{EJFAT_ERSAP_INSTALL_DIR})
message(FATAL_ERROR "Define GRPC_INSTALL_DIR or EJFAT_ERSAP_INSTALL_DIR so gRPC can be found")
else()
set(GRPC_INSTALL_DIR $ENV{EJFAT_ERSAP_INSTALL_DIR})
endif()
else()
set(GRPC_INSTALL_DIR $ENV{GRPC_INSTALL_DIR})
endif()
find_package(gRPC REQUIRED CONFIG PATHS ${GRPC_INSTALL_DR}/lib/cmake/grpc)
endif()
if (NOT gRPC_FOUND)
message(FATAL_ERROR "grpc cannot be found, cmake will exit." )
endif()
message(STATUS "Using gRPC ${gRPC_VERSION}")
set(_REFLECTION gRPC::grpc++_reflection)
set(_GRPC_GRPCPP gRPC::grpc++)
set(_GRPC_CPP_PLUGIN_EXECUTABLE $<TARGET_FILE:gRPC::grpc_cpp_plugin>)
# Find where ejfat_grpc lib and includes are installed
if (NOT DEFINED Ejfat_grpc_FOUND)
find_package(Ejfat_grpc)
endif()
if (NOT Ejfat_grpc_FOUND)
message(STATUS "ejfat_grpc lib cannot be found, compile without it")
endif()
#----------------------------------------------------------
# For executables in BACKEND_EXEC_FILES_2 to be compiled,
# the following additional packages are required.
#----------------------------------------------------------
# Need ET for ERSAP CODE
find_package(ET)
if (NOT ET_FOUND)
message(FATAL_ERROR "Et cannot be found, cmake will exit")
endif()
# for clasBlasteeEtNTPRT
find_package(ASIO REQUIRED)
find_package(CROW REQUIRED)
find_package(prometheus-cpp REQUIRED CONFIG)
endif()
# CLAS12 source build is optional and set it to OFF by default
option(BUILD_CLAS "Build CLAS 12 source code" OFF)
# if you tell cmake to have code use USE_CLAS preprocessor macro
if (BUILD_CLAS)
# Find where CLAS libs and includes are installed for ejfat use.
# If nothing is found in INSTALL_DIR, then $ENV{HIPO_HOME} will be searched
find_package(HIPO)
if (NOT HIPO_FOUND)
message(FATAL_ERROR "Hipo cannot be found, exit cmake")
endif()
endif()
if (BUILD_TEST)
set(EXEC_FILES ${EXEC_FILES} ${TEST_FILES})
endif()
# No outside dependency programs
foreach(fileName ${EXEC_FILES})
# Get file name with no directory or extension as executable name
get_filename_component(execName ${fileName} NAME_WE)
# Create executable from file
message(STATUS "Create normal executable " ${execName})
add_executable(${execName} ${fileName})
# Put debug extension on if applicable
set_target_properties(${execName} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
# Location of include files
target_include_directories(${execName} PUBLIC ${CMAKE_SOURCE_DIR}/simulation
${CMAKE_SOURCE_DIR}/util)
# Needs these libs
target_link_libraries(${execName} pthread)
# Only install if installation directory has been defined
if (INSTALL_DIR_DEFINED)
# Install into bin dir
install(TARGETS ${execName} RUNTIME DESTINATION bin)
endif()
endforeach(fileName)
if (BUILD_CLAS)
foreach(fileName ${CLAS_EXEC_FILES})
# Get file name with no directory or extension as executable name
get_filename_component(execName ${fileName} NAME_WE)
# Create executable from file
message(STATUS "Create normal executable " ${execName})
add_executable(${execName} ${fileName})
# Put debug extension on if applicable
set_target_properties(${execName} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
# Location of include files
target_include_directories(${execName} PUBLIC ${HIPO_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/simulation)
# Needs these libs
target_link_libraries(${execName} pthread ${HIPO_LIBRARIES})
# Only install if installation directory has been defined
if (INSTALL_DIR_DEFINED)
# Install into bin dir
install(TARGETS ${execName} RUNTIME DESTINATION bin)
endif()
endforeach(fileName)
endif()
if (BUILD_BACKEND)
message(STATUS "TRY BACKEND CODE:")
# This files need util files added to executable
foreach(fileName ${BACKEND_EXEC_FILES})
# Get file name with no directory or extension as executable name
get_filename_component(execName ${fileName} NAME_WE)
# Create executable from file
message(STATUS "Create backend-related executable " ${execName})
add_executable(${execName} ${fileName} ${UTIL_FILES})
# Put debug extension on if applicable
set_target_properties(${execName} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
# Location of include files
target_include_directories(${execName} PUBLIC
${CMAKE_SOURCE_DIR}/simulation
${CMAKE_SOURCE_DIR}/util
${Boost_INCLUDE_DIRS}
${Ejfat_grpc_INCLUDE_DIRS}
${gRPC_INCLUDE_DIRS}
${DISRUPTOR_INCLUDE_DIRS}
)
# Needs these libs
target_link_libraries(${execName} pthread
${Boost_LIBRARIES}
${_REFLECTION}
${_GRPC_GRPCPP}
${Ejfat_grpc_LIBRARIES}
${DISRUPTOR_LIBRARIES}
)
# Only install if installation directory has been defined
if (INSTALL_DIR_DEFINED)
# Install into bin dir
install(TARGETS ${execName} RUNTIME DESTINATION bin)
endif()
endforeach(fileName)
# Also create a utility library out of the utility files
set (UTIL_LIB_NAME ejfat_util)
set (UTIL_LIB_NAME_STATIC ejfat_util_st)
add_library(${UTIL_LIB_NAME} SHARED ${UTIL_FILES})
target_include_directories(${UTIL_LIB_NAME} PUBLIC
${CMAKE_SOURCE_DIR}/simulation
${CMAKE_SOURCE_DIR}/util
${Boost_INCLUDE_DIRS}
${DISRUPTOR_INCLUDE_DIRS})
target_link_libraries(${UTIL_LIB_NAME} pthread ${DISRUPTOR_LIBRARIES})
add_library(${UTIL_LIB_NAME_STATIC} STATIC ${UTIL_FILES})
target_include_directories(${UTIL_LIB_NAME_STATIC} PUBLIC
${CMAKE_SOURCE_DIR}/simulation
${CMAKE_SOURCE_DIR}/util
${Boost_INCLUDE_DIRS}
${DISRUPTOR_INCLUDE_DIRS})
target_link_libraries(${UTIL_LIB_NAME_STATIC} pthread ${DISRUPTOR_LIBRARIES})
if (DEFINED INSTALL_DIR_DEFINED)
# Install library into lib dir
install(TARGETS ${UTIL_LIB_NAME} LIBRARY DESTINATION lib)
install(TARGETS ${UTIL_LIB_NAME_STATIC} LIBRARY DESTINATION lib)
# Install headers into include dir
endif()
# add_executable(packetBlasteeEtMTPRT simulation/packetBlasteeEtMTPRT.cc ${UTIL_FILES} ${GRPC_SRC_FILES})
#
# target_include_directories(packetBlasteeEtMTPRT PUBLIC ${CMAKE_SOURCE_DIR}/simulation
# ${ASIO_INCLUDE_DIRS}
# ${CROW_INCLUDE_DIRS}
# ${CMAKE_SOURCE_DIR}/util
# ${GRPC_INCLUDE_DIRS}
# ${ET_INCLUDE_DIRS}
# ${Boost_INCLUDE_DIRS}
# ${DISRUPTOR_INCLUDE_DIRS})
#
# target_link_libraries(packetBlasteeEtMTPRT PRIVATE prometheus-cpp::core prometheus-cpp::pull pthread ${Boost_LIBRARIES} ${DISRUPTOR_LIBRARY} ${GRPC_LIBRARIES} ${ET_LIBRARY})
#
# if (INSTALL_DIR_DEFINED)
# # Install into bin dir
# install(TARGETS packetBlasteeEtMTPRT RUNTIME DESTINATION bin)
# endif()
#
# # -------- Prometheus stuff ----------------------------------------
# This files need util files added to executable
foreach(fileName ${BACKEND_EXEC_FILES_2})
# Get file name with no directory or extension as executable name
get_filename_component(execName ${fileName} NAME_WE)
# Create executable from file
message(STATUS "Create grpc-related executable " ${execName})
# UTIL_FILES and BACKEND_SRC_FILES are only really needed for packetBlasteeEtMT
add_executable(${execName} ${fileName} ${UTIL_FILES} ${BACKEND_SRC_FILES})
# Put debug extension on if applicable
set_target_properties(${execName} PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX})
# Location of include files
target_include_directories(${execName} PUBLIC
${CMAKE_SOURCE_DIR}/simulation
${ASIO_INCLUDE_DIRS}
${CROW_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/util
${Ejfat_grpc_INCLUDE_DIRS}
${gRPC_INCLUDE_DIRS}
${ET_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${DISRUPTOR_INCLUDE_DIRS})
# Needs these libs
target_link_libraries(${execName} PRIVATE pthread
prometheus-cpp::core prometheus-cpp::pull
${Boost_LIBRARIES}
${_REFLECTION}
${_GRPC_GRPCPP}
${Ejfat_grpc_LIBRARIES}
${DISRUPTOR_LIBRARIES}
${ET_LIBRARY})
# Only install if installation directory has been defined
if (INSTALL_DIR_DEFINED)
# Install into bin dir
install(TARGETS ${execName} RUNTIME DESTINATION bin)
endif()
endforeach(fileName)
endif()
# Only install if installation directory has been defined
if (INSTALL_DIR_DEFINED)
install(FILES ${CPP_HEADER_FILES} DESTINATION include)
install(FILES ${CPP_HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
endif()
# Uninstall target
if(NOT TARGET uninstall)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" IMMEDIATE @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)
endif()