One unit-test/ directory per module/target, mirroring the existing TetraIF/unit-test/ layout (one QtTest executable per module, guarded by BUILD_TESTING and the module target, each registered with ctest): Lts/Common/CodeGen codegen_unit_test Lts/Common/LtsCoordinate ltscoordinate_unit_test Lts/Common/LtsSession ltssession_unit_test Lts/DDS/Core ddscore_unit_test Lts/DDS/QosProfile ddsqos_unit_test Lts/Tools/LogViewer logviewer_unit_test Lts/Tools/SqlBrowser sqlbrowser_unit_test Z/src/NGLLogger ngllogger_unit_test Z/src/WMS_Interface wms_json_ds_unit_test Z/src/nglapplication nglcoreapplication_unit_test Z/src/nglcompression nglcompression_unit_test Z/src/nglsettings nglsettings_unit_test Z/src/ngltranslator ngltranslator_unit_test Where a module is built with hidden visibility and has no export macro (LogViewer, SqlBrowser, ngltranslator, NGLLogger, nglcompression, nglsettings), its sources are compiled directly into the test executable, the same pattern as prtcnv_unit_test. ctest baseline in the container (QT_QPA_PLATFORM=offscreen): 20/23 passed (13 new + 7 pre-existing in-scope tests), 3 Not Run as before (nglcomp_test, GrantleeParserSmoke, utils_test). README: ctest baseline table extended to the 23 registered tests and section 2.4 now documents the per-module test layout. ddsview has no unit test (GUI tool, XmlHelper needs the DDS dynamic-xtypes runtime).
178 lines
4.1 KiB
CMake
Executable File
178 lines
4.1 KiB
CMake
Executable File
#
|
|
# $Id$
|
|
# $HeadURL$
|
|
# $Author$
|
|
#
|
|
|
|
# Make ${Qt6_Widgets} optional
|
|
if(QT6_GUI_AVAILABLE AND TARGET Qt6::Widgets)
|
|
set(Qt6_Widgets ${Qt6_Widgets})
|
|
else()
|
|
set(Qt6_Widgets "")
|
|
endif()
|
|
|
|
|
|
FIND_PACKAGE(RTI)
|
|
|
|
# KTextTemplate is Qt6-compatible replacement for Grantlee5
|
|
IF(BUILD_GRANTLEE)
|
|
FIND_PACKAGE(KF6TextTemplate REQUIRED)
|
|
ENDIF()
|
|
|
|
NGL_ADD_LIBRARY2(ALL codegen_base SHARED
|
|
codegen_export.h
|
|
SqlGenerator.cpp
|
|
SqlGenerator.h
|
|
StructBuilder.cpp
|
|
StructBuilder.h
|
|
XmlReader.cpp
|
|
XmlReader.h
|
|
)
|
|
NGL_TARGET_LINK_LIBRARIES(codegen_base
|
|
PRIVATE
|
|
Qt6::Xml
|
|
NGLLogger
|
|
ngltools
|
|
PUBLIC
|
|
Qt6::Core
|
|
)
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(codegen_base
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../
|
|
)
|
|
# If RTI target is available, propagate its include dirs/compile defs
|
|
if (TARGET RTI::nddscpp2)
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(codegen_base
|
|
PUBLIC
|
|
$<TARGET_PROPERTY:RTI::nddscpp2,INTERFACE_INCLUDE_DIRECTORIES>
|
|
)
|
|
NGL_TARGET_COMPILE_DEFINITIONS(codegen_base
|
|
PUBLIC
|
|
$<TARGET_PROPERTY:RTI::nddscpp2,INTERFACE_COMPILE_DEFINITIONS>
|
|
RTI_DDS_AVAILABLE
|
|
)
|
|
message(STATUS "RTI found; building codegen_base with RTI support")
|
|
else()
|
|
message(STATUS "RTI not found; building codegen_base without RTI support")
|
|
endif()
|
|
NGL_INSTALL_TARGET(codegen_base)
|
|
|
|
# KTextTemplate is Qt6-compatible replacement for Grantlee5
|
|
IF(BUILD_GRANTLEE AND TARGET KF6::TextTemplate)
|
|
NGL_ADD_LIBRARY(ALL codegen_grantlee STATIC
|
|
CppTopicGeneratorGrantlee.cpp
|
|
CppTopicGeneratorGrantlee.h
|
|
DaoGeneratorGrantlee.cpp
|
|
DaoGeneratorGrantlee.h
|
|
DatabaseGeneratorGrantlee.cpp
|
|
DatabaseGeneratorGrantlee.h
|
|
GeneratorGrantleeBase.cpp
|
|
GeneratorGrantleeBase.h
|
|
GrantleeWrappers.cpp
|
|
GrantleeWrappers.h
|
|
|
|
svc.idl.grantlee
|
|
svc_enums.idl.grantlee
|
|
|
|
svc_translation.cpp.grantlee
|
|
svc_translation.h.grantlee
|
|
|
|
svc_dao.cpp.grantlee
|
|
svc_dao.h.grantlee
|
|
|
|
svc_db.h.grantlee
|
|
svc_db_impl.h.grantlee
|
|
svc_db_impl.cpp.grantlee
|
|
|
|
svc_dtc.h.grantlee
|
|
svc_dtc_impl.cpp.grantlee
|
|
svc_dtc_impl.h.grantlee
|
|
|
|
svc_dts.h.grantlee
|
|
svc_dts_impl.cpp.grantlee
|
|
svc_dts_impl.h.grantlee
|
|
|
|
svc_ftc.h.grantlee
|
|
svc_ftc_impl.cpp.grantlee
|
|
svc_ftc_impl.h.grantlee
|
|
|
|
svc_fts.h.grantlee
|
|
svc_fts_impl.cpp.grantlee
|
|
svc_fts_impl.h.grantlee
|
|
|
|
svc_json.cpp.grantlee
|
|
svc_json.h.grantlee
|
|
|
|
svc_topic_type_plugin.cpp.grantlee
|
|
svc_topic_type_plugin.h.grantlee
|
|
|
|
svc_record_replay_plugin.cpp.grantlee
|
|
svc_record_replay_plugin.h.grantlee
|
|
|
|
codegen_simple.py
|
|
)
|
|
|
|
NGL_TARGET_LINK_LIBRARIES(codegen_grantlee
|
|
PRIVATE
|
|
NGLLogger
|
|
ProjectConfig
|
|
PUBLIC
|
|
codegen_base
|
|
KF6::TextTemplate
|
|
)
|
|
NGL_TARGET_INCLUDE_DIRECTORIES(codegen_grantlee
|
|
PUBLIC
|
|
${CMAKE_CURRENT_SOURCE_DIR}/../
|
|
${CMAKE_BINARY_DIR}/Z/src/NGLLogger
|
|
)
|
|
|
|
# Smoke-test: parse all .grantlee templates in this directory to detect parse/render regressions
|
|
find_package(Qt6 COMPONENTS Core QUIET)
|
|
if (Qt6_FOUND)
|
|
set(QTCORE_TARGET Qt6::Core)
|
|
else()
|
|
find_package(Qt6 COMPONENTS Core REQUIRED)
|
|
set(QTCORE_TARGET Qt6::Core)
|
|
endif()
|
|
|
|
add_executable(grantlee_parser_smoke tests/GrantleeParserSmoke.cpp)
|
|
target_link_libraries(grantlee_parser_smoke PRIVATE KF6::TextTemplate ${QTCORE_TARGET})
|
|
add_test(NAME GrantleeParserSmoke COMMAND grantlee_parser_smoke ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
NGL_ADD_EXECUTABLE(ALL ngl_codegen
|
|
main_grantlee.cpp
|
|
)
|
|
NGL_TARGET_LINK_LIBRARIES(ngl_codegen
|
|
codegen_grantlee
|
|
LtsCommandLineParser
|
|
nglcoreapplication
|
|
Qt6::Core
|
|
KF6::TextTemplate
|
|
)
|
|
|
|
NGL_WRAP_UI(codegen_gui_uics
|
|
main_grantlee_gui.ui
|
|
)
|
|
NGL_ADD_EXECUTABLE(WS AAR SV NO_TRANSLATION codegen_gui
|
|
${codegen_gui_uics}
|
|
main_grantlee_gui.cpp
|
|
main_grantlee_gui.ui
|
|
)
|
|
if(QT6_GUI_AVAILABLE)
|
|
NGL_TARGET_LINK_LIBRARIES(codegen_gui
|
|
codegen_grantlee
|
|
LtsCommandLineParser
|
|
nglapplication
|
|
${Qt6_Widgets}
|
|
KF6::TextTemplate
|
|
)
|
|
endif()
|
|
ELSE()
|
|
message(STATUS "BUILD_GRANTLEE disabled or Grantlee not found; skipping codegen_grantlee, ngl_codegen, and codegen_gui targets")
|
|
ENDIF()
|
|
|
|
#
|
|
# Unit tests
|
|
#
|
|
ADD_SUBDIRECTORY(unit-test)
|