X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=CMakeLists.txt;h=26b429b7f0691cea9ec7867f8f861fcc66d5c169;hb=refs%2Fheads%2Fg-release;hp=d702d45193c38def355a58a485beeab7a91223a3;hpb=8cb3c6f5d5062b83f17a5739e0671490beb543de;p=ric-plt%2Fxapp-frame-cpp.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d702d45..26b429b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,9 +28,9 @@ project( ricxfcpp ) cmake_minimum_required( VERSION 3.5 ) -set( major_version "0" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this -set( minor_version "1" ) -set( patch_level "0" ) +set( major_version "2" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this +set( minor_version "3" ) +set( patch_level "8" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) set( install_inc "include/ricxfcpp" ) @@ -100,7 +100,7 @@ add_definitions( -DMAJOR_VER=${major_version} -DMINOR_VER=${minor_version} -DPATCH_VER=${patch_level} - -DDEBUG=${debugging} + #-DDEBUG=${debugging} ) # ---------------- suss out pkg gen tools so we don't fail generating packages that the system cannot support -------------- @@ -149,18 +149,24 @@ endif() +# bleeding cmake names are short novels; and when lines cannot be split they're a pain +set ( srcd "${CMAKE_CURRENT_SOURCE_DIR}" ) + # this gets us round a chicken/egg problem. include files don't exist until make is run # but Cmake insists on having these exist when we add them to include directories to # enable code to find them after we build them. # -include_directories( "${CMAKE_CURRENT_SOURCE_DIR}/src/messaging" ) - +#include_directories( "${srcd}/src/messaging;${srcd}/src/json;${srcd}/src/alarm;${srcd}/src/metrics;${srcd}/src/config;${srcd}/ext/jsmn" ) +include_directories( "${srcd}/src/messaging;${srcd}/src/json;${srcd}/src/alarm;${srcd}/src/metrics;${srcd}/src/config;${srcd}/ext/jsmn;;${srcd}/src/model;${srcd}/src/rest-client;${srcd}/src/rest-server" ) # Compiler flags # +#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17") +#set(CMAKE_CXX_STANDARD 17) set( CMAKE_POSITION_INDEPENDENT_CODE ON ) set( CMAKE_C_FLAGS "-g " ) set( CMAKE_CPP_FLAGS "-g " ) +set( CMAKE_CXX_FLAGS "-g " ) if( GPROF ) # if set, we'll set profiling flag on compiles message( "+++ profiling is on" ) set( CMAKE_C_FLAGS "-pg " ) @@ -170,35 +176,63 @@ else() endif() unset( GPROF CACHE ) # we don't want this to persist + +# --------------------- external building -------------------------------------------------------- +execute_process( COMMAND git submodule update --init -- ext/jsmn + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + ) + + +# --------------------- framework building -------------------------------------------------------- # Include modules +add_subdirectory( src/json ) add_subdirectory( src/messaging ) add_subdirectory( src/xapp ) -#add_subdirectory( doc ) # this will auto skip if {X}fm is not available +add_subdirectory( src/alarm ) +add_subdirectory( src/metrics ) +add_subdirectory( src/config ) +add_subdirectory( src/model ) +add_subdirectory( src/rest-client ) +add_subdirectory( src/rest-server ) +#add_subdirectory( doc ) # this will auto skip if {X}fm is not available # shared and static libraries are built from the same object files. # -add_library( ricxfcpp_shared SHARED "$;$" ) +add_library( ricxfcpp_shared SHARED + "$;$;$;$;$;$;$;$;$" +) set_target_properties( ricxfcpp_shared PROPERTIES OUTPUT_NAME "ricxfcpp" SOVERSION ${major_version} - VERSION ${major_version}.${minor_version}.${patch_level} + VERSION ${major_version}.${minor_version}.${patch_level} ) -target_include_directories( ricxfcpp_shared PUBLIC "src/messenger" "src/xapp" ) +#target_include_directories( ricxfcpp_shared PUBLIC "src/alarm" "src/metrics" "src/messenger" "src/xapp" ) # we only build/export the static archive (.a) if generating a dev package if( DEV_PKG ) - add_library( ricxfcpp_static STATIC "$;$" ) + add_library( ricxfcpp_static STATIC + "$;$;$;$;$;$;$;$;$" + ) set_target_properties( ricxfcpp_static PROPERTIES OUTPUT_NAME "ricxfcpp" SOVERSION ${major_version} - VERSION ${major_version}.${minor_version}.${patch_level} + VERSION ${major_version}.${minor_version}.${patch_level} ) - target_include_directories( ricxfcpp_static PUBLIC "src/messenger" "src/xapp" ) +# target_include_directories( ricxfcpp_static PUBLIC "src/alarm" "src/metrics" "src/messenger" "src/xapp" ) endif() +# -------- unit testing ------------------------------------------------------- +enable_testing() +add_test( + NAME drive_unit_tests + COMMAND bash ../test/unit_test.sh -q CMBUILD=${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ../test +) + + # ------------- packaging ----------------------------------------------------- # Define what should be installed, and where they should go. For dev package we install @@ -212,9 +246,9 @@ else() endif() install( TARGETS ${target_list} EXPORT LibraryConfig - LIBRARY DESTINATION ${install_lib} - ARCHIVE DESTINATION ${install_lib} - PUBLIC_HEADER DESTINATION ${install_inc} + LIBRARY DESTINATION ${install_lib} + ARCHIVE DESTINATION ${install_lib} + PUBLIC_HEADER DESTINATION ${install_inc} ) unset( DEV_PKG CACHE ) # prevent from being a hidden setting if user redoes things @@ -254,3 +288,4 @@ IF( EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" ) INCLUDE( CPack ) ENDIF() +