CMakeLists.txt 58.7 KB
Newer Older
thomasl's avatar
thomasl committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
################################################################################
#   OpenAirInterface
#   Copyright(c) 1999 - 2014 Eurecom
#
#   OpenAirInterface is free software: you can redistribute it and/or modify
#   it under the terms of the GNU General Public License as published by
#   the Free Software Foundation, either version 3 of the License, or
#   (at your option) any later version.
#
#   OpenAirInterface is distributed in the hope that it will be useful,
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#   GNU General Public License for more details.
#
#   You should have received a copy of the GNU General Public License
#   along with OpenAirInterface.The full GNU General Public License is
#  included in this distribution in the file called "COPYING". If not,
#  see <http://www.gnu.org/licenses/>.
#
# Contact Information
# OpenAirInterface Admin: openair_admin@eurecom.fr
# OpenAirInterface Tech : openair_tech@eurecom.fr
# OpenAirInterface Dev  : openair4g-devel@eurecom.fr
#
# Address      : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
# Author: laurent THOMAS
###############################################################################

cmake_minimum_required (VERSION 2.8)

31
#############################################
thomasl's avatar
thomasl committed
32 33 34 35 36 37 38 39 40 41 42 43 44
# Base directories, compatible with legacy OAI building
################################################
set (OPENAIR_DIR     $ENV{OPENAIR_DIR})
set (OPENAIR1_DIR    ${OPENAIR_DIR}/openair1)
set (OPENAIR2_DIR    ${OPENAIR_DIR}/openair2)
set (OPENAIR3_DIR    ${OPENAIR_DIR}/openair3)
set (OPENAIR_TARGETS ${OPENAIR_DIR}/targets)
set (OPENAIRCN_DIR   ${OPENAIR_DIR}/openair-cn)
set (OPENAIR_CMAKE   ${OPENAIR_DIR}/cmake_targets)
set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})

project (OpenAirInterface)

thomasl's avatar
thomasl committed
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
###########################################
# macros to define options as there is numerous options in oai
################################################
macro(add_boolean_option name val helpstr)
  if(DEFINED ${name})
    set(value ${${name}})
  else(DEFINED ${name})
    set(value ${val})
  endif()
  set(${name} ${value} CACHE STRING "${helpstr}")
  set_property(CACHE ${name} PROPERTY TYPE BOOL)
  if (${value})
    add_definitions("-D${name}")
  endif (${value})
endmacro(add_boolean_option)

macro(add_integer_option name val helpstr)
  if(DEFINED ${name})
    set(value ${${name}})
  else(DEFINED ${name})
    set(value ${val})
  endif()
  set(${name} ${value} CACHE STRING "${helpstr}")
  add_definitions("-D${name}=${value}")
endmacro(add_integer_option)

macro(add_list1_option name val helpstr)
  if(DEFINED ${name})
    set(value ${${name}})
  else(DEFINED ${name})
    set(value ${val})
  endif()
  set(${name} ${value} CACHE STRING "${helpstr}")
  set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
  if(NOT "${value}" STREQUAL "False")
    add_definitions("-D${name}=${value}")
  endif()
endmacro(add_list1_option)

macro(add_list2_option name val helpstr)
  if(DEFINED ${name})
    set(value ${${name}})
  else(DEFINED ${name})
    set(value ${val})
  endif()
  set(${name} ${value} CACHE STRING "${helpstr}")
  set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
  if(NOT "${value}" STREQUAL "False")
    add_definitions("-D${value}=1")
  endif()
endmacro(add_list2_option)

97 98 99 100 101 102 103 104 105 106 107 108
macro(add_list_string_option name val helpstr)
  if(DEFINED ${name})
    set(value ${${name}})
  else(DEFINED ${name})
    set(value ${val})
  endif()
  set(${name} ${value} CACHE STRING "${helpstr}")
  set_property(CACHE ${name} PROPERTY STRINGS ${ARGN})
  if(NOT "${value}" STREQUAL "False")
    add_definitions("-D${name}=\"${value}\"")
  endif()
endmacro(add_list_string_option)
109
####################################################
thomasl's avatar
thomasl committed
110 111
# compilation flags
#############################################
thomasl's avatar
thomasl committed
112

113
add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release RelWithDebInfo MinSizeRel)
114
set(CMAKE_BUILD_TYPE "RelWithDebInfo")
thomasl's avatar
thomasl committed
115 116

#
117
set(CMAKE_C_FLAGS 
thomasl's avatar
thomasl committed
118
  "${CMAKE_C_FLAGS} -msse4.2 -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
119 120 121 122
# add autotools definitions that were maybe used!
set(CMAKE_C_FLAGS 
  "${CMAKE_C_FLAGS} -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_FCNTL_H=1 -DHAVE_ARPA_INET_H=1 -DHAVE_SYS_TIME_H=1 -DHAVE_SYS_SOCKET_H=1 -DHAVE_STRERROR=1 -DHAVE_SOCKET=1 -DHAVE_MEMSET=1 -DHAVE_GETTIMEOFDAY=1 -DHAVE_STDLIB_H=1 -DHAVE_MALLOC=1 -DHAVE_LIBSCTP"
)
123 124
# set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files
125
add_definitions(-DCMAKER)
thomasl's avatar
thomasl committed
126 127 128
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -DMALLOC_CHECK_=3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -ggdb -DMALLOC_CHECK_=3 -O3")

129 130 131 132 133 134 135 136 137 138 139 140 141 142 143
# Below has been put in comment because does not work with
# SVN authentication.
#
#find_package(Subversion)
#if(SUBVERSION_FOUND)
#  Subversion_WC_INFO(${OPENAIR_DIR} openair)
#  set (FIRMWARE_VERSION "${openair_WC_REVISION} - ${openair_WC_LAST_CHANGED_DATE}")
#  Subversion_WC_LOG(${OPENAIR_DIR} Project)
#else()
#  set (FIRMWARE_VERSION "No svn information")
#endif()
#add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")

# Below is a hard-coded info
set (FIRMWARE_VERSION "No svn information")
thomasl's avatar
thomasl committed
144
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
145 146
add_definitions("-DPACKAGE_VERSION=\"${FIRMWARE_VERSION}\"")
add_definitions("-DPACKAGE_BUGREPORT=\"OpenAirInterface web site\"")
thomasl's avatar
thomasl committed
147 148 149 150 151 152



# Debug related options
#########################################
add_boolean_option(MSG_PRINT  False "print debug messages")
thomasl's avatar
thomasl committed
153
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
154
add_boolean_option(XER_PRINT False "print XER Format")
thomasl's avatar
thomasl committed
155 156
add_boolean_option(RRC_MSG_PRINT False "print RRC messages")
add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages")
157 158
add_boolean_option(TEST_OMG False "???")
add_boolean_option(DEBUG_OMG False "???")
159
add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope")
thomasl's avatar
thomasl committed
160

161
add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
thomasl's avatar
thomasl committed
162 163 164 165 166 167 168 169 170 171 172 173
set (ITTI_DIR ${OPENAIR_DIR}/common/utils/itti)
if (${ENABLE_ITTI})
  add_library(ITTI 
    # add .h files if depend on (this one is generated)
    ${ITTI_DIR}/intertask_interface.h
    ${ITTI_DIR}/intertask_interface.c
    ${ITTI_DIR}/intertask_interface_dump.c
    ${ITTI_DIR}/backtrace.c
    ${ITTI_DIR}/memory_pools.c
    ${ITTI_DIR}/signals.c
    ${ITTI_DIR}/timer.c
    )
174
  set(ITTI_LIB ITTI)
thomasl's avatar
thomasl committed
175
  set(GTPU_need_ITTI ${OPENAIRCN_DIR}/GTPV1-U/gtpv1u_eNB.c)
thomasl's avatar
thomasl committed
176 177 178 179 180
  set(EXMIMO_IOT)
endif (${ENABLE_ITTI})

add_boolean_option(RTAI False "Use RTAI")
if (${RTAI})
181 182 183
  set(LOWLATENCY False)
  add_definitions("-DENABLE_RTAI_CLOCK")
  add_definitions("-DCONFIG_RTAI_LXRT_INLINE")
thomasl's avatar
thomasl committed
184 185 186 187 188 189 190 191 192 193 194 195 196 197
  include_directories ("/usr/realtime/include")
  include_directories ("/usr/realtime/include/asm")
  set(RTAI_SOURCE sched_dlsch.c sched_rx_pdsch.c rt_wrapper.c vcd_signal_dumper.c log.c)
endif (${RTAI})

#############################
# ASN.1 grammar C code generation & dependancies
################################
# A difficulty: asn1c generates C code of a un-predictable list of files
# so, generate the c from asn1c once at cmake run time
# So, if someone modify the asn.1 source file in such as way that it will create
# (so creating new asn.1 objects instead of modifying the object attributes)
# New C code source file, cmake must be re-run (instead of re-running make only) 
#############
198
set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1.bash")
thomasl's avatar
thomasl committed
199 200 201 202
set(asn1_generated_dir ${OPENAIR_BIN_DIR})

# RRC
######
thomasl's avatar
thomasl committed
203
add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA")
thomasl's avatar
thomasl committed
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219

if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
  set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10")
  set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn)
endif  (${RRC_ASN1_VERSION} STREQUAL "Rel8")

set (RRC_FULL_DIR ${asn1_generated_dir}/${RRC_ASN1_VERSION})
if(NOT EXISTS ${asn1c_call})
  message( FATAL_ERROR "The script ${asn1c_call} must be present" )
endif(NOT EXISTS ${asn1c_call})
execute_process(COMMAND ${asn1c_call}  ${RRC_FULL_DIR} ${RRC_GRAMMAR})
file(GLOB rrc_source ${RRC_FULL_DIR}/*.c)
set(rrc_source  ${rrc_source} ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c)
file(GLOB rrc_h ${RRC_FULL_DIR}/*.h)
set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h)
220
add_library(RRC_LIB ${rrc_h} ${rrc_source})
thomasl's avatar
thomasl committed
221 222 223 224 225 226 227 228 229 230 231 232 233 234
include_directories ("${RRC_FULL_DIR}")

# add the command to generate the source code
# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make
add_custom_command (
  OUTPUT ${RRC_FULL_DIR}/asn1_constants.h
  COMMAND ${asn1c_call}  ${RRC_FULL_DIR} ${RRC_GRAMMAR}
  DEPENDS ${RRC_GRAMMAR}
  )

# S1AP
# Same limitation as described in RRC: unknown generated file list
# so we generate it at cmake time
##############
thomasl's avatar
thomasl committed
235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254
add_list1_option(S1AP_VERSION R10 "S1AP Asn.1 grammar version" R8 R9 R10)

set(S1AP_DIR ${OPENAIRCN_DIR}/S1AP)
if (${S1AP_VERSION} STREQUAL "R10")
  set (ASN1RELDIR R10.5)
  add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10")
elseif (${S1AP_VERSION} STREQUAL "R9")
  set (ASN1RELDIR R9.8)
  add_definitions("-DUPDATE_RELEASE_9")
else(${S1AP_VERSION} STREQUAL "R8")
  set (ASN1RELDIR R8.10)
endif(${S1AP_VERSION} STREQUAL "R10")
set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(S1AP_ASN_FILES
  ${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn 
  ${S1AP_ASN_DIR}/S1AP-Constants.asn 
  ${S1AP_ASN_DIR}/S1AP-IEs.asn 
  ${S1AP_ASN_DIR}/S1AP-PDU.asn
  )
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
thomasl's avatar
thomasl committed
255
  
thomasl's avatar
thomasl committed
256 257
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES})
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
258

thomasl's avatar
thomasl committed
259 260 261 262 263 264 265
set(S1AP_OAI_generated 
  ${S1AP_C_DIR}/s1ap_decoder.c
  ${S1AP_C_DIR}/s1ap_encoder.c
  ${S1AP_C_DIR}/s1ap_xer_print.c
  ${S1AP_C_DIR}/s1ap_ies_defs.h
  )
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
266 267
set(s1ap_h ${s1ap_h} )

thomasl's avatar
thomasl committed
268 269 270 271 272 273
add_custom_command (
  OUTPUT ${S1AP_OAI_generated}
  COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
  COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
  DEPENDS ${S1AP_ASN_FILES} 
  )
274 275 276 277 278 279
add_library(S1AP_LIB 
  ${S1AP_OAI_generated} 
  ${S1AP_source}
  ${S1AP_DIR}/s1ap_common.c
  )

thomasl's avatar
thomasl committed
280 281
include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}")
thomasl's avatar
thomasl committed
282

283 284 285 286 287 288 289 290 291 292 293 294 295 296 297
add_library(S1AP_ENB
  ${S1AP_C_DIR}/s1ap_ies_defs.h
  ${S1AP_DIR}/s1ap_eNB.c
  ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c
  ${S1AP_DIR}/s1ap_eNB_decoder.c
  ${S1AP_DIR}/s1ap_eNB_encoder.c
  ${S1AP_DIR}/s1ap_eNB_handlers.c
  ${S1AP_DIR}/s1ap_eNB_itti_messaging.c
  ${S1AP_DIR}/s1ap_eNB_management_procedures.c
  ${S1AP_DIR}/s1ap_eNB_nas_procedures.c
  ${S1AP_DIR}/s1ap_eNB_nnsf.c
  ${S1AP_DIR}/s1ap_eNB_overload.c
  ${S1AP_DIR}/s1ap_eNB_trace.c
  ${S1AP_DIR}/s1ap_eNB_ue_context.c
  )
thomasl's avatar
thomasl committed
298

299 300 301 302 303 304 305 306 307 308 309
add_library(S1AP_EPC
  ${S1AP_C_DIR}/s1ap_ies_defs.h
  ${S1AP_DIR}/s1ap_mme_encoder.c
  ${S1AP_DIR}/s1ap_mme_decoder.c
  ${S1AP_DIR}/s1ap_mme_handlers.c
  ${S1AP_DIR}/s1ap_mme_nas_procedures.c
  ${S1AP_DIR}/s1ap_mme.c
  ${S1AP_DIR}/s1ap_mme_itti_messaging.c
  ${S1AP_DIR}/s1ap_mme_retransmission.c
  ${S1AP_DIR}/s1ap_mme_ta.c
  ) 
thomasl's avatar
thomasl committed
310 311
# Hardware dependant options
###################################
thomasl's avatar
thomasl committed
312 313 314 315 316 317 318
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TX "2" "Number of antennas in transmission" "1" "2" "4")
add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")

add_list2_option(RF_BOARD "EXMIMO" "RF head type" "False" "EXMIMO" "USRP" "ETHERNET")

if (${RF_BOARD} STREQUAL "EXMIMO")
thomasl's avatar
thomasl committed
319 320 321 322 323 324
  set(DRIVER2013)
  include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/")
  include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/")
  set(HW_SOURCE ${HW_SOURCE} 
    ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c 
    ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c)   
325

thomasl's avatar
thomasl committed
326
elseif (${RF_BOARD} STREQUAL "USRP")
thomasl's avatar
thomasl committed
327 328 329
  include_directories("/opt/include/uhd")
  LINK_DIRECTORIES("/opt/lib")
  set(option_USRP "uhd")
330

thomasl's avatar
thomasl committed
331
elseif (${RF_BOARD} STREQUAL "ETHERNET")
thomasl's avatar
thomasl committed
332
  include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
333

thomasl's avatar
thomasl committed
334
endif (${RF_BOARD} STREQUAL "EXMIMO")
thomasl's avatar
thomasl committed
335 336 337
 
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")

338 339 340 341
####################
# to be documented options
###################
add_boolean_option(ADDR_CONF False "specific to oaisim")
thomasl's avatar
thomasl committed
342
add_boolean_option(ASSERT True "???")
343
add_boolean_option(DISABLE_USE_NAS False "???")
344 345 346 347 348 349 350 351
add_boolean_option(DRIVER2013 True "????")
add_boolean_option(ENABLE_FXP True "????")
add_boolean_option(ENABLE_NAS_UE_LOGGING True "????")
add_boolean_option(ENABLE_NEW_MULTICAST False "specific to oaisim")
add_boolean_option(ENABLE_PDCP_NETLINK_FIFO False "????")
add_boolean_option(ENABLE_PGM_TRANSPORT False "specific to oaisim")
add_boolean_option(ENABLE_RAL False "????")
add_boolean_option(ENABLE_SECURITY True "???")
352
add_boolean_option(ENABLE_STANDALONE_EPC True "Compile MME, SGW and PGW in a single executable")
353
add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues")
354
add_boolean_option(ENABLE_USE_GTPU_IN_KERNEL True "as per name")
355
add_boolean_option(ENABLE_USE_MME True "???")
356 357 358
add_boolean_option(ENABLE_USE_NETFILTER_FOR_SGI False "SGI option")
add_boolean_option(ENABLE_USE_PCAP_FOR_SGI False "SGI option")
add_boolean_option(ENABLE_USE_RAW_SOCKET_FOR_SGI False "As per name")
359
add_boolean_option(ENABLE_VCD_FIFO True "Seems legacy: always true now")
thomasl's avatar
thomasl committed
360
add_boolean_option(ENB_MODE True "???")
thomasl's avatar
thomasl committed
361
add_boolean_option(EPC_BUILD False "???")
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376
add_boolean_option(HARD_RT False "???")
add_boolean_option(JUMBO_FRAME True "???")
add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120")
add_boolean_option(LINK_PDCP_TO_GTPV1U True "????")
add_boolean_option(LINUX_LIST False "???")
add_boolean_option(LINUX True "???")
add_boolean_option(LOCALIZATION  False "???")
add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true")
add_boolean_option(LOWLATENCY  True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
add_boolean_option(MAC_CONTEXT True "specific to oaisim")
add_integer_option(MAX_NUM_CCs 1 "????")
add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS True "????")
add_boolean_option(MU_RECEIVER False "????")
add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
add_boolean_option(NAS_MME False "NAS_UE and NAS_MME are incompatible options")
377
add_boolean_option(NAS_NETLINK False "???? Must be True to compile nasmesh driver without rtai")
378 379 380 381
add_boolean_option(NAS_UE True "NAS_UE and NAS_MME are incompatible options")
add_boolean_option(NEW_FFT True "????")
add_boolean_option(NO_RRM True "????")
add_boolean_option(OAI_EMU False "specific to oaisim")
thomasl's avatar
thomasl committed
382
add_boolean_option(OAISIM False "specific to oaisim")
383
add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
384
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
385 386 387 388 389 390 391 392 393
add_boolean_option(OPENAIR1 True "????")
add_boolean_option(OPENAIR2 True "????")
add_boolean_option(OPENAIR_EMU False "specific to oaisim")
add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true")
add_boolean_option(PBS_SIM False "????")
add_boolean_option(PC_DSP True "????")
add_boolean_option(PC_TARGET True "????")
add_boolean_option(PERFECT_CE False "????")
add_boolean_option(PHY_ABSTRACTION False "specific to oaisim")
thomasl's avatar
thomasl committed
394
add_boolean_option(PHY_CONTEXT True "not clear: must remain False for dlsim")
395
add_boolean_option(PHY_EMUL False "not clear: must remain False for dlsim")
thomasl's avatar
thomasl committed
396
add_boolean_option(PHYSIM True "??? set in lte-softmodem, for L1 simulators dlsim, ulsim, ...?")
397 398 399 400 401 402
add_boolean_option(PUCCH True "????")
add_boolean_option(RANDOM_BF False "????")
add_boolean_option(RLC_STOP_ON_LOST_PDU False "Fatal assert in this case")
add_boolean_option(SECU False "???")
add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator")
add_boolean_option(SPECTRA False "???")
thomasl's avatar
thomasl committed
403
add_boolean_option(UE_BUILD True "????")
404
add_boolean_option(USE_3GPP_ADDR_AS_LINK_ADDR False "As per attribute name")
405
add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c")
406
add_boolean_option(USER_MODE True "????")
407
add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name")
408 409 410 411 412 413 414 415

add_boolean_option(EMOS False "????")
if(${EMOS})
  add_definitions("-D_FILE_OFFSET_BITS=64")
  set(EMOS_LIB gps)
endif(${EMOS})


thomasl's avatar
thomasl committed
416 417 418 419 420 421 422 423 424 425 426 427 428
 # add the binary tree to the search path for include files
#######################################################
# We will find ConfigOAI.h after generation in target directory
include_directories("${OPENAIR_BIN_DIR}")
# add directories to find all include files
# the internal rule is to use generic names such as defs.h 
# but to make it uniq name as adding the relative path in the include directtive
# example: #include "RRC/LITE/defs.h"
#find_path (include_dirs_all *.h ${OPENAIR_DIR})
#find_path (include_dirs_all *.h PATHS /usr/include NO_CMAKE_PATH)
#include_directories("${include_dirs_all}")

# Legacy exact order
429 430 431 432 433 434 435 436 437 438 439 440 441
if(ENB_MODE)
  include_directories("${OPENAIR2_DIR}/COMMON")
  include_directories("${OPENAIR2_DIR}/UTIL")
  include_directories("${OPENAIR2_DIR}/UTIL/LOG")
  include_directories("${OPENAIRCN_DIR}/COMMON")
  include_directories("${OPENAIRCN_DIR}/UTILS")
else()
  include_directories("${OPENAIRCN_DIR}/COMMON")
  include_directories("${OPENAIRCN_DIR}/UTILS")
  include_directories("${OPENAIR2_DIR}/COMMON")
  include_directories("${OPENAIR2_DIR}/UTIL")
  include_directories("${OPENAIR2_DIR}/UTIL/LOG")
endif()
thomasl's avatar
thomasl committed
442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490
include_directories("${OPENAIR1_DIR}")
include_directories("${OPENAIR2_DIR}/NAS")
include_directories("${OPENAIR2_DIR}")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0")
include_directories("${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0")
include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES")
include_directories("${OPENAIR2_DIR}/RRC/LITE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/INTERFACE-802.21/INCLUDE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_ENB/INCLUDE")
include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_UE/INCLUDE")
include_directories("${OPENAIR_DIR}/common/utils")
include_directories("${OPENAIR_DIR}/common/utils/itti")
include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/api/network")
include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/include")
include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/ies")
include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/emm/msg")
include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/esm/msg")
include_directories("${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/util")
include_directories("${OPENAIRCN_DIR}/SECU")
include_directories("${OPENAIRCN_DIR}/SCTP")
include_directories("${OPENAIR2_DIR}/X2AP")
include_directories("${OPENAIRCN_DIR}/S1AP")
include_directories("${OPENAIRCN_DIR}/UDP")
include_directories("${OPENAIRCN_DIR}/GTPV1-U")
include_directories("${OPENAIR_DIR}/targets/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS")
include_directories("${OPENAIR2_DIR}/ENB_APP")
include_directories("${OPENAIR2_DIR}/UTIL/OSA")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
include_directories("${OPENAIR2_DIR}/UTIL/MEM")
include_directories("${OPENAIR2_DIR}/UTIL/LISTS")
include_directories("${OPENAIR2_DIR}/UTIL/FIFO")
include_directories("${OPENAIR2_DIR}/UTIL/OCG")
include_directories("${OPENAIR2_DIR}/UTIL/MATH")
include_directories("${OPENAIR2_DIR}/UTIL/TIMER")
include_directories("${OPENAIR2_DIR}/UTIL/OMG")
include_directories("${OPENAIR2_DIR}/UTIL/OTG")
include_directories("${OPENAIR2_DIR}/UTIL/CLI")
include_directories("${OPENAIR2_DIR}/UTIL/OPT")
include_directories("${OPENAIR2_DIR}/UTIL/OMV")
include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES")
include_directories("${OPENAIRCN_DIR}/NAS")
include_directories("${OPENAIRCN_DIR}/GTPV1-U/nw-gtpv1u/shared")
include_directories("${OPENAIRCN_DIR}/GTPV1-U/nw-gtpv1u/include")
491 492 493 494 495
include_directories("${OPENAIRCN_DIR}/SGW-LITE")
include_directories("${OPENAIRCN_DIR}/MME_APP")
include_directories("${OPENAIRCN_DIR}/SGI")
include_directories("${OPENAIRCN_DIR}/S6A")
include_directories("${OPENAIR_DIR}")
thomasl's avatar
thomasl committed
496 497 498

# Utilities Library
################
499
add_library(HASHTABLE
thomasl's avatar
thomasl committed
500 501
  ${OPENAIRCN_DIR}/UTILS/HASHTABLE/hashtable.c
  ${OPENAIRCN_DIR}/UTILS/HASHTABLE/obj_hashtable.c
502
)
thomasl's avatar
thomasl committed
503
include_directories(${OPENAIRCN_DIR}/UTILS/HASHTABLE)
504 505

set(UTIL_SRC 
thomasl's avatar
thomasl committed
506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543
  ${OPENAIR2_DIR}/UTIL/CLI/cli.c
  ${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c
  ${OPENAIR2_DIR}/UTIL/CLI/cli_server.c
  ${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c
  ${OPENAIR2_DIR}/UTIL/LISTS/list.c
  ${OPENAIR2_DIR}/UTIL/LISTS/list2.c
  ${OPENAIR2_DIR}/UTIL/LOG/log.c
  ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c
  ${OPENAIR2_DIR}/UTIL/MATH/oml.c
  ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c
  ${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c
  ${OPENAIR2_DIR}/UTIL/OMG/client_traci_OMG.c
  ${OPENAIR2_DIR}/UTIL/OMG/common.c
  ${OPENAIR2_DIR}/UTIL/OMG/grid.c
  ${OPENAIR2_DIR}/UTIL/OMG/id_manager.c
  ${OPENAIR2_DIR}/UTIL/OMG/job.c
  ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c
  ${OPENAIR2_DIR}/UTIL/OMG/omg.c
  ${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c
  ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c
  ${OPENAIR2_DIR}/UTIL/OMG/rwp.c
  ${OPENAIR2_DIR}/UTIL/OMG/socket_traci_OMG.c
  ${OPENAIR2_DIR}/UTIL/OMG/static.c
  ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c
  ${OPENAIR2_DIR}/UTIL/OMG/storage_traci_OMG.c
  ${OPENAIR2_DIR}/UTIL/OMG/trace.c
  ${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c
  ${OPENAIR2_DIR}/UTIL/OPT/probe.c
  ${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c
  ${OPENAIR2_DIR}/UTIL/OTG/otg.c
  ${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c
  ${OPENAIR2_DIR}/UTIL/OTG/otg_models.c
544 545
  ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c
  ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c
thomasl's avatar
thomasl committed
546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571
  )
add_library(UTIL ${UTIL_SRC})

set(SECU_OSA_SRC
  ${OPENAIR2_DIR}/UTIL/OSA/osa_key_deriver.c
  ${OPENAIR2_DIR}/UTIL/OSA/osa_rijndael.c
  ${OPENAIR2_DIR}/UTIL/OSA/osa_snow3g.c
  ${OPENAIR2_DIR}/UTIL/OSA/osa_stream_eea.c
  ${OPENAIR2_DIR}/UTIL/OSA/osa_stream_eia.c
  )
add_library(SECU_OSA ${SECU_OSA_SRC})

set(SECU_CN_SRC
  ${OPENAIRCN_DIR}/SECU/kdf.c
  ${OPENAIRCN_DIR}/SECU/rijndael.c
  ${OPENAIRCN_DIR}/SECU/snow3g.c
  ${OPENAIRCN_DIR}/SECU/key_nas_deriver.c
  ${OPENAIRCN_DIR}/SECU/nas_stream_eea1.c
  ${OPENAIRCN_DIR}/SECU/nas_stream_eia1.c
  ${OPENAIRCN_DIR}/SECU/nas_stream_eea2.c
  ${OPENAIRCN_DIR}/SECU/nas_stream_eia2.c
  )
add_library(SECU_CN ${SECU_CN_SRC})

# Scheduler
################################"
thomasl's avatar
thomasl committed
572 573
file(GLOB SCHED_SRC ${OPENAIR1_DIR}/SCHED/*.c)
add_library(SCHED_LIB ${SCHED_SRC})
thomasl's avatar
thomasl committed
574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750

# Layer 1
#############################
set(PHY_SRC 
  # depend on code generation from asn1c
  ${RRC_FULL_DIR}/asn1_constants.h
  # actual source
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c
  ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c
  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c
  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c
  ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c
  ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c
  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c
  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c
  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c
  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c
  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c
  ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c
  ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
  ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
  ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
  ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
  ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
  ${OPENAIR1_DIR}/PHY/CODING/rate_matching.c
  ${OPENAIR1_DIR}/PHY/CODING/viterbi.c
  ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
  ${OPENAIR1_DIR}/PHY/INIT/lte_init.c
  ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c
  ${OPENAIR1_DIR}/PHY/INIT/init_top.c
  ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c
  ${OPENAIR1_DIR}/PHY/TOOLS/fft.c
  ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c
  ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c
  ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c
  ${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c
  ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c
  ${OPENAIR1_DIR}/PHY/TOOLS/cdot_prod.c
  ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c
  ${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c
  ${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c
  ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c
  ${OPENAIR1_DIR}/PHY/TOOLS/lut.c
  )
if (${SMBV})
  set(PHY_SRC "${PHY_SRC} ${OPENAIR1_DIR}/PHY/TOOLS/smbv.c")
endif  (${SMBV})
add_library(PHY ${PHY_SRC})

#Layer 2 library
#####################
set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC)
set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC)
set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0)
set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0)
set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0)
set(RRC_DIR ${OPENAIR2_DIR}/RRC/LITE)
set(PDCP_DIR  ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0)
set(L2_SRC
  ${OPENAIR2_DIR}/LAYER2/openair2_proc.c
  ${PDCP_DIR}/pdcp.c
  ${PDCP_DIR}/pdcp_fifo.c
  ${PDCP_DIR}/pdcp_sequence_manager.c
  ${PDCP_DIR}/pdcp_primitives.c
  ${PDCP_DIR}/pdcp_util.c
  ${PDCP_DIR}/pdcp_security.c
  ${PDCP_DIR}/pdcp_netlink.c
  ${RLC_AM_DIR}/rlc_am.c
  ${RLC_AM_DIR}/rlc_am_init.c
  ${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c
  ${RLC_AM_DIR}/rlc_am_timer_reordering.c
  ${RLC_AM_DIR}/rlc_am_timer_status_prohibit.c
  ${RLC_AM_DIR}/rlc_am_segment.c
  ${RLC_AM_DIR}/rlc_am_segments_holes.c
  ${RLC_AM_DIR}/rlc_am_in_sdu.c
  ${RLC_AM_DIR}/rlc_am_receiver.c
  ${RLC_AM_DIR}/rlc_am_retransmit.c
  ${RLC_AM_DIR}/rlc_am_windows.c
  ${RLC_AM_DIR}/rlc_am_rx_list.c
  ${RLC_AM_DIR}/rlc_am_reassembly.c
  ${RLC_AM_DIR}/rlc_am_status_report.c
  ${RLC_TM_DIR}/rlc_tm.c
  ${RLC_TM_DIR}/rlc_tm_init.c
  ${RLC_UM_DIR}/rlc_um.c
  ${RLC_UM_DIR}/rlc_um_fsm.c
  ${RLC_UM_DIR}/rlc_um_control_primitives.c
  ${RLC_UM_DIR}/rlc_um_segment.c
  ${RLC_UM_DIR}/rlc_um_reassembly.c
  ${RLC_UM_DIR}/rlc_um_receiver.c
  ${RLC_UM_DIR}/rlc_um_dar.c
  ${RLC_DIR}/rlc_mac.c
  ${RLC_DIR}/rlc.c
  ${RLC_DIR}/rlc_rrc.c
  ${RLC_DIR}/rlc_mpls.c
  ${RRC_DIR}/rrc_UE.c
  ${RRC_DIR}/rrc_eNB.c
  ${RRC_DIR}/rrc_eNB_S1AP.c
  ${RRC_DIR}/rrc_common.c
  ${RRC_DIR}/L2_interface.c
  )
set (MAC_SRC
  ${MAC_DIR}/lte_transport_init.c
  ${MAC_DIR}/main.c
  ${MAC_DIR}/ue_procedures.c
  ${MAC_DIR}/ra_procedures.c
  ${MAC_DIR}/l1_helpers.c
  ${MAC_DIR}/rar_tools.c
  ${MAC_DIR}/eNB_scheduler.c
  ${MAC_DIR}/eNB_scheduler_dlsch.c
  ${MAC_DIR}/eNB_scheduler_ulsch.c
  ${MAC_DIR}/eNB_scheduler_mch.c
  ${MAC_DIR}/eNB_scheduler_bch.c
  ${MAC_DIR}/eNB_scheduler_primitives.c
  ${MAC_DIR}/eNB_scheduler_RA.c
  ${MAC_DIR}/pre_processor.c
  ${MAC_DIR}/config.c
  )

set (ENB_APP_SRC
  ${OPENAIR2_DIR}/ENB_APP/enb_app.c
  ${OPENAIR2_DIR}/ENB_APP/enb_config.c
  )

add_library(L2 
  ${L2_SRC} 
  ${MAC_SRC} 
  ${ENB_APP_SRC}
  ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)

# L3 Libs
##########################

set(RAL_LTE_DIR ${OPENAIR3_DIR}/RAL-LTE/)
751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794
if (${ENABLE_RAL})
  set(RAL_LTE_SRC
    ${RRC_DIR}/rrc_UE_ral.c
    ${RRC_DIR}/rrc_eNB_ral.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_action.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_main.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_parameters.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_process.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_subscribe.c
    ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_thresholds.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_action.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_main.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_mih_msg.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_parameters.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_process.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_rrc_msg.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_subscribe.c
    ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_thresholds.c
    )
  add_library(RAL ${RAL_LTE_SRC})
  set(RAL_LIB RAL)
endif()

if(MIH_C_MEDIEVAL_EXTENSIONS)
  set(MIH_SRC
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_header_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_msg_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_primitive_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F1_basic_data_types_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F2_general_data_types_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F3_data_types_for_address_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F4_data_types_for_links_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F9_data_types_for_qos_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_F13_data_types_for_information_elements_codec.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_L2_type_values_for_tlv_encoding.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_Medieval_extensions.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C_bit_buffer.c
    ${RAL_LTE_DIR}INTERFACE-802.21/C/MIH_C.c
    )
  add_library(MIH ${MIH_SRC})
  set(MIH_LIB MIH)
endif()
thomasl's avatar
thomasl committed
795 796 797

# CN libs
##########################
798 799 800 801 802 803 804 805 806 807 808

add_library(CN_UTILS 
  ${OPENAIRCN_DIR}/UTILS/conversions.c
  ${OPENAIRCN_DIR}/UTILS/enum_string.c
  ${OPENAIRCN_DIR}/UTILS/log.c
  ${OPENAIRCN_DIR}/UTILS/mme_config.c
  ${OPENAIRCN_DIR}/UTILS/mcc_mnc_itu.c
  )
  
set(GTPV1U_DIR ${OPENAIRCN_DIR}/GTPV1-U)
set (GTPV1U_SRC
thomasl's avatar
thomasl committed
809
  ${RRC_DIR}/rrc_eNB_GTPV1U.c
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870
  ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c
  ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c
  ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c
  ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c
  ${GTPV1U_DIR}/gtpv1u_teid_pool.c
)
add_library(GTPV1U ${GTPV1U_SRC})

set(GTPV2C_DIR  ${OPENAIRCN_DIR}/GTPV2-C/nwgtpv2c-0.11/src)
add_library(GTPV2C
  ${GTPV2C_DIR}/NwGtpv2cTrxn.c
  ${GTPV2C_DIR}/NwGtpv2cTunnel.c
  ${GTPV2C_DIR}/NwGtpv2cMsg.c
  ${GTPV2C_DIR}/NwGtpv2cMsgIeParseInfo.c
  ${GTPV2C_DIR}/NwGtpv2cMsgParser.c
  ${GTPV2C_DIR}/NwGtpv2c.c
  )
include_directories(${OPENAIRCN_DIR}/GTPV2-C/nwgtpv2c-0.11/include/)
include_directories(${OPENAIRCN_DIR}/GTPV2-C/nwgtpv2c-0.11/shared/)

execute_process(
  COMMAND /sbin/iptables -V 
  OUTPUT_VARIABLE iptables_version
  )
string(REGEX REPLACE "[a-zA-Z .\r\n]" "" IPTVERSION ${iptables_version})
string(REGEX REPLACE "[a-zA-Z \r\n]" "" IPTABLES_VERSION_STRING ${iptables_version})

# From original Polaris code, added _lib because cmake doesn't accept two targets with the same name
# and the driver is also named xt_GTPUAH
# the _lib suffix is removed during installation in /lib/xtables
add_library(xt_GTPUAH_lib SHARED ${OPENAIRCN_DIR}/GTPV1-U/GTPUAH/libxt_GTPUAH.c)
target_compile_definitions(xt_GTPUAH_lib PRIVATE 
-D_LARGEFILE_SOURCE=1 
-D_LARGE_FILES 
-D_FILE_OFFSET_BITS=64 
-D_REENTRANT 
-D_INIT=libxt_GTPUAH_init 
-DKVERSION=3
-DPIC 
IPTVERSION=${IPTVERSION} -DIPTABLES_VERSION_STRING=\"${IPTABLES_VERSION_STRING}\"
)


add_library(xt_GTPURH_lib SHARED ${OPENAIRCN_DIR}/GTPV1-U/GTPURH/libxt_GTPURH.c)
target_compile_definitions(xt_GTPURH_lib PRIVATE
-D_LARGEFILE_SOURCE=1 
-D_LARGE_FILES 
-D_FILE_OFFSET_BITS=64 
-D_REENTRANT 
-D_INIT=libxt_GTPURH_init 
-DKVERSION=3
-DPIC 
-DIPTVERSION=${IPTVERSION} -DIPTABLES_VERSION_STRING=${IPTABLES_VERSION_STRING}
)

set(SGI_DIR  ${OPENAIRCN_DIR}/SGI)
set(SGI_SRC
  ${SGI_DIR}/sgi_task.c
  ${SGI_DIR}/sgi_socket.c
  ${SGI_DIR}/sgi_egress.c
  ${SGI_DIR}/sgi_util.c 
thomasl's avatar
thomasl committed
871
)
872 873 874 875 876 877 878 879 880 881 882 883 884 885
if(ENABLE_USE_PCAP_FOR_SGI)
  set(SGI_SRC ${SGI_SRC}
    ${SGI_DIR}/sgi_pcap.c
    )
  set(SGI_option_lib ${SGI_option_lib} pcap)
endif()
if (ENABLE_USE_NETFILTER_FOR_SGI)
  set(SGI_SRC ${SGI_SRC}
    ${SGI_DIR}/sgi_nf.c
    )
  set(SGI_option_lib ${SGI_option_lib} netfilter_queue nfnetlink)
endif()
add_library(SGI ${SGI_SRC})

thomasl's avatar
thomasl committed
886 887 888 889 890
set(SCTP_SRC
  ${OPENAIRCN_DIR}/SCTP/sctp_common.c
  ${OPENAIRCN_DIR}/SCTP/sctp_eNB_task.c
  ${OPENAIRCN_DIR}/SCTP/sctp_eNB_itti_messaging.c
)
891 892 893 894 895 896 897 898
add_library(SCTP_CLIENT ${SCTP_SRC})

add_library(SCTP_SERVER
  ${OPENAIRCN_DIR}/SCTP/sctp_common.c
  ${OPENAIRCN_DIR}/SCTP/sctp_itti_messaging.c
  ${OPENAIRCN_DIR}/SCTP/sctp_primitives_server.c
  )

thomasl's avatar
thomasl committed
899 900 901

add_library(UDP ${OPENAIRCN_DIR}/UDP/udp_eNB_task.c)

902 903 904 905 906 907 908 909 910 911 912 913
add_library(UDP_SERVER ${OPENAIRCN_DIR}/UDP/udp_primitives_server.c)

set(S11_DIR ${OPENAIRCN_DIR}/S11)
add_library(S11	
  ${S11_DIR}/s11_common.c
  ${S11_DIR}/s11_ie_formatter.c
  ${S11_DIR}/s11_mme_task.c
  ${S11_DIR}/s11_sgw.c
  ${S11_DIR}/s11_mme_session_manager.c
  ${S11_DIR}/s11_sgw_session_manager.c
  ${S11_DIR}/s11_sgw_bearer_manager.c
)
thomasl's avatar
thomasl committed
914
include_directories(${S11_DIR})
915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935

set(S6A_DIR ${OPENAIRCN_DIR}/S6A)
add_library(S6A
  ${S6A_DIR}/s6a_auth_info.c
  ${S6A_DIR}/s6a_dict.c
  ${S6A_DIR}/s6a_error.c
  ${S6A_DIR}/s6a_peer.c
  ${S6A_DIR}/s6a_subscription_data.c
  ${S6A_DIR}/s6a_task.c
  ${S6A_DIR}/s6a_up_loc.c
  )

set(SGW_DIR ${OPENAIRCN_DIR}/SGW-LITE)
add_library (SGW
  ${SGW_DIR}/spgw_config.c
  ${SGW_DIR}/s11_causes.c
  ${SGW_DIR}/sgw_lite_task.c
  ${SGW_DIR}/sgw_lite_handlers.c
  ${SGW_DIR}/sgw_lite_context_manager.c
  ${SGW_DIR}/pgw_lite_paa.c
  )
thomasl's avatar
thomasl committed
936

937 938 939 940 941 942 943 944 945 946 947 948 949
set(MME_DIR ${OPENAIRCN_DIR}/MME_APP)
add_library(MME_APP
  ${MME_DIR}/mme_app_capabilities.c
  ${MME_DIR}/mme_app_context.c
  ${MME_DIR}/mme_app_main.c
  ${MME_DIR}/mme_app_bearer.c
  ${MME_DIR}/mme_app_authentication.c
  ${MME_DIR}/mme_app_location.c
  ${MME_DIR}/mme_app_statistics.c
  ${MME_DIR}/s6a_2_nas_cause.c
  )

set(NAS_SRC ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/src/)
thomasl's avatar
thomasl committed
950 951 952
set(libnas_api_OBJS
  ${NAS_SRC}api/mme/mme_api.c
  ${NAS_SRC}api/network/nas_message.c
953 954
  ${NAS_SRC}api/network/as_message.c
  ${NAS_SRC}api/network/network_api.c
thomasl's avatar
thomasl committed
955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189
  )

set(libnas_emm_OBJS
  ${NAS_SRC}emm/Attach.c
  ${NAS_SRC}emm/Authentication.c
  ${NAS_SRC}emm/Detach.c
  ${NAS_SRC}emm/EmmCommon.c
  ${NAS_SRC}emm/emm_data_ctx.c
  ${NAS_SRC}emm/emm_main.c
  ${NAS_SRC}emm/EmmStatusHdl.c
  ${NAS_SRC}emm/Identification.c
  ${NAS_SRC}emm/IdleMode.c
  ${NAS_SRC}emm/LowerLayer.c
  ${NAS_SRC}emm/SecurityModeControl.c
  ${NAS_SRC}emm/ServiceRequestHdl.c
  ${NAS_SRC}emm/TrackingAreaUpdate.c
  )
  
set(libnas_emm_msg_OBJS
  ${NAS_SRC}emm/msg/AttachAccept.c
  ${NAS_SRC}emm/msg/AuthenticationFailure.c
  ${NAS_SRC}emm/msg/CsServiceNotification.c
  ${NAS_SRC}emm/msg/ExtendedServiceRequest.c
  ${NAS_SRC}emm/msg/IdentityResponse.c
  ${NAS_SRC}emm/msg/EmmInformation.c
  ${NAS_SRC}emm/msg/ServiceReject.c
  ${NAS_SRC}emm/msg/TrackingAreaUpdateReject.c
  ${NAS_SRC}emm/msg/AttachComplete.c
  ${NAS_SRC}emm/msg/AuthenticationReject.c
  ${NAS_SRC}emm/msg/DetachAccept.c
  ${NAS_SRC}emm/msg/GutiReallocationCommand.c
  ${NAS_SRC}emm/msg/emm_msg.c
  ${NAS_SRC}emm/msg/SecurityModeCommand.c
  ${NAS_SRC}emm/msg/ServiceRequest.c
  ${NAS_SRC}emm/msg/TrackingAreaUpdateRequest.c
  ${NAS_SRC}emm/msg/AttachReject.c
  ${NAS_SRC}emm/msg/AuthenticationRequest.c
  ${NAS_SRC}emm/msg/DetachRequest.c
  ${NAS_SRC}emm/msg/GutiReallocationComplete.c
  ${NAS_SRC}emm/msg/SecurityModeComplete.c
  ${NAS_SRC}emm/msg/TrackingAreaUpdateAccept.c
  ${NAS_SRC}emm/msg/UplinkNasTransport.c
  ${NAS_SRC}emm/msg/AttachRequest.c
  ${NAS_SRC}emm/msg/AuthenticationResponse.c
  ${NAS_SRC}emm/msg/DownlinkNasTransport.c
  ${NAS_SRC}emm/msg/EmmStatus.c
  ${NAS_SRC}emm/msg/IdentityRequest.c
  ${NAS_SRC}emm/msg/SecurityModeReject.c
  ${NAS_SRC}emm/msg/TrackingAreaUpdateComplete.c
)

set(libnas_emm_sap_OBJS
  ${NAS_SRC}emm/sap/emm_as.c
  ${NAS_SRC}emm/sap/emm_cn.c
  ${NAS_SRC}emm/sap/EmmDeregisteredNoImsi.c
  ${NAS_SRC}emm/sap/emm_reg.c
  ${NAS_SRC}emm/sap/EmmRegisteredUpdateNeeded.c
  ${NAS_SRC}emm/sap/EmmDeregisteredNormalService.c
  ${NAS_SRC}emm/sap/emm_sap.c
  ${NAS_SRC}emm/sap/EmmDeregisteredPlmnSearch.c
  ${NAS_SRC}emm/sap/emm_esm.c
  ${NAS_SRC}emm/sap/EmmRegisteredAttemptingToUpdate.c
  ${NAS_SRC}emm/sap/emm_send.c
  ${NAS_SRC}emm/sap/EmmCommonProcedureInitiated.c
  ${NAS_SRC}emm/sap/EmmRegistered.c
  ${NAS_SRC}emm/sap/EmmDeregisteredAttachNeeded.c
  ${NAS_SRC}emm/sap/EmmRegisteredImsiDetachInitiated.c
  ${NAS_SRC}emm/sap/EmmServiceRequestInitiated.c
  ${NAS_SRC}emm/sap/EmmDeregisteredAttemptingToAttach.c
  ${NAS_SRC}emm/sap/emm_fsm.c
  ${NAS_SRC}emm/sap/EmmRegisteredInitiated.c
  ${NAS_SRC}emm/sap/EmmTrackingAreaUpdatingInitiated.c
  ${NAS_SRC}emm/sap/EmmDeregistered.c
  ${NAS_SRC}emm/sap/EmmRegisteredLimitedService.c
  ${NAS_SRC}emm/sap/EmmDeregisteredInitiated.c
  ${NAS_SRC}emm/sap/EmmNull.c
  ${NAS_SRC}emm/sap/EmmRegisteredNoCellAvailable.c
  ${NAS_SRC}emm/sap/EmmDeregisteredLimitedService.c
  ${NAS_SRC}emm/sap/emm_recv.c
  ${NAS_SRC}emm/sap/EmmRegisteredNormalService.c
  ${NAS_SRC}emm/sap/EmmDeregisteredNoCellAvailable.c
  ${NAS_SRC}emm/sap/EmmRegisteredPlmnSearch.c
)

set (libnas_esm_OBJS
  ${NAS_SRC}esm/esm_ebr_context.c
  ${NAS_SRC}esm/PdnConnectivity.c
  ${NAS_SRC}esm/esm_ebr.c
  ${NAS_SRC}esm/EpsBearerContextDeactivation.c
  ${NAS_SRC}esm/DefaultEpsBearerContextActivation.c
  ${NAS_SRC}esm/DedicatedEpsBearerContextActivation.c
  ${NAS_SRC}esm/PdnDisconnect.c
  ${NAS_SRC}esm/EsmStatusHdl.c
  ${NAS_SRC}esm/esm_main.c
  ${NAS_SRC}esm/esm_pt.c
  ${NAS_SRC}esm/esm_ip.c
)

set(libnas_esm_msg_OBJS
  ${NAS_SRC}esm/msg/ModifyEpsBearerContextRequest.c
  ${NAS_SRC}esm/msg/DeactivateEpsBearerContextRequest.c
  ${NAS_SRC}esm/msg/BearerResourceAllocationReject.c
  ${NAS_SRC}esm/msg/BearerResourceModificationRequest.c
  ${NAS_SRC}esm/msg/ActivateDedicatedEpsBearerContextRequest.c
  ${NAS_SRC}esm/msg/EsmInformationResponse.c
  ${NAS_SRC}esm/msg/PdnDisconnectReject.c
  ${NAS_SRC}esm/msg/ActivateDedicatedEpsBearerContextAccept.c
  ${NAS_SRC}esm/msg/PdnDisconnectRequest.c
  ${NAS_SRC}esm/msg/BearerResourceModificationReject.c
  ${NAS_SRC}esm/msg/ActivateDefaultEpsBearerContextAccept.c
  ${NAS_SRC}esm/msg/ActivateDedicatedEpsBearerContextReject.c
  ${NAS_SRC}esm/msg/ModifyEpsBearerContextAccept.c
  ${NAS_SRC}esm/msg/DeactivateEpsBearerContextAccept.c
  ${NAS_SRC}esm/msg/esm_msg.c
  ${NAS_SRC}esm/msg/EsmInformationRequest.c
  ${NAS_SRC}esm/msg/ActivateDefaultEpsBearerContextRequest.c
  ${NAS_SRC}esm/msg/ModifyEpsBearerContextReject.c
  ${NAS_SRC}esm/msg/EsmStatus.c
  ${NAS_SRC}esm/msg/PdnConnectivityReject.c
  ${NAS_SRC}esm/msg/ActivateDefaultEpsBearerContextReject.c
  ${NAS_SRC}esm/msg/PdnConnectivityRequest.c
  ${NAS_SRC}esm/msg/BearerResourceAllocationRequest.c
)
  
set(libnas_esm_sap_OBJS
  ${NAS_SRC}esm/sap/esm_recv.c
  ${NAS_SRC}esm/sap/esm_send.c
  ${NAS_SRC}esm/sap/esm_sap.c
)

set(libnas_ies_OBJS
  ${NAS_SRC}ies/UeSecurityCapability.c
  ${NAS_SRC}ies/SecurityHeaderType.c
  ${NAS_SRC}ies/RadioPriority.c
  ${NAS_SRC}ies/EpsAttachResult.c
  ${NAS_SRC}ies/ImeisvRequest.c
  ${NAS_SRC}ies/EmergencyNumberList.c
  ${NAS_SRC}ies/SupportedCodecList.c
  ${NAS_SRC}ies/EsmCause.c
  ${NAS_SRC}ies/NetworkName.c
  ${NAS_SRC}ies/AuthenticationResponseParameter.c
  ${NAS_SRC}ies/Cli.c
  ${NAS_SRC}ies/AccessPointName.c
  ${NAS_SRC}ies/DaylightSavingTime.c
  ${NAS_SRC}ies/LcsIndicator.c
  ${NAS_SRC}ies/PagingIdentity.c
  ${NAS_SRC}ies/EpsMobileIdentity.c
  ${NAS_SRC}ies/GutiType.c
  ${NAS_SRC}ies/NasKeySetIdentifier.c
  ${NAS_SRC}ies/CsfbResponse.c
  ${NAS_SRC}ies/PacketFlowIdentifier.c
  ${NAS_SRC}ies/ApnAggregateMaximumBitRate.c
  ${NAS_SRC}ies/EpsBearerContextStatus.c
  ${NAS_SRC}ies/MobileIdentity.c
  ${NAS_SRC}ies/AuthenticationFailureParameter.c
  ${NAS_SRC}ies/EpsUpdateResult.c
  ${NAS_SRC}ies/TimeZone.c
  ${NAS_SRC}ies/MessageType.c
  ${NAS_SRC}ies/EmmCause.c
  ${NAS_SRC}ies/MobileStationClassmark2.c
  ${NAS_SRC}ies/AuthenticationParameterRand.c
  ${NAS_SRC}ies/PdnAddress.c
  ${NAS_SRC}ies/MobileStationClassmark3.c
  ${NAS_SRC}ies/ServiceType.c
  ${NAS_SRC}ies/NasRequestType.c
  ${NAS_SRC}ies/PlmnList.c
  ${NAS_SRC}ies/EpsQualityOfService.c
  ${NAS_SRC}ies/NasMessageContainer.c
  ${NAS_SRC}ies/EsmInformationTransferFlag.c
  ${NAS_SRC}ies/TrafficFlowTemplate.c
  ${NAS_SRC}ies/LinkedEpsBearerIdentity.c
  ${NAS_SRC}ies/NasSecurityAlgorithms.c
  ${NAS_SRC}ies/LlcServiceAccessPointIdentifier.c
  ${NAS_SRC}ies/ShortMac.c
  ${NAS_SRC}ies/TrafficFlowAggregateDescription.c
  ${NAS_SRC}ies/PTmsiSignature.c
  ${NAS_SRC}ies/ProtocolDiscriminator.c
  ${NAS_SRC}ies/EpsBearerIdentity.c
  ${NAS_SRC}ies/TimeZoneAndTime.c
  ${NAS_SRC}ies/TrackingAreaIdentityList.c
  ${NAS_SRC}ies/QualityOfService.c
  ${NAS_SRC}ies/EpsUpdateType.c
  ${NAS_SRC}ies/PdnType.c
  ${NAS_SRC}ies/UeRadioCapabilityInformationUpdateNeeded.c
  ${NAS_SRC}ies/AuthenticationParameterAutn.c
  ${NAS_SRC}ies/EpsAttachType.c
  ${NAS_SRC}ies/IdentityType2.c
  ${NAS_SRC}ies/LcsClientIdentity.c
  ${NAS_SRC}ies/DetachType.c
  ${NAS_SRC}ies/LocationAreaIdentification.c
  ${NAS_SRC}ies/TrackingAreaIdentity.c
  ${NAS_SRC}ies/CipheringKeySequenceNumber.c
  ${NAS_SRC}ies/MsNetworkCapability.c
  ${NAS_SRC}ies/UeNetworkCapability.c
  ${NAS_SRC}ies/ProtocolConfigurationOptions.c
  ${NAS_SRC}ies/AdditionalUpdateType.c
  ${NAS_SRC}ies/TmsiStatus.c
  ${NAS_SRC}ies/EsmMessageContainer.c
  ${NAS_SRC}ies/Nonce.c
  ${NAS_SRC}ies/ProcedureTransactionIdentity.c
  ${NAS_SRC}ies/TransactionIdentifier.c
  ${NAS_SRC}ies/AdditionalUpdateResult.c
  ${NAS_SRC}ies/GprsTimer.c
  ${NAS_SRC}ies/EpsNetworkFeatureSupport.c
  ${NAS_SRC}ies/SsCode.c
  ${NAS_SRC}ies/DrxParameter.c
  ${NAS_SRC}ies/KsiAndSequenceNumber.c
  ${NAS_SRC}ies/VoiceDomainPreferenceAndUeUsageSetting.c
)

set (libnas_utils_OBJS
  ${NAS_SRC}util/device.c
  ${NAS_SRC}util/memory.c
  ${NAS_SRC}util/nas_log.c
  ${NAS_SRC}util/nas_timer.c
  ${NAS_SRC}util/socket.c
  ${NAS_SRC}util/stty.c
  ${NAS_SRC}util/TLVEncoder.c
  ${NAS_SRC}util/TLVDecoder.c
  ${NAS_SRC}util/OctetString.c
)

set (libnas_user_OBJS
  ${NAS_SRC}api/user/user_api.c
  ${NAS_SRC}api/user/user_indication.c
  ${NAS_SRC}api/user/at_command.c
  ${NAS_SRC}api/user/at_error.c
  ${NAS_SRC}api/user/at_response.c
)
    
set(libnas_usim_OBJS
  ${NAS_SRC}api/usim/aka_functions.c
  ${NAS_SRC}api/usim/usim_api.c
)

thomasl's avatar
thomasl committed
1190
add_library(NAS_UE
thomasl's avatar
thomasl committed
1191
  ${OPENAIRCN_DIR}/NAS/nas_ue_task.c
thomasl's avatar
thomasl committed
1192 1193 1194 1195
)

set(libnas_OBJS
  
thomasl's avatar
thomasl committed
1196 1197 1198 1199
  ${OPENAIRCN_DIR}/NAS/nas_itti_messaging.c
  ${NAS_SRC}nas_parser.c
  ${NAS_SRC}nas_proc.c
  ${NAS_SRC}nas_user.c
thomasl's avatar
thomasl committed
1200
  ${NAS_SRC}nas_network.c
thomasl's avatar
thomasl committed
1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213
  ${libnas_utils_OBJS}
  ${libnas_user_OBJS}
  ${libnas_usim_OBJS}
  ${libnas_emm_OBJS}
  ${libnas_emm_msg_OBJS}
  ${libnas_emm_sap_OBJS}
  ${libnas_esm_OBJS}
  ${libnas_esm_msg_OBJS}
  ${libnas_esm_sap_OBJS}
  ${libnas_ies_OBJS}
  ${libnas_api_OBJS}
  )
add_library(NAS ${libnas_OBJS})
1214

1215
if(NAS_UE)
thomasl's avatar
thomasl committed
1216
  set(NAS_LIB NAS NAS_UE)
1217 1218
endif()

thomasl's avatar
thomasl committed
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257
include_directories(${NAS_SRC})
include_directories(${NAS_SRC}/api/user)
include_directories(${NAS_SRC}/esm)
include_directories(${NAS_SRC}/esm/sap)
include_directories(${NAS_SRC}/emm)
include_directories(${NAS_SRC}/emm/sap)
include_directories(${NAS_SRC}/api/usim)
include_directories(${NAS_SRC}/api/mme)

# Make lfds as a own source code (even if it is a outside library)
# For better intergration with compilation flags & structure of cmake
###################################################################
set(lfds ${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/src/)
file(GLOB lfds_queue ${lfds}/lfds611_queue/*.c)
file(GLOB lfds_ring ${lfds}/lfds611_ringbuffer/*.c)
file(GLOB lfds_slist ${lfds}/lfds611_slist/*.c)
file(GLOB lfds_stack ${lfds}/lfds611_stack/*.c/)
file(GLOB lfds_freelist ${lfds}/lfds611_freelist/*.c)

include_directories(${lfds})
add_library(LFDS 
  ${lfds_queue} ${lfds_ring} ${lfds_slist} ${lfds_stack} ${lfds_freelist}
  ${lfds}/lfds611_liblfds/lfds611_liblfds_abstraction_test_helpers.c
  ${lfds}/lfds611_liblfds/lfds611_liblfds_aligned_free.c
  ${lfds}/lfds611_liblfds/lfds611_liblfds_aligned_malloc.c
  ${lfds}/lfds611_abstraction/lfds611_abstraction_free.c
  ${lfds}/lfds611_abstraction/lfds611_abstraction_malloc.c
)

# Simulation library
##########################
add_library(SIMU
${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c
${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c
${OPENAIR1_DIR}/SIMULATION/RF/rf.c
1258 1259
${OPENAIR1_DIR}/SIMULATION/RF/dac.c
${OPENAIR1_DIR}/SIMULATION/RF/adc.c
thomasl's avatar
thomasl committed
1260 1261 1262
${OPENAIR1_DIR}/USERSPACE_TOOLS/SCOPE/lte_scope.c
)

1263 1264 1265 1266 1267 1268 1269 1270 1271
add_library(SIMU_ETH
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/emu_transport.c
${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/pgm_link.c
)

thomasl's avatar
thomasl committed
1272
# System packages that are required
1273 1274
# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/
# or cmake provide a generic interface to pkg-config that widely used
thomasl's avatar
thomasl committed
1275
###################################
1276 1277 1278 1279 1280 1281 1282
include(FindPkgConfig)

pkg_search_module(LIBXML2 libxml-2.0 REQUIRED)
include_directories(${LIBXML2_INCLUDE_DIRS})

pkg_search_module(OPENSSL openssl REQUIRED)
include_directories(${OPENSSL_INCLUDE_DIRS})
thomasl's avatar
thomasl committed
1283

1284 1285 1286 1287 1288 1289 1290
pkg_search_module(CONFIG libconfig REQUIRED)
include_directories(${CONFIG_INCLUDE_DIRS})

pkg_search_module(CRYPTO libcrypto REQUIRED)
include_directories(${CRYPTO_INCLUDE_DIRS})

#use native cmake method as this package is not in pkg-config
thomasl's avatar
thomasl committed
1291 1292 1293 1294 1295 1296
if (${RF_BOARD} STREQUAL "USRP")
  find_package(Boost REQUIRED)
  include_directories(${LIBBOOST_INCLUDE_DIR})
  target_link_libraries (lte-softmodem ${LIBBOOST_LIBRARIES})
endif (${RF_BOARD} STREQUAL "USRP")

1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327
pkg_search_module(OPENPGM openpgm-5.1)
if(NOT ${OPENPGM_FOUND})
  message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built")
else()
  include_directories(${OPENPGM_INCLUDE_DIRS})
endif()

pkg_search_module(NETTLE nettle)
if(NOT ${NETTLE_FOUND})
  message("PACKAGE nettle not found: some targets will fail")
else()
  include_directories(${NETTLE_INCLUDE_DIRS})
endif()

pkg_search_module(XPM xpm)
if(NOT ${XPM_FOUND})
  message("PACKAGE xpm not found: some targets will fail")
else()
  include_directories(${XPM_INCLUDE_DIRS})
endif()

# Atlas is required by some packages, but not found in pkg-config
if(EXISTS "/usr/include/atlas/cblas.h")
  include_directories("/usr/include/atlas")
  list(APPEND ATLAS_LIBRARIES lapack cblas atlas)
else()
  message("No Blas/Atlas libs found, some targets will fail")
endif()

if (${XFORMS})
  include_directories ("/usr/include/X11")
1328 1329
  set(XFORMS_SOURCE 
    ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope.c
1330 1331
    )
  set(XFORMS_SOURCE_SOFTMODEM
1332 1333
    ${OPENAIR_TARGETS}/RT/USER/stats.c
    )
1334 1335 1336
  set(XFORMS_LIBRARIES "forms")
endif (${XFORMS})

thomasl's avatar
thomasl committed
1337 1338 1339
# Hack on a test of asn1c version (already dirty)
add_definitions(-DASN1_MINIMUM_VERSION=924)

1340 1341 1342
#################################
# add executables for operation
#################################""
thomasl's avatar
thomasl committed
1343

1344 1345
# lte-softmodem is both eNB and UE implementation
###################################################
thomasl's avatar
thomasl committed
1346
add_executable(lte-softmodem 
1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358
  ${rrc_h}
  ${s1ap_h}
  ${OPENAIR_BIN_DIR}/messages_xml.h
  ${OPENAIR_TARGETS}/RT/USER/sched_dlsch.c
  ${OPENAIR_TARGETS}/RT/USER/sched_rx_pdsch.c
  ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c
  ${OPENAIR_TARGETS}/RT/USER/lte-ue.c
  ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c
  ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c
  ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
  ${OPENAIR_TARGETS}/COMMON/create_tasks.c
  ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c
thomasl's avatar
thomasl committed
1359
  ${GTPU_need_ITTI}
1360 1361 1362 1363 1364
  ${HW_SOURCE}
  ${RTAI_SOURCE}
  ${XFORMS_SOURCE}
  ${XFORMS_SOURCE_SOFTMODEM}
  )
thomasl's avatar
thomasl committed
1365 1366
target_link_libraries (lte-softmodem 
  -Wl,--start-group 
1367
  RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${RAL_LIB} ${NAS_LIB} ${ITTI_LIB} ${MIH_LIB}
thomasl's avatar
thomasl committed
1368 1369
  -Wl,--end-group )
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
1370
target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${option_USRP} ${XFORMS_LIBRARIES} )
thomasl's avatar
thomasl committed
1371

1372 1373 1374 1375 1376 1377 1378 1379
# EPC is ??? nodes implementation in one process
################################
add_executable(oai_epc
  ${OPENAIR_BIN_DIR}/messages_xml.h
  ${OPENAIRCN_DIR}/OAI_EPC/oai_epc_log.c 
  ${OPENAIRCN_DIR}/OAI_EPC/oai_epc.c
  ${GTPV1U_DIR}/gtpv1u_task.c
  ${OPENAIRCN_DIR}/SCTP/sctp_primitives_server.c
thomasl's avatar
thomasl committed
1380
  ${OPENAIRCN_DIR}/NAS/nas_main.c
1381 1382 1383
  )
target_link_libraries (oai_epc
  -Wl,--start-group 
thomasl's avatar
thomasl committed
1384
   NAS S1AP_LIB S1AP_EPC GTPV1U GTPV2C SCTP_SERVER UDP_SERVER SECU_CN SECU_OSA SGI S6A SGW MME_APP LFDS ${ITTI_LIB} CN_UTILS HASHTABLE
1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397
  -Wl,--end-group 
  pthread m sctp  rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
  )

# oai_sgw is SGW  node implementation
################################
add_executable(oai_sgw
  ${OPENAIR_BIN_DIR}/messages_xml.h
  ${OPENAIRCN_DIR}/OAI_SGW/oai_sgw_log.c
  ${OPENAIRCN_DIR}/OAI_SGW/oai_sgw.c
  )
target_link_libraries (oai_sgw
  -Wl,--start-group 
thomasl's avatar
thomasl committed
1398
  GTPV1U SECU_CN SECU_OSA SGI S6A SGW CN_UTILS LFDS ${ITTI_LIB}
1399 1400 1401 1402 1403 1404 1405 1406 1407
  -Wl,--end-group  
  pthread m sctp  rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
  )

# USIM process 
#################
add_executable(usim_data  
  ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/tools/usim_data.c
  )
thomasl's avatar
thomasl committed
1408
target_link_libraries (usim_data ${NAS_LIB} UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m)
1409 1410 1411 1412 1413 1414

# ???
#####################
add_executable(ue_data  
  ${OPENAIRCN_DIR}/NAS/EURECOM-NAS/tools/ue_data.c
  )
thomasl's avatar
thomasl committed
1415
target_link_libraries (ue_data ${NAS_LIB} UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m)
1416 1417 1418 1419 1420 1421 1422

###################################"
# Addexecutables for tests
####################################

# A all in one network simulator
################
1423
add_executable(oaisim
thomasl's avatar
thomasl committed
1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441
  ${rrc_h}
  ${s1ap_h}
  ${OPENAIR_BIN_DIR}/messages_xml.h
  ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c
  ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c
  ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c
  ${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c
  ${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c
  ${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c
  ${OPENAIR_TARGETS}/SIMU/USER/event_handler.c
  ${OPENAIR_TARGETS}/SIMU/USER/oaisim.c
  ${OPENAIR2_DIR}/RRC/NAS/nas_config.c
  ${OPENAIR2_DIR}/RRC/NAS/rb_config.c
  ${OPENAIR2_DIR}/UTIL/OMG/sumo.c
  ${GTPU_need_ITTI}
  ${OPENAIR_TARGETS}/COMMON/create_tasks.c
  ${HW_SOURCE}
  ${XFORMS_SOURCE}
thomasl's avatar
thomasl committed
1442
)
1443 1444 1445
target_include_directories(oaisim PUBLIC  ${OPENAIR_TARGETS}/SIMU/USER)
target_link_libraries (oaisim
  -Wl,--start-group 
thomasl's avatar
thomasl committed
1446
  RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 ${RAL_LIB} ${NAS_LIB} SIMU SIMU_ETH SECU_OSA ${ITTI_LIB}  ${MIH_LIB}
1447 1448 1449 1450 1451 1452
  -Wl,--end-group )
target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES})
target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES}  ${NETTLE_LIBRARIES} sctp ${option_USRP} 
  ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES})
#Force link with forms, regardless XFORMS option
target_link_libraries (oaisim forms)
1453

1454 1455 1456
# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator
#####################################

1457 1458 1459 1460 1461 1462 1463 1464 1465 1466
foreach(myExe dlsim ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim)
  add_executable(${myExe}
    ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c
    ${XFORMS_SOURCE} 
    )
  target_link_libraries (${myExe}
    -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS  ${ITTI_LIB} -Wl,--end-group 
    pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES}
    )
endforeach(myExe)
1467

1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486
#unitary tests for Core NEtwork pieces
#################################
foreach(myExe s1ap 
    secu_knas_encrypt_eia1 
    secu_kenb
    aes128_ctr_encrypt 
    aes128_ctr_decrypt 
    secu 
    secu_knas_stream_int 
    secu_knas_encrypt_eea2 
    secu_knas secu_knas_encrypt_eea1 
    kdf 
    aes128_cmac_encrypt 
    secu_knas_encrypt_eia2)
  add_executable(test_${myExe}
    ${OPENAIRCN_DIR}/TEST/test_util.c
    ${OPENAIRCN_DIR}/TEST/test_${myExe}.c
    )
  target_link_libraries (test_${myExe}
thomasl's avatar
thomasl committed
1487
    -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} fdproto fdcore
1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507
    )
endforeach(myExe)


# to be added
#../targets/TEST/PDCP/test_pdcp.c
#../targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c


#  ???
###########################
add_executable(oaisim_mme
  ${OPENAIRCN_DIR}/OAISIM_MME/oai_mme_log.c
  ${OPENAIRCN_DIR}/OAISIM_MME/oaisim_mme.c
)
target_link_libraries (oaisim_mme
  ${ITTI_LIB} ${NAS_LIB} S1AP_LIB S1AP_ENB
  S11 S6A UTILS UDP MME_APP SECU_CN LFDS fdproto fdcore
)

1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541
##################################################
# Generated specific cases is not regular code
###############################################

##################""
# itti symbolic debug print require to generate a specific include file
########################################

# retrieve the compiler options to send it to gccxml
get_directory_property( DirDefs COMPILE_DEFINITIONS )
foreach( d ${DirDefs} )
    list(APPEND itti_compiler_options "-D${d}")
endforeach()
get_directory_property( DirDefs INCLUDE_DIRECTORIES )
foreach( d ${DirDefs} )
    list(APPEND itti_compiler_options "-I${d}")
endforeach()

set (ITTI_H ${ITTI_DIR}/intertask_interface_types.h)
add_custom_command (
  OUTPUT ${OPENAIR_BIN_DIR}/messages.xml
  COMMAND gccxml ${itti_compiler_options} -fxml=${OPENAIR_BIN_DIR}/messages.xml ${ITTI_H} 
  DEPENDS ${S1AP_OAI_generated} ${RRC_FULL_DIR}/asn1_constants.h
  )

add_custom_command (
  OUTPUT ${OPENAIR_BIN_DIR}/messages_xml.h
  COMMAND sed -e 's/ *//'   -e 's/\"/\\\\\"/g' -e 's/^/\"/' -e 's/$$/\\\\n\"/' ${OPENAIR_BIN_DIR}/messages.xml  > ${OPENAIR_BIN_DIR}/messages_xml.h
  DEPENDS ${OPENAIR_BIN_DIR}/messages.xml ${RRC_FULL_DIR}/asn1_constants.h
  )

################
# Kernel modules
###############
1542 1543 1544 1545 1546
# Set compiler options for kernel modules
# we need to get out cmake to use the regular Linux Kernel process
# this is documented as https://www.kernel.org/doc/Documentation/kbuild/modules.txt
######################################

1547
# retrieve the compiler options to send it to gccxml
1548
get_directory_property(DirDefs COMPILE_DEFINITIONS )
1549
foreach( d ${DirDefs} )
1550
  set(module_cc_opt_tmp "${module_cc_opt_tmp} -D${d}")
1551
endforeach()
1552
string(REPLACE "-DUSER_MODE" "" module_cc_opt ${module_cc_opt_tmp})
1553 1554
get_directory_property( DirDefs INCLUDE_DIRECTORIES )
foreach( d ${DirDefs} )
1555
  set(module_cc_opt "${module_cc_opt} -I${d}")
1556 1557 1558
endforeach()

EXECUTE_PROCESS(COMMAND uname -r
1559 1560
  OUTPUT_VARIABLE os_release
  OUTPUT_STRIP_TRAILING_WHITESPACE)
1561 1562 1563 1564 1565 1566 1567 1568 1569
SET(module_build_path /lib/modules/${os_release}/build)

function(make_driver name dir)
  file(MAKE_DIRECTORY ${OPENAIR_BIN_DIR}/${name})
  foreach(f  IN  ITEMS ${ARGN})
    list(APPEND src_path_list ${dir}/${f})
    string(REGEX REPLACE "c *$" "o" obj ${f})
    set(objs "${objs} ${obj}")
  endforeach()
1570
  CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild)
1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583
  add_custom_command(OUTPUT ${name}.ko
    COMMAND make -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name}
    WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name}
    COMMENT "building ${module}.ko"
    VERBATIM
    SOURCES  ${src_path_list}
    )
  add_custom_target(${name} DEPENDS ${name}.ko)
endfunction(make_driver name dir src)

# nashmesh module 
################
list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c)
1584 1585 1586 1587 1588 1589 1590 1591 1592
# Actually nasty stuff to be FIXED: the hereafter flag is for RTAI compilation in the driver, 
# but has different meaning in the other parts of the code
# We should change the constant name to xxx_RTAI or likely
if(NOT ${module_cc_opt} MATCHES "DRTAI")
  set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK")
else()
  string(REPLACE "-DNAS_NETLINK" "" tmp "${module_cc_opt}")
  set(module_cc_opt ${tmp})
endif()
1593 1594 1595 1596 1597
# legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag
# so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere
if (OAI_NW_DRIVER_USE_NETLINK)
  list(APPEND nasmesh_src netlink.c)
endif()
1598
make_driver(nasmesh  ${OPENAIR2_DIR}/NAS/DRIVER/MESH ${nasmesh_src})
1599
  
thomasl's avatar
thomasl committed
1600
# ???
1601
####################
1602 1603 1604 1605 1606
list(APPEND oai_nw_drv_src device.c common.c ioctl.c classifier.c tool.c)
if(OAI_NW_DRIVER_USE_NETLINK)
  list(APPEND oai_nw_drv_src netlink.c)
endif()
make_driver(oai_nw_drv ${OPENAIR2_DIR}/NAS/DRIVER/LITE ${oai_nw_drv_src})
1607

thomasl's avatar
thomasl committed
1608 1609 1610 1611 1612 1613 1614 1615
# Exmimo board drivers
#########################
list(APPEND openair_rf_src module_main.c irq.c fileops.c exmimo_fw.c)
make_driver(openair_rf ${OPENAIR_TARGETS}/ARCH/EXMIMO/DRIVER/eurecom ${openair_rf_src})

add_executable(updatefw
  ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c
)
1616

1617 1618 1619 1620 1621 1622 1623 1624
# ue_ip: purpose ???
###############
list(APPEND ue_ip_src device.c common.c)
if(OAI_NW_DRIVER_USE_NETLINK)
  list(APPEND ue_ip_src netlink.c)
endif()
make_driver(ue_ip ${OPENAIR2_DIR}/NETWORK_DRIVER/UE_IP ${ue_ip_src})

1625 1626 1627 1628 1629 1630 1631
# GTP 
########################
# KVERSION is not used in the code, but required 
set(module_cc_opt "${module_cc_opt} -DKVERSION=3")
make_driver(xt_GTPUAH ${OPENAIRCN_DIR}/GTPV1-U/GTPUAH "")
make_driver(xt_GTPURH ${OPENAIRCN_DIR}/GTPV1-U/GTPURH "")

thomasl's avatar
thomasl committed
1632 1633 1634
# add the install targets
#install (TARGETS Tutorial DESTINATION bin)
#install (FILES "${PROJECT_BIN_DIR}/TutorialConfig.h"        DESTINATION include)