Merge remote-tracking branch 'origin/asn1c-default-no-output' into integration_2025_w15 (!3368)

Encapsulate the asn1c call from cmake in a cmake function run_asn1c().
As a notable change to the previous manual add_custom_command()
invocation, in suppresses the output of asn1c by default [1] and stores
it in a log file. In case of asn1c4 error, the output will output on
stdout.

Use the new run_asn1c() in all occasions for code generation.

[1] it is quite verbose, with many warnings that we cannot influence nor
suppress, and lists all generated files which is verified by the build
system automatically, anyway.
This commit is contained in:
Robert Schmidt
2025-04-11 16:29:27 +02:00
13 changed files with 76 additions and 49 deletions
+5 -4
View File
@@ -9,10 +9,11 @@ else()
message(FATAL_ERROR "unknown E1AP_RELEASE ${E1AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${e1ap_source} ${e1ap_headers}
COMMAND ASN1C_PREFIX=E1AP_ ${ASN1C_EXEC} -gen-APER -gen-UPER -no-gen-JER -no-gen-BER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${E1AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${E1AP_GRAMMAR}
COMMENT "Generating E1AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${E1AP_GRAMMAR}"
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${E1AP_GRAMMAR}
"E1AP_"
OUTPUT ${e1ap_source} ${e1ap_headers}
OPTIONS -gen-APER -gen-UPER -no-gen-JER -no-gen-BER -no-gen-OER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps
COMMENT "E1AP source files"
)
add_library(asn1_e1ap ${e1ap_source})
+5 -4
View File
@@ -8,10 +8,11 @@ else()
message(FATAL_ERROR "unknown F1AP_RELEASE ${F1AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${f1ap_source} ${f1ap_headers}
COMMAND ASN1C_PREFIX=F1AP_ ${ASN1C_EXEC} -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}
COMMENT "Generating F1AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}"
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${F1AP_GRAMMAR}
"F1AP_"
OUTPUT ${f1ap_source} ${f1ap_headers}
OPTIONS -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -findirect-choice -fno-include-deps
COMMENT "F1AP source files"
)
add_library(asn1_f1ap ${f1ap_source})
+5 -4
View File
@@ -18,10 +18,11 @@ else()
message(FATAL_ERROR "unknown M2AP_RELEASE ${M2AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${m2ap_source} ${m2ap_headers}
COMMAND ASN1C_PREFIX=M2AP_ ${ASN1C_EXEC} -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}
COMMENT "Generating M2AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}"
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${M2AP_GRAMMAR}
"M2AP_"
OUTPUT ${m2ap_source} ${m2ap_headers}
OPTIONS -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -fno-include-deps
COMMENT "M2AP source files"
)
add_library(asn1_m2ap ${m2ap_source})
+5 -4
View File
@@ -10,10 +10,11 @@ else()
message(FATAL_ERROR "unknown LTE_RRC_RELEASE ${LTE_RRC_RELEASE}")
endif()
add_custom_command(OUTPUT ${lte_rrc_source} ${lte_rrc_headers}
COMMAND ASN1C_PREFIX=LTE_ ${ASN1C_EXEC} -pdu=all -fcompound-names -gen-UPER -no-gen-BER -no-gen-JER -no-gen-OER -gen-APER -no-gen-example -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}
COMMENT "Generating LTE RRC source file from ${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}"
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${LTE_RRC_GRAMMAR}
"LTE_"
OUTPUT ${lte_rrc_source} ${lte_rrc_headers}
OPTIONS -pdu=all -fcompound-names -gen-UPER -no-gen-BER -no-gen-JER -no-gen-OER -gen-APER -no-gen-example
COMMENT "LTE RRC source files"
)
# Many other targets include LTE RRC ASN.1 headers, without actually needing
+5 -4
View File
@@ -10,10 +10,11 @@ else()
message(FATAL_ERROR "unknown NR_RRC_RELEASE ${NR_RRC_RELEASE}")
endif()
add_custom_command(OUTPUT ${nr_rrc_source} ${nr_rrc_headers}
COMMAND ASN1C_PREFIX=NR_ ${ASN1C_EXEC} -pdu=all -fcompound-names -gen-UPER -no-gen-BER -no-gen-JER -no-gen-OER -gen-APER -no-gen-example -findirect-choice -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}
COMMENT "Generating NR RRC source file from ${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}"
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${NR_RRC_GRAMMAR}
"NR_"
OUTPUT ${nr_rrc_source} ${nr_rrc_headers}
OPTIONS -pdu=all -fcompound-names -gen-UPER -no-gen-BER -no-gen-JER -no-gen-OER -gen-APER -no-gen-example -findirect-choice
COMMENT "NR RRC source files"
)
# Many other targets include NR RRC ASN.1 headers, without actually needing the
+5 -4
View File
@@ -9,10 +9,11 @@ else()
message(FATAL_ERROR "unknown X2AP_RELEASE ${X2AP_RELEASE}")
endif()
add_custom_command(OUTPUT ${x2ap_source} ${x2ap_headers}
COMMAND ASN1C_PREFIX=X2AP_ ${ASN1C_EXEC} -pdu=all -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -fno-include-deps -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}
COMMENT "Generating X2AP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}"
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${X2AP_GRAMMAR}
"X2AP_"
OUTPUT ${x2ap_source} ${x2ap_headers}
OPTIONS -pdu=all -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -fno-include-deps
COMMENT "X2AP source files"
)
add_library(asn1_x2ap ${x2ap_source})
+6 -5
View File
@@ -9,11 +9,12 @@ else()
message(FATAL_ERROR "unknown XNAP_RELEASE ${XNAP_RELEASE}")
endif()
add_custom_command(OUTPUT ${xnap_source} ${xnap_headers}
COMMAND ASN1C_PREFIX=XNAP_ ${ASN1C_EXEC} -pdu=all -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -fno-include-deps -findirect-choice -D ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/${XNAP_GRAMMAR}
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${XNAP_GRAMMAR}
COMMENT "Generating XNAP source files from ${CMAKE_CURRENT_SOURCE_DIR}/${XNAP_GRAMMAR}"
)
run_asn1c(${CMAKE_CURRENT_SOURCE_DIR}/${XNAP_GRAMMAR}
"XNAP_"
OUTPUT ${xnap_source} ${xnap_headers}
OPTIONS -pdu=all -gen-APER -no-gen-BER -no-gen-JER -no-gen-OER -gen-UPER -fcompound-names -no-gen-example -fno-include-deps -findirect-choice
COMMENT "XnAP source files"
)
add_library(asn1_xnap ${xnap_source})
target_include_directories(asn1_xnap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")