337 lines
9.5 KiB
CMake
Executable File
337 lines
9.5 KiB
CMake
Executable File
#
|
|
# $Id$
|
|
# $HeadURL$
|
|
# $Author$
|
|
#
|
|
|
|
# Uncomment if necessary
|
|
#ADD_SUBDIRECTORY(UnitTests)
|
|
#ADD_SUBDIRECTORY(ModuleTests)
|
|
|
|
# Make ${Qt6_Gui} optional
|
|
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Gui)
|
|
set(Qt6_Gui ${Qt6_Gui})
|
|
else()
|
|
set(Qt6_Gui "")
|
|
endif()
|
|
|
|
|
|
INCLUDE(MacroRTIDDSGen)
|
|
INCLUDE(MacroCodeGenIdl)
|
|
|
|
ADD_SUBDIRECTORY(Plugins)
|
|
|
|
SET(xml_FILE tab_service.xml)
|
|
|
|
#
|
|
# --- Library tabTelegrams --------------------------------------------------------------------------------
|
|
#
|
|
find_package(Qt6 COMPONENTS Core Sql Network REQUIRED)
|
|
set(_QT_CORE_TARGET Qt6::Core)
|
|
set(_QT_SQL_TARGET Qt6::Sql)
|
|
set(_QT_NETWORK_TARGET Qt6::Network)
|
|
|
|
SET(SRCS_telegrams
|
|
training_area_telegrams.cpp
|
|
training_area_telegrams.h
|
|
)
|
|
NGL_ADD_LIBRARY(AAR SV WS HLA tabTelegrams STATIC ${SRCS_telegrams})
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(tabTelegrams
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/..
|
|
)
|
|
NGL_TARGET_LINK_LIBRARIES(tabTelegrams
|
|
PUBLIC
|
|
${_QT_CORE_TARGET}
|
|
$<IF:$<AND:$<BOOL:${QT6_GUI_AVAILABLE}>,$<TARGET_EXISTS:Qt6::Gui>>,Qt6::Gui,>
|
|
${_QT_NETWORK_TARGET}
|
|
)
|
|
|
|
# install on RPM build and copy for local builds so that LogView automatically finds the training_area_telegrams.h file
|
|
if (BUILD_RPM)
|
|
add_custom_target(training_area_telegrams.h_bin) # empty target so that LogView still builds on RPM build
|
|
NGL_INSTALL(AAR SV FILES training_area_telegrams.h DESTINATION bin)
|
|
else()
|
|
add_custom_command(
|
|
OUTPUT ${CMAKE_BINARY_DIR}/bin/training_area_telegrams.h
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_SOURCE_DIR}/training_area_telegrams.h ${CMAKE_BINARY_DIR}/bin/training_area_telegrams.h
|
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/training_area_telegrams.h
|
|
COMMENT "[Local build] Copy training_area_telegrams.h for LogView into bin/"
|
|
)
|
|
add_custom_target(training_area_telegrams.h_bin DEPENDS ${CMAKE_BINARY_DIR}/bin/training_area_telegrams.h)
|
|
endif()
|
|
|
|
#
|
|
# --- Library svcTabCommon --------------------------------------------------------------------------------
|
|
#
|
|
SET(SRCS_common
|
|
logger.cpp
|
|
logger.h
|
|
tab_export.h
|
|
)
|
|
|
|
IF(BUILD_RTI)
|
|
# Generate tab_enums.idl / tab.idl
|
|
CODEGEN_IDL_SVC(SRCS_common ${xml_FILE})
|
|
# Generate tab_db_impl.cpp/.h, tab_db.h
|
|
CODEGEN_DATABASE(SRCS_common ${xml_FILE})
|
|
# Generate *.cpp/*.hpp from idl (only with BUILD_RTI)
|
|
RTIDDSGEN(SRCS_common tab_enums.idl)
|
|
# tab.idl includes pdm.idl, so add explicit dependency on pdm.idl generation
|
|
RTIDDSGEN(SRCS_common tab.idl DEPENDS ${CMAKE_BINARY_DIR}/Lts/Services/ProjectDataManagement/pdm.idl)
|
|
# Generate tab_dt[s,c]_types.h, tab_ft[s,c]_types.h
|
|
CODEGEN_TOPIC_TYPEDEFS(SRCS_common ${xml_FILE})
|
|
# generate tab_[d|f]tc.h
|
|
CODEGEN_CLIENT_TOPICS_IFC(SRCS_common ${xml_FILE})
|
|
ELSE()
|
|
# Stub files for BUILD_RTI=OFF - NO code generation
|
|
LIST(APPEND SRCS_common
|
|
stubs/tab_enums_stub.hpp
|
|
stubs/tab_stub.hpp
|
|
stubs/tab_db_stub.hpp
|
|
stubs/tab_topic_type_plugin_stub.cpp
|
|
)
|
|
ENDIF()
|
|
|
|
# Create target only if component flags allow
|
|
NGL_ADD_LIBRARY2(AAR SV WS HLA svcTabCommon SHARED ${SRCS_common})
|
|
|
|
# Generate export header ALWAYS (needed for logger.h even if target not built)
|
|
# Use custom command to create minimal export header if target wasn't created
|
|
IF(NOT TARGET svcTabCommon)
|
|
# Create a dummy static library just for export header generation
|
|
ADD_LIBRARY(svcTabCommon STATIC ${SRCS_common})
|
|
ENDIF()
|
|
GENERATE_EXPORT_HEADER(svcTabCommon EXPORT_FILE_NAME "svctabcommon_export.h")
|
|
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabCommon
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/stubs
|
|
)
|
|
NGL_TARGET_LINK_LIBRARIES(svcTabCommon
|
|
PUBLIC
|
|
Qt6::Core
|
|
$<IF:$<AND:$<BOOL:${QT6_GUI_AVAILABLE}>,$<TARGET_EXISTS:Qt6::Gui>>,Qt6::Gui,>
|
|
Qt6::Sql
|
|
Qt6::Network
|
|
NGLLogger
|
|
ngldb
|
|
$<IF:$<TARGET_EXISTS:svcPdmCommon>,svcPdmCommon,>
|
|
LtsUtilsCoreHeaderOnly
|
|
)
|
|
IF(BUILD_RTI)
|
|
NGL_TARGET_LINK_LIBRARIES(svcTabCommon
|
|
PRIVATE
|
|
RTI::nddscpp2
|
|
PUBLIC
|
|
ddscore
|
|
)
|
|
ENDIF(BUILD_RTI)
|
|
NGL_INSTALL_TARGET(svcTabCommon)
|
|
|
|
#
|
|
# --- Library svcTabClient --------------------------------------------------------------------------------
|
|
#
|
|
SET(SRCS_client
|
|
tab_export.h
|
|
)
|
|
|
|
IF(BUILD_RTI)
|
|
# generate tab_[d|f]tc_impl.[cpp|h]
|
|
CODEGEN_CLIENT_TOPICS_IMPL(SRCS_client ${xml_FILE})
|
|
ENDIF()
|
|
|
|
NGL_ADD_LIBRARY2(AAR SV WS HLA svcTabClient SHARED ${SRCS_client})
|
|
# NGL_ADD_LIBRARY2 (unlike NGL_ADD_LIBRARY) does not define the
|
|
# MAKE_<SYMBOL>_LIB compile guard, but the generated tab_[d|f]tc_impl.h
|
|
# headers require MAKE_SVCTABCLIENT_LIB — same situation as
|
|
# svcCoreClient/ddscore, which define their guards explicitly.
|
|
TARGET_COMPILE_DEFINITIONS(svcTabClient PRIVATE MAKE_SVCTABCLIENT_LIB)
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabClient
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../
|
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
|
)
|
|
|
|
IF(BUILD_RTI)
|
|
NGL_TARGET_LINK_LIBRARIES(svcTabClient
|
|
PRIVATE
|
|
RTI::nddscpp2
|
|
ddsconnector
|
|
PUBLIC
|
|
svcTabCommon
|
|
ddsftc
|
|
)
|
|
ENDIF(BUILD_RTI)
|
|
NGL_INSTALL_TARGET(svcTabClient)
|
|
|
|
#
|
|
# --- Library svcTabServer --------------------------------------------------------------------------------
|
|
#
|
|
SET(SRCS_server
|
|
tx_mixin.cpp
|
|
tx_mixin.h
|
|
)
|
|
|
|
IF(BUILD_RTI)
|
|
# generate tab_[d|f]ts.h, tab_[d|f]ts_impl.[cpp|h]
|
|
CODEGEN_SERVER_TOPICS(SRCS_server ${xml_FILE})
|
|
ENDIF()
|
|
|
|
NGL_ADD_LIBRARY2(AAR HLA SV svcTabServer SHARED ${SRCS_server}) # NGL_ADD_LIBRARY2 won't work here - no time for investigations
|
|
# Generated tab_[d|f]ts_impl.h require MAKE_SVCTABSERVER_LIB (see svcTabClient above).
|
|
TARGET_COMPILE_DEFINITIONS(svcTabServer PRIVATE MAKE_SVCTABSERVER_LIB)
|
|
if(BUILD_SV OR BUILD_HLA)
|
|
GENERATE_EXPORT_HEADER(svcTabServer) # FIXME: quick workaround
|
|
endif()
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(svcTabServer
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../
|
|
${CMAKE_CURRENT_BINARY_DIR}/../
|
|
)
|
|
|
|
NGL_TARGET_LINK_LIBRARIES(svcTabServer
|
|
PUBLIC
|
|
svcTabCommon
|
|
ngldb
|
|
${_QT_CORE_TARGET}
|
|
$<IF:$<AND:$<BOOL:${QT6_GUI_AVAILABLE}>,$<TARGET_EXISTS:Qt6::Gui>>,Qt6::Gui,>
|
|
${_QT_NETWORK_TARGET}
|
|
)
|
|
IF(BUILD_RTI)
|
|
NGL_TARGET_LINK_LIBRARIES(svcTabServer
|
|
PRIVATE
|
|
RTI::nddscpp2
|
|
ddsconnector
|
|
ddsfts
|
|
)
|
|
ENDIF(BUILD_RTI)
|
|
NGL_INSTALL_TARGET(svcTabServer)
|
|
|
|
#
|
|
# --- Topic Type Plugin --------------------------------------------------------------
|
|
#
|
|
IF(BUILD_RTI)
|
|
CREATE_TOPIC_TYPE_PLUGIN(${xml_FILE})
|
|
ENDIF()
|
|
|
|
#
|
|
# --- RecordReplayPlugin --------------------------------------------------------------
|
|
#
|
|
IF(BUILD_RTI)
|
|
CREATE_RECORD_REPLAY_PLUGIN_SHARED(${xml_FILE})
|
|
IF (TARGET tabRecordReplayPlugin)
|
|
TARGET_SOURCES(tabRecordReplayPlugin
|
|
PRIVATE
|
|
tab_record_replay_plugin_custom.cpp
|
|
tab_record_replay_plugin_custom.h
|
|
)
|
|
ENDIF()
|
|
ENDIF()
|
|
|
|
#
|
|
# --- Executable svcTrainingAreaBase (sTAB) -------------------------------------------------
|
|
#
|
|
SET(SRCS_exe
|
|
dds_handler.cpp
|
|
dds_handler.h
|
|
exm_handler.cpp
|
|
exm_handler.h
|
|
ism_handler.cpp
|
|
ism_handler.h
|
|
main.cpp
|
|
main_handler.cpp
|
|
main_handler.h
|
|
pdm_handler.cpp
|
|
pdm_handler.h
|
|
ppm_handler.cpp
|
|
ppm_handler.h
|
|
position_handler.cpp
|
|
position_handler.h
|
|
recv_from_dds_aes.cpp
|
|
recv_from_dds_aes.h
|
|
recv_from_dds_fts.cpp
|
|
recv_from_dds_fts.h
|
|
recv_from_tab.h
|
|
send_to_dds.cpp
|
|
send_to_dds.h
|
|
send_to_tab.h
|
|
settings.cpp
|
|
settings.h
|
|
tab_export.h
|
|
tab_plugin_interface.h
|
|
|
|
WebSocketInterface/data_manager.cpp
|
|
WebSocketInterface/data_manager.h
|
|
WebSocketInterface/json_keys.h
|
|
WebSocketInterface/websocket_interface_handler.cpp
|
|
WebSocketInterface/websocket_interface_handler.h
|
|
WebSocketInterface/Messages/client_message.cpp
|
|
WebSocketInterface/Messages/client_message.h
|
|
WebSocketInterface/Messages/reply_message.cpp
|
|
WebSocketInterface/Messages/reply_message.h
|
|
# tx_mixin.cpp
|
|
# tx_mixin.h
|
|
|
|
log4cxx_tab.props
|
|
${xml_FILE}
|
|
)
|
|
|
|
IF(BUILD_RTI)
|
|
# Generate tab.sql, tab.xml
|
|
CODEGEN_SQL(SRCS_exe ${xml_FILE})
|
|
ENDIF()
|
|
|
|
NGL_ADD_SVC_ICON(SRCS_exe)
|
|
NGL_ADD_EXECUTABLE(AAR SV svcTrainingAreaBase ${SRCS_exe})
|
|
NGL_TARGET_LINK_LIBRARIES(svcTrainingAreaBase
|
|
Qt6::Core
|
|
Qt6::Network
|
|
LtsCoordTrans
|
|
LtsWebSocketServer
|
|
LtsCommandLineParser
|
|
LtsPluginLoader
|
|
LtsUtilsCoreHeaderOnly
|
|
LtsUtilsCore
|
|
svcTabCommon
|
|
svcTabServer
|
|
# main_handler.cpp includes the generated <TrainingAreaBase/tab_record_replay_plugin.h>
|
|
# and directly instantiates TrainingAreaBase::RecordReplayPluginCustom (whose methods
|
|
# live in the plugin .so). Linking the plugin target (rather than relying on a full
|
|
# `make all` having generated the header first) makes this a proper build dependency:
|
|
# the plugin's codegen runs before the exe compiles (so the generated header exists),
|
|
# the plugin's PUBLIC build-tree include dir is inherited (so the include resolves),
|
|
# and the plugin .so is linked (so the RecordReplayPluginCustom symbols resolve).
|
|
$<IF:$<TARGET_EXISTS:tabRecordReplayPlugin>,tabRecordReplayPlugin,>
|
|
svcNomClient
|
|
svcAesClient
|
|
svcOpmClient
|
|
svcCoreClient
|
|
svcAsmClient
|
|
svcExmClient
|
|
$<IF:$<TARGET_EXISTS:svcIsmClient>,svcIsmClient,>
|
|
svcPdmClient
|
|
svcPpmClient
|
|
$<IF:$<TARGET_EXISTS:ddsconnector>,ddsconnector,>
|
|
nglsettings
|
|
ProjectConfig
|
|
NGLLogger
|
|
nglcoreapplication
|
|
ngltools
|
|
tabTelegrams
|
|
)
|
|
NGL_INSTALL_TARGET(svcTrainingAreaBase)
|
|
NGL_INSTALL(AAR SV FILES log4cxx_tab.props DESTINATION bin)
|
|
NGL_ADD_TARGET_LINK(svcTrainingAreaBase sTAB)
|
|
|
|
# clientPluginInterface
|
|
ADD_LIBRARY(tabPluginInterface INTERFACE)
|
|
TARGET_SOURCES(tabPluginInterface INTERFACE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tab_plugin_interface.h
|
|
${CMAKE_CURRENT_SOURCE_DIR}/training_area_telegrams.h
|
|
)
|
|
TARGET_INCLUDE_DIRECTORIES(tabPluginInterface INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/../)
|
|
TARGET_LINK_LIBRARIES(tabPluginInterface INTERFACE Qt6::Core $<IF:$<TARGET_EXISTS:svcPdmCommon>,svcPdmCommon,>)
|