X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=CMakeLists.txt;h=31095138a11d4d89cec002ca32ad31df9cb2562f;hb=e3a021c1e7bc4bdb877cd12601a55c7e3f74437e;hp=b8176999cdd70e5808becd026e5e128f43b8c774;hpb=ab6d04ce30514b16ba5821fcc788157b4779a4a3;p=ric-plt%2Flib%2Frmr.git diff --git a/CMakeLists.txt b/CMakeLists.txt index b817699..3109513 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,12 +33,14 @@ # -DSKIP_EXTERNALS=1 Do not use NNG submodule when building; uee installed packages # -DMAN_PREFIX= Supply a path where man pages are installed (default: /usr/share/man) +# See ci/build_all for an example of how to build and test + project( rmr LANGUAGES C ) cmake_minimum_required( VERSION 3.5 ) set( major_version "3" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this -set( minor_version "2" ) -set( patch_level "1" ) +set( minor_version "8" ) +set( patch_level "2" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) set( install_inc "include/rmr" ) @@ -274,15 +276,15 @@ set_target_properties( rmr_si_shared SOVERSION ${major_version} VERSION ${major_version}.${minor_version}.${patch_level} ) -# we only build/export the static archive (.a) if generating a dev package -if( DEV_PKG ) - add_library( rmr_si_static STATIC "$;$" ) - set_target_properties( rmr_si_static - PROPERTIES - OUTPUT_NAME "rmr_si" - SOVERSION ${major_version} - VERSION ${major_version}.${minor_version}.${patch_level} ) -endif() +# even if not generating a development package we still need to generate the .a so that health check +# can link against it to avoid RPM install issues. +# +add_library( rmr_si_static STATIC "$;$" ) +set_target_properties( rmr_si_static + PROPERTIES + OUTPUT_NAME "rmr_si" + SOVERSION ${major_version} + VERSION ${major_version}.${minor_version}.${patch_level} ) # if externals need to be built, then we must force them to be built first by depending on them if( need_ext ) @@ -293,6 +295,29 @@ if( need_ext ) endif() endif() +# ------------- testing ------------------------------------------------------- +enable_testing() +# cmake cannot set env vars, so we have to passed desired vars on the wrapper command +add_test( + NAME drive_unit_tests + COMMAND bash ../test/run_unit_tests.sh CMBUILD=${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ../test +) + +# cmake seems unable to start test/app_test/run_all.ksh, so we have to lump +# a dummy script in ./test that does the obvious thing. +add_test( + NAME drive_app + COMMAND bash ./run_app_tests.sh LD_LIBRARY_PATH=${install_root}/lib C_INCLUDE_PATH=${install_root}/include CMBUILD=${CMAKE_CURRENT_BINARY_DIR} + WORKING_DIRECTORY ../test +) + + +# --- support binaries that depend on the libs identified above --------------- +add_subdirectory( src/support ) + +# ------------- packaging ----------------------------------------------------- + # if( APPLE ) message( "### apple hack: forcing hard coded library paths for nng/nano dynamic libraries" ) @@ -319,7 +344,7 @@ install( TARGETS ${target_list} EXPORT LibraryConfig unset( DEV_PKG CACHE ) # prevent from being a hidden setting if user redoes things # install any nano/nng libraries in to the deb as well, but ONLY if asked for on the 'cmake ..' command -# (sure would be nice if FILEs allowed for globbing; sadlyy it does not.) +# (sure would be nice if FILEs allowed for globbing; sadly it does not.) # if( PACK_EXTERNALS ) message( "+++ including nano and nng libraries in the deb" ) @@ -341,6 +366,9 @@ IF( EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" ) set( CPACK_DEBIAN_PACKAGE_NAME ${deb_pkg_name} ) set( CPACK_RPM_PACKAGE_NAME ${rpm_pkg_name} ) + # auto dependency checking makes the RPM install fail, see NOTES + set( CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION="/usr/local /usr/local/bin /usr/local/lib" ) + set( CPACK_set_DESTDIR "on" ) set( CPACK_PACKAGING_INSTALL_PREFIX "${install_root}" ) set( CPACK_GENERATOR "${pkg_list}" )