Files
openairinterface5g/openair2/M2AP/MESSAGES/CMakeLists.txt
T
Robert Schmidt fdb2abebd0 Add cmake option to select asn1c, and test asn1c parameters
CMake now takes the option ASN1C_EXEC to select an asn1c to use for
compilation. For instance, run with
cmake .. -GNinja -DASN1C_EXEC=/opt/asn1c/bin/asn1c
or
./build_oai --cmake-opt -DASN1C_EXEC=/opt/asn1c/bin/asn1c
to select the alternative asn1c. For instance, this is important for the
CI to allow to build multiple versions of OAI in parallel that might use
different commits of OAI.

Further, this patch introduces functionality to check for the support of
asn1c options that we require, and alerts the user if they are missing,
alongside a message of how to resolve the problem.
2023-06-02 10:42:02 +02:00

30 lines
1.2 KiB
CMake

set(M2AP_VERSION 14 0 0)
make_version(M2AP_cc ${M2AP_VERSION})
string(REPLACE ";" "." M2AP_RELEASE "${M2AP_VERSION}")
if(M2AP_RELEASE VERSION_EQUAL "16.3.1")
include(ASN1/m2ap-16.3.1.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "8.9.0")
include(ASN1/m2ap-8.9.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "11.9.0")
include(ASN1/m2ap-11.9.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "12.9.0")
include(ASN1/m2ap-12.9.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "14.0.0")
include(ASN1/m2ap-14.0.0.cmake)
elseif(M2AP_RELEASE VERSION_EQUAL "15.1.0")
include(ASN1/m2ap-15.1.0.cmake)
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}"
)
add_library(asn1_m2ap ${m2ap_source})
target_include_directories(asn1_m2ap PUBLIC "${CMAKE_CURRENT_BINARY_DIR}")
target_compile_options(asn1_m2ap PRIVATE -DASN_DISABLE_OER_SUPPORT -w)