ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 1 | # Copyright 2019 AT&T Intellectual Property |
| 2 | # Copyright 2019 Nokia |
| 3 | # |
| 4 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | # you may not use this file except in compliance with the License. |
| 6 | # You may obtain a copy of the License at |
| 7 | # |
| 8 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | # |
| 10 | # Unless required by applicable law or agreed to in writing, software |
| 11 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | # See the License for the specific language governing permissions and |
| 14 | # limitations under the License. |
| 15 | |
nm755n | 2e26814 | 2019-11-28 16:40:23 +0000 | [diff] [blame] | 16 | # This source code is part of the near-RT RIC (RAN Intelligent Controller) |
| 17 | # platform project (RICP). |
| 18 | |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 19 | cmake_minimum_required(VERSION 3.13) |
| 20 | project(e2) |
| 21 | |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 22 | set(CMAKE_VERBOSE_MAKEFILE off) |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 23 | |
| 24 | set(CMAKE_CXX_STANDARD 17) |
| 25 | |
| 26 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEV_PKG=1") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 27 | set(PROJECT_NAME "e2") |
| 28 | set(PROJECT_TEST_NAME "e2") |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 29 | |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 30 | |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 31 | if (NOT CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 32 | #set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -LRIC-E2-TERMINATION/tracelibcpp/build -ggdb3 -Wall -W -Wpedantic") |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 33 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -g -ggdb3 -O3 -L/usr/lib -L/usr/local/lib -Wall -Wpedantic") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 34 | #only c code with -O3 |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 35 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -O3 -L/usr/lib -L/usr/local/lib -Wall -W -Wpedantic") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 36 | else () |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 37 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -ggdb3 --coverage -L/usr/lib -L/usr/local/lib -Wall -Wpedantic") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 38 | #only c code with -O3 |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 39 | set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DASN_DISABLE_OER_SUPPORT -DASN_PDU_COLLECTION -L. -ggdb3 -L/usr/lib -L/usr/local/lib -Wall -W -Wpedantic") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 40 | |
| 41 | endif () |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 42 | |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 43 | include_directories(RIC-E2-TERMINATION |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 44 | RIC-E2-TERMINATION/3rdparty/oranE2 |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 45 | RIC-E2-TERMINATION/3rdparty/oranE2SM |
aa7133@att.com | 233facd | 2020-04-02 00:10:46 +0300 | [diff] [blame] | 46 | RIC-E2-TERMINATION/3rdparty/cxxopts/include |
ss412g | 4aeeda2 | 2020-06-16 14:12:41 +0300 | [diff] [blame] | 47 | RIC-E2-TERMINATION/3rdparty/prometheus-cpp |
| 48 | RIC-E2-TERMINATION/3rdparty/prometheus-cpp/core/include |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 49 | RIC-E2-TERMINATION/3rdparty |
| 50 | cmake-modules) |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 51 | |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 52 | #E2AP library |
| 53 | file(GLOB E2AP_ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/oranE2/*.c") |
| 54 | file(GLOB E2AP_ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/oranE2/*.h") |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 55 | |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 56 | add_library(asn1codec ${E2AP_ASN_MODULE_SRCS} ${E2AP_ASN_MODULE_HDRS}) |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 57 | install(TARGETS asn1codec DESTINATION /usr/lib) |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 58 | install(FILES ${E2AP_E2AP_ASN_MODULE_HDRS} DESTINATION /usr/include/asn1c) |
| 59 | |
| 60 | |
| 61 | #E2SM library |
| 62 | file(GLOB E2SM_ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/oranE2SM/*.c") |
| 63 | file(GLOB E2SM_ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/oranE2SM/*.h") |
| 64 | |
| 65 | add_library(asn1ce2smcodec ${E2SM_ASN_MODULE_SRCS} ${E2SM_ASN_MODULE_HDRS}) |
| 66 | #add_custom_command( |
| 67 | # TARGET asn1ce2smcodec |
| 68 | # POST_BUILD |
| 69 | # COMMAND objcopy |
| 70 | # ARGS --prefix-symbols=e2sm_ libasn1ce2smcodec.a |
| 71 | #) |
| 72 | |
| 73 | install(TARGETS asn1ce2smcodec DESTINATION /usr/lib) |
| 74 | install(FILES ${E2SM_ASN_MODULE_HDRS} DESTINATION /usr/include/asn1c) |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 75 | |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 76 | include_directories(RIC-E2-TERMINATION/TEST) |
| 77 | include_directories(RIC-E2-TERMINATION/TEST/e2smTest) |
| 78 | include_directories(RIC-E2-TERMINATION/TEST/T1) |
| 79 | include_directories(RIC-E2-TERMINATION/TEST/T2) |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 80 | |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 81 | |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 82 | add_definitions(-DBOOST_LOG_DYN_LINK) |
| 83 | |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 84 | link_libraries(nsl |
| 85 | sctp |
| 86 | gcov |
| 87 | c |
| 88 | m |
| 89 | dl |
| 90 | mdclog |
aa7133@att.com | 7ed3d13 | 2020-03-23 15:50:03 +0200 | [diff] [blame] | 91 | rmr_si |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 92 | asn1codec |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 93 | asn1ce2smcodec |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 94 | boost_system |
| 95 | boost_log_setup |
| 96 | boost_log |
| 97 | boost_date_time |
| 98 | boost_thread |
| 99 | boost_system |
| 100 | rt |
aa7133@att.com | 233facd | 2020-04-02 00:10:46 +0300 | [diff] [blame] | 101 | tbb |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 102 | boost_filesystem |
| 103 | cgreen |
ss412g | 4aeeda2 | 2020-06-16 14:12:41 +0300 | [diff] [blame] | 104 | prometheus-cpp-core |
| 105 | prometheus-cpp-pull |
| 106 | prometheus-cpp-push |
| 107 | z |
| 108 | curl |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 109 | pthread) |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 110 | |
| 111 | add_executable(e2 RIC-E2-TERMINATION/sctpThread.cpp |
| 112 | RIC-E2-TERMINATION/sctpThread.h |
| 113 | RIC-E2-TERMINATION/openTracing.h |
| 114 | RIC-E2-TERMINATION/mapWrapper.h |
| 115 | RIC-E2-TERMINATION/base64.h |
| 116 | RIC-E2-TERMINATION/base64.cpp |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 117 | RIC-E2-TERMINATION/ReadConfigFile.h |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 118 | RIC-E2-TERMINATION/BuildRunName.h |
aa7133@att.com | df4f182 | 2020-06-16 16:23:53 +0300 | [diff] [blame] | 119 | # RIC-E2-TERMINATION/3rdparty/pugixml/src/pugiconfig.hpp |
| 120 | # RIC-E2-TERMINATION/3rdparty/pugixml/src/pugixml.cpp |
| 121 | # RIC-E2-TERMINATION/3rdparty/pugixml/src/pugixml.hpp |
| 122 | # RIC-E2-TERMINATION/BuildXml.h |
| 123 | ) |
aa7133@att.com | 7b437f7 | 2020-03-30 13:25:54 +0300 | [diff] [blame] | 124 | target_link_libraries(e2 libasn1ce2smcodec.a) |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 125 | target_link_libraries(e2 librmr_si.a) |
| 126 | target_link_libraries(e2 libicui18n.a) |
| 127 | target_link_libraries(e2 libicuuc.a) |
| 128 | target_link_libraries(e2 libicudata.a) |
ss412g | 4aeeda2 | 2020-06-16 14:12:41 +0300 | [diff] [blame] | 129 | target_link_libraries(e2 prometheus-cpp-core.a) |
| 130 | target_link_libraries(e2 prometheus-cpp-pull.a) |
| 131 | target_link_libraries(e2 prometheus-cpp-push.a) |
ss412g | 1a79bdf | 2019-10-24 12:03:05 +0300 | [diff] [blame] | 132 | |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 133 | #target_link_libraries(e2 libnng.a) |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 134 | |
| 135 | add_executable(testConfigFile |
| 136 | RIC-E2-TERMINATION/ReadConfigFile.h |
| 137 | RIC-E2-TERMINATION/TEST/ConfigurationFileTest/testConfigFile.cpp) |
| 138 | |
| 139 | add_executable(b64Test |
| 140 | RIC-E2-TERMINATION/base64.cpp |
| 141 | RIC-E2-TERMINATION/base64.h |
| 142 | RIC-E2-TERMINATION/TEST/base64/testBase64.cpp) |
| 143 | |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 144 | |
| 145 | add_executable(sctpClient |
aa7133@att.com | bc6da78 | 2020-03-16 18:22:09 +0200 | [diff] [blame] | 146 | RIC-E2-TERMINATION/TEST/testAsn/sctpClient/sctpClient.cpp |
| 147 | RIC-E2-TERMINATION/TEST/testAsn/sctpClient/sctpClient.h |
| 148 | RIC-E2-TERMINATION/TEST/testAsn/rmrClient/rmrClient.h |
| 149 | RIC-E2-TERMINATION/TEST/testAsn/httpServer/HttpServer.cpp |
| 150 | RIC-E2-TERMINATION/TEST/testAsn/httpServer/HttpServer.h |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 151 | RIC-E2-TERMINATION/base64.h |
| 152 | RIC-E2-TERMINATION/base64.cpp |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 153 | RIC-E2-TERMINATION/TEST/T1/E2Builder.h |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 154 | |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 155 | #RIC-E2-TERMINATION/TEST/T1/Test1.cpp |
| 156 | #RIC-E2-TERMINATION/TEST/T1/ |
| 157 | ) |
dhirajverma | af4da6d | 2021-05-05 15:46:10 +0530 | [diff] [blame] | 158 | target_link_libraries(sctpClient libpistache.so) |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 159 | target_link_libraries(sctpClient librmr_si.a) |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 160 | |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 161 | add_executable(setUpMessages |
aa7133@att.com | bc6da78 | 2020-03-16 18:22:09 +0200 | [diff] [blame] | 162 | RIC-E2-TERMINATION/TEST/testAsn/setUpMessages/SetUpMessages.cpp |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 163 | RIC-E2-TERMINATION/BuildRunName.h |
| 164 | ) |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 165 | |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 166 | #find_package(RapidJSON) |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 167 | |
| 168 | add_executable(teste2 |
| 169 | RIC-E2-TERMINATION/TEST/e2test.h |
| 170 | RIC-E2-TERMINATION/TEST/e2test.cpp |
| 171 | ) |
| 172 | |
dhirajverma | 31768a9 | 2021-05-06 12:38:49 +0530 | [diff] [blame] | 173 | |
| 174 | # Locate GTest |
| 175 | string(REPLACE " " ";" REPLACED_FLAGS ${CMAKE_CXX_FLAGS}) |
| 176 | string(CONCAT FINAL_FLAG ${REPLACED_FLAGS} ";-DUNIT_TEST") |
| 177 | find_package(GTest REQUIRED) |
| 178 | include_directories(${GTEST_INCLUDE_DIRS}) |
| 179 | # Link runTests with what we want to test and the GTest and pthread library |
| 180 | add_executable(sctp_test /opt/e2/RIC-E2-TERMINATION/TEST/sctp_thread_test.cpp |
| 181 | RIC-E2-TERMINATION/sctpThread.h |
| 182 | RIC-E2-TERMINATION/sctpThread.cpp |
| 183 | RIC-E2-TERMINATION/base64.h |
| 184 | RIC-E2-TERMINATION/base64.cpp |
| 185 | |
| 186 | ) |
| 187 | target_link_libraries(sctp_test ${GTEST_LIBRARIES} pthread) |
| 188 | target_compile_options(sctp_test PRIVATE ${FINAL_FLAG}) |
| 189 | |
| 190 | |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 191 | if (CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 192 | LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules") |
| 193 | set(CMAKE_BUILD_TYPE "Debug") |
| 194 | include(cmake-modules/CodeCoverage.cmake) |
| 195 | target_link_libraries(${PROJECT_TEST_NAME} gcov) |
| 196 | |
| 197 | set(LDFLAGS "--coverage -fprofile-arcs") |
dhirajverma | 31768a9 | 2021-05-06 12:38:49 +0530 | [diff] [blame] | 198 | message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 199 | |
| 200 | # setup_target_for_coverage_lcov(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage) |
dhirajverma | 31768a9 | 2021-05-06 12:38:49 +0530 | [diff] [blame] | 201 | set(COVERAGE_LCOV_EXCLUDES "${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/3rdparty/*" |
| 202 | "${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/oranE2/*" |
| 203 | "${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/TEST/*" |
| 204 | "${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/config/*") |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 205 | |
| 206 | set(COVERAGE_EXCLUDES '${PROJECT_SOURCE_DIR}/config' |
| 207 | ${PROJECT_SOURCE_DIR}/log' |
| 208 | '${PROJECT_SOURCE_DIR}/docs' |
| 209 | '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/3rdparty' |
aa7133@att.com | a8a819f | 2020-03-16 12:04:24 +0200 | [diff] [blame] | 210 | '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/oranE2' |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 211 | '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/TEST' |
| 212 | '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/config') |
| 213 | append_coverage_compiler_flags() |
| 214 | SETUP_TARGET_FOR_COVERAGE_LCOV(NAME e2_coverage |
dhirajverma | 31768a9 | 2021-05-06 12:38:49 +0530 | [diff] [blame] | 215 | EXECUTABLE e2 |
ss412g | 3bac2da | 2020-01-05 11:52:19 +0200 | [diff] [blame] | 216 | DEPENDENCIES e2) |
dhirajverma | af4da6d | 2021-05-05 15:46:10 +0530 | [diff] [blame] | 217 | endif () |