From b1f568cb7115e74871a97af55eef92571940b5da Mon Sep 17 00:00:00 2001 From: Milan Kriz Date: Fri, 12 Jan 2024 18:46:05 +0100 Subject: [PATCH] [#560] Provide zserio_compiler.cmake helper in release Use also internally for zserio tests --- cmake/zserio_compiler.cmake | 270 +++++++++++ cmake/zserio_tool.cmake | 66 --- cmake/zserio_utils.cmake | 173 ------- compiler/extensions/cpp/README.md | 112 ++++- scripts/build.sh | 25 + scripts/common_tools.sh | 23 +- scripts/release.sh | 4 +- scripts/test_perf.sh | 4 +- scripts/test_zs.sh | 10 +- test/CMakeLists.txt | 21 +- .../allow_implicit_arrays/CMakeLists.txt | 53 +-- .../set_cpp_allocator/CMakeLists.txt | 153 +++--- .../set_top_level_package/CMakeLists.txt | 40 +- .../with_range_check_code/CMakeLists.txt | 78 +--- .../ClangTidySuppressions.txt | 2 + .../with_reflection_code/CMakeLists.txt | 51 +- .../with_sources_amalgamation/CMakeLists.txt | 76 ++- .../with_type_info_code/CMakeLists.txt | 73 +-- .../with_validation_code/CMakeLists.txt | 95 +--- .../CMakeLists.txt | 60 +-- .../without_pubsub_code/CMakeLists.txt | 35 +- .../without_service_code/CMakeLists.txt | 35 +- .../arguments/without_sql_code/CMakeLists.txt | 30 +- .../without_writer_code/CMakeLists.txt | 47 +- .../errors/compatibility_error/CMakeLists.txt | 144 +++--- .../cpp/CompatibilityErrorTest.cpp | 27 +- .../errors/cpp_generator_error/CMakeLists.txt | 144 +++--- .../cpp/CppGeneratorErrorTest.cpp | 29 +- test/language/alignment/CMakeLists.txt | 36 +- test/language/array_types/CMakeLists.txt | 195 +------- test/language/bitmask_types/CMakeLists.txt | 57 +-- test/language/builtin_types/CMakeLists.txt | 41 +- test/language/choice_types/CMakeLists.txt | 134 +----- test/language/comments/CMakeLists.txt | 92 +--- .../comments/ClangTidySuppressions.txt | 8 + test/language/constants/CMakeLists.txt | 91 +--- test/language/constraints/CMakeLists.txt | 51 +- test/language/default_values/CMakeLists.txt | 36 +- .../language/enumeration_types/CMakeLists.txt | 67 +-- .../explicit_parameters/CMakeLists.txt | 75 +-- test/language/expressions/CMakeLists.txt | 137 +----- test/language/extended_members/CMakeLists.txt | 93 +--- test/language/functions/CMakeLists.txt | 96 +--- test/language/identifiers/CMakeLists.txt | 51 +- test/language/indexed_offsets/CMakeLists.txt | 74 +-- test/language/literals/CMakeLists.txt | 50 +- test/language/member_access/CMakeLists.txt | 32 +- test/language/offsets/CMakeLists.txt | 63 +-- test/language/optional_members/CMakeLists.txt | 55 +-- test/language/packages/CMakeLists.txt | 255 ++++------ .../parameterized_types/CMakeLists.txt | 128 +---- test/language/pubsub_types/CMakeLists.txt | 38 +- test/language/rules/CMakeLists.txt | 31 +- test/language/service_types/CMakeLists.txt | 56 +-- test/language/sql_constraints/CMakeLists.txt | 41 +- test/language/sql_databases/CMakeLists.txt | 44 +- test/language/sql_tables/CMakeLists.txt | 103 +--- test/language/sql_types/CMakeLists.txt | 43 +- .../sql_virtual_columns/CMakeLists.txt | 38 +- .../sql_virtual_tables/CMakeLists.txt | 38 +- .../sql_without_rowid_tables/CMakeLists.txt | 40 +- test/language/structure_types/CMakeLists.txt | 60 +-- test/language/subtypes/CMakeLists.txt | 59 +-- test/language/templates/CMakeLists.txt | 442 +----------------- test/language/union_types/CMakeLists.txt | 62 +-- test/others/gif/CMakeLists.txt | 79 +--- .../array_types_warning/CMakeLists.txt | 98 +--- .../choice_types_warning/CMakeLists.txt | 34 +- test/warnings/comments_warning/CMakeLists.txt | 170 ++----- .../ClangTidySuppressions.txt | 72 +-- .../compatibility_warning/CMakeLists.txt | 71 ++- .../cpp/CompatibilityWarningTest.cpp | 10 +- .../file_encoding_warning/CMakeLists.txt | 32 +- .../warnings/functions_warning/CMakeLists.txt | 32 +- .../not_handled_warning/CMakeLists.txt | 36 +- .../optional_members_warning/CMakeLists.txt | 58 +-- test/warnings/packages_warning/CMakeLists.txt | 41 +- .../sql_tables_warning/CMakeLists.txt | 62 +-- .../CMakeLists.txt | 35 +- .../warnings/templates_warning/CMakeLists.txt | 48 +- .../unused_type_warning/CMakeLists.txt | 58 +-- 81 files changed, 1849 insertions(+), 3979 deletions(-) create mode 100644 cmake/zserio_compiler.cmake delete mode 100644 cmake/zserio_tool.cmake delete mode 100644 cmake/zserio_utils.cmake diff --git a/cmake/zserio_compiler.cmake b/cmake/zserio_compiler.cmake new file mode 100644 index 000000000..07ecfdf56 --- /dev/null +++ b/cmake/zserio_compiler.cmake @@ -0,0 +1,270 @@ +# A function which allows to automatically generate C++ sources from zserio schemas. +# +# Prerequisites: +# CMake 3.15+ +# JAVA must be available - calls find_program(JAVA java) +# ZSERIO_JAR_FILE must be set either as an environment or CMake variable +# +# Usage: +# zserio_generate_cpp( +# TARGET +# [SRC_DIR ] +# [MAIN_ZS ] +# [GEN_DIR ] +# [EXTRA_ARGS ...] +# [GENERATED_SOURCES_VAR ] +# [OUTPUT_VAR ] +# [ERROR_VAR ] +# [RESULT_VAR ] +# [FORCE_REGENERATION] +# [CLEAN_GEN_DIR] +# +# Arguments: +# TARGET - Target to which the generated sources will be assigned. +# SRC_DIR - Source directory for zserio schemas. Optional, defaults to CMAKE_CURRENT_SOURCE_DIR. +# MAIN_ZS - Main zserio schema. Optional if the MAIN_ZS file is specified as a source for the given TARGET. +# GEN_DIR - Directory where the C++ sources will be generated. +# EXTRA_ARGS - Extra arguments to be passed to the Zserio tool. +# GENERATED_SOURCES_VAR - The variable will be set with a list of generated source files (full paths). +# Optional. +# OUTPUT_VAR - The variable will be set with the contents of the standard output pipe. Optional. +# If not set, the standard output pipe is printed. +# ERROR_VAR - The variable will be set with the contents of the standard error pipe. Optional. +# If not set, the standard error pipe is printed. +# RESULT_VAR - The variable will be set to contain the result of the zserio generator. Optional. +# If not set, a FATAL_ERROR is raised in case of the zserio generator error. +# FORCE_RECONFIGURE - Forces regeneration every time the CMake configure is run. +# CLEAN_GEN_DIR - Cleans GEN_DIR when generation in CMake configure time is run. +# +# Note that OUTPUT_VAR and ERROR_VAR can be set to the same value and then both pipes will be merged. +# +# Note that OUTPUT_VAR, ERROR_VAR and RESULT_VAR are updated only when the generation is executed within +# the configure-time - i.e. for the first time or when zserio schema sources are changed, etc. +# See "How if works" for more info. +# +# Example: +# set(CMAKE_MODULE_PATH "${ZSERIO_RELEASE}/cmake") +# set(ZSERIO_JAR_FILE "${ZSERIO_RELEASE}/zserio.jar") +# include(zserio_compiler) +# +# add_library(sample_zs sample.zs) +# zserio_generate_cpp( +# TARGET sample_zs +# GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) +# +# How it works: +# +# First time the CMake configure is run, the sources are generated using execute_process directly in +# configure-time and auxilary information (timestamps, list of generated sources, etc.) is stored in the +# CMake cache. The auxilary info is used to define a custom command which uses the same zserio command line +# as the original execute_process and thus allows to re-generate sources when it's needed - e.g. after the +# clean step. +# +# The custom command is sufficient as long as the generated sources remains unchanged. Otherwise the +# execute_process must be re-run in configure-time to ensure that all generated sources are collected correctly. +# This functionality is achieved using the auxilary information mentioned above. +# +# List of generated sources can change in following situations: +# +# - ZSERIO_JAR_FILE is changed +# - zserio schema sources are changed +# - EXTRA_ARGS are changed +function(zserio_generate_cpp) + find_program(JAVA java) + if (NOT JAVA) + message(FATAL_ERROR "Could not find java!") + endif() + if (DEFINED ENV{ZSERIO_JAR_FILE}) + set(ZSERIO_JAR_FILE $ENV{ZSERIO_JAR_FILE}) + endif () + if (NOT DEFINED ZSERIO_JAR_FILE OR NOT EXISTS ${ZSERIO_JAR_FILE}) + message(FATAL_ERROR "Could not find zserio.jar!") + endif() + + cmake_parse_arguments(ZSERIO_GENERATE + "FORCE_REGENERATE;CLEAN_GEN_DIR" + "TARGET;SRC_DIR;MAIN_ZS;GEN_DIR;GENERATED_SOURCES_VAR;OUTPUT_VAR;ERROR_VAR;RESULT_VAR" + "EXTRA_ARGS" + ${ARGN}) + + if (ZSERIO_GENERATE_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "zserio_generate_cpp: Unknown arguments '${ZSERIO_GENERATE_UNPARSED_ARGUMENTS}'!") + endif () + + # check required arguments + foreach (ARG TARGET GEN_DIR) + if (NOT DEFINED ZSERIO_GENERATE_${ARG}) + message(FATAL_ERROR "No value defined for required argument ${ARG}!") + endif () + endforeach () + + # default values + if (NOT DEFINED ZSERIO_GENERATE_SRC_DIR) + set(ZSERIO_GENERATE_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + endif () + if (NOT DEFINED ZSERIO_GENERATE_MAIN_ZS) + # try to get a single main zs + get_target_property(ZS_SOURCES ${ZSERIO_GENERATE_TARGET} SOURCES) + list(FILTER ZS_SOURCES INCLUDE REGEX "\\.zs$") + list(LENGTH ZS_SOURCES ZS_SOURCES_LENGTH) + if (${ZS_SOURCES_LENGTH} EQUAL 1) + list(GET ZS_SOURCES 0 ZSERIO_GENERATE_MAIN_ZS) + + # try to map the found source to ZSERIO_GENERATE_SRC_DIR + if (NOT IS_ABSOLUTE ${ZSERIO_GENERATE_MAIN_ZS}) + set(ZSERIO_GENERATE_MAIN_ZS "${CMAKE_CURRENT_SOURCE_DIR}/${ZSERIO_GENERATE_MAIN_ZS}") + endif () + file(RELATIVE_PATH ZSERIO_GENERATE_MAIN_ZS + "${ZSERIO_GENERATE_SRC_DIR}" "${ZSERIO_GENERATE_MAIN_ZS}") + else () + message(FATAL_ERROR "MAIN_ZS file not specifid and cannot be detected!") + endif () + endif () + + # ensure cmake reconfigure when zserio sources are changed + file(GLOB_RECURSE ZSERIO_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" + "${ZSERIO_GENERATE_SRC_DIR}/*.zs") + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${ZSERIO_SOURCES} ${ZSERIO_JAR_FILE}) + + set(ZSERIO_COMMAND + ${JAVA} -jar ${ZSERIO_JAR_FILE} + -src ${ZSERIO_GENERATE_SRC_DIR} ${ZSERIO_GENERATE_MAIN_ZS} + -cpp ${ZSERIO_GENERATE_GEN_DIR} + ${ZSERIO_GENERATE_EXTRA_ARGS} + ) + + _zserio_compiler_get_latest_timestamp(FILES ${ZSERIO_SOURCES} TIMESTAMP_VAR ZSERIO_SOURCES_TIMESTAMP) + _zserio_compiler_get_latest_timestamp(FILES ${ZSERIO_JAR_FILE} TIMESTAMP_VAR ZSERIO_JAR_TIMESTAMP) + + set(REGENERATE_SOURCES 1) + if (NOT ZSERIO_GENERATE_FORCE_REGENERATE AND + DEFINED ZSERIO_COMPILER_ZSERIO_JAR_TIMESTAMP AND + DEFINED ZSERIO_COMPILER_SOURCES_TIMESTAMP_${ZSERIO_GENERATE_TARGET} AND + DEFINED ZSERIO_COMPILER_SOURCES_${ZSERIO_GENERATE_TARGET} AND + DEFINED ZSERIO_COMPILER_EXTRA_ARGS_${ZSERIO_GENERATE_TARGET} AND + DEFINED ZSERIO_COMPILER_GENERATED_SOURCES_${ZSERIO_GENERATE_TARGET}) + if (${ZSERIO_COMPILER_ZSERIO_JAR_TIMESTAMP} EQUAL ${ZSERIO_JAR_TIMESTAMP} AND + ${ZSERIO_COMPILER_SOURCES_TIMESTAMP_${ZSERIO_GENERATE_TARGET}} EQUAL ${ZSERIO_SOURCES_TIMESTAMP} AND + "${ZSERIO_COMPILER_EXTRA_ARGS_${ZSERIO_GENERATE_TARGET}}" STREQUAL + "${ZSERIO_GENERATE_EXTRA_ARGS}" AND + "${ZSERIO_COMPILER_SOURCES_${ZSERIO_GENERATE_TARGET}}" STREQUAL "${ZSERIO_SOURCES}") + set(REGENERATE_SOURCES 0) + endif () + endif () + + set(TOOL_COMMENT "Generating C++ sources from '${ZSERIO_GENERATE_MAIN_ZS}'.") + + if (REGENERATE_SOURCES) + if ("${ZSERIO_GENERATE_OUTPUT_VAR}" STREQUAL "${ZSERIO_GENERATE_ERROR_VAR}") + set(SEPARATE_OUTPUT OFF) + set(ZSERIO_OUTPUT_VAR ZSERIO_OUTPUT) + set(ZSERIO_ERROR_VAR ZSERIO_OUTPUT) + else () + set(SEPARATE_OUTPUT ON) + set(ZSERIO_OUTPUT_VAR ZSERIO_OUTPUT) + set(ZSERIO_ERROR_VAR ZSERIO_ERROR) + endif () + + if (ZSERIO_GENERATE_CLEAN_GEN_DIR) + file(REMOVE_RECURSE ${ZSERIO_GENERATE_GEN_DIR}) + file(MAKE_DIRECTORY ${ZSERIO_GENERATE_GEN_DIR}) + endif () + + message(STATUS ${TOOL_COMMENT}) + + # run the generator during configure phase for the first time + execute_process( + COMMAND ${ZSERIO_COMMAND} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + OUTPUT_VARIABLE ${ZSERIO_OUTPUT_VAR} + ERROR_VARIABLE ${ZSERIO_ERROR_VAR} + RESULT_VARIABLE ZSERIO_RESULT) + + if (${SEPARATE_OUTPUT}) + if (DEFINED ZSERIO_GENERATE_OUTPUT_VAR) + set(${ZSERIO_GENERATE_OUTPUT_VAR} ${ZSERIO_OUTPUT} PARENT_SCOPE) + else () + message(STATUS ${ZSERIO_OUTPUT}) + endif () + + if (DEFINED ZSERIO_GENERATE_ERROR_VAR) + set(${ZSERIO_GENERATE_ERROR_VAR} ${ZSERIO_ERROR} PARENT_SCOPE) + else () + message(STATUS ${ZSERIO_ERROR}) + endif () + else () + # both OUTPUT_VAR and ERROR_VAR are either not set or set to the same value + if (DEFINED ZSERIO_GENERATE_OUTPUT_VAR) + set(${ZSERIO_GENERATE_OUTPUT_VAR} ${ZSERIO_OUTPUT} PARENT_SCOPE) + else () + message(STATUS ${ZSERIO_OUTPUT}) + endif () + endif () + + if (DEFINED ZSERIO_GENERATE_RESULT_VAR) + set(${ZSERIO_GENERATE_RESULT_VAR} ${ZSERIO_RESULT} PARENT_SCOPE) + endif () + + if (NOT ${ZSERIO_RESULT} EQUAL 0 AND NOT DEFINED ZSERIO_GENERATE_RESULT_VAR) + message(STATUS ${${ZSERIO_ERROR_VAR}}) + message(FATAL_ERROR "Zserio generator failed!") + endif () + + file(GLOB_RECURSE GENERATED_SOURCES + "${ZSERIO_GENERATE_GEN_DIR}/*.h" + "${ZSERIO_GENERATE_GEN_DIR}/*.cpp") + + set(ZSERIO_COMPILER_ZSERIO_JAR_TIMESTAMP "${ZSERIO_JAR_TIMESTAMP}" + CACHE INTERNAL "Timestamp of the '${ZSERIO_JAR_FILE}'" + FORCE) + set(ZSERIO_COMPILER_SOURCES_TIMESTAMP_${ZSERIO_GENERATE_TARGET} "${ZSERIO_SOURCES_TIMESTAMP}" + CACHE INTERNAL "Latest timestamp of the Zserio schema sources for ${ZSERIO_GENERATE_TARGET}." + FORCE) + set(ZSERIO_COMPILER_SOURCES_${ZSERIO_GENERATE_TARGET} "${ZSERIO_SOURCES}" + CACHE INTERNAL "List of Zserio schema sources for ${ZSERIO_GENERATE_TARGET}." + FORCE) + set(ZSERIO_COMPILER_EXTRA_ARGS_${ZSERIO_GENERATE_TARGET} "${ZSERIO_GENERATE_EXTRA_ARGS}" + CACHE INTERNAL "Extra arguments to Zserio tool used for ${ZSERIO_GENERATE_TARGET}." + FORCE) + set(ZSERIO_COMPILER_GENERATED_SOURCES_${ZSERIO_GENERATE_TARGET} "${GENERATED_SOURCES}" + CACHE INTERNAL "List of sources files generated by Zserio for ${ZSERIO_GENERATE_TARGET}." + FORCE) + else () + set(GENERATED_SOURCES "${ZSERIO_COMPILER_GENERATED_SOURCES_${ZSERIO_GENERATE_TARGET}}") + endif () + + if (NOT "${GENERATED_SOURCES}" STREQUAL "") + if (DEFINED ZSERIO_GENERATE_GENERATED_SOURCES_VAR) + set(${ZSERIO_GENERATE_GENERATED_SOURCES_VAR} "${GENERATED_SOURCES}" PARENT_SCOPE) + endif () + + add_custom_command(OUTPUT ${GENERATED_SOURCES} + COMMAND ${ZSERIO_COMMAND} + DEPENDS ${ZSERIO_SOURCES} + COMMENT ${TOOL_COMMENT}) + + target_sources(${ZSERIO_GENERATE_TARGET} PRIVATE ${GENERATED_SOURCES}) + set_source_files_properties(${GENERATED_SOURCES} PROPERTIES GENERATED TRUE) + target_include_directories(${ZSERIO_GENERATE_TARGET} PUBLIC ${ZSERIO_GENERATE_GEN_DIR}) + + set_target_properties(${ZSERIO_GENERATE_TARGET} PROPERTIES + ADDITIONAL_CLEAN_FILES "${GENERATED_SOURCES}") + endif () +endfunction() + +function(_zserio_compiler_get_latest_timestamp) + cmake_parse_arguments(GET_LATEST_TIMESTAMP "" "TIMESTAMP_VAR" "FILES" ${ARGN}) + + set(LATEST_TIMESTAMP 0) + foreach(FILE ${GET_LATEST_TIMESTAMP_FILES}) + if (NOT IS_ABSOLUTE ${FILE}) + set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}") + endif () + + file(TIMESTAMP ${FILE} FILE_TIMESTAMP "%s") + if (${FILE_TIMESTAMP} GREATER ${LATEST_TIMESTAMP}) + set(LATEST_TIMESTAMP ${FILE_TIMESTAMP}) + endif () + endforeach() + set(${GET_LATEST_TIMESTAMP_TIMESTAMP_VAR} ${LATEST_TIMESTAMP} PARENT_SCOPE) +endfunction() diff --git a/cmake/zserio_tool.cmake b/cmake/zserio_tool.cmake deleted file mode 100644 index 8e638448b..000000000 --- a/cmake/zserio_tool.cmake +++ /dev/null @@ -1,66 +0,0 @@ -# Script called from zserio_utils.cmake to check that tests does not fire any warnings -# -# Expected defines: -# JAVA_BIN Java binary. -# CORE_DIR Zserio core directory. -# CPP_DIR Zserio C++ extension directory. -# OUT_DIR Zserio output directory. -# SOURCE_DIR Zserio source directory. -# MAIN_SOURCE Zserio main source file. -# OPTIONS Zserio tool options. -# EXTRA_OPTIONS Zserio tool extra options. -# EXPECTED_WARNINGS Number of expected zserio warnings to check. -# IGNORE_ERRORS Whether to ignore errors. -# LOG_FILENAME Name of file where to store the zserio error log. -# APPEND_TO_LOG_FILE Whether to append errors to the zserio error log. -cmake_minimum_required(VERSION 3.6.0) - -separate_arguments(OPTIONS) -separate_arguments(EXTRA_OPTIONS) - -# don't use WIN32 because it can be set during cross-compilation on Linux -if ("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Windows") - set(JAVA_CLASSPATH_SEPARATOR ";") -else () - set(JAVA_CLASSPATH_SEPARATOR ":") -endif () - -execute_process( - COMMAND ${JAVA_BIN} -cp "${CORE_DIR}/zserio_core.jar${JAVA_CLASSPATH_SEPARATOR}${CPP_DIR}/zserio_cpp.jar" - zserio.tools.ZserioTool ${OPTIONS} ${EXTRA_OPTIONS} -cpp ${OUT_DIR} -src ${SOURCE_DIR} ${MAIN_SOURCE} - ERROR_VARIABLE ZSERIO_LOG - RESULT_VARIABLE ZSERIO_RESULT -) - -if (NOT ${ZSERIO_RESULT} EQUAL 0) - message(STATUS ${ZSERIO_LOG}) - if (NOT "${LOG_FILENAME}" STREQUAL "") - if (APPEND_TO_LOG_FILE) - file(APPEND ${LOG_FILENAME} ${ZSERIO_LOG}) - else () - file(WRITE ${LOG_FILENAME} ${ZSERIO_LOG}) - endif () - endif () - if (NOT IGNORE_ERRORS) - message(FATAL_ERROR "Zserio tool failed!") - endif () -endif () - -set(NUM_WARNINGS 0) -if (${ZSERIO_RESULT} EQUAL 0 AND NOT "${ZSERIO_LOG}" STREQUAL "") - message(STATUS ${ZSERIO_LOG}) - if (NOT "${LOG_FILENAME}" STREQUAL "") - if (APPEND_TO_LOG_FILE) - file(APPEND ${LOG_FILENAME} ${ZSERIO_LOG}) - else () - file(WRITE ${LOG_FILENAME} ${ZSERIO_LOG}) - endif () - endif () - - string(REGEX MATCHALL "\\[WARNING\\]" WARNINGS ${ZSERIO_LOG}) - list(LENGTH WARNINGS NUM_WARNINGS) -endif () - -if (NOT ${NUM_WARNINGS} EQUAL ${EXPECTED_WARNINGS}) - message(FATAL_ERROR "Zserio tool produced ${NUM_WARNINGS} warning(s) (expected ${EXPECTED_WARNINGS})!") -endif () diff --git a/cmake/zserio_utils.cmake b/cmake/zserio_utils.cmake deleted file mode 100644 index cb58aa26c..000000000 --- a/cmake/zserio_utils.cmake +++ /dev/null @@ -1,173 +0,0 @@ -# A function to create a zserio C++ runtime static library. -# -# Usage: zserio_add_runtime_library -# RUNTIME_LIBRARY_DIR runtime_library_dir -function(zserio_add_runtime_library) - # parse cmdline args - foreach (ARG ${ARGV}) - if ((ARG STREQUAL RUNTIME_LIBRARY_DIR)) - if (DEFINED VALUE_${ARG}) - message(FATAL_ERROR "Option ${ARG} used multiple times!") - endif () - set(ARG_NAME ${ARG}) - else () - if (DEFINED VALUE_${ARG_NAME}) - message(FATAL_ERROR "Argument ${ARG_NAME} requires exactly one value!") - endif () - set(VALUE_${ARG_NAME} ${ARG}) - endif () - endforeach () - - foreach (ARG RUNTIME_LIBRARY_DIR) - if (NOT DEFINED VALUE_${ARG}) - message(FATAL_ERROR "No value defined for required argument ${ARG}!") - endif () - endforeach () - - add_subdirectory(${VALUE_RUNTIME_LIBRARY_DIR} ZserioCppRuntime) -endfunction() - -# A function to create a static library out of Zserio-generated sources. -# -# Usage: zserio_add_library -# target_name -# SOURCE_DIR src_dir -# MAIN_SOURCE src_file -# SOURCES all source files (optional, relative to SOURCE_DIR) -# OUT_DIR out_dir -# OUT_FILES out_files... -# ZSERIO_CORE_DIR zserio_core_dir -# ZSERIO_CPP_DIR zserio_cpp_dir -# ZSERIO_OPTIONS ... (optional) -# EXPECTED_WARNINGS num_warnings (optional, default 0) -# IGNORE_ERRORS ON|OFF (optional, default OFF) -# ZSERIO_LOG_FILENAME (optional) -# APPEND_TO_ZSERIO_LOG_FILE ON|OFF (optional, default OFF) -# -# Only the files mentioned in OUT_FILES will be added to the static library target. -# OUT_FILES can be EMPTY if no output should be generated. -# Glob is not used because using GLOB for sources is frowned upon in CMake world. -# (CMake doesn't pick up changes in the glob, e.g. added files.) -# -# The actual Zserio generation target is added to the top-level target "gen". -function(zserio_add_library TARGET_NAME) - # parse cmdline args - foreach (ARG ${ARGN}) - if ((ARG STREQUAL SOURCE_DIR) OR - (ARG STREQUAL MAIN_SOURCE) OR - (ARG STREQUAL SOURCES) OR - (ARG STREQUAL OUT_DIR) OR - (ARG STREQUAL OUT_FILES) OR - (ARG STREQUAL ZSERIO_CORE_DIR) OR - (ARG STREQUAL ZSERIO_CPP_DIR) OR - (ARG STREQUAL ZSERIO_OPTIONS) OR - (ARG STREQUAL EXPECTED_WARNINGS) OR - (ARG STREQUAL IGNORE_ERRORS) OR - (ARG STREQUAL ZSERIO_LOG_FILENAME) OR - (ARG STREQUAL APPEND_TO_ZSERIO_LOG_FILE)) - if (DEFINED VALUE_${ARG}) - message(FATAL_ERROR "Option ${ARG} used multiple times!") - endif () - set(ARG_NAME ${ARG}) - else () - list(APPEND VALUE_${ARG_NAME} ${ARG}) - endif () - endforeach () - - foreach (ARG SOURCE_DIR MAIN_SOURCE OUT_DIR OUT_FILES ZSERIO_CORE_DIR ZSERIO_CPP_DIR) - if (NOT DEFINED VALUE_${ARG}) - message(FATAL_ERROR "No value defined for required argument ${ARG}!") - endif () - endforeach () - - foreach (ARG SOURCE_DIR MAIN_SOURCE OUT_DIR ZSERIO_CORE_DIR ZSERIO_CPP_DIR) - list(LENGTH VALUE_${ARG} LEN) - if (NOT(LEN EQUAL 1)) - message(FATAL_ERROR "Argument ${ARG} requires exactly one value!") - endif () - endforeach () - - # defaults - if (NOT DEFINED VALUE_EXPECTED_WARNINGS) - set(VALUE_EXPECTED_WARNINGS 0) - endif () - if (NOT DEFINED VALUE_IGNORE_ERRORS) - set(VALUE_IGNORE_ERRORS OFF) - endif () - if (NOT DEFINED VALUE_APPEND_TO_ZSERIO_LOG_FILE) - set(VALUE_APPEND_TO_ZSERIO_LOG_FILE OFF) - endif () - - # create ALL_SOURCES list with full paths - foreach (SOURCE ${VALUE_SOURCES}) - list(APPEND ALL_SOURCES ${VALUE_SOURCE_DIR}/${SOURCE}) - endforeach () - list(APPEND ALL_SOURCES ${VALUE_SOURCE_DIR}/${VALUE_MAIN_SOURCE}) - - # Java is required, so search for it already here at file-scope - if (NOT DEFINED JAVA_BIN OR JAVA_BIN STREQUAL "JAVA_BIN-NOTFOUND") - find_program(JAVA_BIN java PATHS $ENV{JAVA_HOME}/bin ENV PATH NO_DEFAULT_PATH) - if (JAVA_BIN STREQUAL "JAVA_BIN-NOTFOUND") - message(FATAL_ERROR "Java not found, define JAVA_BIN in CMake or JAVA_HOME in environment!") - endif () - endif () - - # check if library is header only - if ("${VALUE_OUT_FILES}" STREQUAL "EMPTY") - set(VALUE_OUT_FILES "") - endif () - string(FIND "${VALUE_OUT_FILES}" ".cpp" SOURCE_FILE_POSITION) - - # set ${VALUE_OUT_FILES} as GENERATED - set_source_files_properties(${VALUE_OUT_FILES} PROPERTIES GENERATED TRUE) - - # set zserio extra options given by environment - set(ZSERIO_EXTRA_OPTIONS "$ENV{ZSERIO_EXTRA_ARGS}") - separate_arguments(ZSERIO_EXTRA_OPTIONS) - - # hack to always re-run Zserio compiler (Zserio itself can skip sources generations if it's not needed) - # - uses ${TARGET_NAME}_ALWAYS_GENERATE output which will be never generated and thus it will always re-run - add_custom_command(OUTPUT ${TARGET_NAME}_ALWAYS_GENERATE - COMMAND ${CMAKE_COMMAND} -DJAVA_BIN=${JAVA_BIN} - -DCORE_DIR=${VALUE_ZSERIO_CORE_DIR} -DCPP_DIR=${VALUE_ZSERIO_CPP_DIR} -DOUT_DIR=${VALUE_OUT_DIR} - -DSOURCE_DIR=${VALUE_SOURCE_DIR} -DMAIN_SOURCE=${VALUE_MAIN_SOURCE} - -DOPTIONS="${VALUE_ZSERIO_OPTIONS}" -DEXTRA_OPTIONS="${ZSERIO_EXTRA_OPTIONS}" - -DEXPECTED_WARNINGS=${VALUE_EXPECTED_WARNINGS} - -DIGNORE_ERRORS=${VALUE_IGNORE_ERRORS} - -DLOG_FILENAME="${VALUE_ZSERIO_LOG_FILENAME}" - -DAPPEND_TO_LOG_FILE=${VALUE_APPEND_TO_ZSERIO_LOG_FILE} - -P ${CMAKE_MODULE_PATH}/zserio_tool.cmake - COMMENT "Generating sources with Zserio from ${VALUE_MAIN_SOURCE}") - - # add a custom target for the generation step - add_custom_target(${TARGET_NAME}_generate - DEPENDS ${TARGET_NAME}_ALWAYS_GENERATE) - - # add to custom "gen" target - if (NOT TARGET gen) - add_custom_target(gen COMMENT "Trigger compilation of all included zserio files.") - endif () - add_dependencies(gen ${TARGET_NAME}_generate) - - # delete whole directory even if Zserio generated a file that's not listed in ZSERIO_GENERATED_SOURCES - set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${VALUE_OUT_DIR}) - - # add a static library - if (SOURCE_FILE_POSITION EQUAL -1) - add_library(${TARGET_NAME} INTERFACE) - add_dependencies(${TARGET_NAME} ${TARGET_NAME}_generate) - target_include_directories(${TARGET_NAME} INTERFACE ${VALUE_OUT_DIR}) - target_link_libraries(${TARGET_NAME} INTERFACE ZserioCppRuntime) - else () - add_library(${TARGET_NAME} STATIC ${VALUE_OUT_FILES}) - add_dependencies(${TARGET_NAME} ${TARGET_NAME}_generate) - target_include_directories(${TARGET_NAME} PUBLIC ${VALUE_OUT_DIR}) - target_link_libraries(${TARGET_NAME} PUBLIC ZserioCppRuntime) - if (SOURCE_FILE_POSITION EQUAL -1) - # make sure that cmake knows language when no sources are available - set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE CXX) - endif () - set_target_properties(${TARGET_NAME} PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED YES - CXX_EXTENSIONS NO) - endif () -endfunction() diff --git a/compiler/extensions/cpp/README.md b/compiler/extensions/cpp/README.md index e1c39241d..703a606ae 100644 --- a/compiler/extensions/cpp/README.md +++ b/compiler/extensions/cpp/README.md @@ -29,6 +29,116 @@ Zserio C++ generator supports the following C++ compilers: Although newer C++ compilers are not tested, they should work as well as long as they are backward compatible. +## Using Zserio CMake Helper + +Zserio provides [`zserio_compiler.cmake`](https://github.com/ndsev/zserio/blob/master/cmake/zserio_compiler_cmake) helper, which defines custom function `zserio_generate_cpp`. +This function can be used for automatic generation of C++ sources from zserio schemas. + +#### Prerequisites + +* CMake 3.15+ +* Java must be available - the function calls `find_package(JAVA java)` +* `ZSERIO_JAR_FILE` must be defined either as an environment or CMake variable + +#### Usage + + zserio_generate_cpp( + TARGET + [SRC_DIR ] + [MAIN_ZS ] + [GEN_DIR ] + [EXTRA_ARGS ...] + [GENERATED_SOURCES_VAR ] + [OUTPUT_VAR ] + [ERROR_VAR ] + [RESULT_VAR ] + [FORCE_REGENERATION] + [CLEAN_GEN_DIR] + +#### Arguments + +`TARGET` + +Target to which the generated sources will be assigned. + +`SRC_DIR` + +Source directory for zserio schemas. Optional, defaults to `CMAKE_CURRENT_SOURCE_DIR`. + +`MAIN_ZS` + +Main zserio schema. Optional if the MAIN_ZS file is specified as a source for the given `TARGET`. + +`GEN_DIR` + +Directory where the C++ sources will be generated. + +`EXTRA_ARGS` + +Extra arguments to be passed to the Zserio tool. + +`GENERATED_SOURCES_VAR` + +The variable will be set with a list of generated source files (full paths). Optional. + +`OUTPUT_VAR` + +The variable will be set with the contents of the standard output pipe. Optional. +If not set, the standard output pipe is printed. + +`ERROR_VAR` + +The variable will be set with the contents of the standard error pipe. Optional. +If not set, the standard error pipe is printed. + +`RESULT_VAR` + +The variable will be set to contain the result of the zserio generator. Optional. +If not set, a `FATAL_ERROR` is raised in case of the zserio generator error. + +`FORCE_RECONFIGURE` + +Forces regeneration every time the CMake configure is run. + +`CLEAN_GEN_DIR` + +Cleans `GEN_DIR` when generation in CMake configure-time is run. + +> Note that `OUTPUT_VAR` and `ERROR_VAR` can be set to the same value and then both pipes will be merged. + +> Note that `OUTPUT_VAR`, `ERROR_VAR` and `RESULT_VAR` are updated only when the generation is executed within +> the configure-time - i.e. for the first time or when zserio schema sources are changed, etc. +> See "[How if works](#how-it-works)" for more info. + +#### Example + + set(CMAKE_MODULE_PATH "${ZSERIO_RELEASE}/cmake") + set(ZSERIO_JAR_FILE "${ZSERIO_RELEASE}/zserio.jar") + include(zserio_compiler) + + add_library(sample_zs sample.zs) + zserio_generate_cpp( + TARGET sample_zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) + +#### How it works + +First time the CMake configure is run, the sources are generated using `execute_process` directly in +configure-time and auxiliary information (timestamps, list of generated sources, etc.) is stored in the +CMake cache. The auxiliary info is used to define a custom command which uses the same zserio command line +as the original `execute_process` and thus allows to re-generate sources when it's needed - e.g. after the +clean step. + +The custom command is sufficient as long as the generated sources remains unchanged. Otherwise the +`execute_process` must be re-run in configure-time to ensure that all generated sources are collected correctly. +This functionality is achieved using the auxiliary information mentioned above. + +List of generated sources can change in following situations: + +- ZSERIO_JAR_FILE is changed +- Zserio schema sources are changed +- EXTRA_ARGS are changed + ## Functional Safety Zserio's C++ support is designed with a strong focus on functional safety, aiming to ensure the reliability, @@ -56,7 +166,7 @@ Clang-tidy tool is run using [this configuration](https://github.com/ndsev/zseri The clang-tidy report from the latest C++ runtime library is available [here](https://zserio.org/doc/runtime/latest/cpp/clang-tidy/clang-tidy-report.txt). Due to compatibility and functional safety considerations, zserio is constrained to utilize the C++11 standard. -Consequently, certain clang-tidy findings remain unresolved at present. This is mainly attributed to +Consequently, certain clang-tidy findings remain unresolved at present. This is mainly attributed to zserio's C++ runtime library, which operates at a lower level and emulates standard abstractions like std::span or std::string_view introduced in C++17. diff --git a/scripts/build.sh b/scripts/build.sh index d69ea78c0..c58796bff 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -193,6 +193,26 @@ install_python_runtime() return 0 } +# Install zserio_compiler.jar to distribution directory. +install_zserio_cmake_helper() +{ + exit_if_argc_ne $# 2 + local ZSERIO_PROJECT_ROOT="${1}"; shift + local ZSERIO_DISTR_DIR="${1}"; shift + + echo "Installing Zserio CMake helper." + echo + + mkdir -p "${ZSERIO_DISTR_DIR}/cmake" + cp "${ZSERIO_PROJECT_ROOT}/cmake/zserio_compiler.cmake" "${ZSERIO_DISTR_DIR}/cmake" + if [ $? -ne 0 ] ; then + stderr_echo "Failed to copy zseiro cmake helper!" + return 1 + fi + + return 0 +} + # Print help message. print_help() { @@ -554,6 +574,9 @@ main() return 1 fi echo + if [[ ${SWITCH_CLEAN} == 0 ]] ; then + install_zserio_cmake_helper "${ZSERIO_PROJECT_ROOT}" "${ZSERIO_DISTR_DIR}" + fi fi # build Zserio C++ runtime library @@ -613,6 +636,8 @@ main() return 1 fi echo + + install_zserio_cmake_helper "${ZSERIO_PROJECT_ROOT}" "${ZSERIO_DISTR_DIR}" fi # build Zserio Python extension diff --git a/scripts/common_tools.sh b/scripts/common_tools.sh index d45e42a80..48c67cf13 100644 --- a/scripts/common_tools.sh +++ b/scripts/common_tools.sh @@ -75,6 +75,9 @@ set_global_cpp_variables() # CMake extra arguments are empty by default CMAKE_EXTRA_ARGS="${CMAKE_EXTRA_ARGS:-""}" + # CMake reconfigure flag, 1 by default + CMAKE_RECONFIGURE="${CMAKE_RECONFIGURE:-1}" + # CTest to use, defaults to "ctest" if not set CTEST="${CTEST:-ctest}" if [ ! -f "`which "${CTEST}"`" ] ; then @@ -431,6 +434,7 @@ Uses the following environment variables for building: CLANG_VERSION_SUFFIX Clang compiler version suffix. Default is empty. Set e.g. "-8" to use "clang-8" instead of "clang". CMAKE_EXTRA_ARGS Extra arguments to CMake. Default is empty string. + CMAKE_RECONFIGURE Flag whether CMake should always reconfigure. Default is 1 (true). CMAKE_BUILD_OPTIONS Arguments to be passed by CMake to a native build tool. CTEST Ctest executable to use. Default is "ctest". DOXYGEN Doxygen executable to use. Default is 'doxygen". @@ -849,6 +853,11 @@ compile_cpp_for_target() BUILD_DIR="${BUILD_DIR}/${BUILD_TYPE_LOWER_CASE}" + local CMAKE_CACHE_EXISTS=0 + if [[ -f "${BUILD_DIR}"/CMakeCache.txt && -d "${BUILD_DIR}/CMakeFiles" ]] ; then + CMAKE_CACHE_EXISTS=1 + fi + mkdir -p "${BUILD_DIR}" pushd "${BUILD_DIR}" > /dev/null @@ -873,12 +882,14 @@ compile_cpp_for_target() fi # generate makefile running cmake - "${CMAKE}" ${CMAKE_EXTRA_ARGS} -G "${CMAKE_GENERATOR}" "${CMAKE_ARGS[@]}" "${CMAKELISTS_DIR}" - local CMAKE_RESULT=$? - if [ ${CMAKE_RESULT} -ne 0 ] ; then - stderr_echo "Running CMake failed with return code ${CMAKE_RESULT}!" - popd > /dev/null - return 1 + if [[ ${CMAKE_CACHE_EXISTS} == 0 || ${CMAKE_RECONFIGURE} == 1 ]] ; then + "${CMAKE}" ${CMAKE_EXTRA_ARGS} -G "${CMAKE_GENERATOR}" "${CMAKE_ARGS[@]}" "${CMAKELISTS_DIR}" + local CMAKE_RESULT=$? + if [ ${CMAKE_RESULT} -ne 0 ] ; then + stderr_echo "Running CMake failed with return code ${CMAKE_RESULT}!" + popd > /dev/null + return 1 + fi fi # build it running cmake diff --git a/scripts/release.sh b/scripts/release.sh index 691c0153d..cd50ec3ea 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -197,8 +197,8 @@ make_release() pushd "${ZSERIO_RELEASE_SRC_DIR}" > /dev/null # create zip: jar - "${ZIP}" -rq "${ZSERIO_RELEASE_ZIP_DIR}/zserio-${ZSERIO_VERSION}-bin.zip" "ant_task" "zserio_libs" \ - "zserio.jar" "zserio_javadocs.jar" "zserio_sources.jar" + "${ZIP}" -rq "${ZSERIO_RELEASE_ZIP_DIR}/zserio-${ZSERIO_VERSION}-bin.zip" "ant_task" "cmake" \ + "zserio_libs" "zserio.jar" "zserio_javadocs.jar" "zserio_sources.jar" if [ $? -ne 0 ] ; then stderr_echo "Can't zip Zserio release (bin)." return 1 diff --git a/scripts/test_perf.sh b/scripts/test_perf.sh index 67f7824f0..8b9a88b3f 100755 --- a/scripts/test_perf.sh +++ b/scripts/test_perf.sh @@ -315,9 +315,7 @@ endif () compiler_set_warnings() # add zserio runtime library -include(zserio_utils) -set(ZSERIO_RUNTIME_LIBRARY_DIR "\${ZSERIO_RELEASE}/runtime_libs/cpp") -zserio_add_runtime_library(RUNTIME_LIBRARY_DIR "\${ZSERIO_RUNTIME_LIBRARY_DIR}") +add_subdirectory("\${ZSERIO_RELEASE}/runtime_libs/cpp" ZserioCppRuntime) file(GLOB_RECURSE SOURCES RELATIVE "\${CMAKE_CURRENT_SOURCE_DIR}" "gen/*.cpp" "gen/*.h") diff --git a/scripts/test_zs.sh b/scripts/test_zs.sh index 1ff633a99..e4b888280 100755 --- a/scripts/test_zs.sh +++ b/scripts/test_zs.sh @@ -168,12 +168,11 @@ EOF # Generate CMakeList.txt generate_cmake_lists() { - exit_if_argc_ne $# 6 + exit_if_argc_ne $# 5 local ZSERIO_RELEASE="$1"; shift local ZSERIO_ROOT="$1"; shift local BUILD_DIR="$1"; shift local TEST_NAME="$1"; shift - local RUNTIME_LIBRARY_SUBDIR="$1"; shift local NEEDS_SQLITE="$1"; shift # use host paths in generated files @@ -226,9 +225,7 @@ endif () compiler_set_test_warnings()${WERROR_SETUP}${SQLITE_SETUP} # add zserio runtime library -include(zserio_utils) -set(ZSERIO_RUNTIME_LIBRARY_DIR "\${ZSERIO_RELEASE}/runtime_libs/${RUNTIME_LIBRARY_SUBDIR}") -zserio_add_runtime_library(RUNTIME_LIBRARY_DIR "\${ZSERIO_RUNTIME_LIBRARY_DIR}") +add_subdirectory("\${ZSERIO_RELEASE}/runtime_libs/cpp" ZserioCppRuntime) file(GLOB_RECURSE SOURCES "gen/*.cpp" "gen/*.h") add_library(\${PROJECT_NAME} \${SOURCES}) @@ -341,8 +338,7 @@ test_zs() ! grep "#include " -qr ${TEST_OUT_DIR}/cpp/gen local CPP_NEEDS_SQLITE=$? generate_cmake_lists "${UNPACKED_ZSERIO_RELEASE_DIR}" "${ZSERIO_PROJECT_ROOT}" \ - "${TEST_OUT_DIR}/cpp" "${SWITCH_TEST_NAME}" "cpp" \ - ${CPP_NEEDS_SQLITE} + "${TEST_OUT_DIR}/cpp" "${SWITCH_TEST_NAME}" ${CPP_NEEDS_SQLITE} local CTEST_ARGS=() compile_cpp "${ZSERIO_PROJECT_ROOT}" "${TEST_OUT_DIR}/cpp" "${TEST_OUT_DIR}/cpp" CPP_TARGETS[@] \ CMAKE_ARGS[@] CTEST_ARGS[@] all diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b83e35406..7af522686 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -4,7 +4,7 @@ # # This CMake file is designed to be included directly without any further dependencies. # -cmake_minimum_required(VERSION 3.6.0) +cmake_minimum_required(VERSION 3.15.0) project(ZserioCppTest) @@ -54,11 +54,10 @@ compiler_set_warnings() compiler_set_warnings_as_errors() # add zserio runtime library -include(zserio_utils) -set(ZSERIO_JAR_DIR "${ZSERIO_RELEASE_ROOT}/zserio_libs") -set(ZSERIO_CPP_DISTR_DIR "${ZSERIO_JAR_DIR}") -set(ZSERIO_RUNTIME_LIBRARY_DIR "${ZSERIO_RELEASE_ROOT}/runtime_libs/cpp") -zserio_add_runtime_library(RUNTIME_LIBRARY_DIR "${ZSERIO_RUNTIME_LIBRARY_DIR}") +set(ZSERIO_JAR_FILE "${ZSERIO_RELEASE_ROOT}/zserio.jar") +include(zserio_compiler) + +add_subdirectory("${ZSERIO_RELEASE_ROOT}/runtime_libs/cpp" ZserioCppRuntime) compiler_reset_warnings() compiler_set_test_warnings() @@ -66,6 +65,16 @@ if (SANITIZERS_ENABLED) compiler_set_undefined_sanitizer() endif () +# A function which checks whether the number of warnings produced by zserio compilers is as expected. +function(check_zserio_warnings ZSERIO_LOG EXPECTED_WARNINGS) + string(REGEX MATCHALL "\\[WARNING\\]" WARNINGS "${ZSERIO_LOG}") + list(LENGTH WARNINGS NUM_WARNINGS) + + if (NOT ${NUM_WARNINGS} EQUAL ${EXPECTED_WARNINGS}) + message(FATAL_ERROR "Zserio tool produced ${NUM_WARNINGS} warning(s) (expected ${EXPECTED_WARNINGS})!") + endif () +endfunction() + # cppcheck needs to know all include directories in generated code function(get_generated_dirs GENERATED_SOURCES GENERATED_INCLUDES_VAR) foreach (SOURCE ${GENERATED_SOURCES}) diff --git a/test/arguments/allow_implicit_arrays/CMakeLists.txt b/test/arguments/allow_implicit_arrays/CMakeLists.txt index 44ec9ccde..3441d69dd 100644 --- a/test/arguments/allow_implicit_arrays/CMakeLists.txt +++ b/test/arguments/allow_implicit_arrays/CMakeLists.txt @@ -1,42 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_bit8/ImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_bit8/ImplicitArray.h - - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_float16/ImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_float16/ImplicitArray.h - - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_int24/ImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_int24/ImplicitArray.h - - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_uint8/ImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_uint8/ImplicitArray.h - - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_uint64/ImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/implicit_array_uint64/ImplicitArray.h - - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/lengthof_with_implicit_array/LengthOfWithImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/lengthof_with_implicit_array/LengthOfWithImplicitArray.h - - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/table_with_implicit_array/DbWithImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/table_with_implicit_array/DbWithImplicitArray.h - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/table_with_implicit_array/StructWithImplicit.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/table_with_implicit_array/StructWithImplicit.h - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/table_with_implicit_array/TableWithImplicitArray.cpp - ${ZSERIO_GEN_DIR}/allow_implicit_arrays/table_with_implicit_array/TableWithImplicitArray.h -) - -zserio_add_library(allow_implicit_arrays_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE allow_implicit_arrays.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -allowImplicitArrays -withoutSourcesAmalgamation +add_library(allow_implicit_arrays_zs STATIC zs/allow_implicit_arrays.zs) +zserio_generate_cpp( + TARGET allow_implicit_arrays_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -allowImplicitArrays + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(allow_implicit_arrays_zs PUBLIC ZserioCppRuntime) target_include_directories(allow_implicit_arrays_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(allow_implicit_arrays DEPENDS @@ -50,5 +27,5 @@ add_custom_test(allow_implicit_arrays ${CMAKE_CURRENT_SOURCE_DIR}/cpp/LengthOfWithImplicitArrayTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/TableWithImplicitArrayTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/set_cpp_allocator/CMakeLists.txt b/test/arguments/set_cpp_allocator/CMakeLists.txt index 777ee0184..b058abb52 100644 --- a/test/arguments/set_cpp_allocator/CMakeLists.txt +++ b/test/arguments/set_cpp_allocator/CMakeLists.txt @@ -1,100 +1,67 @@ -set(ZSERIO_GEN_DIR_COMPLEX_ALLOCATION ${CMAKE_CURRENT_BINARY_DIR}/gen_complex_allocation) -set(ZSERIO_GENERATED_SOURCES_COMPLEX_ALLOCATION - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/MainStructure.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/MainStructure.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_choice/AllocationChoice.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_choice/AllocationChoice.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_choice/ChoiceCompound.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_choice/ChoiceCompound.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_struct/AllocationStruct.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_struct/AllocationStruct.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_struct/Element.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_struct/Element.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_struct_optional/AllocationStructOptional.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_struct_optional/AllocationStructOptional.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_union/AllocationUnion.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_union/AllocationUnion.h - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_union/UnionCompound.cpp - ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION}/complex_allocation/allocation_union/UnionCompound.h +add_library(complex_allocation_zs STATIC zs/complex_allocation.zs) +zserio_generate_cpp( + TARGET complex_allocation_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_complex_allocation + EXTRA_ARGS -withoutSourcesAmalgamation -setCppAllocator polymorphic + GENERATED_SOURCES_VAR GENERATED_SOURCES_COMPLEX_ALLOCATION + OUTPUT_VAR ZSERIO_LOG_COMPLEX_ALLOCATION + ERROR_VAR ZSERIO_LOG_COMPLEX_ALLOCATION ) +target_link_libraries(complex_allocation_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_COMPLEX_ALLOCATION) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_complex_allocation.txt "${ZSERIO_LOG_COMPLEX_ALLOCATION}") + check_zserio_warnings("${ZSERIO_LOG_COMPLEX_ALLOCATION}" 0) +endif () -set(ZSERIO_GEN_DIR_PUBSUB_ALLOCATION ${CMAKE_CURRENT_BINARY_DIR}/gen_pubsub_allocation) -set(ZSERIO_GENERATED_SOURCES_PUBSUB_ALLOCATION - ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION}/pubsub_allocation/Greeting.cpp - ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION}/pubsub_allocation/Greeting.h - ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION}/pubsub_allocation/GreetingPubsub.cpp - ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION}/pubsub_allocation/GreetingPubsub.h - ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION}/pubsub_allocation/Name.cpp - ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION}/pubsub_allocation/Name.h +add_library(pubsub_allocation_zs STATIC zs/pubsub_allocation.zs) +zserio_generate_cpp( + TARGET pubsub_allocation_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_pubsub_allocation + EXTRA_ARGS -withoutSourcesAmalgamation -setCppAllocator polymorphic + GENERATED_SOURCES_VAR GENERATED_SOURCES_PUBSUB_ALLOCATION + OUTPUT_VAR ZSERIO_LOG_PUBSUB_ALLOCATION + ERROR_VAR ZSERIO_LOG_PUBSUB_ALLOCATION ) +target_link_libraries(pubsub_allocation_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_PUBSUB_ALLOCATION) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_pubsub_allocation.txt "${ZSERIO_LOG_PUBSUB_ALLOCATION}") + check_zserio_warnings("${ZSERIO_LOG_PUBSUB_ALLOCATION}" 0) +endif () -set(ZSERIO_GEN_DIR_SERVICE_ALLOCATION ${CMAKE_CURRENT_BINARY_DIR}/gen_service_allocation) -set(ZSERIO_GENERATED_SOURCES_SERVICE_ALLOCATION - ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION}/service_allocation/Greeting.cpp - ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION}/service_allocation/Greeting.h - ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION}/service_allocation/GreetingService.cpp - ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION}/service_allocation/GreetingService.h - ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION}/service_allocation/Name.cpp - ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION}/service_allocation/Name.h +add_library(service_allocation_zs STATIC zs/service_allocation.zs) +zserio_generate_cpp( + TARGET service_allocation_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_service_allocation + EXTRA_ARGS -withoutSourcesAmalgamation -setCppAllocator polymorphic + GENERATED_SOURCES_VAR GENERATED_SOURCES_SERVICE_ALLOCATION + OUTPUT_VAR ZSERIO_LOG_SERVICE_ALLOCATION + ERROR_VAR ZSERIO_LOG_SERVICE_ALLOCATION ) +target_link_libraries(service_allocation_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_SERVICE_ALLOCATION) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_service_allocation.txt "${ZSERIO_LOG_SERVICE_ALLOCATION}") + check_zserio_warnings("${ZSERIO_LOG_SERVICE_ALLOCATION}" 0) +endif () -set(ZSERIO_GEN_DIR_SQL_ALLOCATION ${CMAKE_CURRENT_BINARY_DIR}/gen_sql_allocation) -set(ZSERIO_GENERATED_SOURCES_SQL_ALLOCATION - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/Color.cpp - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/Color.h - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/DataBlob.cpp - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/DataBlob.h - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/ParameterizedBlob.cpp - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/ParameterizedBlob.h - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/Role.cpp - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/Role.h - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/SqlAllocationDb.cpp - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/SqlAllocationDb.h - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/SqlAllocationTable.cpp - ${ZSERIO_GEN_DIR_SQL_ALLOCATION}/sql_allocation/SqlAllocationTable.h +add_library(sql_allocation_zs STATIC zs/sql_allocation.zs) +zserio_generate_cpp( + TARGET sql_allocation_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_sql_allocation + EXTRA_ARGS -withoutSourcesAmalgamation -setCppAllocator polymorphic -withValidationCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG_SQL_ALLOCATION + ERROR_VAR ZSERIO_LOG_SQL_ALLOCATION ) - -zserio_add_library(complex_allocation_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE complex_allocation.zs - OUT_DIR ${ZSERIO_GEN_DIR_COMPLEX_ALLOCATION} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_COMPLEX_ALLOCATION} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -setCppAllocator polymorphic -withoutSourcesAmalgamation -) - -zserio_add_library(pubsub_allocation_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE pubsub_allocation.zs - OUT_DIR ${ZSERIO_GEN_DIR_PUBSUB_ALLOCATION} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_PUBSUB_ALLOCATION} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -setCppAllocator polymorphic -withoutSourcesAmalgamation -) - -zserio_add_library(service_allocation_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE service_allocation.zs - OUT_DIR ${ZSERIO_GEN_DIR_SERVICE_ALLOCATION} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_SERVICE_ALLOCATION} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -setCppAllocator polymorphic -withoutSourcesAmalgamation -) - -zserio_add_library(sql_allocation_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_allocation.zs - OUT_DIR ${ZSERIO_GEN_DIR_SQL_ALLOCATION} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_SQL_ALLOCATION} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -setCppAllocator polymorphic -withoutSourcesAmalgamation -withValidationCode -) - +target_link_libraries(sql_allocation_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_allocation_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG_SQL_ALLOCATION) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_sql_allocation.txt "${ZSERIO_LOG_SQL_ALLOCATION}") + check_zserio_warnings("${ZSERIO_LOG_SQL_ALLOCATION}" 0) +endif () add_custom_test(set_cpp_allocator DEPENDS @@ -108,8 +75,8 @@ add_custom_test(set_cpp_allocator ${CMAKE_CURRENT_SOURCE_DIR}/cpp/ServiceAllocationTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SqlAllocationTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES_COMPLEX_ALLOCATION} - ${ZSERIO_GENERATED_SOURCES_PUBSUB_ALLOCATION} - ${ZSERIO_GENERATED_SOURCES_SERVICE_ALLOCATION} - ${ZSERIO_GENERATED_SOURCES_SQL_ALLOCATION} + ${GENERATED_SOURCES_COMPLEX_ALLOCATION} + ${GENERATED_SOURCES_PUBSUB_ALLOCATION} + ${GENERATED_SOURCES_SERVICE_ALLOCATION} + ${GENERATED_SOURCES_SQL_ALLOCATION} ) diff --git a/test/arguments/set_top_level_package/CMakeLists.txt b/test/arguments/set_top_level_package/CMakeLists.txt index 7b5c83296..aaaf2f336 100644 --- a/test/arguments/set_top_level_package/CMakeLists.txt +++ b/test/arguments/set_top_level_package/CMakeLists.txt @@ -1,28 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/company/appl/set_top_level_package/constant/CONST.h - - ${ZSERIO_GEN_DIR}/company/appl/set_top_level_package/enumeration/Enumeration.cpp - ${ZSERIO_GEN_DIR}/company/appl/set_top_level_package/enumeration/Enumeration.h - - ${ZSERIO_GEN_DIR}/company/appl/SimpleChoice.cpp - ${ZSERIO_GEN_DIR}/company/appl/SimpleChoice.h - ${ZSERIO_GEN_DIR}/company/appl/SimpleStructure.cpp - ${ZSERIO_GEN_DIR}/company/appl/SimpleStructure.h - ${ZSERIO_GEN_DIR}/company/appl/SimpleTemplate_Enumeration.cpp - ${ZSERIO_GEN_DIR}/company/appl/SimpleTemplate_Enumeration.h - ${ZSERIO_GEN_DIR}/company/appl/U8.h -) - -zserio_add_library(set_top_level_package_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE set_top_level_package.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -setTopLevelPackage company.appl -withoutSourcesAmalgamation +add_library(set_top_level_package_zs STATIC zs/set_top_level_package.zs) +zserio_generate_cpp( + TARGET set_top_level_package_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -setTopLevelPackage company.appl + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(set_top_level_package_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(set_top_level_package DEPENDS @@ -30,5 +20,5 @@ add_custom_test(set_top_level_package SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SetTopLevelPackageTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/with_range_check_code/CMakeLists.txt b/test/arguments/with_range_check_code/CMakeLists.txt index d2f688b69..abfd45376 100644 --- a/test/arguments/with_range_check_code/CMakeLists.txt +++ b/test/arguments/with_range_check_code/CMakeLists.txt @@ -1,66 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/with_range_check_code/bit4_range_check/Bit4RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/bit4_range_check/Bit4RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/choice_bit4_range_check/ChoiceBit4RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/choice_bit4_range_check/ChoiceBit4RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/dynamic_bit_range_check/DynamicBitRangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/dynamic_bit_range_check/DynamicBitRangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/dynamic_int_range_check/DynamicIntRangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/dynamic_int_range_check/DynamicIntRangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/int4_range_check/Int4RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/int4_range_check/Int4RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/int7_array_range_check/Int7ArrayRangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/int7_array_range_check/Int7ArrayRangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/int8_range_check/Int8RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/int8_range_check/Int8RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/optional_bit31_range_check/OptionalBit31RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/optional_bit31_range_check/OptionalBit31RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/uint8_range_check/UInt8RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/uint8_range_check/UInt8RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/union_int4_range_check/UnionInt4RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/union_int4_range_check/UnionInt4RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varint16_range_check/VarInt16RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varint16_range_check/VarInt16RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varint32_range_check/VarInt32RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varint32_range_check/VarInt32RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varint64_range_check/VarInt64RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varint64_range_check/VarInt64RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varsize_range_check/VarSizeRangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varsize_range_check/VarSizeRangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varuint16_range_check/VarUInt16RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varuint16_range_check/VarUInt16RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varuint32_range_check/VarUInt32RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varuint32_range_check/VarUInt32RangeCheckCompound.h - - ${ZSERIO_GEN_DIR}/with_range_check_code/varuint64_range_check/VarUInt64RangeCheckCompound.cpp - ${ZSERIO_GEN_DIR}/with_range_check_code/varuint64_range_check/VarUInt64RangeCheckCompound.h -) - -zserio_add_library(with_range_check_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE with_range_check_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withRangeCheckCode -withoutSourcesAmalgamation +add_library(with_range_check_code_zs STATIC zs/with_range_check_code.zs) +zserio_generate_cpp( + TARGET with_range_check_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withRangeCheckCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(with_range_check_code_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(with_range_check_code DEPENDS @@ -84,5 +36,5 @@ add_custom_test(with_range_check_code ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VarUInt32RangeCheckTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VarUInt64RangeCheckTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/with_range_check_code/ClangTidySuppressions.txt b/test/arguments/with_range_check_code/ClangTidySuppressions.txt index 431bce351..da44b13f6 100644 --- a/test/arguments/with_range_check_code/ClangTidySuppressions.txt +++ b/test/arguments/with_range_check_code/ClangTidySuppressions.txt @@ -14,10 +14,12 @@ readability-make-member-function-const:gen/with_range_check_code/uint8_range_che readability-make-member-function-const:gen/with_range_check_code/varint16_range_check/VarInt16RangeCheckCompound.cpp readability-make-member-function-const:gen/with_range_check_code/varint32_range_check/VarInt32RangeCheckCompound.cpp readability-make-member-function-const:gen/with_range_check_code/varint64_range_check/VarInt64RangeCheckCompound.cpp +readability-make-member-function-const:gen/with_range_check_code/varint_range_check/VarIntRangeCheckCompound.cpp readability-make-member-function-const:gen/with_range_check_code/varsize_range_check/VarSizeRangeCheckCompound.cpp readability-make-member-function-const:gen/with_range_check_code/varuint16_range_check/VarUInt16RangeCheckCompound.cpp readability-make-member-function-const:gen/with_range_check_code/varuint32_range_check/VarUInt32RangeCheckCompound.cpp readability-make-member-function-const:gen/with_range_check_code/varuint64_range_check/VarUInt64RangeCheckCompound.cpp +readability-make-member-function-const:gen/with_range_check_code/varuint_range_check/VarUIntRangeCheckCompound.cpp readability-simplify-boolean-expr:gen/with_range_check_code/choice_bit4_range_check/ChoiceBit4RangeCheckCompound.cpp readability-simplify-boolean-expr:gen/with_range_check_code/optional_bit31_range_check/OptionalBit31RangeCheckCompound.cpp diff --git a/test/arguments/with_reflection_code/CMakeLists.txt b/test/arguments/with_reflection_code/CMakeLists.txt index e186c81d6..8dcd6f8f9 100644 --- a/test/arguments/with_reflection_code/CMakeLists.txt +++ b/test/arguments/with_reflection_code/CMakeLists.txt @@ -1,39 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/with_reflection_code/Bitmask.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Bitmask.h - ${ZSERIO_GEN_DIR}/with_reflection_code/BitmaskLen.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Child.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Child.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Choice.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Choice.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Empty.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Empty.h - ${ZSERIO_GEN_DIR}/with_reflection_code/EmptyString.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Extended.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Extended.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Original.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Original.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Parameterized.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Parameterized.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Selector.h - ${ZSERIO_GEN_DIR}/with_reflection_code/SelectorEnum.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/SelectorEnum.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Struct.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Struct.h - ${ZSERIO_GEN_DIR}/with_reflection_code/Union.cpp - ${ZSERIO_GEN_DIR}/with_reflection_code/Union.h -) - -zserio_add_library(with_reflection_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE with_reflection_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withTypeInfoCode -withReflectionCode -withoutSourcesAmalgamation +add_library(with_reflection_code_zs STATIC zs/with_reflection_code.zs) +zserio_generate_cpp( + TARGET with_reflection_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withTypeInfoCode -withReflectionCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(with_reflection_code_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(with_reflection_code DEPENDS @@ -41,5 +20,5 @@ add_custom_test(with_reflection_code SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithReflectionCodeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/with_sources_amalgamation/CMakeLists.txt b/test/arguments/with_sources_amalgamation/CMakeLists.txt index 88b07685a..8c37d834c 100644 --- a/test/arguments/with_sources_amalgamation/CMakeLists.txt +++ b/test/arguments/with_sources_amalgamation/CMakeLists.txt @@ -1,45 +1,37 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GEN_DEFAULT_PACKAGE_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_default_package) - -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/with_sources_amalgamation/WithSourcesAmalgamation.cpp - ${ZSERIO_GEN_DIR}/with_sources_amalgamation/GeoMapTable.h - ${ZSERIO_GEN_DIR}/with_sources_amalgamation/WorldDb.h - - ${ZSERIO_GEN_DIR}/_imported_tile_/ImportedTile.cpp - ${ZSERIO_GEN_DIR}/_imported_tile_/Tile.h - - ${ZSERIO_GEN_DIR}/___/Amalgamation.cpp - ${ZSERIO_GEN_DIR}/___/Empty.h -) - -set(ZSERIO_GENERATED_SOURCES_DEFAULT_PACKAGE - ${ZSERIO_GEN_DEFAULT_PACKAGE_DIR}/DefaultPackageAmalgamation.cpp - - ${ZSERIO_GEN_DEFAULT_PACKAGE_DIR}/AmalgamationStructure.h +add_library(with_sources_amalgamation_zs STATIC zs/with_sources_amalgamation.zs) +zserio_generate_cpp( + TARGET with_sources_amalgamation_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG_WITH_SOURCES_AMALGAMATION + ERROR_VAR ZSERIO_LOG_WITH_SOURCES_AMALGAMATION ) - -zserio_add_library(with_sources_amalgamation_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE with_sources_amalgamation.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withSourcesAmalgamation -) - -zserio_add_library(default_package_amalgamation_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE default_package_amalgamation.zs - OUT_DIR ${ZSERIO_GEN_DEFAULT_PACKAGE_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_DEFAULT_PACKAGE} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withSourcesAmalgamation -) - +target_link_libraries(with_sources_amalgamation_zs PUBLIC ZserioCppRuntime) target_include_directories(with_sources_amalgamation_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG_WITH_SOURCES_AMALGAMATION) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_with_sources_amalgamation.txt + "${ZSERIO_LOG_WITH_SOURCES_AMALGAMATION}") + check_zserio_warnings("${ZSERIO_LOG_WITH_SOURCES_AMALGAMATION}" 0) +endif () + +add_library(default_package_amalgamation_zs STATIC zs/default_package_amalgamation.zs) +zserio_generate_cpp( + TARGET default_package_amalgamation_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_default_package + EXTRA_ARGS -withSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_DEFAULT_PACKAGE + OUTPUT_VAR ZSERIO_LOG_DEFAULT_PACKAGE_AMALGAMATION + ERROR_VAR ZSERIO_LOG_DEFAULT_PACKAGE_AMALGAMATION +) +target_link_libraries(default_package_amalgamation_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_DEFAULT_PACKAGE_AMALGAMATION) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_default_package_amalgamation.txt + "${ZSERIO_LOG_DEFAULT_PACKAGE_AMALGAMATION}") + check_zserio_warnings("${ZSERIO_LOG_DEFAULT_PACKAGE_AMALGAMATION}" 0) +endif () add_custom_test(with_sources_amalgamation DEPENDS @@ -49,6 +41,6 @@ add_custom_test(with_sources_amalgamation ${CMAKE_CURRENT_SOURCE_DIR}/cpp/DefaultPackageAmalgamationTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithSourcesAmalgamationTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} - ${ZSERIO_GENERATED_SOURCES_DEFAULT_PACKAGE} + ${GENERATED_SOURCES} + ${GENERATED_SOURCES_DEFAULT_PACKAGE} ) diff --git a/test/arguments/with_type_info_code/CMakeLists.txt b/test/arguments/with_type_info_code/CMakeLists.txt index b27d24b2f..1234e3d99 100644 --- a/test/arguments/with_type_info_code/CMakeLists.txt +++ b/test/arguments/with_type_info_code/CMakeLists.txt @@ -1,62 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/with_type_info_code/ComplexStruct.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/ComplexStruct.h - ${ZSERIO_GEN_DIR}/with_type_info_code/EnumUnderlyingType.h - ${ZSERIO_GEN_DIR}/with_type_info_code/Fts4Table.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/Fts4Table.h - ${ZSERIO_GEN_DIR}/with_type_info_code/ParameterizedStruct.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/ParameterizedStruct.h - ${ZSERIO_GEN_DIR}/with_type_info_code/RecursiveChoice.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/RecursiveChoice.h - ${ZSERIO_GEN_DIR}/with_type_info_code/RecursiveStruct.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/RecursiveStruct.h - ${ZSERIO_GEN_DIR}/with_type_info_code/RecursiveUnion.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/RecursiveUnion.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleChoice.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleChoice.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SimplePubsub.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SimplePubsub.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleService.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleService.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleStruct.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleStruct.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleUnion.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SimpleUnion.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SqlDatabase.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SqlDatabase.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SqlTable.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/SqlTable.h - ${ZSERIO_GEN_DIR}/with_type_info_code/SubtypedSimpleStruct.h - ${ZSERIO_GEN_DIR}/with_type_info_code/TemplatedParameterizedStruct_TS32.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/TemplatedParameterizedStruct_TS32.h - ${ZSERIO_GEN_DIR}/with_type_info_code/TemplatedSqlTableU8.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/TemplatedSqlTableU8.h - ${ZSERIO_GEN_DIR}/with_type_info_code/TemplatedSqlTable_uint32.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/TemplatedSqlTable_uint32.h - ${ZSERIO_GEN_DIR}/with_type_info_code/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/TestBitmask.h - ${ZSERIO_GEN_DIR}/with_type_info_code/TestEnum.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/TestEnum.h - ${ZSERIO_GEN_DIR}/with_type_info_code/TS32.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/TS32.h - ${ZSERIO_GEN_DIR}/with_type_info_code/WithoutRowIdTable.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/WithoutRowIdTable.h - ${ZSERIO_GEN_DIR}/with_type_info_code/WithTypeInfoCode.cpp - ${ZSERIO_GEN_DIR}/with_type_info_code/WithTypeInfoCode.h +add_library(with_type_info_code_zs STATIC zs/with_type_info_code.zs) +zserio_generate_cpp( + TARGET with_type_info_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withTypeInfoCode -withReflectionCode -allowImplicitArrays + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(with_type_info_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE with_type_info_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withTypeInfoCode -allowImplicitArrays -withoutSourcesAmalgamation -withReflectionCode -) - +target_link_libraries(with_type_info_code_zs PUBLIC ZserioCppRuntime) target_include_directories(with_type_info_code_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(with_type_info_code DEPENDS @@ -67,5 +24,5 @@ add_custom_test(with_type_info_code ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithTypeInfoCodeCreator.h ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithTypeInfoCodeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/with_validation_code/CMakeLists.txt b/test/arguments/with_validation_code/CMakeLists.txt index a384bc685..1ac89fd34 100644 --- a/test/arguments/with_validation_code/CMakeLists.txt +++ b/test/arguments/with_validation_code/CMakeLists.txt @@ -1,84 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/with_validation_code/blob_table_validation/Blob.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/blob_table_validation/Blob.h - ${ZSERIO_GEN_DIR}/with_validation_code/blob_table_validation/BlobTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/blob_table_validation/BlobTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/blob_table_validation/BlobTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/blob_table_validation/BlobTableValidationDb.h - - ${ZSERIO_GEN_DIR}/with_validation_code/column_type_validation/Blob.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/column_type_validation/Blob.h - ${ZSERIO_GEN_DIR}/with_validation_code/column_type_validation/ColumnTypeDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/column_type_validation/ColumnTypeDb.h - ${ZSERIO_GEN_DIR}/with_validation_code/column_type_validation/ColumnTypeTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/column_type_validation/ColumnTypeTable.h - - ${ZSERIO_GEN_DIR}/with_validation_code/constraint_table_validation/Blob.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/constraint_table_validation/Blob.h - ${ZSERIO_GEN_DIR}/with_validation_code/constraint_table_validation/ConstraintTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/constraint_table_validation/ConstraintTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/constraint_table_validation/ConstraintTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/constraint_table_validation/ConstraintTableValidationDb.h - - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Blob.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Blob.h - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Table1.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Table1.h - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Table2.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Table2.h - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Table3.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/Table3.h - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/ControlValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/control_validation/ControlValidationDb.h - - ${ZSERIO_GEN_DIR}/with_validation_code/depend_table_validation/Blob.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/depend_table_validation/Blob.h - ${ZSERIO_GEN_DIR}/with_validation_code/depend_table_validation/DependTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/depend_table_validation/DependTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/depend_table_validation/DependTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/depend_table_validation/DependTableValidationDb.h - - ${ZSERIO_GEN_DIR}/with_validation_code/full_range_table_validation/FullRangeTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/full_range_table_validation/FullRangeTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/full_range_table_validation/FullRangeTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/full_range_table_validation/FullRangeTableValidationDb.h - - ${ZSERIO_GEN_DIR}/with_validation_code/hidden_column_table_validation/HiddenColumnTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/hidden_column_table_validation/HiddenColumnTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/hidden_column_table_validation/HiddenColumnTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/hidden_column_table_validation/HiddenColumnTableValidationDb.h - - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/RootStruct.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/RootStruct.h - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/SimpleTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/SimpleTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/SimpleTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/SimpleTableValidationDb.h - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/TestBitmask.h - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/TestEnum.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/simple_table_validation/TestEnum.h - - ${ZSERIO_GEN_DIR}/with_validation_code/virtual_table_validation/VirtualTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/virtual_table_validation/VirtualTable.h - ${ZSERIO_GEN_DIR}/with_validation_code/virtual_table_validation/VirtualTableValidationDb.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/virtual_table_validation/VirtualTableValidationDb.h - ${ZSERIO_GEN_DIR}/with_validation_code/virtual_table_validation/TestTable.cpp - ${ZSERIO_GEN_DIR}/with_validation_code/virtual_table_validation/TestTable.h +add_library(with_validation_code_zs STATIC zs/with_validation_code.zs) +zserio_generate_cpp( + TARGET with_validation_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withValidationCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(with_validation_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE with_validation_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withValidationCode -withoutSourcesAmalgamation -) - +target_link_libraries(with_validation_code_zs PUBLIC ZserioCppRuntime) target_include_directories(with_validation_code_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(with_validation_code DEPENDS @@ -94,5 +29,5 @@ add_custom_test(with_validation_code ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimpleTableValidationTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VirtualTableValidationTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/without_cross_extension_check/CMakeLists.txt b/test/arguments/without_cross_extension_check/CMakeLists.txt index c8ea80d3e..b305d1839 100644 --- a/test/arguments/without_cross_extension_check/CMakeLists.txt +++ b/test/arguments/without_cross_extension_check/CMakeLists.txt @@ -1,34 +1,34 @@ -set(ZSERIO_GEN_DIR_JAVA ${CMAKE_CURRENT_BINARY_DIR}/gen_java) -set(ZSERIO_GENERATED_SOURCES_JAVA - ${ZSERIO_GEN_DIR_JAVA}/invalid_in_java/Test.cpp - ${ZSERIO_GEN_DIR_JAVA}/invalid_in_java/Test.h +add_library(invalid_in_java_zs STATIC zs/invalid_in_java.zs) +zserio_generate_cpp( + TARGET invalid_in_java_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_java + EXTRA_ARGS -withoutSourcesAmalgamation -withoutCrossExtensionCheck + GENERATED_SOURCES_VAR GENERATED_SOURCES_JAVA + OUTPUT_VAR ZSERIO_LOG_INVALID_IN_JAVA + ERROR_VAR ZSERIO_LOG_INVALID_IN_JAVA ) +target_link_libraries(invalid_in_java_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_INVALID_IN_JAVA) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_invalid_in_java.txt "${ZSERIO_LOG_INVALID_IN_JAVA}") + check_zserio_warnings("${ZSERIO_LOG_INVALID_IN_JAVA}" 0) +endif () -set(ZSERIO_GEN_DIR_PYTHON ${CMAKE_CURRENT_BINARY_DIR}/gen_python) -set(ZSERIO_GENERATED_SOURCES_PYTHON - ${ZSERIO_GEN_DIR_PYTHON}/invalid_in_python/Test.cpp - ${ZSERIO_GEN_DIR_PYTHON}/invalid_in_python/Test.h -) - -zserio_add_library(invalid_in_java_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE invalid_in_java.zs - OUT_DIR ${ZSERIO_GEN_DIR_JAVA} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_JAVA} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -withoutCrossExtensionCheck -) - -zserio_add_library(invalid_in_python_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE invalid_in_python.zs - OUT_DIR ${ZSERIO_GEN_DIR_PYTHON} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_PYTHON} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -withoutCrossExtensionCheck +add_library(invalid_in_python_zs STATIC zs/invalid_in_python.zs) +zserio_generate_cpp( + TARGET invalid_in_python_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_python + EXTRA_ARGS -withoutSourcesAmalgamation -withoutCrossExtensionCheck + GENERATED_SOURCES_VAR GENERATED_SOURCES_PYTHON + OUTPUT_VAR ZSERIO_LOG_INVALID_IN_PYTHON + ERROR_VAR ZSERIO_LOG_INVALID_IN_PYTHON ) +target_link_libraries(invalid_in_python_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_INVALID_IN_PYTHON) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_invalid_in_python.txt "${ZSERIO_LOG_INVALID_IN_PYTHON}") + check_zserio_warnings("${ZSERIO_LOG_INVALID_IN_PYTHON}" 0) +endif () add_custom_test(without_cross_extension_check DEPENDS @@ -37,6 +37,6 @@ add_custom_test(without_cross_extension_check SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithoutCrossExtensionCheckTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES_JAVA} - ${ZSERIO_GENERATED_SOURCES_PYTHON} + ${GENERATED_SOURCES_JAVA} + ${GENERATED_SOURCES_PYTHON} ) diff --git a/test/arguments/without_pubsub_code/CMakeLists.txt b/test/arguments/without_pubsub_code/CMakeLists.txt index 2f65715b0..2e4d17b8c 100644 --- a/test/arguments/without_pubsub_code/CMakeLists.txt +++ b/test/arguments/without_pubsub_code/CMakeLists.txt @@ -1,23 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - # Pubsub files are not generated - ${ZSERIO_GEN_DIR}/without_pubsub_code/Response.cpp - ${ZSERIO_GEN_DIR}/without_pubsub_code/Response.h - ${ZSERIO_GEN_DIR}/without_pubsub_code/Request.cpp - ${ZSERIO_GEN_DIR}/without_pubsub_code/Request.h - ${ZSERIO_GEN_DIR}/without_pubsub_code/Service.cpp - ${ZSERIO_GEN_DIR}/without_pubsub_code/Service.h -) - -zserio_add_library(without_pubsub_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE without_pubsub_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutPubsubCode -withoutSourcesAmalgamation +add_library(without_pubsub_code_zs STATIC zs/without_pubsub_code.zs) +zserio_generate_cpp( + TARGET without_pubsub_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withoutPubsubCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(without_pubsub_code_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(without_pubsub_code DEPENDS @@ -25,5 +20,5 @@ add_custom_test(without_pubsub_code SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithoutPubsubCodeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/without_service_code/CMakeLists.txt b/test/arguments/without_service_code/CMakeLists.txt index 23cadf282..cff9d3fd6 100644 --- a/test/arguments/without_service_code/CMakeLists.txt +++ b/test/arguments/without_service_code/CMakeLists.txt @@ -1,23 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - # Service files are not generated - ${ZSERIO_GEN_DIR}/without_service_code/Pubsub.cpp - ${ZSERIO_GEN_DIR}/without_service_code/Pubsub.h - ${ZSERIO_GEN_DIR}/without_service_code/Response.cpp - ${ZSERIO_GEN_DIR}/without_service_code/Response.h - ${ZSERIO_GEN_DIR}/without_service_code/Request.cpp - ${ZSERIO_GEN_DIR}/without_service_code/Request.h -) - -zserio_add_library(without_service_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE without_service_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutServiceCode -withoutSourcesAmalgamation +add_library(without_service_code_zs STATIC zs/without_service_code.zs) +zserio_generate_cpp( + TARGET without_service_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withoutServiceCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(without_service_code_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(without_service_code DEPENDS @@ -25,5 +20,5 @@ add_custom_test(without_service_code SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithoutServiceCodeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/without_sql_code/CMakeLists.txt b/test/arguments/without_sql_code/CMakeLists.txt index b40119eac..1c2d4fcec 100644 --- a/test/arguments/without_sql_code/CMakeLists.txt +++ b/test/arguments/without_sql_code/CMakeLists.txt @@ -1,18 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/without_sql_code/Tile.cpp - ${ZSERIO_GEN_DIR}/without_sql_code/Tile.h -) - -zserio_add_library(without_sql_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE without_sql_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSqlCode -withoutSourcesAmalgamation +add_library(without_sql_code_zs STATIC zs/without_sql_code.zs) +zserio_generate_cpp( + TARGET without_sql_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withoutSqlCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(without_sql_code_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(without_sql_code DEPENDS @@ -20,5 +20,5 @@ add_custom_test(without_sql_code SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithoutSqlCodeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/arguments/without_writer_code/CMakeLists.txt b/test/arguments/without_writer_code/CMakeLists.txt index a008ed513..56d27da2a 100644 --- a/test/arguments/without_writer_code/CMakeLists.txt +++ b/test/arguments/without_writer_code/CMakeLists.txt @@ -1,36 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/without_writer_code/ExtraParamUnion.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/ExtraParamUnion.h - ${ZSERIO_GEN_DIR}/without_writer_code/GeoMapTable.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/GeoMapTable.h - ${ZSERIO_GEN_DIR}/without_writer_code/ItemChoice.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/ItemChoice.h - ${ZSERIO_GEN_DIR}/without_writer_code/ItemChoiceHolder.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/ItemChoiceHolder.h - ${ZSERIO_GEN_DIR}/without_writer_code/Item.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/Item.h - ${ZSERIO_GEN_DIR}/without_writer_code/ItemType.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/ItemType.h - ${ZSERIO_GEN_DIR}/without_writer_code/Tile.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/Tile.h - ${ZSERIO_GEN_DIR}/without_writer_code/VersionAvailability.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/VersionAvailability.h - ${ZSERIO_GEN_DIR}/without_writer_code/WorldDb.cpp - ${ZSERIO_GEN_DIR}/without_writer_code/WorldDb.h +add_library(without_writer_code_zs STATIC zs/without_writer_code.zs) +zserio_generate_cpp( + TARGET without_writer_code_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withoutWriterCode -withTypeInfoCode -withReflectionCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(without_writer_code_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE without_writer_code.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutWriterCode -withoutSourcesAmalgamation -withTypeInfoCode -withReflectionCode -) - +target_link_libraries(without_writer_code_zs PUBLIC ZserioCppRuntime) target_include_directories(without_writer_code_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(without_writer_code DEPENDS @@ -38,5 +21,5 @@ add_custom_test(without_writer_code SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithoutWriterCodeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/errors/compatibility_error/CMakeLists.txt b/test/errors/compatibility_error/CMakeLists.txt index aae51771a..6fe36d2c6 100644 --- a/test/errors/compatibility_error/CMakeLists.txt +++ b/test/errors/compatibility_error/CMakeLists.txt @@ -1,73 +1,99 @@ set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(LOG_FILENAME zserio_log.txt) -# clean old log file -file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${LOG_FILENAME}) - -zserio_add_library(packed_array_in_template_240_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE packed_array_in_template_240_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(packed_array_in_template_240_error_zs INTERFACE) +zserio_generate_cpp( + TARGET packed_array_in_template_240_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS packed_array_in_template_240_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_PACKED_ARRAY_IN_TEMPLATE_240 + ERROR_VAR ZSERIO_LOG_PACKED_ARRAY_IN_TEMPLATE_240 + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_PACKED_ARRAY_IN_TEMPLATE_240) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_packed_array_in_template_240.txt + "${ZSERIO_LOG_PACKED_ARRAY_IN_TEMPLATE_240}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(packed_compound_array_242_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE packed_compound_array_242_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(packed_compound_array_242_error_zs INTERFACE) +zserio_generate_cpp( + TARGET packed_compound_array_242_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS packed_compound_array_242_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_PACKED_COMPOUND_ARRAY_242 + ERROR_VAR ZSERIO_LOG_PACKED_COMPOUND_ARRAY_242 + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_PACKED_COMPOUND_ARRAY_242) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_packed_compound_array_242.txt + "${ZSERIO_LOG_PACKED_COMPOUND_ARRAY_242}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(packed_uint32_array_241_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE packed_uint32_array_241_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(packed_uint32_array_241_error_zs INTERFACE) +zserio_generate_cpp( + TARGET packed_uint32_array_241_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS packed_uint32_array_241_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_PACKED_UINT32_ARRAY_241 + ERROR_VAR ZSERIO_LOG_PACKED_UINT32_ARRAY_241 + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_PACKED_UINT32_ARRAY_241) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_packed_uint32_array_241.txt + "${ZSERIO_LOG_PACKED_UINT32_ARRAY_241}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(version_less_than_min_supported_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE version_less_than_min_supported_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(version_less_than_min_supported_error_zs INTERFACE) +zserio_generate_cpp( + TARGET version_less_than_min_supported_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS version_less_than_min_supported_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_VERSION_LESS_THAN_MIN_SUPPORTED + ERROR_VAR ZSERIO_LOG_VERSION_LESS_THAN_MIN_SUPPORTED + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_VERSION_LESS_THAN_MIN_SUPPORTED) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_version_less_than_min_supported.txt + "${ZSERIO_LOG_VERSION_LESS_THAN_MIN_SUPPORTED}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(wrong_compatibility_version_format_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE wrong_compatibility_version_format_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(wrong_compatibility_version_format_error_zs INTERFACE) +zserio_generate_cpp( + TARGET wrong_compatibility_version_format_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS wrong_compatibility_version_format_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_WRONG_COMPATIBILITY_VERSION_FORMAT + ERROR_VAR ZSERIO_LOG_WRONG_COMPATIBILITY_VERSION_FORMAT + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_WRONG_COMPATIBILITY_VERSION_FORMAT) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_wrong_compatibility_version_format.txt + "${ZSERIO_LOG_WRONG_COMPATIBILITY_VERSION_FORMAT}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () add_custom_test(compatibility_error DEPENDS diff --git a/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp b/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp index 596b64a0b..3584ffaa8 100644 --- a/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp +++ b/test/errors/compatibility_error/cpp/CompatibilityErrorTest.cpp @@ -5,10 +5,23 @@ class CompatibilityErrorTest : public ::testing::Test { protected: CompatibilityErrorTest() : - zserioErrors("errors/compatibility_error") + zserioErrorsPackedArrayInTemplate240( + "errors/compatibility_error", "zserio_log_packed_array_in_template_240.txt"), + zserioErrorsPackedCompoundArray242( + "errors/compatibility_error", "zserio_log_packed_compound_array_242.txt"), + zserioErrorsPackedUInt32Array241( + "errors/compatibility_error", "zserio_log_packed_uint32_array_241.txt"), + zserioErrorsVersionLessThanMinSupported( + "errors/compatibility_error", "zserio_log_version_less_than_min_supported.txt"), + zserioErrorsWrongCompatibilityVersionFormat( + "errors/compatibility_error", "zserio_log_wrong_compatibility_version_format.txt") {} - const test_utils::ZserioErrorOutput zserioErrors; + const test_utils::ZserioErrorOutput zserioErrorsPackedArrayInTemplate240; + const test_utils::ZserioErrorOutput zserioErrorsPackedCompoundArray242; + const test_utils::ZserioErrorOutput zserioErrorsPackedUInt32Array241; + const test_utils::ZserioErrorOutput zserioErrorsVersionLessThanMinSupported; + const test_utils::ZserioErrorOutput zserioErrorsWrongCompatibilityVersionFormat; }; TEST_F(CompatibilityErrorTest, packedArrayInTemplate240) @@ -19,7 +32,7 @@ TEST_F(CompatibilityErrorTest, packedArrayInTemplate240) "Packed arrays binary encoding has been changed in version '2.5.0'!", "C++11 Generator: Compatibility check failed!"}}; - ASSERT_TRUE(zserioErrors.isPresent(errors)); + ASSERT_TRUE(zserioErrorsPackedArrayInTemplate240.isPresent(errors)); } TEST_F(CompatibilityErrorTest, packedCompoundArray242) @@ -30,7 +43,7 @@ TEST_F(CompatibilityErrorTest, packedCompoundArray242) "Packed arrays binary encoding has been changed in version '2.5.0'!", "C++11 Generator: Compatibility check failed!"}}; - ASSERT_TRUE(zserioErrors.isPresent(errors)); + ASSERT_TRUE(zserioErrorsPackedCompoundArray242.isPresent(errors)); } TEST_F(CompatibilityErrorTest, packedUInt32Array241) @@ -41,12 +54,12 @@ TEST_F(CompatibilityErrorTest, packedUInt32Array241) "Packed arrays binary encoding has been changed in version '2.5.0'!", "C++11 Generator: Compatibility check failed!"}}; - ASSERT_TRUE(zserioErrors.isPresent(errors)); + ASSERT_TRUE(zserioErrorsPackedUInt32Array241.isPresent(errors)); } TEST_F(CompatibilityErrorTest, versionLessThanMinSupported) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsVersionLessThanMinSupported.isPresent( "version_less_than_min_supported_error.zs:1:30: " "Package specifies unsupported compatibility version '2.3.2', " "minimum supported version is '2.4.0'!")); @@ -54,7 +67,7 @@ TEST_F(CompatibilityErrorTest, versionLessThanMinSupported) TEST_F(CompatibilityErrorTest, wrongCompatibilityVersionFormat) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsWrongCompatibilityVersionFormat.isPresent( "wrong_compatibility_version_format_error.zs:2:30: " "Failed to parse version string: '2.5.0-rc1' as a version!")); } diff --git a/test/errors/cpp_generator_error/CMakeLists.txt b/test/errors/cpp_generator_error/CMakeLists.txt index 789e23934..0d25e6b13 100644 --- a/test/errors/cpp_generator_error/CMakeLists.txt +++ b/test/errors/cpp_generator_error/CMakeLists.txt @@ -1,73 +1,99 @@ set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(LOG_FILENAME zserio_log.txt) -# clean old log file -file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${LOG_FILENAME}) - -zserio_add_library(wrong_set_cpp_allocator_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE wrong_set_cpp_allocator_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck -setCppAllocator wrong - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(wrong_set_cpp_allocator_error_zs INTERFACE) +zserio_generate_cpp( + TARGET wrong_set_cpp_allocator_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS wrong_set_cpp_allocator_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck -setCppAllocator wrong + OUTPUT_VAR ZSERIO_LOG_WRONG_SET_CPP_ALLOCATOR + ERROR_VAR ZSERIO_LOG_WRONG_SET_CPP_ALLOCATOR + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_WRONG_SET_CPP_ALLOCATOR) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_wrong_set_cpp_allocator.txt + "${ZSERIO_LOG_WRONG_SET_CPP_ALLOCATOR}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(bitmask_values_class_clash_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE bitmask_values_class_clash_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(bitmask_values_class_clash_error_zs INTERFACE) +zserio_generate_cpp( + TARGET bitmask_values_class_clash_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS bitmask_values_class_clash_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_BITMASK_VALUES_CLASS_CLASH + ERROR_VAR ZSERIO_LOG_BITMASK_VALUES_CLASS_CLASH + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_BITMASK_VALUES_CLASS_CLASH) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_bitmask_values_class_clash.txt + "${ZSERIO_LOG_BITMASK_VALUES_CLASS_CLASH}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(sql_table_provider_class_clash_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_table_provider_class_clash_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(sql_table_provider_class_clash_error_zs INTERFACE) +zserio_generate_cpp( + TARGET sql_table_provider_class_clash_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS sql_table_provider_class_clash_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_SQL_TABLE_PROVIDER_CLASS_CLASH + ERROR_VAR ZSERIO_LOG_SQL_TABLE_PROVIDER_CLASS_CLASH + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_SQL_TABLE_PROVIDER_CLASS_CLASH) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_sql_table_provider_class_clash.txt + "${ZSERIO_LOG_SQL_TABLE_PROVIDER_CLASS_CLASH}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(sql_table_reader_class_clash_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_table_reader_class_clash_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(sql_table_reader_class_clash_error_zs INTERFACE) +zserio_generate_cpp( + TARGET sql_table_reader_class_clash_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS sql_table_reader_class_clash_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_SQL_TABLE_READER_CLASS_CLASH + ERROR_VAR ZSERIO_LOG_SQL_TABLE_READER_CLASS_CLASH + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_SQL_TABLE_READER_CLASS_CLASH) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_sql_table_reader_class_clash.txt + "${ZSERIO_LOG_SQL_TABLE_READER_CLASS_CLASH}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () -zserio_add_library(sql_table_row_class_clash_error_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_table_row_class_clash_error.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck - IGNORE_ERRORS ON - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(sql_table_row_class_clash_error_zs INTERFACE) +zserio_generate_cpp( + TARGET sql_table_row_class_clash_error_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS sql_table_row_class_clash_error.zs + GEN_DIR ${ZSERIO_GEN_DIR} + EXTRA_ARGS -withoutCrossExtensionCheck + OUTPUT_VAR ZSERIO_LOG_SQL_TABLE_ROW_CLASS_CLASH + ERROR_VAR ZSERIO_LOG_SQL_TABLE_ROW_CLASS_CLASH + RESULT_VAR ZSERIO_RESULT ) +if (ZSERIO_LOG_SQL_TABLE_ROW_CLASS_CLASH) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_sql_table_row_class_clash.txt + "${ZSERIO_LOG_SQL_TABLE_ROW_CLASS_CLASH}") + if (${ZSERIO_RESULT} EQUAL 0) + message(FATAL_ERROR "Zserio tool is expected to fail!") + endif () +endif () add_custom_test(cpp_generator_error DEPENDS diff --git a/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp b/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp index da58692ec..5bdd3dd2b 100644 --- a/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp +++ b/test/errors/cpp_generator_error/cpp/CppGeneratorErrorTest.cpp @@ -5,29 +5,42 @@ class CppGeneratorErrorTest : public ::testing::Test { protected: CppGeneratorErrorTest() : - zserioErrors("errors/cpp_generator_error") + zserioErrorsWrongSetCppAllocator( + "errors/cpp_generator_error", "zserio_log_wrong_set_cpp_allocator.txt"), + zserioErrorsBitmaskValuesClassClash( + "errors/cpp_generator_error", "zserio_log_bitmask_values_class_clash.txt"), + zserioErrorsSqlTableProviderClassClash( + "errors/cpp_generator_error", "zserio_log_sql_table_provider_class_clash.txt"), + zserioErrorsSqlTableReaderClassClash( + "errors/cpp_generator_error", "zserio_log_sql_table_reader_class_clash.txt"), + zserioErrorsSqlTableRowClassClash( + "errors/cpp_generator_error", "zserio_log_sql_table_row_class_clash.txt") {} - const test_utils::ZserioErrorOutput zserioErrors; + const test_utils::ZserioErrorOutput zserioErrorsWrongSetCppAllocator; + const test_utils::ZserioErrorOutput zserioErrorsBitmaskValuesClassClash; + const test_utils::ZserioErrorOutput zserioErrorsSqlTableProviderClassClash; + const test_utils::ZserioErrorOutput zserioErrorsSqlTableReaderClassClash; + const test_utils::ZserioErrorOutput zserioErrorsSqlTableRowClassClash; }; TEST_F(CppGeneratorErrorTest, wrongSetCppAllocator) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsWrongSetCppAllocator.isPresent( "[ERROR] C++11 Generator: The specified option 'setCppAllocator' has unknown allocator 'wrong'!")); } TEST_F(CppGeneratorErrorTest, bitmaskValuesClassClash) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsBitmaskValuesClassClash.isPresent( "bitmask_values_class_clash_error.zs:4:15: " "Class name 'Values' generated for bitmask clashes with its inner class 'Values' " "generated in C++ code.")); } -TEST_F(CppGeneratorErrorTest, sqlTableIParameterProviderClassClash) +TEST_F(CppGeneratorErrorTest, sqlTableProviderClassClash) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsSqlTableProviderClassClash.isPresent( "sql_table_provider_class_clash_error.zs:4:11: " "Class name 'IParameterProvider' generated for SQL table clashes with its inner class " "'IParameterProvider' generated in C++ code.")); @@ -35,7 +48,7 @@ TEST_F(CppGeneratorErrorTest, sqlTableIParameterProviderClassClash) TEST_F(CppGeneratorErrorTest, sqlTableReaderClassClash) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsSqlTableReaderClassClash.isPresent( "sql_table_reader_class_clash_error.zs:3:11: " "Class name 'Reader' generated for SQL table clashes with its inner class 'Reader' " "generated in C++ code.")); @@ -43,7 +56,7 @@ TEST_F(CppGeneratorErrorTest, sqlTableReaderClassClash) TEST_F(CppGeneratorErrorTest, sqlTableRowClassClash) { - ASSERT_TRUE(zserioErrors.isPresent( + ASSERT_TRUE(zserioErrorsSqlTableRowClassClash.isPresent( "sql_table_row_class_clash_error.zs:3:11: " "Class name 'Row' generated for SQL table clashes with its inner class 'Row' " "generated in C++ code.")); diff --git a/test/language/alignment/CMakeLists.txt b/test/language/alignment/CMakeLists.txt index b117efdaa..65df52d2a 100644 --- a/test/language/alignment/CMakeLists.txt +++ b/test/language/alignment/CMakeLists.txt @@ -1,24 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/alignment/auto_optional_member_alignment/AutoOptionalMemberAlignment.cpp - ${ZSERIO_GEN_DIR}/alignment/auto_optional_member_alignment/AutoOptionalMemberAlignment.h - - ${ZSERIO_GEN_DIR}/alignment/bit_alignment/BitAlignment.cpp - ${ZSERIO_GEN_DIR}/alignment/bit_alignment/BitAlignment.h - - ${ZSERIO_GEN_DIR}/alignment/optional_member_alignment/OptionalMemberAlignment.cpp - ${ZSERIO_GEN_DIR}/alignment/optional_member_alignment/OptionalMemberAlignment.h -) - -zserio_add_library(alignment_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE alignment.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(alignment_zs STATIC zs/alignment.zs) +zserio_generate_cpp( + TARGET alignment_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(alignment_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(alignment DEPENDS @@ -28,5 +22,5 @@ add_custom_test(alignment ${CMAKE_CURRENT_SOURCE_DIR}/cpp/BitAlignmentTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/OptionalMemberAlignmentTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/array_types/CMakeLists.txt b/test/language/array_types/CMakeLists.txt index d847797c2..d618c42f4 100644 --- a/test/language/array_types/CMakeLists.txt +++ b/test/language/array_types/CMakeLists.txt @@ -1,186 +1,23 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/ArraysMapping.cpp - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/ArraysMapping.h - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/TestBitmask.h - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/TestEnum.cpp - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/TestEnum.h - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/auto_array_bitfield_param/ParameterizedBitfieldLength.cpp - ${ZSERIO_GEN_DIR}/array_types/auto_array_bitfield_param/ParameterizedBitfieldLength.h - - ${ZSERIO_GEN_DIR}/array_types/auto_array_struct_recursion/AutoArrayRecursion.cpp - ${ZSERIO_GEN_DIR}/array_types/auto_array_struct_recursion/AutoArrayRecursion.h - - ${ZSERIO_GEN_DIR}/array_types/auto_array_subtyped_uint8/ArrayElement.h - ${ZSERIO_GEN_DIR}/array_types/auto_array_subtyped_uint8/AutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/auto_array_subtyped_uint8/AutoArray.h - - ${ZSERIO_GEN_DIR}/array_types/auto_array_uint8/AutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/auto_array_uint8/AutoArray.h - - ${ZSERIO_GEN_DIR}/array_types/fixed_array_uint8/FixedArray.cpp - ${ZSERIO_GEN_DIR}/array_types/fixed_array_uint8/FixedArray.h - - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/TestStructure.h - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/PackedArraysMapping.h - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/TestEnum.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/TestBitmask.h - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/PackedArraysMapping.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_arrays_mapping/TestEnum.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_bitfield_param/ParameterizedBitfieldLength.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_bitfield_param/ParameterizedBitfieldLength.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/EmptyChoice.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/EmptyChoice.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/EmptyStruct.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/EmptyStruct.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/EmptyUnion.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/EmptyUnion.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/Main.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/Main.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/PackedAutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_empty_compounds/PackedAutoArray.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_removed_enum_item/PackedAutoArrayRemovedEnumItem.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_removed_enum_item/PackedAutoArrayRemovedEnumItem.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_removed_enum_item/Traffic.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_removed_enum_item/Traffic.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_recursion/PackedAutoArrayRecursion.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_recursion/PackedAutoArrayRecursion.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_bytes/PackedAutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_bytes/PackedAutoArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_bytes/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_bytes/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_extern/PackedAutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_extern/PackedAutoArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_extern/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_extern/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_unpacked_field/PackedAutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_unpacked_field/PackedAutoArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_unpacked_field/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_struct_with_unpacked_field/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_uint8/PackedAutoArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_auto_array_uint8/PackedAutoArray.h - - ${ZSERIO_GEN_DIR}/array_types/packed_fixed_array_uint8/PackedFixedArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_fixed_array_uint8/PackedFixedArray.cpp - - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/Bit15.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/BITS_PER_BYTE.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/Empty.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/Empty.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/PackedVariableArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/PackedVariableArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestUnpackedArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestUnpackedArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestStructure.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestEnum.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestBitmask.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestChoice.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestChoice.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestEnum.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestUnion.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestUnion.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestPackedArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/TestPackedArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/Value32.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct/Value32.h - - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct_recursion/PackedVariableArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct_recursion/PackedVariableArray.cpp - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct_recursion/Block.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_struct_recursion/Block.cpp - - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_uint8/PackedVariableArray.h - ${ZSERIO_GEN_DIR}/array_types/packed_variable_array_uint8/PackedVariableArray.cpp - - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackingInterfaceOptimization.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackingInterfaceOptimization.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorBitmask.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorEnum.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorEnum.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorChoice.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorChoice.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorsHolder.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorsHolder.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorStruct.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorStruct.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorUnion.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/UnpackedColorUnion.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorBitmask.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorEnum.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorEnum.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorChoice.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorChoice.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorStruct.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorStruct.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorUnion.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/MixedColorUnion.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorBitmask.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorEnum.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorEnum.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorChoice.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorChoice.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorsHolder.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorsHolder.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorStruct.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorStruct.h - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorUnion.cpp - ${ZSERIO_GEN_DIR}/array_types/packing_interface_optimization/PackedColorUnion.h - - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_int8/VariableArray.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_int8/VariableArray.h - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_int8/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_int8/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_varuint/VariableArray.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_varuint/VariableArray.h - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_varuint/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_struct_cast_varuint/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/variable_array_subtyped_struct/ArrayElement.h - ${ZSERIO_GEN_DIR}/array_types/variable_array_subtyped_struct/VariableArray.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_subtyped_struct/VariableArray.h - ${ZSERIO_GEN_DIR}/array_types/variable_array_subtyped_struct/TestStructure.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_subtyped_struct/TestStructure.h - - ${ZSERIO_GEN_DIR}/array_types/variable_array_ternary_operator/VariableArray.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_ternary_operator/VariableArray.h - ${ZSERIO_GEN_DIR}/array_types/variable_array_ternary_operator/VariableArrayElement.cpp - ${ZSERIO_GEN_DIR}/array_types/variable_array_ternary_operator/VariableArrayElement.h -) - -zserio_add_library(array_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE array_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(array_types_zs STATIC zs/array_types.zs) +zserio_generate_cpp( + TARGET array_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(array_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () if (MSVC) set_property( SOURCE - ${ZSERIO_GEN_DIR}/array_types/arrays_mapping/ArraysMapping.cpp + ${CMAKE_CURRENT_BINARY_DIR}/gen/array_types/arrays_mapping/ArraysMapping.cpp APPEND PROPERTY COMPILE_OPTIONS /bigobj ) @@ -215,5 +52,5 @@ add_custom_test(array_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VariableArraySubtypedStructTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VariableArrayTernaryOperatorTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/bitmask_types/CMakeLists.txt b/test/language/bitmask_types/CMakeLists.txt index 40fb1b6b0..92cbecb87 100644 --- a/test/language/bitmask_types/CMakeLists.txt +++ b/test/language/bitmask_types/CMakeLists.txt @@ -1,45 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/bitmask_types/bitfield_const_bitmask/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitfield_const_bitmask/Permission.h - ${ZSERIO_GEN_DIR}/bitmask_types/bitfield_const_bitmask/NUM_BITS.h - - ${ZSERIO_GEN_DIR}/bitmask_types/bitfield_bitmask/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitfield_bitmask/Permission.h - - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_defined_by_constant/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_defined_by_constant/Permission.h - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_defined_by_constant/READ_PERMISSION.h - - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_used_by_bitmask/SimplePermission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_used_by_bitmask/SimplePermission.h - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_used_by_bitmask/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_used_by_bitmask/Permission.h - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_used_by_bitmask/ComplexPermission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_used_by_bitmask/ComplexPermission.h - - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_without_none/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/bitmask_without_none/Permission.h - - ${ZSERIO_GEN_DIR}/bitmask_types/uint8_bitmask/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/uint8_bitmask/Permission.h - - ${ZSERIO_GEN_DIR}/bitmask_types/uint64_bitmask/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/uint64_bitmask/Permission.h - - ${ZSERIO_GEN_DIR}/bitmask_types/varuint_bitmask/Permission.cpp - ${ZSERIO_GEN_DIR}/bitmask_types/varuint_bitmask/Permission.h -) - -zserio_add_library(bitmask_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE bitmask_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(bitmask_types_zs STATIC zs/bitmask_types.zs) +zserio_generate_cpp( + TARGET bitmask_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(bitmask_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(bitmask_types DEPENDS @@ -54,5 +27,5 @@ add_custom_test(bitmask_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UInt8BitmaskTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VarUIntBitmaskTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/builtin_types/CMakeLists.txt b/test/language/builtin_types/CMakeLists.txt index 72349f3b4..9b84ea6c3 100644 --- a/test/language/builtin_types/CMakeLists.txt +++ b/test/language/builtin_types/CMakeLists.txt @@ -1,29 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/builtin_types/all_builtin_types/AllBuiltInTypes.cpp - ${ZSERIO_GEN_DIR}/builtin_types/all_builtin_types/AllBuiltInTypes.h - - ${ZSERIO_GEN_DIR}/builtin_types/all_builtin_types/ExternalStructure.cpp - ${ZSERIO_GEN_DIR}/builtin_types/all_builtin_types/ExternalStructure.h - - ${ZSERIO_GEN_DIR}/builtin_types/all_builtin_types/NUM_BITS.h - - ${ZSERIO_GEN_DIR}/builtin_types/bitfield_function_length/Container.cpp - ${ZSERIO_GEN_DIR}/builtin_types/bitfield_function_length/Container.h - - ${ZSERIO_GEN_DIR}/builtin_types/bitfield_uint64_length/Container.cpp - ${ZSERIO_GEN_DIR}/builtin_types/bitfield_uint64_length/Container.h -) - -zserio_add_library(builtin_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE builtin_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(builtin_types_zs STATIC zs/builtin_types.zs) +zserio_generate_cpp( + TARGET builtin_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(builtin_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(builtin_types DEPENDS @@ -33,5 +22,5 @@ add_custom_test(builtin_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/BitFieldFunctionLengthTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/BitFieldUInt64LengthTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/choice_types/CMakeLists.txt b/test/language/choice_types/CMakeLists.txt index c4899961d..77af1540d 100644 --- a/test/language/choice_types/CMakeLists.txt +++ b/test/language/choice_types/CMakeLists.txt @@ -1,122 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/choice_types/bitmask_param_choice/BitmaskParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/bitmask_param_choice/BitmaskParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/bitmask_param_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/bitmask_param_choice/Selector.h - - ${ZSERIO_GEN_DIR}/choice_types/bool_param_choice/Black.h - ${ZSERIO_GEN_DIR}/choice_types/bool_param_choice/BoolParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/bool_param_choice/BoolParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/bool_param_choice/Grey.h - - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceCompatibilityCheckVersion1.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceCompatibilityCheckVersion1.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceCompatibilityCheckVersion2.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceCompatibilityCheckVersion2.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/HolderVersion1.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/HolderVersion1.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/HolderVersion2.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/HolderVersion2.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceVersion1.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceVersion1.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceVersion2.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/ChoiceVersion2.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/EnumVersion1.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/EnumVersion1.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/EnumVersion2.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/EnumVersion2.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/CoordXY.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/CoordXY.h - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/CoordXYZ.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_compatibility_check/CoordXYZ.h - - ${ZSERIO_GEN_DIR}/choice_types/choice_with_array/TestChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_with_array/TestChoice.h - ${ZSERIO_GEN_DIR}/choice_types/choice_with_array/Data8.cpp - ${ZSERIO_GEN_DIR}/choice_types/choice_with_array/Data8.h - - ${ZSERIO_GEN_DIR}/choice_types/default_empty_choice/DefaultEmptyChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/default_empty_choice/DefaultEmptyChoice.h - ${ZSERIO_GEN_DIR}/choice_types/default_empty_choice/VariantA.h - ${ZSERIO_GEN_DIR}/choice_types/default_empty_choice/VariantB.h - - ${ZSERIO_GEN_DIR}/choice_types/empty_choice/EmptyChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/empty_choice/EmptyChoice.h - - ${ZSERIO_GEN_DIR}/choice_types/empty_choice_with_case/EmptyChoiceWithCase.cpp - ${ZSERIO_GEN_DIR}/choice_types/empty_choice_with_case/EmptyChoiceWithCase.h - - ${ZSERIO_GEN_DIR}/choice_types/empty_choice_with_default/EmptyChoiceWithDefault.cpp - ${ZSERIO_GEN_DIR}/choice_types/empty_choice_with_default/EmptyChoiceWithDefault.h - - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/Black.h - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/EnumParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/EnumParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/Grey.h - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/Selector.h - ${ZSERIO_GEN_DIR}/choice_types/enum_param_choice/White.h - - ${ZSERIO_GEN_DIR}/choice_types/enum_with_removed_item_param_choice/EnumWithRemovedItemParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/enum_with_removed_item_param_choice/EnumWithRemovedItemParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/enum_with_removed_item_param_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/enum_with_removed_item_param_choice/Selector.h - - ${ZSERIO_GEN_DIR}/choice_types/expression_selector_choice/ExpressionSelectorChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/expression_selector_choice/ExpressionSelectorChoice.h - - ${ZSERIO_GEN_DIR}/choice_types/full_bitmask_param_choice/FullBitmaskParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/full_bitmask_param_choice/FullBitmaskParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/full_bitmask_param_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/full_bitmask_param_choice/Selector.h - - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/Black.h - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/FullEnumParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/FullEnumParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/Grey.h - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/Selector.h - ${ZSERIO_GEN_DIR}/choice_types/full_enum_param_choice/White.h - - ${ZSERIO_GEN_DIR}/choice_types/function_returning_literal_selector_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/function_returning_literal_selector_choice/Selector.h - ${ZSERIO_GEN_DIR}/choice_types/function_returning_literal_selector_choice/TestChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/function_returning_literal_selector_choice/TestChoice.h - - ${ZSERIO_GEN_DIR}/choice_types/function_selector_choice/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types/function_selector_choice/Selector.h - ${ZSERIO_GEN_DIR}/choice_types/function_selector_choice/TestChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/function_selector_choice/TestChoice.h - - ${ZSERIO_GEN_DIR}/choice_types/uint16_param_choice/UInt16ParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/uint16_param_choice/UInt16ParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/uint16_param_choice/VariantA.h - ${ZSERIO_GEN_DIR}/choice_types/uint16_param_choice/VariantB.h - ${ZSERIO_GEN_DIR}/choice_types/uint16_param_choice/VariantC.h - - ${ZSERIO_GEN_DIR}/choice_types/uint32_param_choice/UInt32ParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/uint32_param_choice/UInt32ParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/uint32_param_choice/VariantA.h - ${ZSERIO_GEN_DIR}/choice_types/uint32_param_choice/VariantB.h - ${ZSERIO_GEN_DIR}/choice_types/uint32_param_choice/VariantC.h - - ${ZSERIO_GEN_DIR}/choice_types/uint64_param_choice/UInt64ParamChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types/uint64_param_choice/UInt64ParamChoice.h - ${ZSERIO_GEN_DIR}/choice_types/uint64_param_choice/VariantA.h - ${ZSERIO_GEN_DIR}/choice_types/uint64_param_choice/VariantB.h - ${ZSERIO_GEN_DIR}/choice_types/uint64_param_choice/VariantC.h -) - -zserio_add_library(choice_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE choice_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(choice_types_zs STATIC zs/choice_types.zs) +zserio_generate_cpp( + TARGET choice_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(choice_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(choice_types DEPENDS @@ -140,5 +36,5 @@ add_custom_test(choice_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UInt16ParamChoiceTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UInt64ParamChoiceTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/comments/CMakeLists.txt b/test/language/comments/CMakeLists.txt index cbe2f9e98..1b2b51483 100644 --- a/test/language/comments/CMakeLists.txt +++ b/test/language/comments/CMakeLists.txt @@ -1,85 +1,23 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(DOC_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/doc) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/comments/classic_doc/bitmask_comments/Permission.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/bitmask_comments/Permission.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/enum_comments/Direction.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/enum_comments/Direction.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/sql_database_comments/Db.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/sql_database_comments/Db.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/sql_database_comments/Table.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/sql_database_comments/Table.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/sql_table_comments/VirtualTable.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/sql_table_comments/VirtualTable.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_comments/Direction.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_comments/Direction.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_comments/DirectionStructure.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_comments/DirectionStructure.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Compound.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Compound.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Field_Compound.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Field_Compound.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Field_string.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Field_string.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Field_uint32.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/Field_uint32.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/StructTemplatedField.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/struct_template_comments/StructTemplatedField.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/unknown_tag/Test.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/unknown_tag/Test.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/unknown_tag_matching_prefix/Test.cpp - ${ZSERIO_GEN_DIR}/comments/classic_doc/unknown_tag_matching_prefix/Test.h - ${ZSERIO_GEN_DIR}/comments/classic_doc/unknown_tag_matching_prefix/VALUE.h - - ${ZSERIO_GEN_DIR}/comments/markdown_doc/bitmask_comments/Permission.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/bitmask_comments/Permission.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/enum_comments/Direction.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/enum_comments/Direction.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/indented_comments/Direction.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/indented_comments/Direction.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/links_in_comments/VALUE.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/sql_database_comments/Db.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/sql_database_comments/Db.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/sql_database_comments/Table.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/sql_database_comments/Table.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/sql_table_comments/VirtualTable.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/sql_table_comments/VirtualTable.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_comments/Direction.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_comments/Direction.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_comments/DirectionStructure.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_comments/DirectionStructure.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Compound.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Compound.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Field_Compound.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Field_Compound.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Field_string.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Field_string.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Field_uint32.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/Field_uint32.h - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/StructTemplatedField.cpp - ${ZSERIO_GEN_DIR}/comments/markdown_doc/struct_template_comments/StructTemplatedField.h - - ${ZSERIO_GEN_DIR}/comments/mixed_doc/struct_comments/Direction.cpp - ${ZSERIO_GEN_DIR}/comments/mixed_doc/struct_comments/Direction.h - ${ZSERIO_GEN_DIR}/comments/mixed_doc/struct_comments/DirectionStructure.cpp - ${ZSERIO_GEN_DIR}/comments/mixed_doc/struct_comments/DirectionStructure.h +add_library(comments_zs STATIC zs/comments.zs) +zserio_generate_cpp( + TARGET comments_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(comments_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE comments.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - +target_link_libraries(comments_zs PUBLIC ZserioCppRuntime) target_include_directories(comments_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(comments DEPENDS comments_zs GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/comments/ClangTidySuppressions.txt b/test/language/comments/ClangTidySuppressions.txt index 1345f0ed5..77cbbc742 100644 --- a/test/language/comments/ClangTidySuppressions.txt +++ b/test/language/comments/ClangTidySuppressions.txt @@ -3,12 +3,16 @@ bugprone-forwarding-reference-overload:gen/comments/classic_doc/struct_template_ bugprone-forwarding-reference-overload:gen/comments/markdown_doc/struct_template_comments/Field_Compound.h bugprone-forwarding-reference-overload:gen/comments/markdown_doc/struct_template_comments/Field_string.h +cppcoreguidelines-pro-type-member-init:gen/comments/classic_doc/choice_comments/TestChoice.cpp cppcoreguidelines-pro-type-member-init:gen/comments/classic_doc/sql_database_comments/Table.cpp cppcoreguidelines-pro-type-member-init:gen/comments/classic_doc/sql_table_comments/VirtualTable.cpp cppcoreguidelines-pro-type-member-init:gen/comments/classic_doc/struct_comments/DirectionStructure.cpp +cppcoreguidelines-pro-type-member-init:gen/comments/classic_doc/union_comments/TestUnion.cpp +cppcoreguidelines-pro-type-member-init:gen/comments/markdown_doc/choice_comments/TestChoice.cpp cppcoreguidelines-pro-type-member-init:gen/comments/markdown_doc/sql_database_comments/Table.cpp cppcoreguidelines-pro-type-member-init:gen/comments/markdown_doc/sql_table_comments/VirtualTable.cpp cppcoreguidelines-pro-type-member-init:gen/comments/markdown_doc/struct_comments/DirectionStructure.cpp +cppcoreguidelines-pro-type-member-init:gen/comments/markdown_doc/union_comments/TestUnion.cpp cppcoreguidelines-pro-type-member-init:gen/comments/mixed_doc/struct_comments/DirectionStructure.cpp cppcoreguidelines-pro-type-reinterpret-cast:gen/comments/classic_doc/sql_table_comments/VirtualTable.cpp @@ -28,18 +32,22 @@ hicpp-signed-bitwise:gen/comments/markdown_doc/bitmask_comments/Permission.h performance-move-const-arg:gen/comments/classic_doc/struct_comments/DirectionStructure.cpp performance-move-const-arg:gen/comments/classic_doc/struct_template_comments/Field_Compound.cpp performance-move-const-arg:gen/comments/classic_doc/struct_template_comments/StructTemplatedField.cpp +performance-move-const-arg:gen/comments/classic_doc/union_comments/TestUnion.cpp performance-move-const-arg:gen/comments/markdown_doc/struct_comments/DirectionStructure.cpp performance-move-const-arg:gen/comments/markdown_doc/struct_template_comments/Field_Compound.cpp performance-move-const-arg:gen/comments/markdown_doc/struct_template_comments/StructTemplatedField.cpp +performance-move-const-arg:gen/comments/markdown_doc/union_comments/TestUnion.cpp performance-move-const-arg:gen/comments/mixed_doc/struct_comments/DirectionStructure.cpp readability-braces-around-statements +readability-make-member-function-const:gen/comments/classic_doc/choice_comments/TestChoice.cpp readability-make-member-function-const:gen/comments/classic_doc/struct_comments/DirectionStructure.cpp readability-make-member-function-const:gen/comments/classic_doc/struct_template_comments/Compound.cpp readability-make-member-function-const:gen/comments/classic_doc/struct_template_comments/Field_uint32.cpp readability-make-member-function-const:gen/comments/classic_doc/unknown_tag_matching_prefix/Test.cpp readability-make-member-function-const:gen/comments/classic_doc/unknown_tag/Test.cpp +readability-make-member-function-const:gen/comments/markdown_doc/choice_comments/TestChoice.cpp readability-make-member-function-const:gen/comments/markdown_doc/struct_comments/DirectionStructure.cpp readability-make-member-function-const:gen/comments/markdown_doc/struct_template_comments/Compound.cpp readability-make-member-function-const:gen/comments/markdown_doc/struct_template_comments/Field_uint32.cpp diff --git a/test/language/constants/CMakeLists.txt b/test/language/constants/CMakeLists.txt index 88db72cc1..c183fee5e 100644 --- a/test/language/constants/CMakeLists.txt +++ b/test/language/constants/CMakeLists.txt @@ -1,79 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/constants/BITFIELD8_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/BITFIELD8_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/BOOL_FALSE_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/BOOL_TRUE_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/Colors.cpp - ${ZSERIO_GEN_DIR}/constants/Colors.h - ${ZSERIO_GEN_DIR}/constants/ColorsSubtype.h - ${ZSERIO_GEN_DIR}/constants/DEFAULT_PEN_COLOR.h - ${ZSERIO_GEN_DIR}/constants/DEFAULT_PEN_COLOR_VALUE.h - ${ZSERIO_GEN_DIR}/constants/FLOAT16_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/FLOAT32_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/FLOAT64_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/HEX_ESC_STRING_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT16_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT16_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/Int25Subtype.h - ${ZSERIO_GEN_DIR}/constants/INT32_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT32_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT64_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT64_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT8_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INT8_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INTFIELD8_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/INTFIELD8_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/OCTAL_ESC_STRING_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/Permission.cpp - ${ZSERIO_GEN_DIR}/constants/Permission.h - ${ZSERIO_GEN_DIR}/constants/READ_PERMISSION.h - ${ZSERIO_GEN_DIR}/constants/READ_PERMISSION_VALUE.h - ${ZSERIO_GEN_DIR}/constants/STRING_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/StringPascalCaseConstant.h - ${ZSERIO_GEN_DIR}/constants/SUBTYPE_BLUE_COLOR_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/SUBTYPE_INT25_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/SUBTYPE_READ_PERMISSION.h - ${ZSERIO_GEN_DIR}/constants/SUBTYPE_STRING_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT16_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT16_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT32_FULL_MASK.h - ${ZSERIO_GEN_DIR}/constants/UINT32_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT32_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT64_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT64_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT8_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UINT8_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/UNICODE_ESC_STRING_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARIABLE_BITFIELD_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARIABLE_INTFIELD_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT16_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT16_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT32_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT32_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT64_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT64_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARINT_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT16_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT16_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT32_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT32_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT64_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT64_MIN_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT_MAX_CONSTANT.h - ${ZSERIO_GEN_DIR}/constants/VARUINT_MIN_CONSTANT.h -) - -zserio_add_library(constants_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE constants.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(constants_zs STATIC zs/constants.zs) +zserio_generate_cpp( + TARGET constants_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(constants_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(constants DEPENDS @@ -81,5 +20,5 @@ add_custom_test(constants SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/ConstantsTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/constraints/CMakeLists.txt b/test/language/constraints/CMakeLists.txt index ce9b4b9c3..8958413b3 100644 --- a/test/language/constraints/CMakeLists.txt +++ b/test/language/constraints/CMakeLists.txt @@ -1,39 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/constraints/array_lengthof_constraint/ArrayLengthofConstraint.cpp - ${ZSERIO_GEN_DIR}/constraints/array_lengthof_constraint/ArrayLengthofConstraint.h - - ${ZSERIO_GEN_DIR}/constraints/choice_constraints/ChoiceConstraints.cpp - ${ZSERIO_GEN_DIR}/constraints/choice_constraints/ChoiceConstraints.h - - ${ZSERIO_GEN_DIR}/constraints/literal_constraint/LiteralConstraint.cpp - ${ZSERIO_GEN_DIR}/constraints/literal_constraint/LiteralConstraint.h - - ${ZSERIO_GEN_DIR}/constraints/structure_constraints/BasicColor.cpp - ${ZSERIO_GEN_DIR}/constraints/structure_constraints/BasicColor.h - ${ZSERIO_GEN_DIR}/constraints/structure_constraints/ExtendedColor.cpp - ${ZSERIO_GEN_DIR}/constraints/structure_constraints/ExtendedColor.h - ${ZSERIO_GEN_DIR}/constraints/structure_constraints/StructureConstraints.cpp - ${ZSERIO_GEN_DIR}/constraints/structure_constraints/StructureConstraints.h - - ${ZSERIO_GEN_DIR}/constraints/structure_bitmask_constraints/Availability.cpp - ${ZSERIO_GEN_DIR}/constraints/structure_bitmask_constraints/Availability.h - ${ZSERIO_GEN_DIR}/constraints/structure_bitmask_constraints/StructureBitmaskConstraints.cpp - ${ZSERIO_GEN_DIR}/constraints/structure_bitmask_constraints/StructureBitmaskConstraints.h - - ${ZSERIO_GEN_DIR}/constraints/union_constraints/UnionConstraints.cpp - ${ZSERIO_GEN_DIR}/constraints/union_constraints/UnionConstraints.h -) - -zserio_add_library(constraints_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE constraints.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(constraints_zs STATIC zs/constraints.zs) +zserio_generate_cpp( + TARGET constraints_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(constraints_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(constraints DEPENDS @@ -46,5 +25,5 @@ add_custom_test(constraints ${CMAKE_CURRENT_SOURCE_DIR}/cpp/StructureBitmaskConstraintsTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UnionConstraintsTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/default_values/CMakeLists.txt b/test/language/default_values/CMakeLists.txt index 61049534f..eeed9df7d 100644 --- a/test/language/default_values/CMakeLists.txt +++ b/test/language/default_values/CMakeLists.txt @@ -1,24 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/default_values/structure_default_values/StructureDefaultValues.cpp - ${ZSERIO_GEN_DIR}/default_values/structure_default_values/StructureDefaultValues.h - - ${ZSERIO_GEN_DIR}/default_values/structure_default_values/BasicColor.cpp - ${ZSERIO_GEN_DIR}/default_values/structure_default_values/BasicColor.h - - ${ZSERIO_GEN_DIR}/default_values/structure_default_values/Permission.cpp - ${ZSERIO_GEN_DIR}/default_values/structure_default_values/Permission.h -) - -zserio_add_library(default_values_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE default_values.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(default_values_zs STATIC zs/default_values.zs) +zserio_generate_cpp( + TARGET default_values_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(default_values_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(default_values DEPENDS @@ -26,5 +20,5 @@ add_custom_test(default_values SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/StructureDefaultValuesTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/enumeration_types/CMakeLists.txt b/test/language/enumeration_types/CMakeLists.txt index 552f640b6..f256b8e48 100644 --- a/test/language/enumeration_types/CMakeLists.txt +++ b/test/language/enumeration_types/CMakeLists.txt @@ -1,55 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/enumeration_types/bitfield_const_enum/Color.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/bitfield_const_enum/Color.h - ${ZSERIO_GEN_DIR}/enumeration_types/bitfield_const_enum/NUM_ENUM_BITS.h - - ${ZSERIO_GEN_DIR}/enumeration_types/bitfield_enum/Color.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/bitfield_enum/Color.h - - ${ZSERIO_GEN_DIR}/enumeration_types/deprecated_enum_item/Traffic.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/deprecated_enum_item/Traffic.h - - ${ZSERIO_GEN_DIR}/enumeration_types/enum_defined_by_constant/Colors.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/enum_defined_by_constant/Colors.h - ${ZSERIO_GEN_DIR}/enumeration_types/enum_defined_by_constant/WHITE_COLOR.h - - ${ZSERIO_GEN_DIR}/enumeration_types/enum_used_by_enum/Color.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/enum_used_by_enum/Color.h - ${ZSERIO_GEN_DIR}/enumeration_types/enum_used_by_enum/DarkColor.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/enum_used_by_enum/DarkColor.h - ${ZSERIO_GEN_DIR}/enumeration_types/enum_used_by_enum/LightColor.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/enum_used_by_enum/LightColor.h - - ${ZSERIO_GEN_DIR}/enumeration_types/multiple_removed_enum_items/AllocatorType.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/multiple_removed_enum_items/AllocatorType.h - ${ZSERIO_GEN_DIR}/enumeration_types/multiple_removed_enum_items/Traffic.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/multiple_removed_enum_items/Traffic.h - - ${ZSERIO_GEN_DIR}/enumeration_types/removed_enum_item/AllocatorType.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/removed_enum_item/AllocatorType.h - ${ZSERIO_GEN_DIR}/enumeration_types/removed_enum_item/Traffic.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/removed_enum_item/Traffic.h - - ${ZSERIO_GEN_DIR}/enumeration_types/uint64_enum/DarkColor.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/uint64_enum/DarkColor.h - - ${ZSERIO_GEN_DIR}/enumeration_types/uint8_enum/DarkColor.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/uint8_enum/DarkColor.h - - ${ZSERIO_GEN_DIR}/enumeration_types/varuint_enum/DarkColor.cpp - ${ZSERIO_GEN_DIR}/enumeration_types/varuint_enum/DarkColor.h -) - -zserio_add_library(enumeration_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE enumeration_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -withTypeInfoCode +add_library(enumeration_types_zs STATIC zs/enumeration_types.zs) +zserio_generate_cpp( + TARGET enumeration_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withTypeInfoCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(enumeration_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(enumeration_types DEPENDS @@ -66,5 +29,5 @@ add_custom_test(enumeration_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UInt8EnumTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VarUIntEnumTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/explicit_parameters/CMakeLists.txt b/test/language/explicit_parameters/CMakeLists.txt index 5324c2a55..fa337028a 100644 --- a/test/language/explicit_parameters/CMakeLists.txt +++ b/test/language/explicit_parameters/CMakeLists.txt @@ -1,64 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/explicit_parameters/ExplicitParametersDb.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/ExplicitParametersDb.h - - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_bitmask_param/BitmaskParamTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_bitmask_param/BitmaskParamTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_bitmask_param/TestBlob.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_bitmask_param/TestBlob.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_bitmask_param/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_bitmask_param/TestBitmask.h - - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_blob_param/BlobParamTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_blob_param/BlobParamTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_blob_param/Header.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_blob_param/Header.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_blob_param/TestBlob.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_blob_param/TestBlob.h - - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_enum_param/EnumParamTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_enum_param/EnumParamTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_enum_param/TestBlob.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_enum_param/TestBlob.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_enum_param/TestEnum.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_enum_param/TestEnum.h - - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_same_as_field/SameAsFieldTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_same_as_field/SameAsFieldTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_same_as_field/TestBlob.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_same_as_field/TestBlob.h - - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_simple_param/SimpleParamTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_simple_param/SimpleParamTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_simple_param/TestBlob.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/explicit_simple_param/TestBlob.h - - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_explicit_params/MultipleParamsTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_explicit_params/MultipleParamsTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_explicit_params/TestBlob.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_explicit_params/TestBlob.h - - - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_with_same_name/MultipleWithSameNameTable.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_with_same_name/MultipleWithSameNameTable.h - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_with_same_name/Parameterized1.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_with_same_name/Parameterized1.h - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_with_same_name/Parameterized2.cpp - ${ZSERIO_GEN_DIR}/explicit_parameters/multiple_with_same_name/Parameterized2.h +add_library(explicit_parameters_zs STATIC zs/explicit_parameters.zs) +zserio_generate_cpp( + TARGET explicit_parameters_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(explicit_parameters_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE explicit_parameters.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - +target_link_libraries(explicit_parameters_zs PUBLIC ZserioCppRuntime) target_include_directories(explicit_parameters_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(explicit_parameters DEPENDS @@ -72,5 +27,5 @@ add_custom_test(explicit_parameters ${CMAKE_CURRENT_SOURCE_DIR}/cpp/MultipleExplicitParamsTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/MultipleWithSameNameTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/expressions/CMakeLists.txt b/test/language/expressions/CMakeLists.txt index 30f0dc2ef..024a7440e 100644 --- a/test/language/expressions/CMakeLists.txt +++ b/test/language/expressions/CMakeLists.txt @@ -1,125 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/expressions/array_type/ArrayTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/array_type/ArrayTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/bitmask_type/BitmaskTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/bitmask_type/BitmaskTypeExpression.h - ${ZSERIO_GEN_DIR}/expressions/bitmask_type/Colors.cpp - ${ZSERIO_GEN_DIR}/expressions/bitmask_type/Colors.h - - ${ZSERIO_GEN_DIR}/expressions/cast_uint8_to_uint64/CastUInt8ToUInt64Expression.cpp - ${ZSERIO_GEN_DIR}/expressions/cast_uint8_to_uint64/CastUInt8ToUInt64Expression.h - - ${ZSERIO_GEN_DIR}/expressions/cast_uint64_to_uint8/CastUInt64ToUInt8Expression.cpp - ${ZSERIO_GEN_DIR}/expressions/cast_uint64_to_uint8/CastUInt64ToUInt8Expression.h - - ${ZSERIO_GEN_DIR}/expressions/const_type/ConstTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/const_type/ConstTypeExpression.h - ${ZSERIO_GEN_DIR}/expressions/const_type/INVALID_VALUE.h - - ${ZSERIO_GEN_DIR}/expressions/enumeration_type/Color.cpp - ${ZSERIO_GEN_DIR}/expressions/enumeration_type/Color.h - ${ZSERIO_GEN_DIR}/expressions/enumeration_type/EnumerationTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/enumeration_type/EnumerationTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/field_type/ContainedType.cpp - ${ZSERIO_GEN_DIR}/expressions/field_type/ContainedType.h - ${ZSERIO_GEN_DIR}/expressions/field_type/FieldTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/field_type/FieldTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/field_type_with_clash/ContainedType.cpp - ${ZSERIO_GEN_DIR}/expressions/field_type_with_clash/ContainedType.h - ${ZSERIO_GEN_DIR}/expressions/field_type_with_clash/FieldTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/field_type_with_clash/FieldTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/float_type/FloatTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/float_type/FloatTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/full_const_type/FullConstTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/full_const_type/FullConstTypeExpression.h - ${ZSERIO_GEN_DIR}/expressions/full_const_type/FULL_INVALID_VALUE.h - - ${ZSERIO_GEN_DIR}/expressions/full_enumeration_type/Color.cpp - ${ZSERIO_GEN_DIR}/expressions/full_enumeration_type/Color.h - ${ZSERIO_GEN_DIR}/expressions/full_enumeration_type/FullEnumerationTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/full_enumeration_type/FullEnumerationTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/function_type/Color.cpp - ${ZSERIO_GEN_DIR}/expressions/function_type/Color.h - ${ZSERIO_GEN_DIR}/expressions/function_type/FunctionTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/function_type/FunctionTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/index_operator/Element.cpp - ${ZSERIO_GEN_DIR}/expressions/index_operator/Element.h - ${ZSERIO_GEN_DIR}/expressions/index_operator/ElementList.cpp - ${ZSERIO_GEN_DIR}/expressions/index_operator/ElementList.h - - ${ZSERIO_GEN_DIR}/expressions/isset_operator/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/expressions/isset_operator/TestBitmask.h - ${ZSERIO_GEN_DIR}/expressions/isset_operator/Parameterized.cpp - ${ZSERIO_GEN_DIR}/expressions/isset_operator/Parameterized.h - ${ZSERIO_GEN_DIR}/expressions/isset_operator/IsSetOperator.cpp - ${ZSERIO_GEN_DIR}/expressions/isset_operator/IsSetOperator.h - - ${ZSERIO_GEN_DIR}/expressions/lengthof_operator/LengthOfFunctions.cpp - ${ZSERIO_GEN_DIR}/expressions/lengthof_operator/LengthOfFunctions.h - - ${ZSERIO_GEN_DIR}/expressions/modulo_operator/ModuloFunction.cpp - ${ZSERIO_GEN_DIR}/expressions/modulo_operator/ModuloFunction.h - - ${ZSERIO_GEN_DIR}/expressions/negation_operator/NegationOperatorExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/negation_operator/NegationOperatorExpression.h - - ${ZSERIO_GEN_DIR}/expressions/numbits_operator/NumBitsFunctions.cpp - ${ZSERIO_GEN_DIR}/expressions/numbits_operator/NumBitsFunctions.h - - ${ZSERIO_GEN_DIR}/expressions/parameter_type/Color.cpp - ${ZSERIO_GEN_DIR}/expressions/parameter_type/Color.h - ${ZSERIO_GEN_DIR}/expressions/parameter_type/ParameterTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/parameter_type/ParameterTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/parameterized_array_type/ParameterizedArrayElement.cpp - ${ZSERIO_GEN_DIR}/expressions/parameterized_array_type/ParameterizedArrayElement.h - ${ZSERIO_GEN_DIR}/expressions/parameterized_array_type/ParameterizedArrayHolder.cpp - ${ZSERIO_GEN_DIR}/expressions/parameterized_array_type/ParameterizedArrayHolder.h - ${ZSERIO_GEN_DIR}/expressions/parameterized_array_type/ParameterizedArrayTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/parameterized_array_type/ParameterizedArrayTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/parenthesis/ParenthesisExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/parenthesis/ParenthesisExpression.h - - ${ZSERIO_GEN_DIR}/expressions/question_mark/QuestionMarkExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/question_mark/QuestionMarkExpression.h - - ${ZSERIO_GEN_DIR}/expressions/string_type/StringTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/string_type/StringTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/uint64_type/UInt64TypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/uint64_type/UInt64TypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/used_before_type/Color.cpp - ${ZSERIO_GEN_DIR}/expressions/used_before_type/Color.h - ${ZSERIO_GEN_DIR}/expressions/used_before_type/COLOR_RED_VALUE.h - ${ZSERIO_GEN_DIR}/expressions/used_before_type/NUM_VALUE_BITS.h - ${ZSERIO_GEN_DIR}/expressions/used_before_type/UsedBeforeTypeExpression.cpp - ${ZSERIO_GEN_DIR}/expressions/used_before_type/UsedBeforeTypeExpression.h - - ${ZSERIO_GEN_DIR}/expressions/valueof_operator/Color.cpp - ${ZSERIO_GEN_DIR}/expressions/valueof_operator/Color.h - ${ZSERIO_GEN_DIR}/expressions/valueof_operator/ValueOfFunctions.cpp - ${ZSERIO_GEN_DIR}/expressions/valueof_operator/ValueOfFunctions.h -) - -zserio_add_library(expressions_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE expressions.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(expressions_zs STATIC zs/expressions.zs) +zserio_generate_cpp( + TARGET expressions_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(expressions_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(expressions DEPENDS @@ -152,5 +45,5 @@ add_custom_test(expressions ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UsedBeforeTypeTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/ValueOfOperatorTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/extended_members/CMakeLists.txt b/test/language/extended_members/CMakeLists.txt index 07a2e0868..271c7a5d3 100644 --- a/test/language/extended_members/CMakeLists.txt +++ b/test/language/extended_members/CMakeLists.txt @@ -1,81 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/extended_members/extended_choice_field/Choice.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_choice_field/Choice.h - ${ZSERIO_GEN_DIR}/extended_members/extended_choice_field/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_choice_field/Extended.h - ${ZSERIO_GEN_DIR}/extended_members/extended_choice_field/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_choice_field/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_compound_field/Compound.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_compound_field/Compound.h - ${ZSERIO_GEN_DIR}/extended_members/extended_compound_field/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_compound_field/Extended.h - ${ZSERIO_GEN_DIR}/extended_members/extended_compound_field/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_compound_field/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_empty_structure/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_empty_structure/Extended.h - ${ZSERIO_GEN_DIR}/extended_members/extended_empty_structure/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_empty_structure/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/Compound.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/Compound.h - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/ExtendedCompound.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/ExtendedCompound.h - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/ExtendedSimple.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/ExtendedSimple.h - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_field_in_template/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_indexed_offsets/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_indexed_offsets/Original.h - ${ZSERIO_GEN_DIR}/extended_members/extended_indexed_offsets/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_indexed_offsets/Extended.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_optional_parameterized_field/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_optional_parameterized_field/Extended.h - ${ZSERIO_GEN_DIR}/extended_members/extended_optional_parameterized_field/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_optional_parameterized_field/Original.h - ${ZSERIO_GEN_DIR}/extended_members/extended_optional_parameterized_field/Parameterized.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_optional_parameterized_field/Parameterized.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_simple_field/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_simple_field/Extended.h - ${ZSERIO_GEN_DIR}/extended_members/extended_simple_field/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_simple_field/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/extended_unaligned_field/Extended.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_unaligned_field/Extended.h - ${ZSERIO_GEN_DIR}/extended_members/extended_unaligned_field/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/extended_unaligned_field/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields/Extended2.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields/Extended2.h - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields/Extended1.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields/Extended1.h - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields/Original.h - - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Extended2.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Extended2.h - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Extended1.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Extended1.h - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Original.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Original.h - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Union.cpp - ${ZSERIO_GEN_DIR}/extended_members/multiple_extended_fields_various_types/Union.h -) - -zserio_add_library(extended_members_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE extended_members.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(extended_members_zs STATIC zs/extended_members.zs) +zserio_generate_cpp( + TARGET extended_members_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(extended_members_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(extended_members DEPENDS @@ -92,5 +29,5 @@ add_custom_test(extended_members ${CMAKE_CURRENT_SOURCE_DIR}/cpp/MultipleExtendedFieldsTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/MultipleExtendedFieldsVariousTypesTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/functions/CMakeLists.txt b/test/language/functions/CMakeLists.txt index bb9332d7f..b86d067a4 100644 --- a/test/language/functions/CMakeLists.txt +++ b/test/language/functions/CMakeLists.txt @@ -1,84 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/functions/choice_array/Inner.cpp - ${ZSERIO_GEN_DIR}/functions/choice_array/Inner.h - ${ZSERIO_GEN_DIR}/functions/choice_array/Item.cpp - ${ZSERIO_GEN_DIR}/functions/choice_array/Item.h - ${ZSERIO_GEN_DIR}/functions/choice_array/ItemRef.cpp - ${ZSERIO_GEN_DIR}/functions/choice_array/ItemRef.h - ${ZSERIO_GEN_DIR}/functions/choice_array/OuterArray.cpp - ${ZSERIO_GEN_DIR}/functions/choice_array/OuterArray.h - - ${ZSERIO_GEN_DIR}/functions/structure_array/Item.cpp - ${ZSERIO_GEN_DIR}/functions/structure_array/Item.h - ${ZSERIO_GEN_DIR}/functions/structure_array/StructureArray.cpp - ${ZSERIO_GEN_DIR}/functions/structure_array/StructureArray.h - - ${ZSERIO_GEN_DIR}/functions/structure_array_param/ChildStructure.cpp - ${ZSERIO_GEN_DIR}/functions/structure_array_param/ChildStructure.h - ${ZSERIO_GEN_DIR}/functions/structure_array_param/NotLeftMost.cpp - ${ZSERIO_GEN_DIR}/functions/structure_array_param/NotLeftMost.h - ${ZSERIO_GEN_DIR}/functions/structure_array_param/ParentStructure.cpp - ${ZSERIO_GEN_DIR}/functions/structure_array_param/ParentStructure.h - - ${ZSERIO_GEN_DIR}/functions/structure_bytes/TestStructure.cpp - ${ZSERIO_GEN_DIR}/functions/structure_bytes/TestStructure.h - ${ZSERIO_GEN_DIR}/functions/structure_bytes/Child.cpp - ${ZSERIO_GEN_DIR}/functions/structure_bytes/Child.h - - ${ZSERIO_GEN_DIR}/functions/structure_extern/TestStructure.cpp - ${ZSERIO_GEN_DIR}/functions/structure_extern/TestStructure.h - ${ZSERIO_GEN_DIR}/functions/structure_extern/Child.cpp - ${ZSERIO_GEN_DIR}/functions/structure_extern/Child.h - - ${ZSERIO_GEN_DIR}/functions/structure_optional/ValueCalculator.cpp - ${ZSERIO_GEN_DIR}/functions/structure_optional/ValueCalculator.h - ${ZSERIO_GEN_DIR}/functions/structure_optional/ValueConsumer.cpp - ${ZSERIO_GEN_DIR}/functions/structure_optional/ValueConsumer.h - ${ZSERIO_GEN_DIR}/functions/structure_optional/ValueConsumerCreator.cpp - ${ZSERIO_GEN_DIR}/functions/structure_optional/ValueConsumerCreator.h - - ${ZSERIO_GEN_DIR}/functions/structure_param/MetresConverterCaller.cpp - ${ZSERIO_GEN_DIR}/functions/structure_param/MetresConverterCaller.h - ${ZSERIO_GEN_DIR}/functions/structure_param/MetresConverter.cpp - ${ZSERIO_GEN_DIR}/functions/structure_param/MetresConverter.h - - ${ZSERIO_GEN_DIR}/functions/structure_parent_child_value/ParentValue.cpp - ${ZSERIO_GEN_DIR}/functions/structure_parent_child_value/ParentValue.h - ${ZSERIO_GEN_DIR}/functions/structure_parent_child_value/ChildValue.cpp - ${ZSERIO_GEN_DIR}/functions/structure_parent_child_value/ChildValue.h - - ${ZSERIO_GEN_DIR}/functions/structure_string/CONST.h - ${ZSERIO_GEN_DIR}/functions/structure_string/FIELD.h - ${ZSERIO_GEN_DIR}/functions/structure_string/StringPool.cpp - ${ZSERIO_GEN_DIR}/functions/structure_string/StringPool.h - ${ZSERIO_GEN_DIR}/functions/structure_string/TestStructure.cpp - ${ZSERIO_GEN_DIR}/functions/structure_string/TestStructure.h - - ${ZSERIO_GEN_DIR}/functions/structure_value/CustomVarInt.cpp - ${ZSERIO_GEN_DIR}/functions/structure_value/CustomVarInt.h - ${ZSERIO_GEN_DIR}/functions/structure_value/CustomVarList.cpp - ${ZSERIO_GEN_DIR}/functions/structure_value/CustomVarList.h - - ${ZSERIO_GEN_DIR}/functions/union_array/Inner.cpp - ${ZSERIO_GEN_DIR}/functions/union_array/Inner.h - ${ZSERIO_GEN_DIR}/functions/union_array/Item.cpp - ${ZSERIO_GEN_DIR}/functions/union_array/Item.h - ${ZSERIO_GEN_DIR}/functions/union_array/ItemRef.cpp - ${ZSERIO_GEN_DIR}/functions/union_array/ItemRef.h - ${ZSERIO_GEN_DIR}/functions/union_array/OuterArray.cpp - ${ZSERIO_GEN_DIR}/functions/union_array/OuterArray.h -) - -zserio_add_library(functions_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE functions.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(functions_zs STATIC zs/functions.zs) +zserio_generate_cpp( + TARGET functions_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(functions_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(functions DEPENDS @@ -96,5 +30,5 @@ add_custom_test(functions ${CMAKE_CURRENT_SOURCE_DIR}/cpp/StructureValueTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UnionArrayTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/identifiers/CMakeLists.txt b/test/language/identifiers/CMakeLists.txt index baffbc50f..9902a4ffe 100644 --- a/test/language/identifiers/CMakeLists.txt +++ b/test/language/identifiers/CMakeLists.txt @@ -1,39 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/identifiers/bitmask_name_clashing_with_java/BitmaskNameClashingWithJava.cpp - ${ZSERIO_GEN_DIR}/identifiers/bitmask_name_clashing_with_java/BitmaskNameClashingWithJava.h - ${ZSERIO_GEN_DIR}/identifiers/bitmask_name_clashing_with_java/String.cpp - ${ZSERIO_GEN_DIR}/identifiers/bitmask_name_clashing_with_java/String.h - - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Byte.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Byte.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Short.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Short.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Integer.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Integer.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Long.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Long.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/BigInteger.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/BigInteger.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Float.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Float.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Double.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/Double.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/String.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/String.h - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/StructureNameClashingWithJava.cpp - ${ZSERIO_GEN_DIR}/identifiers/structure_name_clashing_with_java/StructureNameClashingWithJava.h -) - -zserio_add_library(identifiers_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE identifiers.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(identifiers_zs STATIC zs/identifiers.zs) +zserio_generate_cpp( + TARGET identifiers_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(identifiers_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(identifiers DEPENDS @@ -42,5 +21,5 @@ add_custom_test(identifiers ${CMAKE_CURRENT_SOURCE_DIR}/cpp/BitmaskNameClashingWithJavaTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/StructureNameClashingWithJavaTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/indexed_offsets/CMakeLists.txt b/test/language/indexed_offsets/CMakeLists.txt index 63b1cda3b..c61a50576 100644 --- a/test/language/indexed_offsets/CMakeLists.txt +++ b/test/language/indexed_offsets/CMakeLists.txt @@ -1,62 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/indexed_offsets/auto_indexed_offset_array/AutoIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/auto_indexed_offset_array/AutoIndexedOffsetArray.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/bit5_indexed_offset_array/Bit5IndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/bit5_indexed_offset_array/Bit5IndexedOffsetArray.h - ${ZSERIO_GEN_DIR}/indexed_offsets/bit5_indexed_offset_array/NUM_BIT5_ELEMENTS.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/bool_indexed_offset_array/BoolIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/bool_indexed_offset_array/BoolIndexedOffsetArray.h - ${ZSERIO_GEN_DIR}/indexed_offsets/bool_indexed_offset_array/NUM_BOOL_ELEMENTS.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/compound_indexed_offset_array/CompoundIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/compound_indexed_offset_array/CompoundIndexedOffsetArray.h - ${ZSERIO_GEN_DIR}/indexed_offsets/compound_indexed_offset_array/Compound.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/compound_indexed_offset_array/Compound.h - ${ZSERIO_GEN_DIR}/indexed_offsets/compound_indexed_offset_array/NUM_COMPOUND_ELEMENTS.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/empty_indexed_offset_array/EmptyIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/empty_indexed_offset_array/EmptyIndexedOffsetArray.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/int14_indexed_offset_array/Int14IndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/int14_indexed_offset_array/Int14IndexedOffsetArray.h - ${ZSERIO_GEN_DIR}/indexed_offsets/int14_indexed_offset_array/NUM_INT14_ELEMENTS.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_indexed_offset_array/NUM_OPTIONAL_ELEMENTS.h - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_indexed_offset_array/OptionalIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_indexed_offset_array/OptionalIndexedOffsetArray.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_nested_indexed_offset_array/Header.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_nested_indexed_offset_array/Header.h - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_nested_indexed_offset_array/OptionalNestedIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/optional_nested_indexed_offset_array/OptionalNestedIndexedOffsetArray.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_auto_indexed_offset_array/AutoIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_auto_indexed_offset_array/AutoIndexedOffsetArray.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_indexed_offset_array_holder/AutoIndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_indexed_offset_array_holder/AutoIndexedOffsetArray.h - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_indexed_offset_array_holder/OffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_indexed_offset_array_holder/OffsetArray.h - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_indexed_offset_array_holder/OffsetHolder.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/packed_indexed_offset_array_holder/OffsetHolder.h - - ${ZSERIO_GEN_DIR}/indexed_offsets/varint32_indexed_offset_array/NUM_VARINT32_ELEMENTS.h - ${ZSERIO_GEN_DIR}/indexed_offsets/varint32_indexed_offset_array/VarInt32IndexedOffsetArray.cpp - ${ZSERIO_GEN_DIR}/indexed_offsets/varint32_indexed_offset_array/VarInt32IndexedOffsetArray.h -) - -zserio_add_library(indexed_offsets_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE indexed_offsets.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(indexed_offsets_zs STATIC zs/indexed_offsets.zs) +zserio_generate_cpp( + TARGET indexed_offsets_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(indexed_offsets_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(indexed_offsets DEPENDS @@ -74,5 +30,5 @@ add_custom_test(indexed_offsets ${CMAKE_CURRENT_SOURCE_DIR}/cpp/PackedIndexedOffsetArrayHolderTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/VarInt32IndexedOffsetArrayTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/literals/CMakeLists.txt b/test/language/literals/CMakeLists.txt index 6347900c9..9893049b6 100644 --- a/test/language/literals/CMakeLists.txt +++ b/test/language/literals/CMakeLists.txt @@ -1,38 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/literals/BINARY_NEGATIVE.h - ${ZSERIO_GEN_DIR}/literals/BINARY_POSITIVE.h - ${ZSERIO_GEN_DIR}/literals/BINARY_POSITIVE_WITH_CAPITAL_B.h - ${ZSERIO_GEN_DIR}/literals/BINARY_POSITIVE_WITH_SIGN.h - ${ZSERIO_GEN_DIR}/literals/BOOLEAN_FALSE.h - ${ZSERIO_GEN_DIR}/literals/BOOLEAN_TRUE.h - ${ZSERIO_GEN_DIR}/literals/DECIMAL_NEGATIVE.h - ${ZSERIO_GEN_DIR}/literals/DECIMAL_POSITIVE.h - ${ZSERIO_GEN_DIR}/literals/DECIMAL_POSITIVE_WITH_SIGN.h - ${ZSERIO_GEN_DIR}/literals/DECIMAL_ZERO.h - ${ZSERIO_GEN_DIR}/literals/FLOAT16.h - ${ZSERIO_GEN_DIR}/literals/FLOAT32.h - ${ZSERIO_GEN_DIR}/literals/FLOAT64.h - ${ZSERIO_GEN_DIR}/literals/HEXADECIMAL_NEGATIVE.h - ${ZSERIO_GEN_DIR}/literals/HEXADECIMAL_POSITIVE.h - ${ZSERIO_GEN_DIR}/literals/HEXADECIMAL_POSITIVE_WITH_CAPITAL_X.h - ${ZSERIO_GEN_DIR}/literals/HEXADECIMAL_POSITIVE_WITH_SIGN.h - ${ZSERIO_GEN_DIR}/literals/OCTAL_NEGATIVE.h - ${ZSERIO_GEN_DIR}/literals/OCTAL_POSITIVE.h - ${ZSERIO_GEN_DIR}/literals/OCTAL_POSITIVE_WITH_SIGN.h - ${ZSERIO_GEN_DIR}/literals/OCTAL_ZERO.h - ${ZSERIO_GEN_DIR}/literals/STRING.h -) - -zserio_add_library(literals_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE literals.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(literals_zs STATIC zs/literals.zs) +zserio_generate_cpp( + TARGET literals_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(literals_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(literals DEPENDS @@ -40,5 +20,5 @@ add_custom_test(literals SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/LiteralsTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/member_access/CMakeLists.txt b/test/language/member_access/CMakeLists.txt index 814d7f39f..897a5087a 100644 --- a/test/language/member_access/CMakeLists.txt +++ b/test/language/member_access/CMakeLists.txt @@ -1,20 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/member_access/access_within_type/Header.cpp - ${ZSERIO_GEN_DIR}/member_access/access_within_type/Header.h - ${ZSERIO_GEN_DIR}/member_access/access_within_type/Message.cpp - ${ZSERIO_GEN_DIR}/member_access/access_within_type/Message.h -) - -zserio_add_library(member_access_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE member_access.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(member_access_zs STATIC zs/member_access.zs) +zserio_generate_cpp( + TARGET member_access_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(member_access_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(member_access DEPENDS @@ -22,5 +20,5 @@ add_custom_test(member_access SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/AccessWithinTypeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/offsets/CMakeLists.txt b/test/language/offsets/CMakeLists.txt index a68437a51..49a4828f1 100644 --- a/test/language/offsets/CMakeLists.txt +++ b/test/language/offsets/CMakeLists.txt @@ -1,51 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/offsets/auto_array_offset/AutoArrayHolder.cpp - ${ZSERIO_GEN_DIR}/offsets/auto_array_offset/AutoArrayHolder.h - - ${ZSERIO_GEN_DIR}/offsets/bit_offset/BitOffset.cpp - ${ZSERIO_GEN_DIR}/offsets/bit_offset/BitOffset.h - - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffset.cpp - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffset.h - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetArrayStructure.cpp - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetArrayStructure.h - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetChoice.cpp - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetChoice.h - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetStructure.cpp - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetStructure.h - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetUnion.cpp - ${ZSERIO_GEN_DIR}/offsets/nested_offset/NestedOffsetUnion.h - - ${ZSERIO_GEN_DIR}/offsets/optional_member_offset/OptionalMemberOffset.cpp - ${ZSERIO_GEN_DIR}/offsets/optional_member_offset/OptionalMemberOffset.h - - ${ZSERIO_GEN_DIR}/offsets/packed_auto_array_offset/AutoArrayHolder.cpp - ${ZSERIO_GEN_DIR}/offsets/packed_auto_array_offset/AutoArrayHolder.h - - ${ZSERIO_GEN_DIR}/offsets/parameter_offset/OffsetHolder.cpp - ${ZSERIO_GEN_DIR}/offsets/parameter_offset/OffsetHolder.h - ${ZSERIO_GEN_DIR}/offsets/parameter_offset/Room.cpp - ${ZSERIO_GEN_DIR}/offsets/parameter_offset/Room.h - ${ZSERIO_GEN_DIR}/offsets/parameter_offset/School.cpp - ${ZSERIO_GEN_DIR}/offsets/parameter_offset/School.h - - ${ZSERIO_GEN_DIR}/offsets/ternary_operator_offset/TernaryOffset.cpp - ${ZSERIO_GEN_DIR}/offsets/ternary_operator_offset/TernaryOffset.h - - ${ZSERIO_GEN_DIR}/offsets/uint64_offset/UInt64Offset.cpp - ${ZSERIO_GEN_DIR}/offsets/uint64_offset/UInt64Offset.h -) - -zserio_add_library(offsets_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE offsets.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(offsets_zs STATIC zs/offsets.zs) +zserio_generate_cpp( + TARGET offsets_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(offsets_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(offsets DEPENDS @@ -60,5 +27,5 @@ add_custom_test(offsets ${CMAKE_CURRENT_SOURCE_DIR}/cpp/TernaryOperatorOffsetTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UInt64OffsetTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/optional_members/CMakeLists.txt b/test/language/optional_members/CMakeLists.txt index ec6d5b5cc..0209bd097 100644 --- a/test/language/optional_members/CMakeLists.txt +++ b/test/language/optional_members/CMakeLists.txt @@ -1,43 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/optional_members/auto_optional/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members/auto_optional/Container.h - - ${ZSERIO_GEN_DIR}/optional_members/optional_array_recursion/Employee.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_array_recursion/Employee.h - ${ZSERIO_GEN_DIR}/optional_members/optional_array_recursion/Title.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_array_recursion/Title.h - - ${ZSERIO_GEN_DIR}/optional_members/optional_array/TestStruct.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_array/TestStruct.h - ${ZSERIO_GEN_DIR}/optional_members/optional_array/Data8.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_array/Data8.h - - ${ZSERIO_GEN_DIR}/optional_members/optional_expression_with_removed_enum_item/Compound.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_expression_with_removed_enum_item/Compound.h - ${ZSERIO_GEN_DIR}/optional_members/optional_expression_with_removed_enum_item/Numbers.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_expression_with_removed_enum_item/Numbers.h - - ${ZSERIO_GEN_DIR}/optional_members/optional_expression/BasicColor.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_expression/BasicColor.h - ${ZSERIO_GEN_DIR}/optional_members/optional_expression/BlackColor.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_expression/BlackColor.h - ${ZSERIO_GEN_DIR}/optional_members/optional_expression/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_expression/Container.h - - ${ZSERIO_GEN_DIR}/optional_members/optional_recursion/Block.cpp - ${ZSERIO_GEN_DIR}/optional_members/optional_recursion/Block.h -) - -zserio_add_library(optional_members_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE optional_members.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(optional_members_zs STATIC zs/optional_members.zs) +zserio_generate_cpp( + TARGET optional_members_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(optional_members_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(optional_members DEPENDS @@ -50,5 +25,5 @@ add_custom_test(optional_members ${CMAKE_CURRENT_SOURCE_DIR}/cpp/OptionalExpressionWithRemovedEnumItemTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/OptionalRecursionTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/packages/CMakeLists.txt b/test/language/packages/CMakeLists.txt index 84c11a966..16dbcc664 100644 --- a/test/language/packages/CMakeLists.txt +++ b/test/language/packages/CMakeLists.txt @@ -1,164 +1,99 @@ -set(ZSERIO_GEN_DIR_DEFAULT_PACKAGE ${CMAKE_CURRENT_BINARY_DIR}/gen_default_package) -set(ZSERIO_GEN_DIR_EMPTY_FILE ${CMAKE_CURRENT_BINARY_DIR}/gen_empty_file) -set(ZSERIO_GEN_DIR_INDEX ${CMAKE_CURRENT_BINARY_DIR}/gen_index) -set(ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT ${CMAKE_CURRENT_BINARY_DIR}/gen_package_name_conflict) -set(ZSERIO_GEN_DIR_PACKAGES ${CMAKE_CURRENT_BINARY_DIR}/gen_packages) -set(ZSERIO_GEN_DIR_READER ${CMAKE_CURRENT_BINARY_DIR}/gen_reader) - -set(ZSERIO_GENERATED_SOURCES_DEFAULT_PACKAGE - ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE}/DefaultPackageStructure.cpp - ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE}/DefaultPackageStructure.h - ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE}/Child.cpp - ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE}/Child.h - ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE}/default_package_import/top/TopStructure.cpp - ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE}/default_package_import/top/TopStructure.h +add_library(default_package_zs STATIC zs/default_package.zs) +zserio_generate_cpp( + TARGET default_package_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_default_package + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_DEFAULT_PACKAGE + OUTPUT_VAR ZSERIO_LOG_DEFAULT_PACKAGE + ERROR_VAR ZSERIO_LOG_DEFAULT_PACKAGE ) - -set(ZSERIO_GENERATED_SOURCES_INDEX - ${ZSERIO_GEN_DIR_INDEX}/index_workaround/index/Element.cpp - ${ZSERIO_GEN_DIR_INDEX}/index_workaround/index/Element.h - ${ZSERIO_GEN_DIR_INDEX}/index_workaround/index/ParameterizedElement.cpp - ${ZSERIO_GEN_DIR_INDEX}/index_workaround/index/ParameterizedElement.h - ${ZSERIO_GEN_DIR_INDEX}/index_workaround/index/Test.cpp - ${ZSERIO_GEN_DIR_INDEX}/index_workaround/index/Test.h +target_link_libraries(default_package_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_DEFAULT_PACKAGE) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_default_package.txt "${ZSERIO_LOG_DEFAULT_PACKAGE}") + check_zserio_warnings("${ZSERIO_LOG_DEFAULT_PACKAGE}" 0) +endif () + +add_library(empty_file_zs INTERFACE) +zserio_generate_cpp( + TARGET empty_file_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + MAIN_ZS empty_file.zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_empty_file + OUTPUT_VAR ZSERIO_LOG_EMPTY_FILE + ERROR_VAR ZSERIO_LOG_EMPTY_FILE ) - -set(ZSERIO_GENERATED_SOURCES_PACKAGES - ${ZSERIO_GEN_DIR_PACKAGES}/ambiguous_imports/first_colour/Colour.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/ambiguous_imports/first_colour/Colour.h - ${ZSERIO_GEN_DIR_PACKAGES}/ambiguous_imports/second_colour/Colour.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/ambiguous_imports/second_colour/Colour.h - ${ZSERIO_GEN_DIR_PACKAGES}/ambiguous_imports/top/TopStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/ambiguous_imports/top/TopStructure.h - - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/bottom/BottomColour.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/bottom/BottomColour.h - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/bottom/BottomStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/bottom/BottomStructure.h - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/middle/MiddleStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/middle/MiddleStructure.h - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/top/GREEN.h - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/top/TopStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/cyclic_imports/top/TopStructure.h - - ${ZSERIO_GEN_DIR_PACKAGES}/import_name_conflict/colour/Colour.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/import_name_conflict/colour/Colour.h - ${ZSERIO_GEN_DIR_PACKAGES}/import_name_conflict/top/TopStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/import_name_conflict/top/TopStructure.h - - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/first/Coordinate.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/first/Coordinate.h - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/second/Coordinate.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/second/Coordinate.h - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/top/Coordinate.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/top/Coordinate.h - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/top/TopStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/package_import/top/TopStructure.h - - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/imported/CONST_A.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/imported/CONST_B.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/imported/SimpleParamStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/imported/SimpleParamStructure.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/imported/SimpleStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/imported/SimpleStructure.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/top/CONST_A.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/top/SimpleParamStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/top/SimpleParamStructure.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/top/TopStructure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_conflict/top/TopStructure.h - - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/pkg/CONST_A.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/pkg/Structure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/pkg/Structure.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/single/CONST_A.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/single/Structure.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/single/Structure.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/top/Parameterized.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/top/Parameterized.h - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/top/SingleImportPrecedence.cpp - ${ZSERIO_GEN_DIR_PACKAGES}/single_import_precedence/top/SingleImportPrecedence.h +if (ZSERIO_LOG_EMPTY_FILE) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_empty_file.txt "${ZSERIO_LOG_EMPTY_FILE}") + check_zserio_warnings("${ZSERIO_LOG_EMPTY_FILE}" 0) +endif () + +add_library(index_zs STATIC zs/index.zs) +zserio_generate_cpp( + TARGET index_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_index + # we must use 'index_workaround' to prevent clash with global function 'index' which is included + # via gtest.h -> ... -> strings.h + EXTRA_ARGS -withoutSourcesAmalgamation -setTopLevelPackage index_workaround + GENERATED_SOURCES_VAR GENERATED_SOURCES_INDEX + OUTPUT_VAR ZSERIO_LOG_INDEX + ERROR_VAR ZSERIO_LOG_INDEX ) - -set(ZSERIO_GENERATED_SOURCES_PACKAGE_NAME_CONFLICT - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/PackageNameConflictLocal.cpp - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/PackageNameConflictLocal.h - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/PackageNameConflictImported.cpp - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/PackageNameConflictImported.h - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/Blob.cpp - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/Blob.h - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/package_name_conflict/Blob.cpp - ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT}/package_name_conflict/package_name_conflict/Blob.h +target_link_libraries(index_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_INDEX) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_index.txt "${ZSERIO_LOG_INDEX}") + check_zserio_warnings("${ZSERIO_LOG_INDEX}" 0) +endif () + +add_library(package_name_conflict_zs STATIC zs/package_name_conflict.zs) +zserio_generate_cpp( + TARGET package_name_conflict_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_package_name_conflict + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_PACKAGE_NAME_CONFLICT + OUTPUT_VAR ZSERIO_LOG_PACKAGE_NAME_CONFLICT + ERROR_VAR ZSERIO_LOG_PACKAGE_NAME_CONFLICT ) - -set(ZSERIO_GENERATED_SOURCES_READER - ${ZSERIO_GEN_DIR_READER}/reader/Element.cpp - ${ZSERIO_GEN_DIR_READER}/reader/Element.h - ${ZSERIO_GEN_DIR_READER}/reader/ParameterizedElement.cpp - ${ZSERIO_GEN_DIR_READER}/reader/ParameterizedElement.h - ${ZSERIO_GEN_DIR_READER}/reader/Test.cpp - ${ZSERIO_GEN_DIR_READER}/reader/Test.h +target_link_libraries(package_name_conflict_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_PACKAGE_NAME_CONFLICT) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_package_name_conflict.txt + "${ZSERIO_LOG_PACKAGE_NAME_CONFLICT}") + check_zserio_warnings("${ZSERIO_LOG_PACKAGE_NAME_CONFLICT}" 0) +endif () + +add_library(packages_zs STATIC zs/packages.zs) +zserio_generate_cpp( + TARGET packages_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_packages + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG_PACKAGES + ERROR_VAR ZSERIO_LOG_PACKAGES ) - -zserio_add_library(default_package_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE default_package.zs - OUT_DIR ${ZSERIO_GEN_DIR_DEFAULT_PACKAGE} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_DEFAULT_PACKAGE} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - -zserio_add_library(empty_file_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE empty_file.zs - OUT_DIR ${ZSERIO_GEN_DIR_EMPTY_FILE} - OUT_FILES EMPTY - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} -) - -# we must use 'index_workaround' to prevent clash with global function 'index' which is included -# via gtest.h -> ... -> strings.h -zserio_add_library(index_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE index.zs - OUT_DIR ${ZSERIO_GEN_DIR_INDEX} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_INDEX} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -setTopLevelPackage index_workaround -) - -zserio_add_library(package_name_conflict_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE package_name_conflict.zs - OUT_DIR ${ZSERIO_GEN_DIR_PACKAGE_NAME_CONFLICT} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_PACKAGE_NAME_CONFLICT} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - -zserio_add_library(packages_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE packages.zs - OUT_DIR ${ZSERIO_GEN_DIR_PACKAGES} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_PACKAGES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - -zserio_add_library(reader_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE reader.zs - OUT_DIR ${ZSERIO_GEN_DIR_READER} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_READER} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +target_link_libraries(packages_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_PACKAGES) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_packages.txt "${ZSERIO_LOG_PACKAGES}") + check_zserio_warnings("${ZSERIO_LOG_PACKAGES}" 0) +endif () + +add_library(reader_zs STATIC zs/reader.zs) +zserio_generate_cpp( + TARGET reader_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_reader + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG_READER + ERROR_VAR ZSERIO_LOG_READER ) +target_link_libraries(reader_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_READER) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_reader.txt "${ZSERIO_LOG_READER}") + check_zserio_warnings("${ZSERIO_LOG_READER}" 0) +endif () add_custom_test(packages DEPENDS @@ -174,9 +109,9 @@ add_custom_test(packages ${CMAKE_CURRENT_SOURCE_DIR}/cpp/PackageNameConflictTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/ReaderTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES_DEFAULT_PACKAGE} - ${ZSERIO_GENERATED_SOURCES_INDEX} - ${ZSERIO_GENERATED_SOURCES_PACKAGE_NAME_CONFLICT} - ${ZSERIO_GENERATED_SOURCES_PACKAGES} - ${ZSERIO_GENERATED_SOURCES_READER} + ${GENERATED_SOURCES_DEFAULT_PACKAGE} + ${GENERATED_SOURCES_INDEX} + ${GENERATED_SOURCES_PACKAGE_NAME_CONFLICT} + ${GENERATED_SOURCES_PACKAGES} + ${GENERATED_SOURCES_READER} ) diff --git a/test/language/parameterized_types/CMakeLists.txt b/test/language/parameterized_types/CMakeLists.txt index 69c796c07..a196902ca 100644 --- a/test/language/parameterized_types/CMakeLists.txt +++ b/test/language/parameterized_types/CMakeLists.txt @@ -1,116 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param/Block.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param/Block.h - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param/BlockHeader.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param/BlockHeader.h - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param/Database.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param/Database.h - - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/ExtraValue.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/ExtraValue.h - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/Holder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/Holder.h - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/Param.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/Param.h - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/Value.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/array_element_param_with_optional/Value.h - - ${ZSERIO_GEN_DIR}/parameterized_types/bytes_param/BytesParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/bytes_param/BytesParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/bytes_param/Parameterized.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/bytes_param/Parameterized.h - - ${ZSERIO_GEN_DIR}/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/dynamic_bitfield_param/DynamicBitfieldParamHolder.h - - ${ZSERIO_GEN_DIR}/parameterized_types/extern_param/ExternParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/extern_param/ExternParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/extern_param/Parameterized.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/extern_param/Parameterized.h - - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/Access.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/Access.h - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/ArrayHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/ArrayHolder.h - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/Color.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/Color.h - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/FixedAndVariableParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/FixedAndVariableParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/LimitHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/fixed_and_variable_param/LimitHolder.h - - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/GrandChildParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/GrandChildParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/Item.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/Item.h - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/ItemChoice.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/ItemChoice.h - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/ItemChoiceHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/grand_child_param/ItemChoiceHolder.h - - ${ZSERIO_GEN_DIR}/parameterized_types/nested_parameterized_field/TopLevel.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/nested_parameterized_field/TopLevel.h - ${ZSERIO_GEN_DIR}/parameterized_types/nested_parameterized_field/ParamHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/nested_parameterized_field/ParamHolder.h - ${ZSERIO_GEN_DIR}/parameterized_types/nested_parameterized_field/Param.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/nested_parameterized_field/Param.h - - ${ZSERIO_GEN_DIR}/parameterized_types/packed_array_element_param/Block.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/packed_array_element_param/Block.h - ${ZSERIO_GEN_DIR}/parameterized_types/packed_array_element_param/BlockHeader.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/packed_array_element_param/BlockHeader.h - ${ZSERIO_GEN_DIR}/parameterized_types/packed_array_element_param/Database.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/packed_array_element_param/Database.h - - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/ExtraValue.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/ExtraValue.h - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/Holder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/Holder.h - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/Param.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/Param.h - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/Value.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/param_with_optional/Value.h - - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/Compound.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/Compound.h - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/ElementChildrenInitializer_array.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/ElementChildrenInitializer_array.h - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/ElementFactory_array.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/ElementFactory_array.h - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/ElementInitializer_array.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/ElementInitializer_array.h - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/Parent.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_inner_classes_clashing/Parent.h - - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_param/Param.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_param/Param.h - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_param/ParameterizedParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_param/ParameterizedParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_param/ParameterizedParamHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/parameterized_param/ParameterizedParamHolder.h - - ${ZSERIO_GEN_DIR}/parameterized_types/simple_param/Item.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/simple_param/Item.h - - ${ZSERIO_GEN_DIR}/parameterized_types/subtyped_bitfield_param/ParamType.h - ${ZSERIO_GEN_DIR}/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParam.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParam.h - ${ZSERIO_GEN_DIR}/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamHolder.cpp - ${ZSERIO_GEN_DIR}/parameterized_types/subtyped_bitfield_param/SubtypedBitfieldParamHolder.h -) - -zserio_add_library(parameterized_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE parameterized_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(parameterized_types_zs STATIC zs/parameterized_types.zs) +zserio_generate_cpp( + TARGET parameterized_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(parameterized_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(parameterized_types DEPENDS @@ -131,5 +33,5 @@ add_custom_test(parameterized_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimpleParamTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SubtypedBitfieldParamTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/pubsub_types/CMakeLists.txt b/test/language/pubsub_types/CMakeLists.txt index 1cbf3192f..c19ec091b 100644 --- a/test/language/pubsub_types/CMakeLists.txt +++ b/test/language/pubsub_types/CMakeLists.txt @@ -1,26 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/Int32Value.cpp - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/Int32Value.h - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/SimplePubsub.cpp - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/SimplePubsub.h - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/SimplePubsubClient.cpp - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/SimplePubsubClient.h - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/SimplePubsubProvider.cpp - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/SimplePubsubProvider.h - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/UInt64Value.cpp - ${ZSERIO_GEN_DIR}/pubsub_types/simple_pubsub/UInt64Value.h -) - -zserio_add_library(pubsub_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE pubsub_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(pubsub_types_zs STATIC zs/pubsub_types.zs) +zserio_generate_cpp( + TARGET pubsub_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(pubsub_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(pubsub_types DEPENDS @@ -28,5 +20,5 @@ add_custom_test(pubsub_types SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimplePubsubTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/rules/CMakeLists.txt b/test/language/rules/CMakeLists.txt index b0adfdd0e..8f9c9a13c 100644 --- a/test/language/rules/CMakeLists.txt +++ b/test/language/rules/CMakeLists.txt @@ -1,23 +1,22 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(DOC_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/doc) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/rules/pkg_rules/Test.cpp - ${ZSERIO_GEN_DIR}/rules/pkg_rules/Test.h -) - -zserio_add_library(rules_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE rules.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(rules_zs STATIC zs/rules.zs) +zserio_generate_cpp( + TARGET rules_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(rules_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(rules DEPENDS rules_zs GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/service_types/CMakeLists.txt b/test/language/service_types/CMakeLists.txt index d9d2f42a2..7c1a16042 100644 --- a/test/language/service_types/CMakeLists.txt +++ b/test/language/service_types/CMakeLists.txt @@ -1,44 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/service_types/simple_service/Response.h - ${ZSERIO_GEN_DIR}/service_types/simple_service/Response.cpp - ${ZSERIO_GEN_DIR}/service_types/simple_service/Request.h - ${ZSERIO_GEN_DIR}/service_types/simple_service/Request.cpp - ${ZSERIO_GEN_DIR}/service_types/simple_service/SimpleService.h - ${ZSERIO_GEN_DIR}/service_types/simple_service/SimpleService.cpp - - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/CMYKModel.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/CMYKModel.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/Color.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ColorModelChoice.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ColorModelChoice.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ColorModel.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ColorModel.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ComplexTypesService.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ComplexTypesService.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/LengthResponse.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/LengthResponse.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/Request.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/RequestData.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/RequestData.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/Request.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/Response.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ResponseData.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/ResponseData.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/Response.h - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/RGBModel.cpp - ${ZSERIO_GEN_DIR}/service_types/complex_types_service/RGBModel.h -) - -zserio_add_library(service_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE service_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(service_types_zs STATIC zs/service_types.zs) +zserio_generate_cpp( + TARGET service_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(service_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(service_types DEPENDS @@ -47,5 +21,5 @@ add_custom_test(service_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimpleServiceTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/ComplexTypesServiceTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_constraints/CMakeLists.txt b/test/language/sql_constraints/CMakeLists.txt index 74697e97b..ba49db5f5 100644 --- a/test/language/sql_constraints/CMakeLists.txt +++ b/test/language/sql_constraints/CMakeLists.txt @@ -1,30 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_constraints/constraint_imports/IMPORTED_CONSTRAINTS_CONSTANT.h - - ${ZSERIO_GEN_DIR}/sql_constraints/field_constraints/CONSTRAINTS_CONSTANT.h - ${ZSERIO_GEN_DIR}/sql_constraints/field_constraints/FieldConstraintsTable.cpp - ${ZSERIO_GEN_DIR}/sql_constraints/field_constraints/FieldConstraintsTable.h - ${ZSERIO_GEN_DIR}/sql_constraints/field_constraints/NOT_NULL_CONSTRAINT.h - - ${ZSERIO_GEN_DIR}/sql_constraints/table_constraints/TableConstraintsTable.cpp - ${ZSERIO_GEN_DIR}/sql_constraints/table_constraints/TableConstraintsTable.h - - ${ZSERIO_GEN_DIR}/sql_constraints/TestDb.cpp - ${ZSERIO_GEN_DIR}/sql_constraints/TestDb.h +add_library(sql_constraints_zs STATIC zs/sql_constraints.zs) +zserio_generate_cpp( + TARGET sql_constraints_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(sql_constraints_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_constraints.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - +target_link_libraries(sql_constraints_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_constraints_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(sql_constraints DEPENDS @@ -33,5 +22,5 @@ add_custom_test(sql_constraints ${CMAKE_CURRENT_SOURCE_DIR}/cpp/FieldConstraintsTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/TableConstraintsTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_databases/CMakeLists.txt b/test/language/sql_databases/CMakeLists.txt index 4d8ce8049..01813fcc4 100644 --- a/test/language/sql_databases/CMakeLists.txt +++ b/test/language/sql_databases/CMakeLists.txt @@ -1,33 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_databases/simple_db/GeoMapTable.cpp - ${ZSERIO_GEN_DIR}/sql_databases/simple_db/GeoMapTable.h - ${ZSERIO_GEN_DIR}/sql_databases/simple_db/Tile.cpp - ${ZSERIO_GEN_DIR}/sql_databases/simple_db/Tile.h - ${ZSERIO_GEN_DIR}/sql_databases/simple_db/WorldDb.cpp - ${ZSERIO_GEN_DIR}/sql_databases/simple_db/WorldDb.h - - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/AmericaDb.cpp - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/AmericaDb.h - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/CountryMapTable.cpp - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/CountryMapTable.h - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/EuropeDb.cpp - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/EuropeDb.h - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/Tile.cpp - ${ZSERIO_GEN_DIR}/sql_databases/db_with_relocation/Tile.h -) - -zserio_add_library(sql_databases_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_databases.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(sql_databases_zs STATIC zs/sql_databases.zs) +zserio_generate_cpp( + TARGET sql_databases_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(sql_databases_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_databases_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(sql_databases DEPENDS @@ -36,6 +22,6 @@ add_custom_test(sql_databases ${CMAKE_CURRENT_SOURCE_DIR}/cpp/DbWithRelocationTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimpleDbTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_tables/CMakeLists.txt b/test/language/sql_tables/CMakeLists.txt index b3b813ee6..1f9e5752f 100644 --- a/test/language/sql_tables/CMakeLists.txt +++ b/test/language/sql_tables/CMakeLists.txt @@ -1,92 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_tables/blob_field_with_children_initialization_table/BlobFieldWithChildrenInitializationTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_field_with_children_initialization_table/BlobFieldWithChildrenInitializationTable.h - ${ZSERIO_GEN_DIR}/sql_tables/blob_field_with_children_initialization_table/BlobWithChildrenInitialization.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_field_with_children_initialization_table/BlobWithChildrenInitialization.h - ${ZSERIO_GEN_DIR}/sql_tables/blob_field_with_children_initialization_table/ParameterizedArray.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_field_with_children_initialization_table/ParameterizedArray.h - - ${ZSERIO_GEN_DIR}/sql_tables/blob_param_table/BlobParamTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_param_table/BlobParamTable.h - ${ZSERIO_GEN_DIR}/sql_tables/blob_param_table/Parameters.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_param_table/Parameters.h - ${ZSERIO_GEN_DIR}/sql_tables/blob_param_table/ParameterizedBlob.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_param_table/ParameterizedBlob.h - - ${ZSERIO_GEN_DIR}/sql_tables/blob_offsets_param_table/BlobOffsetsParamTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_offsets_param_table/BlobOffsetsParamTable.h - ${ZSERIO_GEN_DIR}/sql_tables/blob_offsets_param_table/OffsetsHolder.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_offsets_param_table/OffsetsHolder.h - ${ZSERIO_GEN_DIR}/sql_tables/blob_offsets_param_table/ParameterizedBlob.cpp - ${ZSERIO_GEN_DIR}/sql_tables/blob_offsets_param_table/ParameterizedBlob.h - - ${ZSERIO_GEN_DIR}/sql_tables/column_param_table/ColumnParamTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/column_param_table/ColumnParamTable.h - ${ZSERIO_GEN_DIR}/sql_tables/column_param_table/ParameterizedBlob.cpp - ${ZSERIO_GEN_DIR}/sql_tables/column_param_table/ParameterizedBlob.h - - ${ZSERIO_GEN_DIR}/sql_tables/complex_table/ComplexTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/complex_table/ComplexTable.h - ${ZSERIO_GEN_DIR}/sql_tables/complex_table/TestBlob.cpp - ${ZSERIO_GEN_DIR}/sql_tables/complex_table/TestBlob.h - ${ZSERIO_GEN_DIR}/sql_tables/complex_table/TestEnum.cpp - ${ZSERIO_GEN_DIR}/sql_tables/complex_table/TestEnum.h - - ${ZSERIO_GEN_DIR}/sql_tables/const_param_table/ConstParamTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/const_param_table/ConstParamTable.h - ${ZSERIO_GEN_DIR}/sql_tables/const_param_table/ParameterizedBlob.cpp - ${ZSERIO_GEN_DIR}/sql_tables/const_param_table/ParameterizedBlob.h - - ${ZSERIO_GEN_DIR}/sql_tables/dynamic_bit_field_enum_field_table/DynamicBitFieldEnumFieldTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/dynamic_bit_field_enum_field_table/DynamicBitFieldEnumFieldTable.h - ${ZSERIO_GEN_DIR}/sql_tables/dynamic_bit_field_enum_field_table/TestEnum.cpp - ${ZSERIO_GEN_DIR}/sql_tables/dynamic_bit_field_enum_field_table/TestEnum.h - - ${ZSERIO_GEN_DIR}/sql_tables/multiple_pk_table/MultiplePkTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/multiple_pk_table/MultiplePkTable.h - - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bitmask_field_table/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bitmask_field_table/TestBitmask.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bitmask_field_table/SubtypedBitmaskFieldTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bitmask_field_table/SubtypedBitmaskFieldTable.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bitmask_field_table/SubtypedBitmask.h - - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bool_field_table/SubtypedBoolFieldTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bool_field_table/SubtypedBoolFieldTable.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_bool_field_table/SubtypedBool.h - - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_enum_field_table/SubtypedEnumFieldTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_enum_field_table/SubtypedEnumFieldTable.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_enum_field_table/SubtypedEnum.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_enum_field_table/TestEnum.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_enum_field_table/TestEnum.h - - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_table/Student.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_table/Student.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_table/SubtypedTable.h - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_table/TestTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/subtyped_table/TestTable.h - - ${ZSERIO_GEN_DIR}/sql_tables/without_pk_table/WithoutPkTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables/without_pk_table/WithoutPkTable.h - - ${ZSERIO_GEN_DIR}/sql_tables/TestDb.cpp - ${ZSERIO_GEN_DIR}/sql_tables/TestDb.h -) - -zserio_add_library(sql_tables_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_tables.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 1 +add_library(sql_tables_zs STATIC zs/sql_tables.zs) +zserio_generate_cpp( + TARGET sql_tables_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(sql_tables_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_tables_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 1) +endif () add_custom_test(sql_tables DEPENDS @@ -106,5 +33,5 @@ add_custom_test(sql_tables ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SubtypedTableTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/WithoutPkTableTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_types/CMakeLists.txt b/test/language/sql_types/CMakeLists.txt index 0ba746d1b..b7097026b 100644 --- a/test/language/sql_types/CMakeLists.txt +++ b/test/language/sql_types/CMakeLists.txt @@ -1,32 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_types/SqlTypesDb.cpp - ${ZSERIO_GEN_DIR}/sql_types/SqlTypesDb.h - ${ZSERIO_GEN_DIR}/sql_types/SqlTypesTable.cpp - ${ZSERIO_GEN_DIR}/sql_types/SqlTypesTable.h - ${ZSERIO_GEN_DIR}/sql_types/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/sql_types/TestBitmask.h - ${ZSERIO_GEN_DIR}/sql_types/TestChoice.cpp - ${ZSERIO_GEN_DIR}/sql_types/TestChoice.h - ${ZSERIO_GEN_DIR}/sql_types/TestEnum.cpp - ${ZSERIO_GEN_DIR}/sql_types/TestEnum.h - ${ZSERIO_GEN_DIR}/sql_types/TestStructure.cpp - ${ZSERIO_GEN_DIR}/sql_types/TestStructure.h - ${ZSERIO_GEN_DIR}/sql_types/TestUnion.cpp - ${ZSERIO_GEN_DIR}/sql_types/TestUnion.h +add_library(sql_types_zs STATIC zs/sql_types.zs) +zserio_generate_cpp( + TARGET sql_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(sql_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - +target_link_libraries(sql_types_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_types_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(sql_types DEPENDS @@ -34,5 +21,5 @@ add_custom_test(sql_types SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SqlTypesTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_virtual_columns/CMakeLists.txt b/test/language/sql_virtual_columns/CMakeLists.txt index c17e70a96..41628e1bc 100644 --- a/test/language/sql_virtual_columns/CMakeLists.txt +++ b/test/language/sql_virtual_columns/CMakeLists.txt @@ -1,27 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_virtual_columns/hidden_virtual_columns/HiddenVirtualColumnsDb.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_columns/hidden_virtual_columns/HiddenVirtualColumnsDb.h - ${ZSERIO_GEN_DIR}/sql_virtual_columns/hidden_virtual_columns/HiddenVirtualColumnsTable.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_columns/hidden_virtual_columns/HiddenVirtualColumnsTable.h - - ${ZSERIO_GEN_DIR}/sql_virtual_columns/simple_virtual_columns/SimpleVirtualColumnsDb.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_columns/simple_virtual_columns/SimpleVirtualColumnsDb.h - ${ZSERIO_GEN_DIR}/sql_virtual_columns/simple_virtual_columns/SimpleVirtualColumnsTable.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_columns/simple_virtual_columns/SimpleVirtualColumnsTable.h -) - -zserio_add_library(sql_virtual_columns_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_virtual_columns.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(sql_virtual_columns_zs STATIC zs/sql_virtual_columns.zs) +zserio_generate_cpp( + TARGET sql_virtual_columns_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(sql_virtual_columns_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_virtual_columns_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(sql_virtual_columns DEPENDS @@ -30,5 +22,5 @@ add_custom_test(sql_virtual_columns ${CMAKE_CURRENT_SOURCE_DIR}/cpp/HiddenVirtualColumnsTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimpleVirtualColumnsTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_virtual_tables/CMakeLists.txt b/test/language/sql_virtual_tables/CMakeLists.txt index f7017f96b..1d13a06ad 100644 --- a/test/language/sql_virtual_tables/CMakeLists.txt +++ b/test/language/sql_virtual_tables/CMakeLists.txt @@ -1,27 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts3_virtual_table/Fts3VirtualTable.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts3_virtual_table/Fts3VirtualTable.h - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts3_virtual_table/Fts3TestDb.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts3_virtual_table/Fts3TestDb.h - - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts5_virtual_table/Fts5VirtualTable.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts5_virtual_table/Fts5VirtualTable.h - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts5_virtual_table/Fts5TestDb.cpp - ${ZSERIO_GEN_DIR}/sql_virtual_tables/fts5_virtual_table/Fts5TestDb.h -) - -zserio_add_library(sql_virtual_tables_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_virtual_tables.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(sql_virtual_tables_zs STATIC zs/sql_virtual_tables.zs) +zserio_generate_cpp( + TARGET sql_virtual_tables_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(sql_virtual_tables_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_virtual_tables_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(sql_virtual_tables DEPENDS @@ -30,5 +22,5 @@ add_custom_test(sql_virtual_tables ${CMAKE_CURRENT_SOURCE_DIR}/cpp/Fts3VirtualTableTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/Fts5VirtualTableTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/sql_without_rowid_tables/CMakeLists.txt b/test/language/sql_without_rowid_tables/CMakeLists.txt index a68f56cdb..c0e9f00a5 100644 --- a/test/language/sql_without_rowid_tables/CMakeLists.txt +++ b/test/language/sql_without_rowid_tables/CMakeLists.txt @@ -1,29 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/rowid_and_without_rowid_tables/OrdinaryRowIdTable.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/rowid_and_without_rowid_tables/OrdinaryRowIdTable.h - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdDb.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/rowid_and_without_rowid_tables/RowIdAndWithoutRowIdDb.h - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/rowid_and_without_rowid_tables/WithoutRowIdTable.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/rowid_and_without_rowid_tables/WithoutRowIdTable.h - - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdDb.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdDb.h - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdTable.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables/simple_without_rowid_table/SimpleWithoutRowIdTable.h -) - -zserio_add_library(sql_without_rowid_tables_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_without_rowid_tables.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(sql_without_rowid_tables_zs STATIC zs/sql_without_rowid_tables.zs) +zserio_generate_cpp( + TARGET sql_without_rowid_tables_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(sql_without_rowid_tables_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_without_rowid_tables_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(sql_without_rowid_tables DEPENDS @@ -32,5 +22,5 @@ add_custom_test(sql_without_rowid_tables ${CMAKE_CURRENT_SOURCE_DIR}/cpp/RowIdAndWithoutRowIdTablesTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SimpleWithoutRowIdTableTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/structure_types/CMakeLists.txt b/test/language/structure_types/CMakeLists.txt index 5c0301444..51c975c80 100644 --- a/test/language/structure_types/CMakeLists.txt +++ b/test/language/structure_types/CMakeLists.txt @@ -1,48 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/structure_types/empty_structure/EmptyStructure.cpp - ${ZSERIO_GEN_DIR}/structure_types/empty_structure/EmptyStructure.h - - ${ZSERIO_GEN_DIR}/structure_types/empty_structure_with_parameter/EmptyStructureWithParameter.cpp - ${ZSERIO_GEN_DIR}/structure_types/empty_structure_with_parameter/EmptyStructureWithParameter.h - - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/FieldConstructorClashing.cpp - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/FieldConstructorClashing.h - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/CompoundPackingRead.cpp - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/CompoundPackingRead.h - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/CompoundRead.cpp - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/CompoundRead.h - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/Field.cpp - ${ZSERIO_GEN_DIR}/structure_types/field_constructor_clashing/Field.h - - ${ZSERIO_GEN_DIR}/structure_types/one_string_structure/OneStringStructure.cpp - ${ZSERIO_GEN_DIR}/structure_types/one_string_structure/OneStringStructure.h - - ${ZSERIO_GEN_DIR}/structure_types/simple_structure/SimpleStructure.cpp - ${ZSERIO_GEN_DIR}/structure_types/simple_structure/SimpleStructure.h - - ${ZSERIO_GEN_DIR}/structure_types/structure_inner_classes_clashing/ArrayType_array.cpp - ${ZSERIO_GEN_DIR}/structure_types/structure_inner_classes_clashing/ArrayType_array.h - ${ZSERIO_GEN_DIR}/structure_types/structure_inner_classes_clashing/OffsetChecker_array.cpp - ${ZSERIO_GEN_DIR}/structure_types/structure_inner_classes_clashing/OffsetChecker_array.h - ${ZSERIO_GEN_DIR}/structure_types/structure_inner_classes_clashing/OffsetInitializer_array.cpp - ${ZSERIO_GEN_DIR}/structure_types/structure_inner_classes_clashing/OffsetInitializer_array.h - - ${ZSERIO_GEN_DIR}/structure_types/structure_with_removed_enum_item_field/StructureWithRemovedEnumItemField.cpp - ${ZSERIO_GEN_DIR}/structure_types/structure_with_removed_enum_item_field/StructureWithRemovedEnumItemField.h - ${ZSERIO_GEN_DIR}/structure_types/structure_with_removed_enum_item_field/Enumeration.cpp - ${ZSERIO_GEN_DIR}/structure_types/structure_with_removed_enum_item_field/Enumeration.h -) - -zserio_add_library(structure_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE structure_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -withTypeInfoCode -withReflectionCode +add_library(structure_types_zs STATIC zs/structure_types.zs) +zserio_generate_cpp( + TARGET structure_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation -withTypeInfoCode -withReflectionCode + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(structure_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(structure_types DEPENDS @@ -56,5 +26,5 @@ add_custom_test(structure_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/StructureInnerClassesClashingTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/StructureWithRemovedEnumItemFieldTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/subtypes/CMakeLists.txt b/test/language/subtypes/CMakeLists.txt index 538e24e7e..8870e37c7 100644 --- a/test/language/subtypes/CMakeLists.txt +++ b/test/language/subtypes/CMakeLists.txt @@ -1,47 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/subtypes/bitmask_subtype/CONST_READ.h - ${ZSERIO_GEN_DIR}/subtypes/bitmask_subtype/Permission.cpp - ${ZSERIO_GEN_DIR}/subtypes/bitmask_subtype/Permission.h - ${ZSERIO_GEN_DIR}/subtypes/bitmask_subtype/PermissionSubtype.h - - ${ZSERIO_GEN_DIR}/subtypes/enum_subtype/Color.cpp - ${ZSERIO_GEN_DIR}/subtypes/enum_subtype/Color.h - ${ZSERIO_GEN_DIR}/subtypes/enum_subtype/ColorSubtype.h - ${ZSERIO_GEN_DIR}/subtypes/enum_subtype/CONST_BLACK.h - - ${ZSERIO_GEN_DIR}/subtypes/param_structure_subtype/ParameterizedStruct.cpp - ${ZSERIO_GEN_DIR}/subtypes/param_structure_subtype/ParameterizedStruct.h - ${ZSERIO_GEN_DIR}/subtypes/param_structure_subtype/ParameterizedSubtype.h - ${ZSERIO_GEN_DIR}/subtypes/param_structure_subtype/ParameterizedSubtypeStruct.cpp - ${ZSERIO_GEN_DIR}/subtypes/param_structure_subtype/ParameterizedSubtypeStruct.h - - ${ZSERIO_GEN_DIR}/subtypes/structure_subtype/Student.h - ${ZSERIO_GEN_DIR}/subtypes/structure_subtype/SubtypeStructure.cpp - ${ZSERIO_GEN_DIR}/subtypes/structure_subtype/SubtypeStructure.h - ${ZSERIO_GEN_DIR}/subtypes/structure_subtype/TestStructure.cpp - ${ZSERIO_GEN_DIR}/subtypes/structure_subtype/TestStructure.h - - ${ZSERIO_GEN_DIR}/subtypes/subtype_imported/SubtypeImported.cpp - ${ZSERIO_GEN_DIR}/subtypes/subtype_imported/SubtypeImported.h - ${ZSERIO_GEN_DIR}/subtypes/subtype_imported/Test.cpp - ${ZSERIO_GEN_DIR}/subtypes/subtype_imported/Test.h - ${ZSERIO_GEN_DIR}/subtypes/subtype_imported/pkg/SubTest.h - - ${ZSERIO_GEN_DIR}/subtypes/uint16_subtype/Identifier.h - ${ZSERIO_GEN_DIR}/subtypes/uint16_subtype/TestStructure.cpp - ${ZSERIO_GEN_DIR}/subtypes/uint16_subtype/TestStructure.h -) - -zserio_add_library(subtypes_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE subtypes.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(subtypes_zs STATIC zs/subtypes.zs) +zserio_generate_cpp( + TARGET subtypes_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(subtypes_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(subtypes DEPENDS @@ -54,5 +25,5 @@ add_custom_test(subtypes ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SubtypeImportedTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UInt16SubtypeTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/templates/CMakeLists.txt b/test/language/templates/CMakeLists.txt index 84e523e0b..91d2c6f02 100644 --- a/test/language/templates/CMakeLists.txt +++ b/test/language/templates/CMakeLists.txt @@ -1,431 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/EnumFromZero.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/EnumFromZero.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/EnumFromOne.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/EnumFromOne.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/TemplatedChoice_EnumFromZero.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/TemplatedChoice_EnumFromZero.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/TemplatedChoice_EnumFromOne.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/TemplatedChoice_EnumFromOne.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/ChoiceTemplatedEnumSelector.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_enum_selector/ChoiceTemplatedEnumSelector.h - - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/ChoiceTemplatedSelector.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/ChoiceTemplatedSelector.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/Shift16.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/Shift16.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/Shift32.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/Shift32.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/TemplatedChoice_uint16_Shift16.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/TemplatedChoice_uint16_Shift16.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/TemplatedChoice_uint32_Shift32.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_selector/TemplatedChoice_uint32_Shift32.h - - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/TemplatedChoice_uint32_uint16.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/TemplatedChoice_uint32_uint16.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/TemplatedChoice_Compound_uint32_uint16.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/TemplatedChoice_Compound_uint32_uint16.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/ChoiceTemplatedField.cpp - ${ZSERIO_GEN_DIR}/templates/choice_templated_field/ChoiceTemplatedField.h - - ${ZSERIO_GEN_DIR}/templates/expression_bitmask_template_argument/Permission.cpp - ${ZSERIO_GEN_DIR}/templates/expression_bitmask_template_argument/Permission.h - ${ZSERIO_GEN_DIR}/templates/expression_bitmask_template_argument/BitmaskTemplateArgument_Permission.cpp - ${ZSERIO_GEN_DIR}/templates/expression_bitmask_template_argument/BitmaskTemplateArgument_Permission.h - ${ZSERIO_GEN_DIR}/templates/expression_bitmask_template_argument/BitmaskTemplateArgumentHolder.cpp - ${ZSERIO_GEN_DIR}/templates/expression_bitmask_template_argument/BitmaskTemplateArgumentHolder.h - - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument/Color.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument/Color.h - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument/EnumTemplateArgument_Color.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument/EnumTemplateArgument_Color.h - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument/EnumTemplateArgumentHolder.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument/EnumTemplateArgumentHolder.h - - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/E.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/E.h - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/EnumTemplateArgumentConflictHolder.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/EnumTemplateArgumentConflictHolder.h - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/EnumTemplateArgumentConflict_Letters.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/EnumTemplateArgumentConflict_Letters.h - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/Letters.cpp - ${ZSERIO_GEN_DIR}/templates/expression_enum_template_argument_conflict/Letters.h - - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/import_color/Color.cpp - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/import_color/Color.h - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/Color.cpp - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/Color.h - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/FullTemplateArgument_Color_7C6F461F.cpp - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/FullTemplateArgument_Color_7C6F461F.h - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/FullTemplateArgument_Color_F30EBCB3.cpp - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/FullTemplateArgument_Color_F30EBCB3.h - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/FullTemplateArgumentHolder.cpp - ${ZSERIO_GEN_DIR}/templates/expression_full_template_argument/FullTemplateArgumentHolder.h - - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/TestStructure_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/TestStructure_uint32.h - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/TestStructure_string.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/TestStructure_string.h - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/TestStructure_float32.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/TestStructure_float32.h - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/Holder_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/Holder_uint32.h - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/Holder_string.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/Holder_string.h - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/Holder_float32.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/Holder_float32.h - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/FunctionTemplatedReturnType.cpp - ${ZSERIO_GEN_DIR}/templates/function_templated_return_type/FunctionTemplatedReturnType.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_clash_other_template/InstantiateClashOtherTemplate.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_clash_other_template/InstantiateClashOtherTemplate.h - ${ZSERIO_GEN_DIR}/templates/instantiate_clash_other_template/Test_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_clash_other_template/Test_uint32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_clash_other_template/Test_uint32_99604043.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_clash_other_template/Test_uint32_99604043.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/pkg - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/Test_string.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/Test_string.h - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/InstantiateImported.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/InstantiateImported.h - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/pkg/U32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_imported/pkg/U32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_nested_template/TStr.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_nested_template/TStr.h - ${ZSERIO_GEN_DIR}/templates/instantiate_nested_template/NStr.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_nested_template/NStr.h - ${ZSERIO_GEN_DIR}/templates/instantiate_nested_template/InstantiateNestedTemplate.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_nested_template/InstantiateNestedTemplate.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/InstantiateNotImported.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/InstantiateNotImported.h - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/pkg/U32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/pkg/U32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/pkg/Test_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/pkg/Test_uint32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/pkg/Test_string.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_not_imported/pkg/Test_string.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_only_nested/N32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_only_nested/N32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_only_nested/InstantiateOnlyNested.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_only_nested/InstantiateOnlyNested.h - ${ZSERIO_GEN_DIR}/templates/instantiate_only_nested/pkg/Test_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_only_nested/pkg/Test_uint32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_simple/U32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_simple/U32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_simple/InstantiateSimple.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_simple/InstantiateSimple.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_sql_table/U32Table.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_sql_table/U32Table.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_template_argument/InstantiateTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_template_argument/InstantiateTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/instantiate_template_argument/Other_Str.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_template_argument/Other_Str.h - ${ZSERIO_GEN_DIR}/templates/instantiate_template_argument/Str.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_template_argument/Str.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_choice_field/InstantiateTypeAsChoiceField.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_choice_field/InstantiateTypeAsChoiceField.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_choice_field/Test32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_choice_field/Test32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_parameter/InstantiateTypeAsParameter.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_parameter/InstantiateTypeAsParameter.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_parameter/P32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_parameter/P32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_parameter/Parameterized_P32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_parameter/Parameterized_P32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_database_field/InstantiateTypeAsSqlDatabaseFieldDb.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_database_field/InstantiateTypeAsSqlDatabaseFieldDb.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_database_field/StringTable.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_database_field/StringTable.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_table_field/Test32Table.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_table_field/Test32Table.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_table_field/Test32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_sql_table_field/Test32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_array_field/InstantiateTypeAsStructArrayField.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_array_field/InstantiateTypeAsStructArrayField.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_array_field/Test32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_array_field/Test32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_field/InstantiateTypeAsStructField.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_field/InstantiateTypeAsStructField.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_field/Test32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_struct_field/Test32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_template_argument/InstantiateTypeAsTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_template_argument/InstantiateTypeAsTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_template_argument/Other_Str.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_template_argument/Other_Str.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_template_argument/Str.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_as_template_argument/Str.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_imported_as_struct_field/InstantiateTypeImportedAsStructField.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_imported_as_struct_field/InstantiateTypeImportedAsStructField.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_imported_as_struct_field/pkg/Test32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_imported_as_struct_field/pkg/Test32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_type_on_parameterized_template/InstantiateTypeOnParameterizedTemplate.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_on_parameterized_template/InstantiateTypeOnParameterizedTemplate.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_on_parameterized_template/Parameterized.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_on_parameterized_template/Parameterized.h - ${ZSERIO_GEN_DIR}/templates/instantiate_type_on_parameterized_template/TestP.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_type_on_parameterized_template/TestP.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_unused/U32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_unused/U32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_via_import/InstantiateViaImport.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_via_import/InstantiateViaImport.h - ${ZSERIO_GEN_DIR}/templates/instantiate_via_import/pkg/U32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_via_import/pkg/U32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_via_import/pkg/Test_string.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_via_import/pkg/Test_string.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_via_single_import/InstantiateViaSingleImport.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_via_single_import/InstantiateViaSingleImport.h - ${ZSERIO_GEN_DIR}/templates/instantiate_via_single_import/pkg/U32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_via_single_import/pkg/U32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_via_single_import/pkg/Test_string.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_via_single_import/pkg/Test_string.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_vs_default/TStr.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_vs_default/TStr.h - ${ZSERIO_GEN_DIR}/templates/instantiate_vs_default/InstantiateVsDefault.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_vs_default/InstantiateVsDefault.h - ${ZSERIO_GEN_DIR}/templates/instantiate_vs_default/pkg/Test_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_vs_default/pkg/Test_uint32.h - - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Data8.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Data8.h - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Data32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Data32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/InstantiateWithInstantiateTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/InstantiateWithInstantiateTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Other32.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Other32.h - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Other8.cpp - ${ZSERIO_GEN_DIR}/templates/instantiate_with_instantiate_template_argument/Other8.h - - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/Union.cpp - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/Union.h - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/TemplatedTable_Union.cpp - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/TemplatedTable_Union.h - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/TemplatedTable_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/TemplatedTable_uint32.h - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/SqlTableTemplatedFieldDb.cpp - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/SqlTableTemplatedFieldDb.h - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/Data_Union.cpp - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/Data_Union.h - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/Data_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/sql_table_templated_field/Data_uint32.h - - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/templated_struct/Storage.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/templated_struct/Storage.h - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/templated_struct/StructShortNameTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/templated_struct/StructShortNameTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/templated_struct/TemplatedStruct_Storage.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/templated_struct/TemplatedStruct_Storage.h - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/StructFullNameTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_and_short_template_argument/StructFullNameTemplateArgument.h - - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/import_storage/Storage.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/import_storage/Storage.h - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/Storage.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/Storage.h - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/StructFullNameTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/StructFullNameTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/TemplatedStruct_Storage_A3A4B101.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/TemplatedStruct_Storage_A3A4B101.h - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/TemplatedStruct_Storage_C76E422F.cpp - ${ZSERIO_GEN_DIR}/templates/struct_full_name_template_argument/TemplatedStruct_Storage_C76E422F.h - - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument/StructLongTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument/StructLongTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument/TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_ThisIsVery_.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument/TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_ThisIsVery_.h - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument/ThisIsVeryVeryVeryLongNamedStructure.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument/ThisIsVeryVeryVeryLongNamedStructure.h - - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/StructLongTemplateArgumentClash.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/StructLongTemplateArgumentClash.h - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_1B45EF08.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_1B45EF08.h - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_619A1B35.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/TemplatedStruct_ThisIsVeryVeryVeryLongNamedStructure_Th_619A1B35.h - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/ThisIsVeryVeryVeryLongNamedStructure.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/ThisIsVeryVeryVeryLongNamedStructure.h - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/ThisIsVeryVeryVeryLongNamedStructure_.cpp - ${ZSERIO_GEN_DIR}/templates/struct_long_template_argument_clash/ThisIsVeryVeryVeryLongNamedStructure_.h - - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/StructRecursiveTemplate.cpp - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/StructRecursiveTemplate.h - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_string.cpp - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_string.h - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_Compound_string.cpp - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_Compound_string.h - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_Compound_Compound_string.cpp - ${ZSERIO_GEN_DIR}/templates/struct_recursive_template/Compound_Compound_Compound_string.h - - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/A.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/A.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/A_B.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/A_B.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/B_C.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/B_C.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/C.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/C.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/InstantiationNameClash.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/InstantiationNameClash.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/Template_A_B_C_5EB4E3FC.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/Template_A_B_C_5EB4E3FC.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/Template_A_B_C_7FE93D34.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/Template_A_B_C_7FE93D34.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/TestStruct_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash/TestStruct_uint32.h - - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg1/InstantiationInPkg1.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg1/InstantiationInPkg1.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg1/Test.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg1/Test.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg2/InstantiationInPkg2.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg2/InstantiationInPkg2.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg2/Test.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/pkg2/Test.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/test_struct/TestStruct_Test_67B82BA5.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/test_struct/TestStruct_Test_67B82BA5.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/test_struct/TestStruct_Test_639610D0.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_across_packages/test_struct/TestStruct_Test_639610D0.h - - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/A_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/A_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/InstantiationNameClashOtherTemplate.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/InstantiationNameClashOtherTemplate.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/Test_A_uint32_5D68B0C2.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/Test_A_uint32_5D68B0C2.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/Test_A_uint32_FA82A3B7.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_template/Test_A_uint32_FA82A3B7.h - - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_type/InstantiationNameClashOtherType.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_type/InstantiationNameClashOtherType.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_type/Test_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_type/Test_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_type/Test_uint32_99604043.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_clash_other_type/Test_uint32_99604043.h - - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/StructTemplatedField.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/StructTemplatedField.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Field_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Field_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Field_string.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Field_string.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Field_Compound.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Field_Compound.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Compound.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_field/Compound.h - - ${ZSERIO_GEN_DIR}/templates/struct_templated_template_argument/StructTemplatedTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_template_argument/StructTemplatedTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_template_argument/Field_Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_template_argument/Field_Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_template_argument/Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_template_argument/Compound_uint32.h - - ${ZSERIO_GEN_DIR}/templates/struct_templated_type_argument/StructTemplatedTypeArgument.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_type_argument/StructTemplatedTypeArgument.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_type_argument/ParamHolder_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_type_argument/ParamHolder_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_templated_type_argument/Parameterized_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_templated_type_argument/Parameterized_uint32.h - - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/StructTemplateInTemplate.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/StructTemplateInTemplate.h - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Field_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Field_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Field_string.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Field_string.h - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Compound_string.cpp - ${ZSERIO_GEN_DIR}/templates/struct_template_in_template/Compound_string.h - - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/AnotherCompoundType.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/AnotherUInt32Type.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/Compound.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/Compound.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/CompoundType.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/Field_Compound.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/Field_Compound.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/Field_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/Field_uint32.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/SubtypeTemplateArgument.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/SubtypeTemplateArgument.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_argument/UInt32Type.h - - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_builtin/TestStructure_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_builtin/TestStructure_uint32.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_builtin/TestStructureSubtype.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_builtin/SubtypeTemplateWithBuiltin.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_builtin/SubtypeTemplateWithBuiltin.h - - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/TestStructure_Compound_TemplateCompound_Compound.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/TestStructure_Compound_TemplateCompound_Compound.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/TemplateCompound_Compound.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/TemplateCompound_Compound.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/SubtypeTemplateWithCompound.h - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/Compound.cpp - ${ZSERIO_GEN_DIR}/templates/subtype_template_with_compound/Compound.h - - ${ZSERIO_GEN_DIR}/templates/templated_struct_recursion/TemplatedStructRecursion.cpp - ${ZSERIO_GEN_DIR}/templates/templated_struct_recursion/TemplatedStructRecursion.h - ${ZSERIO_GEN_DIR}/templates/templated_struct_recursion/RecursiveTemplate_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/templated_struct_recursion/RecursiveTemplate_uint32.h - - ${ZSERIO_GEN_DIR}/templates/union_templated_field/UnionTemplatedField.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/UnionTemplatedField.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/TemplatedUnion_uint16_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/TemplatedUnion_uint16_uint32.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/TemplatedUnion_float32_float64.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/TemplatedUnion_float32_float64.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/TemplatedUnion_Compound_uint16_Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/TemplatedUnion_Compound_uint16_Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_uint32.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_uint32.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_uint16.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_uint16.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_float32.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_float32.h - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_Compound_uint16.cpp - ${ZSERIO_GEN_DIR}/templates/union_templated_field/Compound_Compound_uint16.h +add_library(templates_zs STATIC zs/templates.zs) +zserio_generate_cpp( + TARGET templates_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(templates_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE templates.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation -) - +target_link_libraries(templates_zs PUBLIC ZserioCppRuntime) target_include_directories(templates_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(templates DEPENDS @@ -481,5 +69,5 @@ add_custom_test(templates ${CMAKE_CURRENT_SOURCE_DIR}/cpp/TemplatedStructRecursionTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UnionTemplatedFieldTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/language/union_types/CMakeLists.txt b/test/language/union_types/CMakeLists.txt index 00c8ea907..e03305c34 100644 --- a/test/language/union_types/CMakeLists.txt +++ b/test/language/union_types/CMakeLists.txt @@ -1,50 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/union_types/empty_union/EmptyUnion.cpp - ${ZSERIO_GEN_DIR}/union_types/empty_union/EmptyUnion.h - - ${ZSERIO_GEN_DIR}/union_types/empty_union_with_parameter/EmptyUnionWithParameter.cpp - ${ZSERIO_GEN_DIR}/union_types/empty_union_with_parameter/EmptyUnionWithParameter.h - - ${ZSERIO_GEN_DIR}/union_types/simple_union/SimpleUnion.cpp - ${ZSERIO_GEN_DIR}/union_types/simple_union/SimpleUnion.h - - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionCompatibilityCheckVersion1.cpp - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionCompatibilityCheckVersion1.h - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionCompatibilityCheckVersion2.cpp - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionCompatibilityCheckVersion2.h - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionVersion1.cpp - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionVersion1.h - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionVersion2.cpp - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/UnionVersion2.h - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/CoordXY.cpp - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/CoordXY.h - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/CoordXYZ.cpp - ${ZSERIO_GEN_DIR}/union_types/union_compatibility_check/CoordXYZ.h - - ${ZSERIO_GEN_DIR}/union_types/union_with_array/Data8.cpp - ${ZSERIO_GEN_DIR}/union_types/union_with_array/Data8.h - ${ZSERIO_GEN_DIR}/union_types/union_with_array/TestUnion.cpp - ${ZSERIO_GEN_DIR}/union_types/union_with_array/TestUnion.h - - ${ZSERIO_GEN_DIR}/union_types/union_with_parameterized_field/ArrayHolder.cpp - ${ZSERIO_GEN_DIR}/union_types/union_with_parameterized_field/ArrayHolder.h - ${ZSERIO_GEN_DIR}/union_types/union_with_parameterized_field/TestUnion.cpp - ${ZSERIO_GEN_DIR}/union_types/union_with_parameterized_field/TestUnion.h - - ${ZSERIO_GEN_DIR}/union_types/union_with_parameter/TestUnion.cpp - ${ZSERIO_GEN_DIR}/union_types/union_with_parameter/TestUnion.h -) - -zserio_add_library(union_types_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE union_types.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(union_types_zs STATIC zs/union_types.zs) +zserio_generate_cpp( + TARGET union_types_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(union_types_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_test(union_types DEPENDS @@ -58,5 +26,5 @@ add_custom_test(union_types ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UnionWithParameterizedFieldTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UnionWithParameterTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/others/gif/CMakeLists.txt b/test/others/gif/CMakeLists.txt index 0d0f78cd6..8462ecaaf 100644 --- a/test/others/gif/CMakeLists.txt +++ b/test/others/gif/CMakeLists.txt @@ -1,67 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/gif/GifFile.cpp - ${ZSERIO_GEN_DIR}/gif/GifFile.h - - ${ZSERIO_GEN_DIR}/gif/gif_data/ApplicationExtension.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ApplicationExtension.h - ${ZSERIO_GEN_DIR}/gif/gif_data/BlockData.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/BlockData.h - ${ZSERIO_GEN_DIR}/gif/gif_data/BlockType.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/BlockType.h - ${ZSERIO_GEN_DIR}/gif/gif_data/BlockTypes.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/BlockTypes.h - ${ZSERIO_GEN_DIR}/gif/gif_data/CommentExtension.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/CommentExtension.h - ${ZSERIO_GEN_DIR}/gif/gif_data/DisposalMethod.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/DisposalMethod.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ExtensionBlock.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ExtensionBlock.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ExtensionType.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ExtensionType.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ExtensionTypes.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ExtensionTypes.h - ${ZSERIO_GEN_DIR}/gif/gif_data/GifData.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/GifData.h - ${ZSERIO_GEN_DIR}/gif/gif_data/GraphicControlExtension.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/GraphicControlExtension.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ImageBlock.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ImageBlock.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ImageDescriptor.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ImageDescriptor.h - ${ZSERIO_GEN_DIR}/gif/gif_data/PlainTextExtension.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/PlainTextExtension.h - ${ZSERIO_GEN_DIR}/gif/gif_data/RasterData.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/RasterData.h - ${ZSERIO_GEN_DIR}/gif/gif_data/SubBlock.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/SubBlock.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ZippedBlockData.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ZippedBlockData.h - ${ZSERIO_GEN_DIR}/gif/gif_data/ZippedSubBlock.cpp - ${ZSERIO_GEN_DIR}/gif/gif_data/ZippedSubBlock.h - - ${ZSERIO_GEN_DIR}/gif/gif_version/GifVersion.cpp - ${ZSERIO_GEN_DIR}/gif/gif_version/GifVersion.h - - ${ZSERIO_GEN_DIR}/gif/rgb_color/RgbColor.cpp - ${ZSERIO_GEN_DIR}/gif/rgb_color/RgbColor.h - - ${ZSERIO_GEN_DIR}/gif/screen_descriptor/ScreenDescriptor.cpp - ${ZSERIO_GEN_DIR}/gif/screen_descriptor/ScreenDescriptor.h - - ${ZSERIO_GEN_DIR}/gif/signature/Signature.cpp - ${ZSERIO_GEN_DIR}/gif/signature/Signature.h -) - -zserio_add_library(gif_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE gif.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation +add_library(gif_zs STATIC zs/gif.zs) +zserio_generate_cpp( + TARGET gif_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(gif_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 0) +endif () add_custom_command(OUTPUT gif_data_copy COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data/others/gif @@ -77,5 +28,5 @@ add_custom_test(gif SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/GifTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/array_types_warning/CMakeLists.txt b/test/warnings/array_types_warning/CMakeLists.txt index b4ea028b6..9c2633a2c 100644 --- a/test/warnings/array_types_warning/CMakeLists.txt +++ b/test/warnings/array_types_warning/CMakeLists.txt @@ -1,86 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/ChoiceWithoutPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/ChoiceWithoutPackableField.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/PackedArrayChoiceHasNoPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/PackedArrayChoiceHasNoPackableField.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/StructWithPackable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/StructWithPackable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/StructWithPackableArray.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/StructWithPackableArray.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/TestEnum.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/TestEnum.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/UnionWithPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_choice_has_no_packable_field/UnionWithPackableField.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/EmptyStruct.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/EmptyStruct.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/PackedArrayStructHasNoPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/PackedArrayStructHasNoPackableField.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/StructWithoutPackable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/StructWithoutPackable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/StructWithPackable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/StructWithPackable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/StructWithPackableArray.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/StructWithPackableArray.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/TestEnum.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/TestEnum.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/UnionWithPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_struct_has_no_packable_field/UnionWithPackableField.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/Packable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/Packable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_packable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_packable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_str.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_str.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_u32.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_u32.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_unpackable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/T_unpackable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/Unpackable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_template_has_no_packable_field/Unpackable.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/PackedArrayUnionHasNoPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/PackedArrayUnionHasNoPackableField.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/StructWithPackable.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/StructWithPackable.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/StructWithPackableArray.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/StructWithPackableArray.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/UnionWithoutPackableField.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_union_has_no_packable_field/UnionWithoutPackableField.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bool_element/PackedArrayUnpackableBoolElement.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bool_element/PackedArrayUnpackableBoolElement.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bool_element/TestBitmask.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bool_element/TestBitmask.h - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bool_element/TestEnum.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bool_element/TestEnum.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bytes_element/PackedArrayUnpackableBytesElement.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_bytes_element/PackedArrayUnpackableBytesElement.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_extern_element/PackedArrayUnpackableExternElement.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_extern_element/PackedArrayUnpackableExternElement.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_float_element/PackedArrayUnpackableFloatElement.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_float_element/PackedArrayUnpackableFloatElement.h - - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_string_element/PackedArrayUnpackableStringElement.cpp - ${ZSERIO_GEN_DIR}/array_types_warning/packed_array_unpackable_string_element/PackedArrayUnpackableStringElement.h -) - -zserio_add_library(array_types_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE array_types_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 12 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(array_types_warning_zs STATIC zs/array_types_warning.zs) +zserio_generate_cpp( + TARGET array_types_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(array_types_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 12) +endif () add_custom_test(array_types_warning DEPENDS @@ -97,5 +29,5 @@ add_custom_test(array_types_warning ${CMAKE_CURRENT_SOURCE_DIR}/cpp/PackedArrayUnpackableFloatElementTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/PackedArrayUnpackableStringElementTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/choice_types_warning/CMakeLists.txt b/test/warnings/choice_types_warning/CMakeLists.txt index b135cb92d..884a10756 100644 --- a/test/warnings/choice_types_warning/CMakeLists.txt +++ b/test/warnings/choice_types_warning/CMakeLists.txt @@ -1,22 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/choice_types_warning/optional_references_in_selector/Selector.cpp - ${ZSERIO_GEN_DIR}/choice_types_warning/optional_references_in_selector/Selector.h - ${ZSERIO_GEN_DIR}/choice_types_warning/optional_references_in_selector/TestChoice.cpp - ${ZSERIO_GEN_DIR}/choice_types_warning/optional_references_in_selector/TestChoice.h -) - -zserio_add_library(choice_types_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE choice_types_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 1 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(choice_types_warning_zs STATIC zs/choice_types_warning.zs) +zserio_generate_cpp( + TARGET choice_types_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(choice_types_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 1) +endif () add_custom_test(choice_types_warning DEPENDS @@ -24,5 +20,5 @@ add_custom_test(choice_types_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/ChoiceTypesWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/comments_warning/CMakeLists.txt b/test/warnings/comments_warning/CMakeLists.txt index 8790cd4ee..b039555b2 100644 --- a/test/warnings/comments_warning/CMakeLists.txt +++ b/test/warnings/comments_warning/CMakeLists.txt @@ -1,141 +1,37 @@ -set(ZSERIO_GEN_DIR_COMMENTS ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES_COMMENTS - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/OtherTestStruct.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/OtherTestStruct.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/TestDatabase.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/TestDatabase.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/TestStruct.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/TestStruct.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/TestTable.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/markdown_comment_with_wrong_terminator/TestTable.h - - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_markdown_see_tag_reference/Test.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_markdown_see_tag_reference/Test.h - - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructString.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructString.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructUInt32.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructUInt32.h - - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/Database.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/Database.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/Table.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/Table.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/Test.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/Test.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unresolved_see_tag_reference/VALUE.h - - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/BasicComment.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/BasicComment.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByAlignmentAndType.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByAlignmentAndType.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByIndexedOffsetAndType.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByIndexedOffsetAndType.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByOffsetAndType.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByOffsetAndType.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByOptionalAndType.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/ByOptionalAndType.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/Database.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/Database.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/MultipleComments.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/MultipleComments.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/MultipleFieldComments.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/MultipleFieldComments.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/MultipleUnmaskedComments.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/MultipleUnmaskedComments.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/Table.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/Table.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/UnusedCommentById.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_field_comments/UnusedCommentById.h - - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_by_id/Database.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_by_id/Database.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_by_id/Table.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_by_id/Table.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_by_id/Test.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_by_id/Test.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_multiple_comments/Database.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_multiple_comments/Database.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_multiple_comments/Table.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_multiple_comments/Table.h - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_multiple_comments/Test.cpp - ${ZSERIO_GEN_DIR_COMMENTS}/comments_warning/unused_struct_comment_multiple_comments/Test.h -) - -set(ZSERIO_GEN_DIR_DOC_COMMENT_MISSING ${CMAKE_CURRENT_BINARY_DIR}/gen_doc_comment_missing) -set(ZSERIO_GENERATED_SOURCES_DOC_COMMENT_MISSING - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/BitmaskType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/BitmaskType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/ChoiceType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/ChoiceType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/CONSTANT.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/EnumType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/EnumType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/PubsubType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/PubsubType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/ServiceType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/ServiceType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/SqlDatabaseType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/SqlDatabaseType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/SqlTableType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/SqlTableType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/StructureTypeSTR.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/StructureTypeSTR.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/StructureTypeU32.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/StructureTypeU32.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/Subtype.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/UnionType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/all_nodes/UnionType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentdServiceType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentdServiceType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedBitmaskType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedBitmaskType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedChoiceType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedChoiceType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DOCUMENTED_CONSTANT.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedEnumType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedEnumType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedPubsubType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedPubsubType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedSqlDatabaseType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedSqlDatabaseType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedSqlTableType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedSqlTableType.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedStructureTypeSTR.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedStructureTypeSTR.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedStructureTypeU32.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedStructureTypeU32.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedSubtype.h - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedUnionType.cpp - ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING}/doc_comment_missing_warning/documented/DocumentedUnionType.h +add_library(comments_warning_zs STATIC zs/comments_warning.zs) +zserio_generate_cpp( + TARGET comments_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_comments + EXTRA_ARGS -withWarnings unused -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_COMMENTS + OUTPUT_VAR ZSERIO_LOG_COMMENTS + ERROR_VAR ZSERIO_LOG_COMMENTS ) - -zserio_add_library(comments_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE comments_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR_COMMENTS} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_COMMENTS} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withWarnings unused -withoutSourcesAmalgamation - EXPECTED_WARNINGS 24 - ZSERIO_LOG_FILENAME zserio_log_comments.txt -) - -zserio_add_library(doc_comment_missing_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE doc_comment_missing_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR_DOC_COMMENT_MISSING} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_DOC_COMMENT_MISSING} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withWarnings "doc-comment-missing" -withoutSourcesAmalgamation - EXPECTED_WARNINGS 32 - ZSERIO_LOG_FILENAME zserio_log_doc_comment_missing.txt -) - +target_link_libraries(comments_warning_zs PUBLIC ZserioCppRuntime) target_include_directories(comments_warning_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG_COMMENTS) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_comments.txt "${ZSERIO_LOG_COMMENTS}") + check_zserio_warnings("${ZSERIO_LOG_COMMENTS}" 24) +endif () + +add_library(doc_comment_missing_warning_zs STATIC zs/doc_comment_missing_warning.zs) +zserio_generate_cpp( + TARGET doc_comment_missing_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_doc_comment_missing + EXTRA_ARGS -withWarnings "doc-comment-missing" -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_DOC_COMMENT_MISSING + OUTPUT_VAR ZSERIO_LOG_DOC_COMMENT_MISSING + ERROR_VAR ZSERIO_LOG_DOC_COMMENT_MISSING +) +target_link_libraries(doc_comment_missing_warning_zs PUBLIC ZserioCppRuntime) target_include_directories(doc_comment_missing_warning_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG_DOC_COMMENT_MISSING) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_doc_comment_missing.txt + "${ZSERIO_LOG_DOC_COMMENT_MISSING}") + check_zserio_warnings("${ZSERIO_LOG_DOC_COMMENT_MISSING}" 32) +endif () add_custom_test(comments_warning DEPENDS @@ -145,6 +41,6 @@ add_custom_test(comments_warning ${CMAKE_CURRENT_SOURCE_DIR}/cpp/CommentsWarningTest.cpp ${CMAKE_CURRENT_SOURCE_DIR}/cpp/DocCommentMissingWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES_COMMENTS} - ${ZSERIO_GENERATED_SOURCES_DOC_COMMENT_MISSING} + ${GENERATED_SOURCES_COMMENTS} + ${GENERATED_SOURCES_DOC_COMMENT_MISSING} ) diff --git a/test/warnings/comments_warning/ClangTidySuppressions.txt b/test/warnings/comments_warning/ClangTidySuppressions.txt index 94dbe07ec..1ba6fda75 100644 --- a/test/warnings/comments_warning/ClangTidySuppressions.txt +++ b/test/warnings/comments_warning/ClangTidySuppressions.txt @@ -1,30 +1,33 @@ -bugprone-forwarding-reference-overload:gen/comments_warning/unused_field_comments/ByOptionalAndType.h +bugprone-forwarding-reference-overload:gen_comments/comments_warning/unused_field_comments/ByOptionalAndType.h bugprone-forwarding-reference-overload:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/StructureTypeSTR.h bugprone-forwarding-reference-overload:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedStructureTypeSTR.h -cppcoreguidelines-pro-type-member-init:gen/comments_warning/markdown_comment_with_wrong_terminator/TestTable.cpp -cppcoreguidelines-pro-type-member-init:gen/comments_warning/unresolved_see_tag_reference/Table.cpp -cppcoreguidelines-pro-type-member-init:gen/comments_warning/unused_field_comments/Table.cpp -cppcoreguidelines-pro-type-member-init:gen/comments_warning/unused_struct_comment_by_id/Table.cpp -cppcoreguidelines-pro-type-member-init:gen/comments_warning/unused_struct_comment_multiple_comments/Table.cpp +cppcoreguidelines-pro-type-member-init:gen_comments/comments_warning/markdown_comment_with_wrong_terminator/TestTable.cpp +cppcoreguidelines-pro-type-member-init:gen_comments/comments_warning/unresolved_markdown_see_tag_reference/Table.cpp +cppcoreguidelines-pro-type-member-init:gen_comments/comments_warning/unresolved_see_tag_reference/Table.cpp +cppcoreguidelines-pro-type-member-init:gen_comments/comments_warning/unused_field_comments/Table.cpp +cppcoreguidelines-pro-type-member-init:gen_comments/comments_warning/unused_struct_comment_by_id/Table.cpp +cppcoreguidelines-pro-type-member-init:gen_comments/comments_warning/unused_struct_comment_multiple_comments/Table.cpp cppcoreguidelines-pro-type-member-init:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/ChoiceType.cpp cppcoreguidelines-pro-type-member-init:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/SqlTableType.cpp cppcoreguidelines-pro-type-member-init:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedChoiceType.cpp cppcoreguidelines-pro-type-member-init:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedSqlTableType.cpp -cppcoreguidelines-pro-type-reinterpret-cast:gen/comments_warning/markdown_comment_with_wrong_terminator/TestTable.cpp -cppcoreguidelines-pro-type-reinterpret-cast:gen/comments_warning/unresolved_see_tag_reference/Table.cpp -cppcoreguidelines-pro-type-reinterpret-cast:gen/comments_warning/unused_field_comments/Table.cpp -cppcoreguidelines-pro-type-reinterpret-cast:gen/comments_warning/unused_struct_comment_by_id/Table.cpp -cppcoreguidelines-pro-type-reinterpret-cast:gen/comments_warning/unused_struct_comment_multiple_comments/Table.cpp +cppcoreguidelines-pro-type-reinterpret-cast:gen_comments/comments_warning/markdown_comment_with_wrong_terminator/TestTable.cpp +cppcoreguidelines-pro-type-reinterpret-cast:gen_comments/comments_warning/unresolved_markdown_see_tag_reference/Table.cpp +cppcoreguidelines-pro-type-reinterpret-cast:gen_comments/comments_warning/unresolved_see_tag_reference/Table.cpp +cppcoreguidelines-pro-type-reinterpret-cast:gen_comments/comments_warning/unused_field_comments/Table.cpp +cppcoreguidelines-pro-type-reinterpret-cast:gen_comments/comments_warning/unused_struct_comment_by_id/Table.cpp +cppcoreguidelines-pro-type-reinterpret-cast:gen_comments/comments_warning/unused_struct_comment_multiple_comments/Table.cpp cppcoreguidelines-pro-type-reinterpret-cast:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/SqlTableType.cpp cppcoreguidelines-pro-type-reinterpret-cast:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedSqlTableType.cpp -fuchsia-multiple-inheritance:gen/comments_warning/markdown_comment_with_wrong_terminator/TestDatabase.h -fuchsia-multiple-inheritance:gen/comments_warning/unresolved_see_tag_reference/Database.h -fuchsia-multiple-inheritance:gen/comments_warning/unused_field_comments/Database.h -fuchsia-multiple-inheritance:gen/comments_warning/unused_struct_comment_by_id/Database.h -fuchsia-multiple-inheritance:gen/comments_warning/unused_struct_comment_multiple_comments/Database.h +fuchsia-multiple-inheritance:gen_comments/comments_warning/markdown_comment_with_wrong_terminator/TestDatabase.h +fuchsia-multiple-inheritance:gen_comments/comments_warning/unresolved_markdown_see_tag_reference/Database.h +fuchsia-multiple-inheritance:gen_comments/comments_warning/unresolved_see_tag_reference/Database.h +fuchsia-multiple-inheritance:gen_comments/comments_warning/unused_field_comments/Database.h +fuchsia-multiple-inheritance:gen_comments/comments_warning/unused_struct_comment_by_id/Database.h +fuchsia-multiple-inheritance:gen_comments/comments_warning/unused_struct_comment_multiple_comments/Database.h fuchsia-multiple-inheritance:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/SqlDatabaseType.h fuchsia-multiple-inheritance:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedSqlDatabaseType.h @@ -34,29 +37,30 @@ google-explicit-constructor:gen_doc_comment_missing/doc_comment_missing_warning/ hicpp-multiway-paths-covered:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/EnumType.cpp hicpp-multiway-paths-covered:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedEnumType.cpp -performance-move-const-arg:gen/comments_warning/unresolved_see_tag_reference/Table.cpp -performance-move-const-arg:gen/comments_warning/unused_field_comments/Table.cpp -performance-move-const-arg:gen/comments_warning/unused_struct_comment_by_id/Table.cpp -performance-move-const-arg:gen/comments_warning/unused_struct_comment_multiple_comments/Table.cpp +performance-move-const-arg:gen_comments/comments_warning/unresolved_markdown_see_tag_reference/Table.cpp +performance-move-const-arg:gen_comments/comments_warning/unresolved_see_tag_reference/Table.cpp +performance-move-const-arg:gen_comments/comments_warning/unused_field_comments/Table.cpp +performance-move-const-arg:gen_comments/comments_warning/unused_struct_comment_by_id/Table.cpp +performance-move-const-arg:gen_comments/comments_warning/unused_struct_comment_multiple_comments/Table.cpp performance-move-const-arg:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/ServiceType.cpp performance-move-const-arg:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentdServiceType.cpp readability-braces-around-statements -readability-make-member-function-const:gen/comments_warning/unresolved_markdown_see_tag_reference/Test.cpp -readability-make-member-function-const:gen/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructString.cpp -readability-make-member-function-const:gen/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructUInt32.cpp -readability-make-member-function-const:gen/comments_warning/unresolved_see_tag_reference/Test.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/BasicComment.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/ByAlignmentAndType.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/ByOffsetAndType.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/ByOptionalAndType.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/MultipleComments.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/MultipleFieldComments.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/MultipleUnmaskedComments.cpp -readability-make-member-function-const:gen/comments_warning/unused_field_comments/UnusedCommentById.cpp -readability-make-member-function-const:gen/comments_warning/unused_struct_comment_by_id/Test.cpp -readability-make-member-function-const:gen/comments_warning/unused_struct_comment_multiple_comments/Test.cpp +readability-make-member-function-const:gen_comments/comments_warning/unresolved_markdown_see_tag_reference/Test.cpp +readability-make-member-function-const:gen_comments/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructString.cpp +readability-make-member-function-const:gen_comments/comments_warning/unresolved_see_tag_in_templated_struct/TemplatedStructUInt32.cpp +readability-make-member-function-const:gen_comments/comments_warning/unresolved_see_tag_reference/Test.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/BasicComment.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/ByAlignmentAndType.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/ByOffsetAndType.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/ByOptionalAndType.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/MultipleComments.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/MultipleFieldComments.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/MultipleUnmaskedComments.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_field_comments/UnusedCommentById.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_struct_comment_by_id/Test.cpp +readability-make-member-function-const:gen_comments/comments_warning/unused_struct_comment_multiple_comments/Test.cpp readability-make-member-function-const:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/ChoiceType.cpp readability-make-member-function-const:gen_doc_comment_missing/doc_comment_missing_warning/all_nodes/StructureTypeU32.cpp readability-make-member-function-const:gen_doc_comment_missing/doc_comment_missing_warning/documented/DocumentedChoiceType.cpp diff --git a/test/warnings/compatibility_warning/CMakeLists.txt b/test/warnings/compatibility_warning/CMakeLists.txt index 4280a62f9..0807de2c6 100644 --- a/test/warnings/compatibility_warning/CMakeLists.txt +++ b/test/warnings/compatibility_warning/CMakeLists.txt @@ -1,45 +1,38 @@ -set(ZSERIO_GEN_DIR_ROOT_WITH ${CMAKE_CURRENT_BINARY_DIR}/gen_root_with) -set(ZSERIO_GEN_DIR_ROOT_WITHOUT ${CMAKE_CURRENT_BINARY_DIR}/gen_root_without) -set(LOG_FILENAME zserio_log.txt) - -# clean old log file -file(REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${LOG_FILENAME}) - -set(ZSERIO_GENERATED_SOURCES_ROOT_WITH - ${ZSERIO_GEN_DIR_ROOT_WITH}/compatibility_warning/subpackage/TestStruct.cpp - ${ZSERIO_GEN_DIR_ROOT_WITH}/compatibility_warning/subpackage/TestStruct.h +add_library(root_with_diff_compatibility_warning_zs STATIC + zs/compatibility_warning/root_with_diff_compatibility_warning.zs ) - -set(ZSERIO_GENERATED_SOURCES_ROOT_WITHOUT - ${ZSERIO_GEN_DIR_ROOT_WITHOUT}/compatibility_warning/subpackage/TestStruct.cpp - ${ZSERIO_GEN_DIR_ROOT_WITHOUT}/compatibility_warning/subpackage/TestStruct.h +zserio_generate_cpp( + TARGET root_with_diff_compatibility_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_root_with + EXTRA_ARGS -withoutCrossExtensionCheck -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_ROOT_WITH + OUTPUT_VAR ZSERIO_LOG_ROOT_WITH + ERROR_VAR ZSERIO_LOG_ROOT_WITH ) +target_link_libraries(root_with_diff_compatibility_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_ROOT_WITH) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_root_with.txt "${ZSERIO_LOG_ROOT_WITH}") + check_zserio_warnings("${ZSERIO_LOG_ROOT_WITH}" 1) +endif () -zserio_add_library(root_with_diff_compatibility_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE compatibility_warning/root_with_diff_compatibility_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR_ROOT_WITH} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_ROOT_WITH} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck -withoutSourcesAmalgamation - EXPECTED_WARNINGS 1 - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +add_library(root_without_compatibility_warning_zs STATIC + zs/compatibility_warning/root_without_compatibility_warning.zs ) - -zserio_add_library(root_without_compatibility_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE compatibility_warning/root_without_compatibility_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR_ROOT_WITHOUT} - OUT_FILES ${ZSERIO_GENERATED_SOURCES_ROOT_WITHOUT} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutCrossExtensionCheck -withoutSourcesAmalgamation - EXPECTED_WARNINGS 1 - ZSERIO_LOG_FILENAME ${LOG_FILENAME} - APPEND_TO_ZSERIO_LOG_FILE ON +zserio_generate_cpp( + TARGET root_without_compatibility_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen_root_without + EXTRA_ARGS -withoutCrossExtensionCheck -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES_ROOT_WITHOUT + OUTPUT_VAR ZSERIO_LOG_ROOT_WITHOUT + ERROR_VAR ZSERIO_LOG_ROOT_WITHOUT ) +target_link_libraries(root_without_compatibility_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG_ROOT_WITHOUT) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log_root_without.txt "${ZSERIO_LOG_ROOT_WITHOUT}") + check_zserio_warnings("${ZSERIO_LOG_ROOT_WITHOUT}" 1) +endif () add_custom_test(compatibility_warning DEPENDS @@ -48,6 +41,6 @@ add_custom_test(compatibility_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/CompatibilityWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES_ROOT_WITH} - ${ZSERIO_GENERATED_SOURCES_ROOT_WITHOUT} + ${GENERATED_SOURCES_ROOT_WITH} + ${GENERATED_SOURCES_ROOT_WITHOUT} ) diff --git a/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp b/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp index 19de72145..722c4f3e6 100644 --- a/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp +++ b/test/warnings/compatibility_warning/cpp/CompatibilityWarningTest.cpp @@ -7,10 +7,12 @@ class CompatibilityWarningTest : public ::testing::Test { protected: CompatibilityWarningTest() : - zserioWarnings("warnings/compatibility_warning") + zserioWarningsRootWith("warnings/compatibility_warning", "zserio_log_root_with.txt"), + zserioWarningsRootWithout("warnings/compatibility_warning", "zserio_log_root_without.txt") {} - const test_utils::ZserioErrorOutput zserioWarnings; + const test_utils::ZserioErrorOutput zserioWarningsRootWith; + const test_utils::ZserioErrorOutput zserioWarningsRootWithout; }; TEST_F(CompatibilityWarningTest, rootWithDiffCompatibility) @@ -19,7 +21,7 @@ TEST_F(CompatibilityWarningTest, rootWithDiffCompatibility) "subpackage.zs:1:30: " "Package compatibility version '2.4.2' doesn't match to '2.5.0' specified in root package!"; - ASSERT_TRUE(zserioWarnings.isPresent(error)); + ASSERT_TRUE(zserioWarningsRootWith.isPresent(error)); } TEST_F(CompatibilityWarningTest, rootWithoutCompatibility) @@ -28,5 +30,5 @@ TEST_F(CompatibilityWarningTest, rootWithoutCompatibility) "subpackage.zs:1:30: " "Package specifies compatibility version '2.4.2' while root package specifies nothing!"; - ASSERT_TRUE(zserioWarnings.isPresent(error)); + ASSERT_TRUE(zserioWarningsRootWithout.isPresent(error)); } diff --git a/test/warnings/file_encoding_warning/CMakeLists.txt b/test/warnings/file_encoding_warning/CMakeLists.txt index 92a81cad8..c990177fd 100644 --- a/test/warnings/file_encoding_warning/CMakeLists.txt +++ b/test/warnings/file_encoding_warning/CMakeLists.txt @@ -1,20 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/file_encoding_warning/NON_PRINTABLE_ASCII_STRING.h - ${ZSERIO_GEN_DIR}/file_encoding_warning/NON_UTF8_STRING.h -) - -zserio_add_library(file_encoding_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE file_encoding_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 3 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(file_encoding_warning_zs STATIC zs/file_encoding_warning.zs) +zserio_generate_cpp( + TARGET file_encoding_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(file_encoding_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 3) +endif () add_custom_test(file_encoding_warning DEPENDS @@ -22,5 +20,5 @@ add_custom_test(file_encoding_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/FileEncodingWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/functions_warning/CMakeLists.txt b/test/warnings/functions_warning/CMakeLists.txt index 609d197f9..024c07b4f 100644 --- a/test/warnings/functions_warning/CMakeLists.txt +++ b/test/warnings/functions_warning/CMakeLists.txt @@ -1,20 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/functions_warning/optional_references_in_function/SingleOptionalFieldFunction.cpp - ${ZSERIO_GEN_DIR}/functions_warning/optional_references_in_function/SingleOptionalFieldFunction.h -) - -zserio_add_library(functions_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE functions_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 2 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(functions_warning_zs STATIC zs/functions_warning.zs) +zserio_generate_cpp( + TARGET functions_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(functions_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 2) +endif () add_custom_test(functions_warning DEPENDS @@ -22,5 +20,5 @@ add_custom_test(functions_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/FunctionsWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/not_handled_warning/CMakeLists.txt b/test/warnings/not_handled_warning/CMakeLists.txt index df0629993..85462a80c 100644 --- a/test/warnings/not_handled_warning/CMakeLists.txt +++ b/test/warnings/not_handled_warning/CMakeLists.txt @@ -1,24 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/not_handled_warning/Black.h - ${ZSERIO_GEN_DIR}/not_handled_warning/EnumParamChoice.cpp - ${ZSERIO_GEN_DIR}/not_handled_warning/EnumParamChoice.h - ${ZSERIO_GEN_DIR}/not_handled_warning/Grey.h - ${ZSERIO_GEN_DIR}/not_handled_warning/Selector.cpp - ${ZSERIO_GEN_DIR}/not_handled_warning/Selector.h -) - -zserio_add_library(not_handled_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE not_handled_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 2 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(not_handled_warning_zs STATIC zs/not_handled_warning.zs) +zserio_generate_cpp( + TARGET not_handled_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(not_handled_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 2) +endif () add_custom_test(not_handled_warning DEPENDS @@ -26,5 +20,5 @@ add_custom_test(not_handled_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/NotHandledWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/optional_members_warning/CMakeLists.txt b/test/warnings/optional_members_warning/CMakeLists.txt index d12252e56..c7afd7b8c 100644 --- a/test/warnings/optional_members_warning/CMakeLists.txt +++ b/test/warnings/optional_members_warning/CMakeLists.txt @@ -1,46 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_array_length/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_array_length/Container.h - - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_bitfield_length/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_bitfield_length/Container.h - - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_constraint/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_constraint/Container.h - - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_offset/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_offset/Container.h - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_offset/OffsetHolder.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_offset/OffsetHolder.h - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_offset/OptionalOffsetHolder.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_offset/OptionalOffsetHolder.h - - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_optional_clause/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_optional_clause/Container.h - - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/Another.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/Another.h - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/BasicColor.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/BasicColor.h - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/ColorTones.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/ColorTones.h - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/Container.cpp - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/Container.h - ${ZSERIO_GEN_DIR}/optional_members_warning/optional_references_in_type_arguments/SubtypedColorTones.h -) - -zserio_add_library(optional_members_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE optional_members_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 24 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(optional_members_warning_zs STATIC zs/optional_members_warning.zs) +zserio_generate_cpp( + TARGET optional_members_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(optional_members_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 24) +endif () add_custom_test(optional_members_warning DEPENDS @@ -48,5 +20,5 @@ add_custom_test(optional_members_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/OptionalMembersWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/packages_warning/CMakeLists.txt b/test/warnings/packages_warning/CMakeLists.txt index 61be58c18..c54f91152 100644 --- a/test/warnings/packages_warning/CMakeLists.txt +++ b/test/warnings/packages_warning/CMakeLists.txt @@ -1,30 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/packages_warning/package_import_overwrite_warning/TopDatabase.cpp - ${ZSERIO_GEN_DIR}/packages_warning/package_import_overwrite_warning/TopDatabase.h - - ${ZSERIO_GEN_DIR}/packages_warning/simple_database/SimpleDatabase.cpp - ${ZSERIO_GEN_DIR}/packages_warning/simple_database/SimpleDatabase.h - ${ZSERIO_GEN_DIR}/packages_warning/simple_database/SimpleTable.cpp - ${ZSERIO_GEN_DIR}/packages_warning/simple_database/SimpleTable.h - - ${ZSERIO_GEN_DIR}/packages_warning/single_type_already_imported_warning/TopDatabase.cpp - ${ZSERIO_GEN_DIR}/packages_warning/single_type_already_imported_warning/TopDatabase.h +add_library(packages_warning_zs STATIC zs/packages_warning.zs) +zserio_generate_cpp( + TARGET packages_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(packages_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE packages_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 4 - ZSERIO_LOG_FILENAME zserio_log.txt -) - +target_link_libraries(packages_warning_zs PUBLIC ZserioCppRuntime) target_include_directories(packages_warning_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 4) +endif () add_custom_test(packages_warning DEPENDS @@ -32,5 +21,5 @@ add_custom_test(packages_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/PackagesWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/sql_tables_warning/CMakeLists.txt b/test/warnings/sql_tables_warning/CMakeLists.txt index 7fba69d2d..e9dbbf5dd 100644 --- a/test/warnings/sql_tables_warning/CMakeLists.txt +++ b/test/warnings/sql_tables_warning/CMakeLists.txt @@ -1,51 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_tables_warning/bad_ordered_primary_key_warning/BadOrderedPrimaryKeyDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/bad_ordered_primary_key_warning/BadOrderedPrimaryKeyDatabase.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/bad_ordered_primary_key_warning/BadOrderedPrimaryKeyTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/bad_ordered_primary_key_warning/BadOrderedPrimaryKeyTable.h - - ${ZSERIO_GEN_DIR}/sql_tables_warning/duplicated_primary_key_warning/DuplicatedPrimaryKeyDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/duplicated_primary_key_warning/DuplicatedPrimaryKeyDatabase.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/duplicated_primary_key_warning/DuplicatedPrimaryKeyTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/duplicated_primary_key_warning/DuplicatedPrimaryKeyTable.h - - ${ZSERIO_GEN_DIR}/sql_tables_warning/multiple_primary_keys_warning/MultiplePrimaryKeysDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/multiple_primary_keys_warning/MultiplePrimaryKeysDatabase.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/multiple_primary_keys_warning/MultiplePrimaryKeysTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/multiple_primary_keys_warning/MultiplePrimaryKeysTable.h - - ${ZSERIO_GEN_DIR}/sql_tables_warning/no_primary_key_warning/NoPrimaryKeyDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/no_primary_key_warning/NoPrimaryKeyDatabase.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/no_primary_key_warning/NoPrimaryKeyTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/no_primary_key_warning/NoPrimaryKeyTable.h - - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_first_primary_key_warning/NotFirstPrimaryKeyDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_first_primary_key_warning/NotFirstPrimaryKeyDatabase.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_first_primary_key_warning/NotFirstPrimaryKeyTable.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_first_primary_key_warning/NotFirstPrimaryKeyTable.h - - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_null_primary_key_warning/NotNullPrimaryKeyDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_null_primary_key_warning/NotNullPrimaryKeyDatabase.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_null_primary_key_warning/NotNullPrimaryKeyTable1.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_null_primary_key_warning/NotNullPrimaryKeyTable1.h - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_null_primary_key_warning/NotNullPrimaryKeyTable2.cpp - ${ZSERIO_GEN_DIR}/sql_tables_warning/not_null_primary_key_warning/NotNullPrimaryKeyTable2.h -) - -zserio_add_library(sql_tables_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_tables_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 7 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(sql_tables_warning_zs STATIC zs/sql_tables_warning.zs) +zserio_generate_cpp( + TARGET sql_tables_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - +target_link_libraries(sql_tables_warning_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_tables_warning_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 7) +endif () add_custom_test(sql_tables_warning DEPENDS @@ -53,5 +21,5 @@ add_custom_test(sql_tables_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SqlTablesWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/sql_without_rowid_tables_warning/CMakeLists.txt b/test/warnings/sql_without_rowid_tables_warning/CMakeLists.txt index 1bd3e49c4..6e664f8f1 100644 --- a/test/warnings/sql_without_rowid_tables_warning/CMakeLists.txt +++ b/test/warnings/sql_without_rowid_tables_warning/CMakeLists.txt @@ -1,24 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables_warning/integer_primary_key_warning/WithoutRowIdDatabase.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables_warning/integer_primary_key_warning/WithoutRowIdDatabase.h - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables_warning/integer_primary_key_warning/WithoutRowIdTable.cpp - ${ZSERIO_GEN_DIR}/sql_without_rowid_tables_warning/integer_primary_key_warning/WithoutRowIdTable.h +add_library(sql_without_rowid_tables_warning_zs STATIC zs/sql_without_rowid_tables_warning.zs) +zserio_generate_cpp( + TARGET sql_without_rowid_tables_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(sql_without_rowid_tables_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE sql_without_rowid_tables_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withoutSourcesAmalgamation - EXPECTED_WARNINGS 1 - ZSERIO_LOG_FILENAME zserio_log.txt -) - +target_link_libraries(sql_without_rowid_tables_warning_zs PUBLIC ZserioCppRuntime) target_include_directories(sql_without_rowid_tables_warning_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 1) +endif () add_custom_test(sql_without_row_id_tables_warning DEPENDS @@ -26,5 +21,5 @@ add_custom_test(sql_without_row_id_tables_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/SqlWithoutRowIdTablesWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/templates_warning/CMakeLists.txt b/test/warnings/templates_warning/CMakeLists.txt index f9f80dfd9..fa141769d 100644 --- a/test/warnings/templates_warning/CMakeLists.txt +++ b/test/warnings/templates_warning/CMakeLists.txt @@ -1,36 +1,18 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_warning/Subpackage3TemplateU32.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_warning/DefaultInstantiationWarning.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_warning/DefaultInstantiationWarning.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_warning/Template_uint32.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_warning/Template_uint32.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_warning/Subpackage3TemplateU32.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage2/Subpackage2TemplateSTR.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage2/Subpackage2Template_string.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage2/Subpackage2TemplateU32.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage2/Subpackage2TemplateSTR.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage2/Subpackage2TemplateU32.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage2/Subpackage2Template_string.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage3/Subpackage3InnerTemplate_uint32.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage3/Subpackage3InnerTemplate_uint32.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage1/Subpackage1TemplateU32.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage1/Subpackage1Template_string.cpp - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage1/Subpackage1TemplateU32.h - ${ZSERIO_GEN_DIR}/templates_warning/default_instantiation_subpackage1/Subpackage1Template_string.h -) - -zserio_add_library(templates_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE templates_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withWarnings default-instantiation -withoutSourcesAmalgamation - EXPECTED_WARNINGS 5 - ZSERIO_LOG_FILENAME zserio_log.txt +add_library(templates_warning_zs STATIC zs/templates_warning.zs) +zserio_generate_cpp( + TARGET templates_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withWarnings "default-instantiation" -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) +target_link_libraries(templates_warning_zs PUBLIC ZserioCppRuntime) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 5) +endif () add_custom_test(templates_warning DEPENDS @@ -38,5 +20,5 @@ add_custom_test(templates_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/TemplatesWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} ) diff --git a/test/warnings/unused_type_warning/CMakeLists.txt b/test/warnings/unused_type_warning/CMakeLists.txt index d2a5b006d..da668b7fd 100644 --- a/test/warnings/unused_type_warning/CMakeLists.txt +++ b/test/warnings/unused_type_warning/CMakeLists.txt @@ -1,47 +1,19 @@ -set(ZSERIO_GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen) -set(ZSERIO_GENERATED_SOURCES - ${ZSERIO_GEN_DIR}/unused_type_warning/Black.h - ${ZSERIO_GEN_DIR}/unused_type_warning/Blue.h - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolChoice.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolChoice.h - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolStructure.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolStructureDatabase.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolStructureDatabase.h - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolStructure.h - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolStructureTable.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolStructureTable.h - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolUnion.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/BoolUnion.h - ${ZSERIO_GEN_DIR}/unused_type_warning/Color.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/Color.h - ${ZSERIO_GEN_DIR}/unused_type_warning/DARK_BLUE.h - ${ZSERIO_GEN_DIR}/unused_type_warning/Red.h - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedChoice.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedChoice.h - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedEnumeration.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedEnumeration.h - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedStructure.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedStructure.h - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedSubtype.h - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedTable.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedTable.h - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedUnion.cpp - ${ZSERIO_GEN_DIR}/unused_type_warning/UnusedUnion.h +add_library(unused_type_warning_zs STATIC zs/unused_type_warning.zs) +zserio_generate_cpp( + TARGET unused_type_warning_zs + SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs + GEN_DIR ${CMAKE_CURRENT_BINARY_DIR}/gen + EXTRA_ARGS -withWarnings unused -withoutSourcesAmalgamation + GENERATED_SOURCES_VAR GENERATED_SOURCES + OUTPUT_VAR ZSERIO_LOG + ERROR_VAR ZSERIO_LOG ) - -zserio_add_library(unused_type_warning_zs - SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/zs - MAIN_SOURCE unused_type_warning.zs - OUT_DIR ${ZSERIO_GEN_DIR} - OUT_FILES ${ZSERIO_GENERATED_SOURCES} - ZSERIO_CORE_DIR ${ZSERIO_JAR_DIR} - ZSERIO_CPP_DIR ${ZSERIO_CPP_DISTR_DIR} - ZSERIO_OPTIONS -withWarnings unused -withoutSourcesAmalgamation - EXPECTED_WARNINGS 6 - ZSERIO_LOG_FILENAME zserio_log.txt -) - +target_link_libraries(unused_type_warning_zs PUBLIC ZserioCppRuntime) target_include_directories(unused_type_warning_zs SYSTEM PRIVATE ${SQLITE_INCDIR}) +if (ZSERIO_LOG) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/zserio_log.txt "${ZSERIO_LOG}") + check_zserio_warnings("${ZSERIO_LOG}" 6) +endif () add_custom_test(unused_type_warning DEPENDS @@ -49,5 +21,5 @@ add_custom_test(unused_type_warning SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/cpp/UnusedTypeWarningTest.cpp GENERATED_SOURCES - ${ZSERIO_GENERATED_SOURCES} + ${GENERATED_SOURCES} )