blob: 95f9a1bb11a541f76bdecbc3486e496cdcfaf05f [file] [log] [blame]
ss412g1a79bdf2019-10-24 12:03:05 +03001# 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
nm755n2e268142019-11-28 16:40:23 +000016# This source code is part of the near-RT RIC (RAN Intelligent Controller)
17# platform project (RICP).
18
ss412g1a79bdf2019-10-24 12:03:05 +030019cmake_minimum_required(VERSION 3.13)
20project(e2)
21
ss412g3bac2da2020-01-05 11:52:19 +020022set(CMAKE_VERBOSE_MAKEFILE off)
ss412g1a79bdf2019-10-24 12:03:05 +030023
24set(CMAKE_CXX_STANDARD 17)
25
26set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDEV_PKG=1")
ss412g3bac2da2020-01-05 11:52:19 +020027set(PROJECT_NAME "e2")
28set(PROJECT_TEST_NAME "e2")
ss412g1a79bdf2019-10-24 12:03:05 +030029
ss412g1a79bdf2019-10-24 12:03:05 +030030
ss412g3bac2da2020-01-05 11:52:19 +020031if (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.coma8a819f2020-03-16 12:04:24 +020033 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")
ss412g3bac2da2020-01-05 11:52:19 +020034 #only c code with -O3
aa7133@att.coma8a819f2020-03-16 12:04:24 +020035 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")
ss412g3bac2da2020-01-05 11:52:19 +020036else ()
aa7133@att.coma8a819f2020-03-16 12:04:24 +020037 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")
ss412g3bac2da2020-01-05 11:52:19 +020038 #only c code with -O3
aa7133@att.coma8a819f2020-03-16 12:04:24 +020039 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")
ss412g3bac2da2020-01-05 11:52:19 +020040
41endif ()
aa7133@att.com7b437f72020-03-30 13:25:54 +030042
ss412g3bac2da2020-01-05 11:52:19 +020043include_directories(RIC-E2-TERMINATION
aa7133@att.coma8a819f2020-03-16 12:04:24 +020044 RIC-E2-TERMINATION/3rdparty/oranE2
aa7133@att.com7b437f72020-03-30 13:25:54 +030045 RIC-E2-TERMINATION/3rdparty/oranE2SM
aa7133@att.com233facd2020-04-02 00:10:46 +030046 RIC-E2-TERMINATION/3rdparty/cxxopts/include
ss412g4aeeda22020-06-16 14:12:41 +030047 RIC-E2-TERMINATION/3rdparty/prometheus-cpp
48 RIC-E2-TERMINATION/3rdparty/prometheus-cpp/core/include
ss412g3bac2da2020-01-05 11:52:19 +020049 RIC-E2-TERMINATION/3rdparty
50 cmake-modules)
ss412g1a79bdf2019-10-24 12:03:05 +030051
aa7133@att.com7b437f72020-03-30 13:25:54 +030052#E2AP library
53file(GLOB E2AP_ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/oranE2/*.c")
54file(GLOB E2AP_ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/oranE2/*.h")
ss412g1a79bdf2019-10-24 12:03:05 +030055
aa7133@att.com7b437f72020-03-30 13:25:54 +030056add_library(asn1codec ${E2AP_ASN_MODULE_SRCS} ${E2AP_ASN_MODULE_HDRS})
ss412g1a79bdf2019-10-24 12:03:05 +030057install(TARGETS asn1codec DESTINATION /usr/lib)
aa7133@att.com7b437f72020-03-30 13:25:54 +030058install(FILES ${E2AP_E2AP_ASN_MODULE_HDRS} DESTINATION /usr/include/asn1c)
59
60
61#E2SM library
62file(GLOB E2SM_ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/oranE2SM/*.c")
63file(GLOB E2SM_ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/oranE2SM/*.h")
64
65add_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
73install(TARGETS asn1ce2smcodec DESTINATION /usr/lib)
74install(FILES ${E2SM_ASN_MODULE_HDRS} DESTINATION /usr/include/asn1c)
ss412g1a79bdf2019-10-24 12:03:05 +030075
ss412g1a79bdf2019-10-24 12:03:05 +030076include_directories(RIC-E2-TERMINATION/TEST)
77include_directories(RIC-E2-TERMINATION/TEST/e2smTest)
78include_directories(RIC-E2-TERMINATION/TEST/T1)
79include_directories(RIC-E2-TERMINATION/TEST/T2)
ss412g3bac2da2020-01-05 11:52:19 +020080
ss412g1a79bdf2019-10-24 12:03:05 +030081
ss412g1a79bdf2019-10-24 12:03:05 +030082add_definitions(-DBOOST_LOG_DYN_LINK)
83
ss412g3bac2da2020-01-05 11:52:19 +020084link_libraries(nsl
85 sctp
86 gcov
87 c
88 m
89 dl
90 mdclog
aa7133@att.com7ed3d132020-03-23 15:50:03 +020091 rmr_si
ss412g3bac2da2020-01-05 11:52:19 +020092 asn1codec
aa7133@att.com7b437f72020-03-30 13:25:54 +030093 asn1ce2smcodec
ss412g3bac2da2020-01-05 11:52:19 +020094 boost_system
95 boost_log_setup
96 boost_log
97 boost_date_time
98 boost_thread
99 boost_system
100 rt
aa7133@att.com233facd2020-04-02 00:10:46 +0300101 tbb
ss412g3bac2da2020-01-05 11:52:19 +0200102 boost_filesystem
103 cgreen
ss412g4aeeda22020-06-16 14:12:41 +0300104 prometheus-cpp-core
105 prometheus-cpp-pull
106 prometheus-cpp-push
107 z
108 curl
ss412g3bac2da2020-01-05 11:52:19 +0200109 pthread)
ss412g1a79bdf2019-10-24 12:03:05 +0300110
111add_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
ss412g3bac2da2020-01-05 11:52:19 +0200117 RIC-E2-TERMINATION/ReadConfigFile.h
aa7133@att.com7b437f72020-03-30 13:25:54 +0300118 RIC-E2-TERMINATION/BuildRunName.h
aa7133@att.comdf4f1822020-06-16 16:23:53 +0300119 # 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.com7b437f72020-03-30 13:25:54 +0300124target_link_libraries(e2 libasn1ce2smcodec.a)
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200125target_link_libraries(e2 librmr_si.a)
126target_link_libraries(e2 libicui18n.a)
127target_link_libraries(e2 libicuuc.a)
128target_link_libraries(e2 libicudata.a)
ss412g4aeeda22020-06-16 14:12:41 +0300129target_link_libraries(e2 prometheus-cpp-core.a)
130target_link_libraries(e2 prometheus-cpp-pull.a)
131target_link_libraries(e2 prometheus-cpp-push.a)
ss412g1a79bdf2019-10-24 12:03:05 +0300132
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200133#target_link_libraries(e2 libnng.a)
ss412g3bac2da2020-01-05 11:52:19 +0200134
135add_executable(testConfigFile
136 RIC-E2-TERMINATION/ReadConfigFile.h
137 RIC-E2-TERMINATION/TEST/ConfigurationFileTest/testConfigFile.cpp)
138
139add_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.coma8a819f2020-03-16 12:04:24 +0200144
145add_executable(sctpClient
aa7133@att.combc6da782020-03-16 18:22:09 +0200146 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.coma8a819f2020-03-16 12:04:24 +0200151 RIC-E2-TERMINATION/base64.h
152 RIC-E2-TERMINATION/base64.cpp
ss412g3bac2da2020-01-05 11:52:19 +0200153 RIC-E2-TERMINATION/TEST/T1/E2Builder.h
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200154
ss412g3bac2da2020-01-05 11:52:19 +0200155 #RIC-E2-TERMINATION/TEST/T1/Test1.cpp
156 #RIC-E2-TERMINATION/TEST/T1/
157 )
dhirajvermaaf4da6d2021-05-05 15:46:10 +0530158target_link_libraries(sctpClient libpistache.so)
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200159target_link_libraries(sctpClient librmr_si.a)
ss412g3bac2da2020-01-05 11:52:19 +0200160
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200161add_executable(setUpMessages
aa7133@att.combc6da782020-03-16 18:22:09 +0200162 RIC-E2-TERMINATION/TEST/testAsn/setUpMessages/SetUpMessages.cpp
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200163 RIC-E2-TERMINATION/BuildRunName.h
164 )
ss412g3bac2da2020-01-05 11:52:19 +0200165
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200166#find_package(RapidJSON)
ss412g3bac2da2020-01-05 11:52:19 +0200167
168add_executable(teste2
169 RIC-E2-TERMINATION/TEST/e2test.h
170 RIC-E2-TERMINATION/TEST/e2test.cpp
171 )
172
dhirajverma31768a92021-05-06 12:38:49 +0530173
174# Locate GTest
175string(REPLACE " " ";" REPLACED_FLAGS ${CMAKE_CXX_FLAGS})
176string(CONCAT FINAL_FLAG ${REPLACED_FLAGS} ";-DUNIT_TEST")
177find_package(GTest REQUIRED)
178include_directories(${GTEST_INCLUDE_DIRS})
179# Link runTests with what we want to test and the GTest and pthread library
180add_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 )
187target_link_libraries(sctp_test ${GTEST_LIBRARIES} pthread)
188target_compile_options(sctp_test PRIVATE ${FINAL_FLAG})
189
190
ss412g3bac2da2020-01-05 11:52:19 +0200191if (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")
dhirajverma31768a92021-05-06 12:38:49 +0530198 message("PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
ss412g3bac2da2020-01-05 11:52:19 +0200199
200 # setup_target_for_coverage_lcov(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
dhirajverma31768a92021-05-06 12:38:49 +0530201 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/*")
ss412g3bac2da2020-01-05 11:52:19 +0200205
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.coma8a819f2020-03-16 12:04:24 +0200210 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/oranE2'
ss412g3bac2da2020-01-05 11:52:19 +0200211 '${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
dhirajverma31768a92021-05-06 12:38:49 +0530215 EXECUTABLE e2
ss412g3bac2da2020-01-05 11:52:19 +0200216 DEPENDENCIES e2)
dhirajvermaaf4da6d2021-05-05 15:46:10 +0530217endif ()