diff --git a/cmake/Modules/GenerateYFromYm.cmake b/cmake/Modules/GenerateYFromYm.cmake index 1b8b65e4a7..5f2625bc23 100644 --- a/cmake/Modules/GenerateYFromYm.cmake +++ b/cmake/Modules/GenerateYFromYm.cmake @@ -41,10 +41,16 @@ endfunction() # This function is used by add_module function(module_generate_y_from_ym FileWoExtSrc FileWoExtDst) - if (${ARGC} EQUAL 2) + if (${ARGC} EQUAL 2 OR ${ARGC} EQUAL 3) + set(DEPS ${PROJECT_SOURCE_DIR}/lib/cfg-grammar.y) + + if (${ARGC} EQUAL 3) + set(DEPS ${DEPS} ${ARGV2}) + endif() + add_custom_command (OUTPUT ${FileWoExtDst}.y COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/lib/merge-grammar.py ${FileWoExtSrc}.ym > ${FileWoExtDst}.y - DEPENDS ${PROJECT_SOURCE_DIR}/lib/cfg-grammar.y + DEPENDS ${DEPS} ${FileWoExtSrc}.ym) else() message(SEND_ERROR "Wrong usage of module_generate_y_from_ym() function") diff --git a/cmake/add_module.cmake b/cmake/add_module.cmake index 63e464dc31..062ab523df 100644 --- a/cmake/add_module.cmake +++ b/cmake/add_module.cmake @@ -26,10 +26,10 @@ include(CMakeParseArguments) function (add_module) - cmake_parse_arguments(ADD_MODULE "" "TARGET" "GRAMMAR;SOURCES;DEPENDS;INCLUDES;LIBRARY_TYPE;COMPILE_OPTIONS" ${ARGN}) + cmake_parse_arguments(ADD_MODULE "" "TARGET" "GRAMMAR;GRAMMAR_DEPENDS;SOURCES;DEPENDS;INCLUDES;LIBRARY_TYPE;COMPILE_OPTIONS" ${ARGN}) if (ADD_MODULE_GRAMMAR) - module_generate_y_from_ym(${CMAKE_CURRENT_SOURCE_DIR}/${ADD_MODULE_GRAMMAR} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}) + module_generate_y_from_ym(${CMAKE_CURRENT_SOURCE_DIR}/${ADD_MODULE_GRAMMAR} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR} ${ADD_MODULE_GRAMMAR_DEPENDS}) bison_target(${ADD_MODULE_TARGET}Grammar} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}.y ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}.c diff --git a/modules/grpc/bigquery/CMakeLists.txt b/modules/grpc/bigquery/CMakeLists.txt index 0b2a84afed..3b8f3136a8 100644 --- a/modules/grpc/bigquery/CMakeLists.txt +++ b/modules/grpc/bigquery/CMakeLists.txt @@ -28,6 +28,7 @@ add_module( add_module( TARGET bigquery GRAMMAR bigquery-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS bigquery-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${BIGQUERY_SOURCES} diff --git a/modules/grpc/bigquery/Makefile.am b/modules/grpc/bigquery/Makefile.am index 731efe7992..be15547c6e 100644 --- a/modules/grpc/bigquery/Makefile.am +++ b/modules/grpc/bigquery/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/bigquery modules/grpc/bigquery/ mod-bigquery: endif +modules/grpc/bigquery/bigquery-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/bigquery/bigquery-grammar.y \ modules/grpc/bigquery/bigquery-grammar.c \ diff --git a/modules/grpc/clickhouse/CMakeLists.txt b/modules/grpc/clickhouse/CMakeLists.txt index 663291ab0d..7551c442d6 100644 --- a/modules/grpc/clickhouse/CMakeLists.txt +++ b/modules/grpc/clickhouse/CMakeLists.txt @@ -28,6 +28,7 @@ add_module( add_module( TARGET clickhouse GRAMMAR clickhouse-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS clickhouse-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${CLICKHOUSE_SOURCES} diff --git a/modules/grpc/clickhouse/Makefile.am b/modules/grpc/clickhouse/Makefile.am index 90a403e10f..f3fa66de8b 100644 --- a/modules/grpc/clickhouse/Makefile.am +++ b/modules/grpc/clickhouse/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/clickhouse modules/grpc/clickhouse/ mod-clickhouse: endif +modules/grpc/clickhouse/clickhouse-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/clickhouse/clickhouse-grammar.y \ modules/grpc/clickhouse/clickhouse-grammar.c \ diff --git a/modules/grpc/common/CMakeLists.txt b/modules/grpc/common/CMakeLists.txt index 4f041c14a5..ddaefbb4d4 100644 --- a/modules/grpc/common/CMakeLists.txt +++ b/modules/grpc/common/CMakeLists.txt @@ -18,6 +18,8 @@ set(GRPC_COMMON_CPP_SOURCES grpc-source-worker.hpp grpc-source-worker.cpp) +set(GRPC_COMMON_GRAMMAR ${PROJECT_SOURCE_DIR}/modules/grpc/common/grpc-grammar.ym PARENT_SCOPE) + add_module( TARGET grpc-common-cpp SOURCES ${GRPC_COMMON_CPP_SOURCES} diff --git a/modules/grpc/loki/CMakeLists.txt b/modules/grpc/loki/CMakeLists.txt index d31d3c84f4..0251fe195e 100644 --- a/modules/grpc/loki/CMakeLists.txt +++ b/modules/grpc/loki/CMakeLists.txt @@ -29,6 +29,7 @@ add_module( add_module( TARGET loki GRAMMAR loki-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS loki-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${LOKI_SOURCES} diff --git a/modules/grpc/loki/Makefile.am b/modules/grpc/loki/Makefile.am index c374797e7c..c6ccdba847 100644 --- a/modules/grpc/loki/Makefile.am +++ b/modules/grpc/loki/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/loki modules/grpc/loki/ mod-loki: endif +modules/grpc/loki/loki-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/loki/loki-grammar.y \ modules/grpc/loki/loki-grammar.c \ diff --git a/modules/grpc/otel/CMakeLists.txt b/modules/grpc/otel/CMakeLists.txt index d6d49a5e1f..c70667c179 100644 --- a/modules/grpc/otel/CMakeLists.txt +++ b/modules/grpc/otel/CMakeLists.txt @@ -44,6 +44,7 @@ add_module( add_module( TARGET otel GRAMMAR otel-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS otel-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${OTEL_SOURCES} diff --git a/modules/grpc/otel/Makefile.am b/modules/grpc/otel/Makefile.am index acc1298ca4..9259de4062 100644 --- a/modules/grpc/otel/Makefile.am +++ b/modules/grpc/otel/Makefile.am @@ -79,6 +79,8 @@ else modules/grpc/otel modules/grpc/otel/ mod-otel: endif +modules/grpc/otel/otel-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/otel/otel-grammar.y \ modules/grpc/otel/otel-grammar.c \ diff --git a/modules/grpc/pubsub/CMakeLists.txt b/modules/grpc/pubsub/CMakeLists.txt index 2287409b4f..6971c79013 100644 --- a/modules/grpc/pubsub/CMakeLists.txt +++ b/modules/grpc/pubsub/CMakeLists.txt @@ -29,6 +29,7 @@ add_module( TARGET pubsub GRAMMAR pubsub-grammar DEPENDS pubsub-cpp grpc-common-cpp + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${PUBSUB_SOURCES} ) diff --git a/modules/grpc/pubsub/Makefile.am b/modules/grpc/pubsub/Makefile.am index bded8bcd6f..3854cd9a2e 100644 --- a/modules/grpc/pubsub/Makefile.am +++ b/modules/grpc/pubsub/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/pubsub modules/grpc/pubsub/ mod-pubsub: endif +modules/grpc/pubsub/pubsub-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/pubsub/pubsub-grammar.y \ modules/grpc/pubsub/pubsub-grammar.c \