blob: 19d38297d94a34967780bf8dbb0632d3e948b424 [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
ss412g3bac2da2020-01-05 11:52:19 +020046 RIC-E2-TERMINATION/3rdparty
47 cmake-modules)
ss412g1a79bdf2019-10-24 12:03:05 +030048
aa7133@att.com7b437f72020-03-30 13:25:54 +030049#E2AP library
50file(GLOB E2AP_ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/oranE2/*.c")
51file(GLOB E2AP_ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/oranE2/*.h")
ss412g1a79bdf2019-10-24 12:03:05 +030052
aa7133@att.com7b437f72020-03-30 13:25:54 +030053add_library(asn1codec ${E2AP_ASN_MODULE_SRCS} ${E2AP_ASN_MODULE_HDRS})
ss412g1a79bdf2019-10-24 12:03:05 +030054install(TARGETS asn1codec DESTINATION /usr/lib)
aa7133@att.com7b437f72020-03-30 13:25:54 +030055install(FILES ${E2AP_E2AP_ASN_MODULE_HDRS} DESTINATION /usr/include/asn1c)
56
57
58#E2SM library
59file(GLOB E2SM_ASN_MODULE_SRCS "RIC-E2-TERMINATION/3rdparty/oranE2SM/*.c")
60file(GLOB E2SM_ASN_MODULE_HDRS "RIC-E2-TERMINATION/3rdparty/oranE2SM/*.h")
61
62add_library(asn1ce2smcodec ${E2SM_ASN_MODULE_SRCS} ${E2SM_ASN_MODULE_HDRS})
63#add_custom_command(
64# TARGET asn1ce2smcodec
65# POST_BUILD
66# COMMAND objcopy
67# ARGS --prefix-symbols=e2sm_ libasn1ce2smcodec.a
68#)
69
70install(TARGETS asn1ce2smcodec DESTINATION /usr/lib)
71install(FILES ${E2SM_ASN_MODULE_HDRS} DESTINATION /usr/include/asn1c)
ss412g1a79bdf2019-10-24 12:03:05 +030072
ss412g1a79bdf2019-10-24 12:03:05 +030073include_directories(RIC-E2-TERMINATION/TEST)
74include_directories(RIC-E2-TERMINATION/TEST/e2smTest)
75include_directories(RIC-E2-TERMINATION/TEST/T1)
76include_directories(RIC-E2-TERMINATION/TEST/T2)
ss412g3bac2da2020-01-05 11:52:19 +020077
ss412g1a79bdf2019-10-24 12:03:05 +030078
ss412g1a79bdf2019-10-24 12:03:05 +030079add_definitions(-DBOOST_LOG_DYN_LINK)
80
ss412g3bac2da2020-01-05 11:52:19 +020081link_libraries(nsl
82 sctp
83 gcov
84 c
85 m
86 dl
87 mdclog
aa7133@att.com7ed3d132020-03-23 15:50:03 +020088 rmr_si
ss412g3bac2da2020-01-05 11:52:19 +020089 asn1codec
aa7133@att.com7b437f72020-03-30 13:25:54 +030090 asn1ce2smcodec
ss412g3bac2da2020-01-05 11:52:19 +020091 boost_system
92 boost_log_setup
93 boost_log
94 boost_date_time
95 boost_thread
96 boost_system
97 rt
98 boost_filesystem
99 cgreen
100 pthread)
ss412g1a79bdf2019-10-24 12:03:05 +0300101
102add_executable(e2 RIC-E2-TERMINATION/sctpThread.cpp
103 RIC-E2-TERMINATION/sctpThread.h
104 RIC-E2-TERMINATION/openTracing.h
105 RIC-E2-TERMINATION/mapWrapper.h
106 RIC-E2-TERMINATION/base64.h
107 RIC-E2-TERMINATION/base64.cpp
ss412g3bac2da2020-01-05 11:52:19 +0200108 RIC-E2-TERMINATION/ReadConfigFile.h
aa7133@att.com7b437f72020-03-30 13:25:54 +0300109 RIC-E2-TERMINATION/BuildRunName.h
110 RIC-E2-TERMINATION/statCollector.h)
111target_link_libraries(e2 libasn1ce2smcodec.a)
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200112target_link_libraries(e2 librmr_nng.a)
113target_link_libraries(e2 librmr_si.a)
114target_link_libraries(e2 libicui18n.a)
115target_link_libraries(e2 libicuuc.a)
116target_link_libraries(e2 libicudata.a)
ss412g1a79bdf2019-10-24 12:03:05 +0300117
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200118#target_link_libraries(e2 libnng.a)
ss412g3bac2da2020-01-05 11:52:19 +0200119
120add_executable(testConfigFile
121 RIC-E2-TERMINATION/ReadConfigFile.h
122 RIC-E2-TERMINATION/TEST/ConfigurationFileTest/testConfigFile.cpp)
123
124add_executable(b64Test
125 RIC-E2-TERMINATION/base64.cpp
126 RIC-E2-TERMINATION/base64.h
127 RIC-E2-TERMINATION/TEST/base64/testBase64.cpp)
128
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200129
130add_executable(sctpClient
aa7133@att.combc6da782020-03-16 18:22:09 +0200131 RIC-E2-TERMINATION/TEST/testAsn/sctpClient/sctpClient.cpp
132 RIC-E2-TERMINATION/TEST/testAsn/sctpClient/sctpClient.h
133 RIC-E2-TERMINATION/TEST/testAsn/rmrClient/rmrClient.h
134 RIC-E2-TERMINATION/TEST/testAsn/httpServer/HttpServer.cpp
135 RIC-E2-TERMINATION/TEST/testAsn/httpServer/HttpServer.h
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200136 RIC-E2-TERMINATION/base64.h
137 RIC-E2-TERMINATION/base64.cpp
ss412g3bac2da2020-01-05 11:52:19 +0200138 RIC-E2-TERMINATION/TEST/T1/E2Builder.h
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200139
ss412g3bac2da2020-01-05 11:52:19 +0200140 #RIC-E2-TERMINATION/TEST/T1/Test1.cpp
141 #RIC-E2-TERMINATION/TEST/T1/
142 )
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200143target_link_libraries(sctpClient libpistache.a)
144target_link_libraries(sctpClient librmr_nng.a)
145target_link_libraries(sctpClient librmr_si.a)
146#target_link_libraries(sctpClient libnng.a)
ss412g3bac2da2020-01-05 11:52:19 +0200147
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200148add_executable(setUpMessages
aa7133@att.combc6da782020-03-16 18:22:09 +0200149 RIC-E2-TERMINATION/TEST/testAsn/setUpMessages/SetUpMessages.cpp
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200150 RIC-E2-TERMINATION/BuildRunName.h
151 )
ss412g3bac2da2020-01-05 11:52:19 +0200152
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200153#find_package(RapidJSON)
ss412g3bac2da2020-01-05 11:52:19 +0200154
155add_executable(teste2
156 RIC-E2-TERMINATION/TEST/e2test.h
157 RIC-E2-TERMINATION/TEST/e2test.cpp
158 )
159
160if (CMAKE_BUILD_TYPE STREQUAL "Debug")
161 LIST(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules")
162 set(CMAKE_BUILD_TYPE "Debug")
163 include(cmake-modules/CodeCoverage.cmake)
164 target_link_libraries(${PROJECT_TEST_NAME} gcov)
165
166 set(LDFLAGS "--coverage -fprofile-arcs")
167
168 # setup_target_for_coverage_lcov(${PROJECT_NAME}_coverage ${PROJECT_TEST_NAME} coverage)
169 set(COVERAGE_LCOV_EXCLUDES ${PROJECT_SOURCE_DIR}/config'
170 ${PROJECT_SOURCE_DIR}/log'
171 '${PROJECT_SOURCE_DIR}/docs'
172 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/3rdparty'
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200173 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/oranE2'
ss412g3bac2da2020-01-05 11:52:19 +0200174 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/TEST'
175 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/config')
176
177 set(COVERAGE_EXCLUDES '${PROJECT_SOURCE_DIR}/config'
178 ${PROJECT_SOURCE_DIR}/log'
179 '${PROJECT_SOURCE_DIR}/docs'
180 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/3rdparty'
aa7133@att.coma8a819f2020-03-16 12:04:24 +0200181 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/oranE2'
ss412g3bac2da2020-01-05 11:52:19 +0200182 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/TEST'
183 '${PROJECT_SOURCE_DIR}/RIC-E2-TERMINATION/config')
184 append_coverage_compiler_flags()
185 SETUP_TARGET_FOR_COVERAGE_LCOV(NAME e2_coverage
186 EXECUTABLE e2
187 DEPENDENCIES e2)
188endif ()