CMakeLists.txt 86.6 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
#/*
# * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# * contributor license agreements.  See the NOTICE file distributed with
# * this work for additional information regarding copyright ownership.
# * The OpenAirInterface Software Alliance licenses this file to You under
# * the OAI Public License, Version 1.0  (the "License"); you may not use this file
# * except in compliance with the License.
# * You may obtain a copy of the License at
# *
# *      http://www.openairinterface.org/?page_id=698
# *
# * Unless required by applicable law or agreed to in writing, software
# * distributed under the License is distributed on an "AS IS" BASIS,
# * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# * See the License for the specific language governing permissions and
# * limitations under the License.
# *-------------------------------------------------------------------------------
# * For more information about the OpenAirInterface (OAI) Software Alliance:
# *      contact@openairinterface.org
# */

knopp's avatar
knopp committed
22
# Author: laurent THOMAS, Lionel GAUTHIER
thomasl's avatar
thomasl committed
23 24 25

cmake_minimum_required (VERSION 2.8)

26
#############################################
thomasl's avatar
thomasl committed
27 28 29 30 31 32 33
# 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)
34
set (OPENAIR3_DIR    ${OPENAIR_DIR}/openair3)
thomasl's avatar
thomasl committed
35 36 37 38 39
set (OPENAIR_CMAKE   ${OPENAIR_DIR}/cmake_targets)
set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY})

project (OpenAirInterface)

40
#add_definitions("-DEMIT_ASN_DEBUG=1")
41 42 43 44
add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms7002m lms7002m)
add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR lmsSDR)
add_subdirectory(${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/Si5351C Si5351C)

thomasl's avatar
thomasl committed
45 46 47
###########################################
# macros to define options as there is numerous options in oai
################################################
48 49 50 51 52 53 54 55 56 57
macro(add_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_option)

thomasl's avatar
thomasl committed
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 97 98 99 100 101 102 103 104 105 106
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)

107 108 109 110 111 112 113 114 115 116 117 118
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)
119
####################################################
thomasl's avatar
thomasl committed
120 121
# compilation flags
#############################################
122
#set(CMAKE_BUILD_TYPE "Debug")
thomasl's avatar
thomasl committed
123 124 125
if (CMAKE_BUILD_TYPE STREQUAL "")
   set(CMAKE_BUILD_TYPE "RelWithDebInfo")
endif()
126
message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}")
127
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)
thomasl's avatar
thomasl committed
128

129 130
Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}")
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
131
  set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt")
132
else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l")
133 134 135 136 137 138 139 140 141 142 143 144 145
  if(EXISTS  "/proc/cpuinfo")
    file(STRINGS "/proc/cpuinfo" CPUINFO REGEX flags LIMIT_COUNT 1)
    if (CPUINFO MATCHES "avx2")
      set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2")
    endif()
    if (CPUINFO MATCHES "sse4_1")
      set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1")
    endif()
    if (CPUINFO MATCHES "ssse3")
      set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mssse3")
    endif()
  else()
    Message("/proc/cpuinfo does not exit. We will use manual CPU flags")
146
  endif()
147
endif()
148 149 150

set(C_FLAGS_PROCESSOR " ${C_FLAGS_PROCESSOR} ${CFLAGS_PROCESSOR_USER}")

151 152
Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}")

153
if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86")
154
  if ( (NOT( C_FLAGS_PROCESSOR MATCHES "ssse3")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.1")) )
155
    Message(FATAL_ERROR "For x86 Architecture, you must have following flags: -mssse3 -msse4.1. The current detected flags are: ${C_FLAGS_PROCESSOR}. You can pass the flags manually in build script, for example: ./build_oai --cflags_processor \"-mssse3 -msse4.1 -mavx2\" ")
156 157
  endif()
endif()
158

thomasl's avatar
thomasl committed
159
#
160
set(CMAKE_C_FLAGS
161
  "${CMAKE_C_FLAGS} ${C_FLAGS_PROCESSOR} -std=gnu99 -Wall -Wstrict-prototypes -fno-strict-aliasing -rdynamic -funroll-loops -Wno-packed-bitfield-compat -fPIC ")
162
# add autotools definitions that were maybe used!
163
set(CMAKE_C_FLAGS
164 165
  "${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"
)
166
set(CMAKE_CXX_FLAGS
167
  "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 "
168
)
169 170 171


#########################
172
set(CMAKE_EXE_LINKER_FLAGS  "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}")
173
#########################
174 175
# set a flag for changes in the source code
# these changes are related to hardcoded path to include .h files
176
add_definitions(-DCMAKER)
177
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3")
knopp's avatar
knopp committed
178
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2") 
thomasl's avatar
thomasl committed
179

180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212

set(GIT_BRANCH        "UNKNOWN")
set(GIT_COMMIT_HASH   "UNKNOWN")
set(GIT_COMMIT_DATE   "UNKNOWN")

find_package(Git)
if(GIT_FOUND)
  message("git found: ${GIT_EXECUTABLE}")
  # Get the current working branch
  execute_process(
    COMMAND git rev-parse --abbrev-ref HEAD
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_BRANCH
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )

  # Get the latest abbreviated commit hash of the working branch
  execute_process(
    COMMAND git log -1 --format=%h
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_COMMIT_HASH
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
  
  # Get the latest commit date of the working branch
  execute_process(
    COMMAND git log -1 --format=%cd
    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
    OUTPUT_VARIABLE GIT_COMMIT_DATE
    OUTPUT_STRIP_TRAILING_WHITESPACE
  )
endif()

213 214 215

# Below is a hard-coded info
set (FIRMWARE_VERSION "No svn information")
thomasl's avatar
thomasl committed
216
add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"")
217 218
add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"")
add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
thomasl's avatar
thomasl committed
219 220 221 222 223



# Debug related options
#########################################
224 225 226 227 228 229 230 231
add_boolean_option(ASN_DEBUG           False "ASN1 coder/decoder Debug")
add_boolean_option(EMIT_ASN_DEBUG      False "ASN1 coder/decoder Debug")
add_boolean_option(MSG_PRINT           False "print debug messages")
add_boolean_option(DISABLE_XER_PRINT   False "print XER Format")
add_boolean_option(XER_PRINT           False "print XER Format")
add_boolean_option(RRC_MSG_PRINT       False "print RRC messages")
add_boolean_option(PDCP_MSG_PRINT      False "print PDCP messages to /tmp/pdcp.log")
add_boolean_option(DEBUG_PDCP_PAYLOAD  False "print PDCP PDU to stdout")  # if true, make sure that global and PDCP log levels are trace 
232
add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdout") # if true, make sure that global and PDCP log levels are trace 
233 234 235 236 237
add_boolean_option(TRACE_RLC_PAYLOAD   False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace 
add_boolean_option(TEST_OMG            False "???")
add_boolean_option(DEBUG_OMG           False "???")
add_boolean_option(XFORMS              False "This adds the possibility to see the signal oscilloscope")
add_boolean_option(PRINT_STATS         False "This adds the possibility to see the status")
Cedric Roux's avatar
Cedric Roux committed
238
add_boolean_option(T_TRACER            False "Activate the T tracer, a debugging/monitoring framework" )
239

240
add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering")
thomasl's avatar
thomasl committed
241

242
add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets")
thomasl's avatar
thomasl committed
243 244
set (ITTI_DIR ${OPENAIR_DIR}/common/utils/itti)
if (${ENABLE_ITTI})
245
  add_library(ITTI
thomasl's avatar
thomasl committed
246 247 248 249 250 251 252 253 254
    # 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
    )
255
  set(ITTI_LIB ITTI)
256
  set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
thomasl's avatar
thomasl committed
257 258 259 260 261 262 263 264 265 266 267 268
endif (${ENABLE_ITTI})

add_boolean_option(RTAI False "Use 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)
269
# New C code source file, cmake must be re-run (instead of re-running make only)
thomasl's avatar
thomasl committed
270
#############
271
set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1")
Cedric Roux's avatar
Cedric Roux committed
272
set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1")
thomasl's avatar
thomasl committed
273 274
set(asn1_generated_dir ${OPENAIR_BIN_DIR})

275 276 277
set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf")
set(protobuf_generated_dir ${OPENAIR_BIN_DIR})

thomasl's avatar
thomasl committed
278 279
# RRC
######
thomasl's avatar
thomasl committed
280
add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA")
thomasl's avatar
thomasl committed
281 282 283

if (${RRC_ASN1_VERSION} STREQUAL "Rel8")
  set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn)
284 285 286
elseif (${RRC_ASN1_VERSION} STREQUAL "CBA")
  set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn)
else()
thomasl's avatar
thomasl committed
287 288 289 290 291 292 293
  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})
294 295 296 297 298
execute_process(COMMAND ${asn1c_call}  ${RRC_FULL_DIR} ${RRC_GRAMMAR}
                RESULT_VARIABLE ret)
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
Cedric Roux's avatar
Cedric Roux committed
299 300 301
if(NOT EXISTS ${fix_asn1c_call})
  message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" )
endif(NOT EXISTS ${fix_asn1c_call})
302 303
execute_process(COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
                RESULT_VARIABLE ret)
Cedric Roux's avatar
Cedric Roux committed
304 305 306
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
thomasl's avatar
thomasl committed
307 308 309 310
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)
311
set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code
312
add_library(RRC_LIB ${rrc_h} ${rrc_source})
thomasl's avatar
thomasl committed
313 314 315 316 317 318 319
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}
Cedric Roux's avatar
Cedric Roux committed
320
  COMMAND ${fix_asn1c_call}  ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION}
thomasl's avatar
thomasl committed
321 322 323 324 325 326 327
  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
328 329
add_list1_option(S1AP_VERSION R10 "S1AP Asn.1 grammar version" R8 R9 R10)

330
set(S1AP_DIR ${OPENAIR3_DIR}/S1AP)
thomasl's avatar
thomasl committed
331 332 333 334 335 336 337 338 339 340 341
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
342 343 344
  ${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn
  ${S1AP_ASN_DIR}/S1AP-Constants.asn
  ${S1AP_ASN_DIR}/S1AP-IEs.asn
thomasl's avatar
thomasl committed
345 346 347
  ${S1AP_ASN_DIR}/S1AP-PDU.asn
  )
set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
348
#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}")
349 350
execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}
                RESULT_VARIABLE ret)
351 352 353
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
354 355
execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR}
                RESULT_VARIABLE ret)
356 357 358
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
359 360
execute_process(COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
                RESULT_VARIABLE ret)
Cedric Roux's avatar
Cedric Roux committed
361 362 363
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
thomasl's avatar
thomasl committed
364
file(GLOB S1AP_source ${S1AP_C_DIR}/*.c)
365

366
set(S1AP_OAI_generated
thomasl's avatar
thomasl committed
367 368 369
  ${S1AP_C_DIR}/s1ap_decoder.c
  ${S1AP_C_DIR}/s1ap_encoder.c
  ${S1AP_C_DIR}/s1ap_xer_print.c
370
  ${S1AP_C_DIR}/s1ap_compare.c
thomasl's avatar
thomasl committed
371 372 373
  ${S1AP_C_DIR}/s1ap_ies_defs.h
  )
file(GLOB s1ap_h ${S1AP_C_DIR}/*.h)
374 375
set(s1ap_h ${s1ap_h} )

thomasl's avatar
thomasl committed
376 377 378 379
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}
Cedric Roux's avatar
Cedric Roux committed
380
  COMMAND ${fix_asn1c_call} ${S1AP_C_DIR} S1AP ${S1AP_VERSION}
381
  DEPENDS ${S1AP_ASN_FILES}
thomasl's avatar
thomasl committed
382
  )
383 384
add_library(S1AP_LIB
  ${S1AP_OAI_generated}
385 386 387 388
  ${S1AP_source}
  ${S1AP_DIR}/s1ap_common.c
  )

thomasl's avatar
thomasl committed
389 390
include_directories ("${S1AP_C_DIR}")
include_directories ("${S1AP_DIR}")
thomasl's avatar
thomasl committed
391

392 393 394 395 396 397 398 399 400 401 402 403 404 405 406
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
407

408

409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431

#X2AP
# Same limitation as described in RRC/S1AP: unknown generated file list
# so we generate it at cmake time
##############
add_list1_option(X2AP_VERSION R11 "X2AP Asn.1 grammar version" R10 R11)
set(X2AP_DIR ${OPENAIR2_DIR}/X2AP)
if (${X2AP_VERSION} STREQUAL "R11")
  set (ASN1RELDIR R11.2)
elseif (${X2AP_VERSION} STREQUAL "R10")
  set (ASN1RELDIR R.UNKNOWN)
endif(${X2AP_VERSION} STREQUAL "R11")
set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR})
set(X2AP_ASN_FILES
  ${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn
  ${X2AP_ASN_DIR}/X2AP-Constants.asn
  ${X2AP_ASN_DIR}/X2AP-IEs.asn
  ${X2AP_ASN_DIR}/X2AP-PDU.asn
  ${X2AP_ASN_DIR}/X2AP-Containers.asn
  )

set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR})
#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}")
432 433
execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
                RESULT_VARIABLE ret)
434 435 436
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "${asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
437 438
execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
                RESULT_VARIABLE ret)
439 440 441
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "asn1tostruct.py: error")
endif (NOT ${ret} STREQUAL 0)
442 443
execute_process(COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
                RESULT_VARIABLE ret)
Cedric Roux's avatar
Cedric Roux committed
444 445 446
if (NOT ${ret} STREQUAL 0)
  message(FATAL_ERROR "${fix_asn1c_call}: error")
endif (NOT ${ret} STREQUAL 0)
447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
file(GLOB X2AP_source ${X2AP_C_DIR}/*.c)

set(X2AP_OAI_generated
  ${X2AP_C_DIR}/x2ap_decoder.c
  ${X2AP_C_DIR}/x2ap_encoder.c
  ${X2AP_C_DIR}/x2ap_xer_print.c
  ${X2AP_C_DIR}/x2ap_ies_defs.h
  )
file(GLOB x2ap_h ${X2AP_C_DIR}/*.h)
set(x2ap_h ${x2ap_h} )

#message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}")
add_custom_command (
  OUTPUT ${X2AP_OAI_generated}
  COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}
  COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}
Cedric Roux's avatar
Cedric Roux committed
463
  COMMAND ${fix_asn1c_call} ${X2AP_C_DIR} X2AP ${X2AP_VERSION}
464 465 466 467 468 469 470 471 472 473 474 475
  DEPENDS ${X2AP_ASN_FILES}
  )

add_library(X2AP_LIB
  ${X2AP_OAI_generated}
  ${X2AP_source}
  ${X2AP_DIR}/x2ap_common.c
  )

include_directories ("${X2AP_C_DIR}")
include_directories ("${X2AP_DIR}")

thomasl's avatar
thomasl committed
476 477
# Hardware dependant options
###################################
thomasl's avatar
thomasl committed
478
add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4")
Xiwen JIANG's avatar
Xiwen JIANG committed
479
add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4")
thomasl's avatar
thomasl committed
480 481
add_list1_option(NB_ANTENNAS_TXRX "2" "Number of antennas in ????" "1" "2" "4")

482
add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR")
483

484
add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET")
485 486 487 488


# include RF devices / transport protocols library modules
######################################################################
thomasl's avatar
thomasl committed
489

490 491 492 493 494
include_directories("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/")
include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/")
#set (option_HWEXMIMOLIB_lib "-l ")
set(HWLIB_EXMIMO_SOURCE 
  ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
495
#  ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512
  )
add_library(oai_exmimodevif MODULE ${HWLIB_EXMIMO_SOURCE} )

include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/")
set (option_HWUSRPLIB_lib "-l uhd")
set(HWLIB_USRP_SOURCE 
  ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
  )
add_library(oai_usrpdevif MODULE ${HWLIB_USRP_SOURCE} )

include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/")
set (option_HWBLADERFLIB_lib "-l bladerf")
set(HWLIB_BLADERF_SOURCE 
  ${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
  )
add_library(oai_bladerfdevif MODULE ${HWLIB_BLADERF_SOURCE} )

513 514 515 516 517 518 519
include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/")
set (option_HWLMSSDRLIB_lib "-l LMS_SDR -l LMS7002M -l Si5351C")
set(HWLIB_LMSSDR_SOURCE 
  ${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp
  )
add_library(oai_lmssdrdevif MODULE ${HWLIB_LMSSDR_SOURCE} )

520 521 522 523 524 525 526
include_directories("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/")
set(TPLIB_ETHERNET_SOURCE 
  ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
  ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
  ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
  )
add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} )
thomasl's avatar
thomasl committed
527

528

529 530
# RF devices / transport protocols settings
######################################################################
thomasl's avatar
thomasl committed
531
if (${RF_BOARD} STREQUAL "EXMIMO")
thomasl's avatar
thomasl committed
532 533 534
  set(DRIVER2013)
  include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/")
  include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/")
535
  set(HW_SOURCE ${HW_SOURCE}
536 537
    ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c)
#    ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c)
538
  set(option_HW_lib "-rdynamic -ldl")
539

540
elseif (${RF_BOARD} STREQUAL "OAI_USRP")
thomasl's avatar
thomasl committed
541
  include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/")
thomasl's avatar
thomasl committed
542
  include_directories("/opt/include/uhd")
thomasl's avatar
thomasl committed
543 544
  set(HW_SOURCE ${HW_SOURCE}
    ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp)
thomasl's avatar
thomasl committed
545
  LINK_DIRECTORIES("/opt/lib")
546
  set(option_HW_lib "-luhd -rdynamic -ldl -lboost_system")
547

548 549 550 551 552 553 554
elseif (${RF_BOARD} STREQUAL "OAI_BLADERF")
  include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/")
  include_directories("${OPENAIR2_DIR}/UTIL/LOG")
  include_directories("/usr/include")
  set(HW_SOURCE ${HW_SOURCE}
    ${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c
    )
navid's avatar
navid committed
555
  LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
556

557
  set(option_HW_lib "bladeRF -rdynamic -ldl")
navid's avatar
navid committed
558

559 560 561 562
elseif (${RF_BOARD} STREQUAL "OAI_LMSSDR")
  include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB")
  include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR")
  include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms7002m")
563 564
  include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/Si5351C")
  include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lmsSDR/LMS_StreamBoard")
565
  LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu")
566 567 568
  LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lmsSDR")
  LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/lms7002m")
  LINK_DIRECTORIES("${CMAKE_CURRENT_BINARY_DIR}/Si5351C")
569
  set(HW_SOURCE ${HW_SOURCE} ${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp)
570
  set(option_HW_lib "-lLMS_SDR -lLMS7002M -lSi5351C -rdynamic -ldl")
571

thomasl's avatar
thomasl committed
572 573 574 575 576
elseif (${RF_BOARD} STREQUAL "CPRIGW")
  set(HW_SOURCE ${HW_SOURCE}
    ${OPENAIR_TARGETS}/ARCH/CPRIGW/USERSPACE/LIB/cprigw_lib.c
    )
  include_directories("${OPENAIR_TARGETS}/ARCH/CPRIGW/USERSPACE/LIB/")
577 578
  set(option_HW_lib "-rdynamic dl")
  
thomasl's avatar
thomasl committed
579
endif (${RF_BOARD} STREQUAL "EXMIMO")
580

581

582 583
if (${TRANSP_PRO} STREQUAL "ETHERNET")
  
thomasl's avatar
thomasl committed
584
  include_directories ("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB")
585
  set(TRANSPORT_SOURCE ${TRANSPORT_SOURCE}
586
    ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c
587 588
    ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c
    ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c
589
    )
590
  set(option_TP_lib "-rdynamic -ldl")
591

592
  
593 594
endif (${TRANSP_PRO} STREQUAL "ETHERNET")
##########################################################
595

thomasl's avatar
thomasl committed
596 597
include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON")

laurent's avatar
laurent committed
598
Message("DEADLINE_SCHEDULER flag  is ${DEADLINE_SCHEDULER}")
599
Message("CPU_Affinity flag is ${CPU_AFFINITY}")
600 601 602 603 604 605 606 607

##############################################################
#    ???!!! TO BE DOCUMENTED OPTIONS !!!???
##############################################################
add_boolean_option(ENABLE_SECURITY         True  "Enable LTE integrity and ciphering between RRC UE and eNB")
add_boolean_option(ENABLE_USE_MME          True  "eNB connected to MME (INTERFACE S1-C), not standalone eNB")
add_boolean_option(NO_RRM                  True  "DO WE HAVE A RADIO RESSOURCE MANAGER: NO")
add_boolean_option(USER_MODE True "????")
608
add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer")
609 610

add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????")
611
add_boolean_option(DISABLE_USE_NAS False "???")
laurent's avatar
laurent committed
612
add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14")
613
add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs")
614
add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver")
615
add_boolean_option(NAS_NETLINK False "???? Must be True to compile nasmesh driver without rtai")
thomasl's avatar
thomasl committed
616
add_boolean_option(OAISIM False "specific to oaisim")
617
add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????")
618

619
add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c")
620
add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name")
621
add_boolean_option(MESSAGE_CHART_GENERATOR False         "For generating sequence diagrams")
622 623
add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams")
add_boolean_option(MESSAGE_CHART_GENERATOR_PHY     False "trace some PHY exchanges in sequence diagrams")
624

625
add_boolean_option(FLEXRAN_AGENT_SB_IF             False         "enable FlexRAN agent to inteface with a SDN controller")
626

627 628 629
########################
# Include order
##########################
630
add_boolean_option(ENB_MODE True "Swap the include directories between openair2 and openair3" )
631 632 633 634 635 636 637

##########################
# Emulation options
##########################
add_boolean_option(ENABLE_PGM_TRANSPORT    False "specific to oaisim, emulation through ethernet, reliable multicast")
add_boolean_option(ADDR_CONF               False "specific to oaisim, IP autoconf of user-plane IP interface")
add_boolean_option(OPENAIR_EMU             False "specific to oaisim")
gauthier's avatar
gauthier committed
638
add_boolean_option(OAI_EMU                 False "specific to oaisim")
639 640 641 642 643 644
add_boolean_option(PHY_ABSTRACTION         False "specific to oaisim")

##########################
# SCHEDULING/REAL-TIME/PERF options
##########################
add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues")
gauthier's avatar
gauthier committed
645 646
add_boolean_option(ENABLE_VCD              True  "always true now, time measurements of proc calls and var displays")
add_boolean_option(ENABLE_VCD_FIFO         True  "time measurements of proc calls and var displays sent to FIFO (one more thread)")
647 648 649 650 651 652 653 654 655
add_boolean_option(HARD_RT                 False "???")
add_boolean_option(LINUX                   False "used in weird memcpy() in pdcp.c ???")
add_boolean_option(LINUX_LIST              False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False")
add_boolean_option(LOG_NO_THREAD           True  "Disable thread for log, seems always set to true")
add_boolean_option(OPENAIR_LTE             True "Seems legacy: keep it to true")

##########################
# PHY options
##########################
656
add_boolean_option(DRIVER2013              True "only relevant for EXMIMO")
657 658
add_boolean_option(ENABLE_FXP              True "????")
add_boolean_option(ENABLE_NEW_MULTICAST    False "specific to oaisim")
thomasl's avatar
thomasl committed
659
add_boolean_option(EXMIMO_IOT              True "????")
660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675
add_boolean_option(LARGE_SCALE             False "specific to oaisim: defines max eNB=2 and max UE=120")
add_boolean_option(LOCALIZATION            False "???")
add_integer_option(MAX_NUM_CCs             1     "????")
add_boolean_option(MU_RECEIVER             False "????")
add_boolean_option(NEW_FFT                 True "????")
add_boolean_option(OPENAIR1                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(PHYSIM                  True  "for L1 simulators (dlsim, ulsim, ...)")
add_boolean_option(PHY_CONTEXT             True "not clear: must remain False for dlsim")
add_boolean_option(PHY_EMUL                False "not clear: must remain False for dlsim")
add_boolean_option(PUCCH                   True "????")
add_boolean_option(RANDOM_BF               False "????")
add_boolean_option(SMBV                    False "Rohde&Schwarz SMBV100A vector signal generator")
676 677 678
add_boolean_option(DEBUG_PHY               False "Enable PHY layer debugging options")
add_boolean_option(DEBUG_PHY_PROC          False "Enable debugging of PHY layer procedures")
add_boolean_option(DEBUG_DLSCH             False "Enable debugging of DLSCH physical layer channel")
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

##########################
# 802.21 options
##########################
add_boolean_option(ENABLE_RAL              False "ENABLE 802.21 INTERFACE")
add_boolean_option(USE_3GPP_ADDR_AS_LINK_ADDR False "As per attribute name")

##########################
# NAS LAYER OPTIONS
##########################
add_boolean_option(ENABLE_NAS_UE_LOGGING   True  "????")
add_boolean_option(NAS_BUILT_IN_UE         True  "UE NAS layer present in this executable")
add_boolean_option(NAS_UE                  True  "NAS UE INSTANCE (<> NAS_MME)")


##########################
# ACCESS STRATUM LAYER2 OPTIONS
##########################
add_boolean_option(MAC_CONTEXT             True  "specific to oaisim")
add_boolean_option(JUMBO_FRAME             True  "ENABLE LARGE SDU in ACCESS STRATUM (larger than common MTU)")

##########################
# RLC LAYER OPTIONS
##########################
add_boolean_option(OPENAIR2                True  "Access Stratum layer 2 built in executable")
add_boolean_option(TRACE_RLC_PAYLOAD       False "Fatal assert in this case")
add_boolean_option(RLC_STOP_ON_LOST_PDU    False "Fatal assert in this case")

knopp's avatar
knopp committed
707
add_boolean_option(TRACE_RLC_MUTEX         True  "TRACE for RLC, possible problem in thread scheduling")
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
add_boolean_option(TRACE_RLC_AM_BO         False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_FREE_SDU   False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_HOLE       False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_PDU        False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_RESEGMENT  False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_RX         False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_RX_DECODE  False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_TX         False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_TX_STATUS  False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_AM_STATUS_CREATION   False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG")

add_boolean_option(STOP_ON_IP_TRAFFIC_OVERLOAD      False "")
add_boolean_option(TRACE_RLC_UM_DAR        False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_UM_DISPLAY_ASCII_DATA  False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_UM_PDU        False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_UM_RX         False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_UM_SEGMENT    False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG")
add_boolean_option(TRACE_RLC_UM_TX_STATUS  False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG")


##########################
# PDCP LAYER OPTIONS
##########################
add_boolean_option(PDCP_USE_NETLINK            False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO")
add_boolean_option(PDCP_USE_NETLINK_QUEUES     False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues")
add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER  False "For eNB, PDCP communicate with a IP driver")
add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U     True  "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)")

##########################
# RRC LAYER OPTIONS
##########################
add_boolean_option(RRC_DEFAULT_RAB_IS_AM       False  "Otherwise it is UM, configure params are actually set in rrc_eNB.c:rrc_eNB_generate_defaultRRCConnectionReconfiguration(...)")


##########################
# S1AP LAYER OPTIONS
##########################
745
# none
746 747 748 749 750 751

##########################
# PROJECTS (IST, FRENCH COLL., etc)
# SPECIFIC OPTIONS
##########################
add_boolean_option(SPECTRA False "???")
752
add_boolean_option(MIH_C_MEDIEVAL_EXTENSIONS False "EXTENSIONS TO MIH 802.21 IN CONTEXT OF IST PROJECT CALLED MEDIEVAL")
753 754 755



756 757 758 759 760 761 762
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
763 764 765 766 767
 # 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
768
# the internal rule is to use generic names such as defs.h
thomasl's avatar
thomasl committed
769 770 771 772 773 774 775
# 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
776 777 778 779
if(ENB_MODE)
  include_directories("${OPENAIR2_DIR}/COMMON")
  include_directories("${OPENAIR2_DIR}/UTIL")
  include_directories("${OPENAIR2_DIR}/UTIL/LOG")
780 781
  include_directories("${OPENAIR3_DIR}/COMMON")
  include_directories("${OPENAIR3_DIR}/UTILS")
782
else()
783 784
  include_directories("${OPENAIR3_DIR}/COMMON")
  include_directories("${OPENAIR3_DIR}/UTILS")
785 786 787 788
  include_directories("${OPENAIR2_DIR}/COMMON")
  include_directories("${OPENAIR2_DIR}/UTIL")
  include_directories("${OPENAIR2_DIR}/UTIL/LOG")
endif()
thomasl's avatar
thomasl committed
789 790 791 792 793 794 795 796 797 798 799 800 801 802 803
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")
804 805 806 807 808 809 810 811 812
include_directories("${OPENAIR3_DIR}/NAS/COMMON")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/API/NETWORK")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/EMM/MSG")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/ESM/MSG")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/IES")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/UTIL")
include_directories("${OPENAIR3_DIR}/SECU")
include_directories("${OPENAIR3_DIR}/SCTP")
include_directories("${OPENAIR3_DIR}/S1AP")
813
include_directories("${OPENAIR2_DIR}/X2AP")
814 815
include_directories("${OPENAIR3_DIR}/UDP")
include_directories("${OPENAIR3_DIR}/GTPV1-U")
thomasl's avatar
thomasl committed
816 817 818 819 820
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")
821
include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC")
thomasl's avatar
thomasl committed
822 823
include_directories("${OPENAIR2_DIR}/UTIL/OSA")
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc")
824
include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc")
thomasl's avatar
thomasl committed
825 826 827 828 829 830 831 832 833 834 835 836
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")
837 838
include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared")
include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include")
839
include_directories("${OPENAIR_DIR}")
thomasl's avatar
thomasl committed
840 841 842

# Utilities Library
################
843
if (FLEXRAN_AGENT_SB_IF)
844
  # set the version of protobuf messages, V3 not supported yet
845
  add_list1_option(FLPT_VERSION V2 "FLPT MSG  protobuf  grammar version" V2 V3)
846
  
847 848 849 850 851
  if (${FLPT_VERSION} STREQUAL "V2")
    set (FLPTDIR V2)
  elseif (${FLPT_VERSION} STREQUAL "V3")
    set (FLPTDIR V3)
  endif(${FLPT_VERSION} STREQUAL "V2")
852
  
853 854 855 856 857 858 859 860 861 862 863 864
  set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} )
  set(FLPT_MSG_FILES
    ${FLPT_MSG_DIR}/header.proto
    ${FLPT_MSG_DIR}/flexran.proto
    ${FLPT_MSG_DIR}/stats_common.proto
    ${FLPT_MSG_DIR}/stats_messages.proto
    ${FLPT_MSG_DIR}/time_common.proto
    ${FLPT_MSG_DIR}/controller_commands.proto
    ${FLPT_MSG_DIR}/mac_primitives.proto
    ${FLPT_MSG_DIR}/config_messages.proto
    ${FLPT_MSG_DIR}/config_common.proto
    ${FLPT_MSG_DIR}/control_delegation.proto
865 866
    )

867 868 869 870 871 872 873 874 875 876 877 878 879 880 881
  set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR})
  #message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}")
  execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES})
  file(GLOB FLPT_source ${FLPT_C_DIR}/*.c)
  set(FLPT_OAI_generated
    ${FLPT_C_DIR}/header.pb-c.c
    ${FLPT_C_DIR}/flexran.pb-c.c
    ${FLPT_C_DIR}/stats_common.pb-c.c
    ${FLPT_C_DIR}/stats_messages.pb-c.c
    ${FLPT_C_DIR}/time_common.pb-c.c
    ${FLPT_C_DIR}/controller_commands.pb-c.c
    ${FLPT_C_DIR}/mac_primitives.pb-c.c
    ${FLPT_C_DIR}/config_messages.pb-c.c
    ${FLPT_C_DIR}/config_common.pb-c.c
    ${FLPT_C_DIR}/control_delegation.pb-c.c
882 883
    )
  
884 885
  file(GLOB flpt_h ${FLPT_C_DIR}/*.h)
  set(flpt_h ${flpt_h} )
886
  
887 888 889
  add_library(FLPT_MSG
    ${FLPT_OAI_generated}
    ${FLPT_source}
890
    )
891 892 893
  set(FLPT_MSG_LIB FLPT_MSG)
  #message("prpt c dir is : ${FLPT_C_DIR}")
  include_directories (${FLPT_C_DIR})
894

895 896 897 898
  add_library(ASYNC_IF
    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c
    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c
    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c
899
    ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c
900 901
    )
  set(ASYNC_IF_LIB ASYNC_IF)
902 903
  include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF)

904 905 906 907
 add_library(FLEXRAN_AGENT
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c
908
    ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c
909 910 911 912
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c
    ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c
913
    ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c
914
    )
915
  set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT)
916 917 918 919
  #include_directories(${OPENAIR2_DIR}/ENB_APP)
  
  set(PROTOBUF_LIB "protobuf-c")
  
920 921 922 923 924 925 926
  FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h)
  FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml)
  
  INCLUDE(FindPackageHandleStandardArgs)
  FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR)
  MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES)

927
  #set(PROTOBUF_LIB "protobuf") #for Cpp
928
endif()
929

930

931
add_library(HASHTABLE
932 933
  ${OPENAIR_DIR}/common/utils/hashtable/hashtable.c
  ${OPENAIR_DIR}/common/utils/hashtable/obj_hashtable.c
934
)
935
include_directories(${OPENAIR_DIR}/common/utils/hashtable)
936

937
if (MESSAGE_CHART_GENERATOR)
gauthier's avatar
gauthier committed
938
  add_library(MSC  
939
    ${OPENAIR_DIR}/common/utils/msc/msc.c
940 941
  )  
  set(MSC_LIB MSC)
942
endif()
943 944
include_directories(${OPENAIR_DIR}/common/utils/msc)

945
set(UTIL_SRC
thomasl's avatar
thomasl committed
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967
  ${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/common.c
  ${OPENAIR2_DIR}/UTIL/OMG/grid.c
  ${OPENAIR2_DIR}/UTIL/OMG/job.c
  ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c
  ${OPENAIR2_DIR}/UTIL/OMG/omg.c
Thomas Laurent's avatar
Thomas Laurent committed
968
  #${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c
thomasl's avatar
thomasl committed
969 970 971 972 973 974 975 976 977 978 979
  ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c
  ${OPENAIR2_DIR}/UTIL/OMG/rwp.c
  ${OPENAIR2_DIR}/UTIL/OMG/static.c
  ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.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
980 981
  ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c
  ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c
thomasl's avatar
thomasl committed
982 983 984
  )
add_library(UTIL ${UTIL_SRC})

985 986 987 988 989 990 991 992 993
#set(OMG_SUMO_SRC
#  ${OPENAIR2_DIR}/UTIL/OMG/client_traci_OMG.c
#  ${OPENAIR2_DIR}/UTIL/OMG/id_manager.c
#  ${OPENAIR2_DIR}/UTIL/OMG/sumo.c
#  ${OPENAIR2_DIR}/UTIL/OMG/socket_traci_OMG.c
#  ${OPENAIR2_DIR}/UTIL/OMG/storage_traci_OMG.c
#  )
#add_library(OMG_SUMO ${OMG_SUMO_SRC})

thomasl's avatar
thomasl committed
994 995 996 997 998 999 1000 1001 1002 1003
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
1004 1005 1006 1007 1008 1009 1010 1011
  ${OPENAIR3_DIR}/SECU/kdf.c
  ${OPENAIR3_DIR}/SECU/rijndael.c
  ${OPENAIR3_DIR}/SECU/snow3g.c
  ${OPENAIR3_DIR}/SECU/key_nas_deriver.c
  ${OPENAIR3_DIR}/SECU/nas_stream_eea1.c
  ${OPENAIR3_DIR}/SECU/nas_stream_eia1.c
  ${OPENAIR3_DIR}/SECU/nas_stream_eea2.c
  ${OPENAIR3_DIR}/SECU/nas_stream_eia2.c
thomasl's avatar
thomasl committed
1012 1013 1014 1015 1016
  )
add_library(SECU_CN ${SECU_CN_SRC})

# Scheduler
################################"
1017 1018 1019 1020 1021 1022 1023 1024
set(SCHED_SRC 
  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_eNb.c
  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c
  ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c
  ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c
  ${OPENAIR1_DIR}/SCHED/pucch_pc.c
  ${OPENAIR1_DIR}/SCHED/pusch_pc.c
)
thomasl's avatar
thomasl committed
1025
add_library(SCHED_LIB ${SCHED_SRC})
thomasl's avatar
thomasl committed
1026 1027 1028

# Layer 1
#############################
1029
set(PHY_SRC
thomasl's avatar
thomasl committed
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053
  # 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
1054
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c
thomasl's avatar
thomasl committed
1055 1056 1057 1058 1059 1060 1061 1062 1063 1064
  ${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
1065
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c
1066
  ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c
thomasl's avatar
thomasl committed
1067 1068 1069 1070 1071
  ${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
1072
  ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c
1073
  ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c
thomasl's avatar
thomasl committed
1074 1075 1076 1077 1078
  ${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
1079
  ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c
thomasl's avatar
thomasl committed
1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
  ${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
1099
  ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
thomasl's avatar
thomasl committed
1100 1101 1102 1103 1104 1105
  ${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
1106
  ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c
thomasl's avatar
thomasl committed
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
  ${OPENAIR1_DIR}/PHY/TOOLS/file_output.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/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
1172
  ${RRC_DIR}/rrc_eNB_UE_context.c
thomasl's avatar
thomasl committed
1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191
  ${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
1192 1193 1194 1195 1196
 )

if (FLEXRAN_AGENT_SB_IF)

set (MAC_SRC ${MAC_SRC}
1197 1198 1199
  ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c
  ${MAC_DIR}/flexran_agent_scheduler_dataplane.c
  ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c
1200 1201 1202
)

endif()
thomasl's avatar
thomasl committed
1203 1204 1205 1206 1207 1208

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

1209 1210 1211
add_library(L2
  ${L2_SRC}
  ${MAC_SRC}
1212 1213
  ${ENB_APP_SRC})
#  ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c)
thomasl's avatar
thomasl committed
1214

1215 1216
if (FLEXRAN_AGENT_SB_IF)

1217
#Test for adding a shared library
1218 1219
add_library(default_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue.c)
add_library(remote_sched SHARED ${MAC_DIR}/flexran_agent_scheduler_dlsch_ue_remote.c)
1220

1221 1222
endif()

thomasl's avatar
thomasl committed
1223 1224 1225 1226
# L3 Libs
##########################

set(RAL_LTE_DIR ${OPENAIR3_DIR}/RAL-LTE/)
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
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()

1252
if(${MIH_C_MEDIEVAL_EXTENSIONS})
1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270
  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
1271 1272 1273

# CN libs
##########################
1274

1275
add_library(CN_UTILS
1276 1277 1278 1279
  ${OPENAIR3_DIR}/UTILS/conversions.c
  ${OPENAIR3_DIR}/UTILS/enum_string.c
  ${OPENAIR3_DIR}/UTILS/log.c
  ${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c
1280
  )
1281

1282
set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U)
1283
set (GTPV1U_SRC
thomasl's avatar
thomasl committed
1284
  ${RRC_DIR}/rrc_eNB_GTPV1U.c
1285 1286 1287 1288 1289 1290 1291 1292
  ${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})

thomasl's avatar
thomasl committed
1293
set(SCTP_SRC
1294 1295 1296
  ${OPENAIR3_DIR}/SCTP/sctp_common.c
  ${OPENAIR3_DIR}/SCTP/sctp_eNB_task.c
  ${OPENAIR3_DIR}/SCTP/sctp_eNB_itti_messaging.c
thomasl's avatar
thomasl committed
1297
)
1298 1299
add_library(SCTP_CLIENT ${SCTP_SRC})

1300
add_library(UDP ${OPENAIR3_DIR}/UDP/udp_eNB_task.c)
1301 1302


1303
set(NAS_SRC ${OPENAIR3_DIR}/NAS/)
gauthier's avatar
gauthier committed
1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340
set(libnas_api_OBJS
  ${NAS_SRC}COMMON/API/NETWORK/as_message.c
  ${NAS_SRC}COMMON/API/NETWORK/nas_message.c
  ${NAS_SRC}COMMON/API/NETWORK/network_api.c
  )
  
set(libnas_emm_msg_OBJS
  ${NAS_SRC}COMMON/EMM/MSG/AttachAccept.c
  ${NAS_SRC}COMMON/EMM/MSG/AttachComplete.c
  ${NAS_SRC}COMMON/EMM/MSG/AttachReject.c
  ${NAS_SRC}COMMON/EMM/MSG/AttachRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/AuthenticationFailure.c
  ${NAS_SRC}COMMON/EMM/MSG/AuthenticationReject.c
  ${NAS_SRC}COMMON/EMM/MSG/AuthenticationRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/AuthenticationResponse.c
  ${NAS_SRC}COMMON/EMM/MSG/CsServiceNotification.c
  ${NAS_SRC}COMMON/EMM/MSG/DetachAccept.c
  ${NAS_SRC}COMMON/EMM/MSG/DetachRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/DownlinkNasTransport.c
  ${NAS_SRC}COMMON/EMM/MSG/EmmInformation.c
  ${NAS_SRC}COMMON/EMM/MSG/emm_msg.c
  ${NAS_SRC}COMMON/EMM/MSG/EmmStatus.c
  ${NAS_SRC}COMMON/EMM/MSG/ExtendedServiceRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/GutiReallocationCommand.c
  ${NAS_SRC}COMMON/EMM/MSG/GutiReallocationComplete.c
  ${NAS_SRC}COMMON/EMM/MSG/IdentityRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/IdentityResponse.c
  ${NAS_SRC}COMMON/EMM/MSG/SecurityModeCommand.c
  ${NAS_SRC}COMMON/EMM/MSG/SecurityModeComplete.c
  ${NAS_SRC}COMMON/EMM/MSG/SecurityModeReject.c
  ${NAS_SRC}COMMON/EMM/MSG/ServiceReject.c
  ${NAS_SRC}COMMON/EMM/MSG/ServiceRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateAccept.c
  ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateComplete.c
  ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateReject.c
  ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateRequest.c
  ${NAS_SRC}COMMON/EMM/MSG/UplinkNasTransport.c
thomasl's avatar
thomasl committed
1341
)
gauthier's avatar
gauthier committed
1342
  
thomasl's avatar
thomasl committed
1343
set(libnas_esm_msg_OBJS
gauthier's avatar
gauthier committed
1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c
  ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/BearerResourceAllocationReject.c
  ${NAS_SRC}COMMON/ESM/MSG/BearerResourceAllocationRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/BearerResourceModificationReject.c
  ${NAS_SRC}COMMON/ESM/MSG/BearerResourceModificationRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c
  ${NAS_SRC}COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/EsmInformationRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/EsmInformationResponse.c
  ${NAS_SRC}COMMON/ESM/MSG/esm_msg.c
  ${NAS_SRC}COMMON/ESM/MSG/EsmStatus.c
  ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c
  ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextReject.c
  ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/PdnConnectivityReject.c
  ${NAS_SRC}COMMON/ESM/MSG/PdnConnectivityRequest.c
  ${NAS_SRC}COMMON/ESM/MSG/PdnDisconnectReject.c
  ${NAS_SRC}COMMON/ESM/MSG/PdnDisconnectRequest.c
thomasl's avatar
thomasl committed
1367 1368 1369
)

set(libnas_ies_OBJS
gauthier's avatar
gauthier committed
1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412
  ${NAS_SRC}COMMON/IES/AccessPointName.c
  ${NAS_SRC}COMMON/IES/AdditionalUpdateResult.c
  ${NAS_SRC}COMMON/IES/AdditionalUpdateType.c
  ${NAS_SRC}COMMON/IES/ApnAggregateMaximumBitRate.c
  ${NAS_SRC}COMMON/IES/AuthenticationFailureParameter.c
  ${NAS_SRC}COMMON/IES/AuthenticationParameterAutn.c
  ${NAS_SRC}COMMON/IES/AuthenticationParameterRand.c
  ${NAS_SRC}COMMON/IES/AuthenticationResponseParameter.c
  ${NAS_SRC}COMMON/IES/CipheringKeySequenceNumber.c
  ${NAS_SRC}COMMON/IES/Cli.c
  ${NAS_SRC}COMMON/IES/CsfbResponse.c
  ${NAS_SRC}COMMON/IES/DaylightSavingTime.c
  ${NAS_SRC}COMMON/IES/DetachType.c
  ${NAS_SRC}COMMON/IES/DrxParameter.c
  ${NAS_SRC}COMMON/IES/EmergencyNumberList.c
  ${NAS_SRC}COMMON/IES/EmmCause.c
  ${NAS_SRC}COMMON/IES/EpsAttachResult.c
  ${NAS_SRC}COMMON/IES/EpsAttachType.c
  ${NAS_SRC}COMMON/IES/EpsBearerContextStatus.c
  ${NAS_SRC}COMMON/IES/EpsBearerIdentity.c
  ${NAS_SRC}COMMON/IES/EpsMobileIdentity.c
  ${NAS_SRC}COMMON/IES/EpsNetworkFeatureSupport.c
  ${NAS_SRC}COMMON/IES/EpsQualityOfService.c
  ${NAS_SRC}COMMON/IES/EpsUpdateResult.c
  ${NAS_SRC}COMMON/IES/EpsUpdateType.c
  ${NAS_SRC}COMMON/IES/EsmCause.c
  ${NAS_SRC}COMMON/IES/EsmInformationTransferFlag.c
  ${NAS_SRC}COMMON/IES/EsmMessageContainer.c
  ${NAS_SRC}COMMON/IES/GprsTimer.c
  ${NAS_SRC}COMMON/IES/GutiType.c
  ${NAS_SRC}COMMON/IES/IdentityType2.c
  ${NAS_SRC}COMMON/IES/ImeisvRequest.c
  ${NAS_SRC}COMMON/IES/KsiAndSequenceNumber.c
  ${NAS_SRC}COMMON/IES/LcsClientIdentity.c
  ${NAS_SRC}COMMON/IES/LcsIndicator.c
  ${NAS_SRC}COMMON/IES/LinkedEpsBearerIdentity.c
  ${NAS_SRC}COMMON/IES/LlcServiceAccessPointIdentifier.c
  ${NAS_SRC}COMMON/IES/LocationAreaIdentification.c
  ${NAS_SRC}COMMON/IES/MessageType.c
  ${NAS_SRC}COMMON/IES/MobileIdentity.c
  ${NAS_SRC}COMMON/IES/MobileStationClassmark2.c
  ${NAS_SRC}COMMON/IES/MobileStationClassmark3.c
  ${NAS_SRC}COMMON/IES/MsNetworkCapability.c
1413
  ${NAS_SRC}COMMON/IES/MsNetworkFeatureSupport.c
gauthier's avatar
gauthier committed
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447
  ${NAS_SRC}COMMON/IES/NasKeySetIdentifier.c
  ${NAS_SRC}COMMON/IES/NasMessageContainer.c
  ${NAS_SRC}COMMON/IES/NasRequestType.c
  ${NAS_SRC}COMMON/IES/NasSecurityAlgorithms.c
  ${NAS_SRC}COMMON/IES/NetworkName.c
  ${NAS_SRC}COMMON/IES/Nonce.c
  ${NAS_SRC}COMMON/IES/PacketFlowIdentifier.c
  ${NAS_SRC}COMMON/IES/PagingIdentity.c
  ${NAS_SRC}COMMON/IES/PdnAddress.c
  ${NAS_SRC}COMMON/IES/PdnType.c
  ${NAS_SRC}COMMON/IES/PlmnList.c
  ${NAS_SRC}COMMON/IES/ProcedureTransactionIdentity.c
  ${NAS_SRC}COMMON/IES/ProtocolConfigurationOptions.c
  ${NAS_SRC}COMMON/IES/ProtocolDiscriminator.c
  ${NAS_SRC}COMMON/IES/PTmsiSignature.c
  ${NAS_SRC}COMMON/IES/QualityOfService.c
  ${NAS_SRC}COMMON/IES/RadioPriority.c
  ${NAS_SRC}COMMON/IES/SecurityHeaderType.c
  ${NAS_SRC}COMMON/IES/ServiceType.c
  ${NAS_SRC}COMMON/IES/ShortMac.c
  ${NAS_SRC}COMMON/IES/SsCode.c
  ${NAS_SRC}COMMON/IES/SupportedCodecList.c
  ${NAS_SRC}COMMON/IES/TimeZoneAndTime.c
  ${NAS_SRC}COMMON/IES/TimeZone.c
  ${NAS_SRC}COMMON/IES/TmsiStatus.c
  ${NAS_SRC}COMMON/IES/TrackingAreaIdentity.c
  ${NAS_SRC}COMMON/IES/TrackingAreaIdentityList.c
  ${NAS_SRC}COMMON/IES/TrafficFlowAggregateDescription.c
  ${NAS_SRC}COMMON/IES/TrafficFlowTemplate.c
  ${NAS_SRC}COMMON/IES/TransactionIdentifier.c
  ${NAS_SRC}COMMON/IES/UeNetworkCapability.c
  ${NAS_SRC}COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c
  ${NAS_SRC}COMMON/IES/UeSecurityCapability.c
  ${NAS_SRC}COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c
thomasl's avatar
thomasl committed
1448 1449 1450
)

set (libnas_utils_OBJS
gauthier's avatar
gauthier committed
1451 1452 1453 1454 1455 1456 1457 1458 1459
  ${NAS_SRC}COMMON/UTIL/device.c
  ${NAS_SRC}COMMON/UTIL/memory.c
  ${NAS_SRC}COMMON/UTIL/nas_log.c
  ${NAS_SRC}COMMON/UTIL/nas_timer.c
  ${NAS_SRC}COMMON/UTIL/socket.c
  ${NAS_SRC}COMMON/UTIL/stty.c
  ${NAS_SRC}COMMON/UTIL/TLVEncoder.c
  ${NAS_SRC}COMMON/UTIL/TLVDecoder.c
  ${NAS_SRC}COMMON/UTIL/OctetString.c
thomasl's avatar
thomasl committed
1460 1461
)

navid's avatar
navid committed
1462
if(NAS_UE) 
gauthier's avatar
gauthier committed
1463 1464 1465 1466 1467 1468 1469 1470
  set(libnas_ue_api_OBJS
    ${NAS_SRC}UE/API/USER/at_command.c
    ${NAS_SRC}UE/API/USER/at_error.c
    ${NAS_SRC}UE/API/USER/at_response.c
    ${NAS_SRC}UE/API/USER/user_api.c
    ${NAS_SRC}UE/API/USER/user_indication.c
    ${NAS_SRC}UE/API/USIM/aka_functions.c
    ${NAS_SRC}UE/API/USIM/usim_api.c
thomasl's avatar
thomasl committed
1471
  )
gauthier's avatar
gauthier committed
1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531
  set(libnas_ue_emm_OBJS
    ${NAS_SRC}UE/EMM/Attach.c
    ${NAS_SRC}UE/EMM/Authentication.c
    ${NAS_SRC}UE/EMM/Detach.c
    ${NAS_SRC}UE/EMM/emm_main.c
    ${NAS_SRC}UE/EMM/EmmStatusHdl.c
    ${NAS_SRC}UE/EMM/Identification.c
    ${NAS_SRC}UE/EMM/IdleMode.c
    ${NAS_SRC}UE/EMM/LowerLayer.c
    ${NAS_SRC}UE/EMM/SecurityModeControl.c
    ${NAS_SRC}UE/EMM/ServiceRequestHdl.c
    ${NAS_SRC}UE/EMM/TrackingAreaUpdate.c
  )
  set(libnas_ue_emm_sap_OBJS
    ${NAS_SRC}UE/EMM/SAP/emm_as.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c
    ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c
    ${NAS_SRC}UE/EMM/SAP/emm_esm.c
    ${NAS_SRC}UE/EMM/SAP/emm_fsm.c
    ${NAS_SRC}UE/EMM/SAP/EmmNull.c
    ${NAS_SRC}UE/EMM/SAP/emm_recv.c
    ${NAS_SRC}UE/EMM/SAP/emm_reg.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegistered.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c
    ${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c
    ${NAS_SRC}UE/EMM/SAP/emm_sap.c
    ${NAS_SRC}UE/EMM/SAP/emm_send.c
    ${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c
    ${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c
  )
  set (libnas_ue_esm_OBJS
    ${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c
    ${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c
    ${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c
    ${NAS_SRC}UE/ESM/esm_ebr.c
    ${NAS_SRC}UE/ESM/esm_ebr_context.c
    ${NAS_SRC}UE/ESM/esm_ip.c
    ${NAS_SRC}UE/ESM/esm_main.c
    ${NAS_SRC}UE/ESM/esm_pt.c
    ${NAS_SRC}UE/ESM/EsmStatusHdl.c
    ${NAS_SRC}UE/ESM/PdnConnectivity.c
    ${NAS_SRC}UE/ESM/PdnDisconnect.c
  )
  set(libnas_ue_esm_sap_OBJS
    ${NAS_SRC}UE/ESM/SAP/esm_recv.c
    ${NAS_SRC}UE/ESM/SAP/esm_send.c
    ${NAS_SRC}UE/ESM/SAP/esm_sap.c
thomasl's avatar
thomasl committed
1532
  )
gauthier's avatar
gauthier committed
1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549
  add_library(LIB_NAS_UE
    ${NAS_SRC}UE/nas_itti_messaging.c
    ${NAS_SRC}UE/nas_network.c
    ${NAS_SRC}UE/nas_parser.c
    ${NAS_SRC}UE/nas_proc.c
    ${NAS_SRC}UE/nas_user.c
    ${libnas_api_OBJS}
    ${libnas_ue_api_OBJS}
    ${libnas_emm_msg_OBJS}
    ${libnas_esm_msg_OBJS}
    ${libnas_ies_OBJS}
    ${libnas_utils_OBJS}
    ${libnas_ue_emm_OBJS}
    ${libnas_ue_emm_sap_OBJS}
    ${libnas_ue_esm_OBJS}
    ${libnas_ue_esm_sap_OBJS}
  )
navid's avatar
navid committed
1550 1551
  set(NAS_UE_LIB LIB_NAS_UE)

gauthier's avatar
gauthier committed
1552 1553 1554 1555 1556 1557 1558 1559
  include_directories(${NAS_SRC}UE)
  include_directories(${NAS_SRC}UE/API/USER)
  include_directories(${NAS_SRC}UE/API/USIM)
  include_directories(${NAS_SRC}UE/EMM)
  include_directories(${NAS_SRC}UE/EMM/SAP)
  include_directories(${NAS_SRC}UE/ESM)
  include_directories(${NAS_SRC}UE/ESM/SAP)
endif()
1560

gauthier's avatar
gauthier committed
1561

thomasl's avatar
thomasl committed
1562 1563 1564 1565 1566 1567 1568 1569

# 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)
1570
file(GLOB lfds_stack ${lfds}/lfds611_stack/*.c)
thomasl's avatar
thomasl committed
1571 1572 1573
file(GLOB lfds_freelist ${lfds}/lfds611_freelist/*.c)

include_directories(${lfds})
1574
add_library(LFDS
thomasl's avatar
thomasl committed
1575 1576 1577 1578 1579 1580 1581 1582
  ${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
)

1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599
set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/)
file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c)
file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c)
file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c)
file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c)
file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c)
file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c)
file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c)
file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c)
file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c)
file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c)

include_directories(${lfds7})
add_library(LFDS7
  ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc}
)

thomasl's avatar
thomasl committed
1600 1601 1602 1603 1604 1605 1606 1607 1608 1609
# 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
1610 1611
${OPENAIR1_DIR}/SIMULATION/RF/dac.c
${OPENAIR1_DIR}/SIMULATION/RF/adc.c
thomasl's avatar
thomasl committed
1612 1613
)

1614 1615 1616 1617 1618 1619 1620 1621 1622
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
)

1623 1624 1625 1626
add_library(OPENAIR0_LIB
  ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c
)

thomasl's avatar
thomasl committed
1627
# System packages that are required
1628 1629
# 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
1630
###################################
1631 1632 1633 1634 1635
include(FindPkgConfig)

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

gauthier's avatar
gauthier committed
1636 1637 1638
pkg_search_module(LIBXSLT libxslt REQUIRED)
include_directories(${LIBXSLT_INCLUDE_DIRS})

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

1642 1643 1644 1645 1646 1647 1648
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
1649
if (${RF_BOARD} STREQUAL "OAI_USRP")
thomasl's avatar
thomasl committed
1650 1651
  find_package(Boost REQUIRED)
  include_directories(${LIBBOOST_INCLUDE_DIR})
1652
endif (${RF_BOARD} STREQUAL "OAI_USRP")
thomasl's avatar
thomasl committed
1653

1654
pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2)
1655 1656 1657 1658 1659 1660 1661 1662
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})
1663
  message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!")
1664 1665 1666 1667
else()
  include_directories(${NETTLE_INCLUDE_DIRS})
endif()

1668 1669
message ("NETTLE VERSION_INSTALLED  = ${NETTLE_VERSION}")

1670 1671 1672 1673
string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION})
string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION})
message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}")
message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}")
1674

1675
if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "")
1676 1677 1678
  message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" )
endif()

1679 1680
add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}")
add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}")
1681

1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698
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")