Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 1 | # |
| 2 | #================================================================================== |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 3 | # Copyright (c) 2019 Nokia |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 4 | # Copyright (c) 2018-2019 AT&T Intellectual Property. |
| 5 | # |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | #================================================================================== |
| 18 | # |
| 19 | |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 20 | # This CMake definition supports several -D command line options: |
| 21 | # |
| 22 | # -DDEV_PKG=1 Development package configuration |
| 23 | # -DBUILD_DOC=1 Man pages generated |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 24 | # -DIGNORE_LIBDIR=1 Installation of rmr libries is into /usr/local/lib and ignores |
| 25 | # value in CMAKE_INSTALL_LIBDIR. |
| 26 | # system preferred (typically /usr/local/lib64). |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 27 | # -DPRESERVE_PTYPE=1 Do not change the processor type when naming deb packages |
| 28 | # -DPACK_EXTERNALS=1 Include external libraries used to build in the run-time package |
E. Scott Daniels | e30fc3a | 2019-07-16 12:03:45 -0400 | [diff] [blame] | 29 | # (This makes some stand-alone unit testing of bindings possible, it |
| 30 | # is not meant to be used for production package generation.) |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 31 | # -DSKIP_EXTERNALS=1 Do not use NNG submodule when building; uee installed packages |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 32 | # -DMAN_PREFIX=<path> Supply a path where man pages are installed (default: /usr/share/man) |
| 33 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 34 | project( rmr LANGUAGES C ) |
| 35 | cmake_minimum_required( VERSION 3.5 ) |
| 36 | |
E. Scott Daniels | d710957 | 2019-04-18 14:01:16 +0000 | [diff] [blame] | 37 | set( major_version "1" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this |
E. Scott Daniels | 13114d1 | 2019-09-19 08:40:39 -0400 | [diff] [blame^] | 38 | set( minor_version "8" ) |
E. Scott Daniels | 4ac73e3 | 2019-08-13 11:35:04 -0400 | [diff] [blame] | 39 | set( patch_level "0" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 40 | |
| 41 | set( install_root "${CMAKE_INSTALL_PREFIX}" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 42 | set( install_inc "include/rmr" ) |
| 43 | if( MAN_PREFIX ) |
| 44 | set( install_man ${MAN_PREFIX} ) # is there a cmake var for this -- can't find one |
| 45 | else() |
| 46 | set( install_man "/usr/share/man" ) # this needs to be fixed so it's not hard coded |
| 47 | endif() |
| 48 | |
| 49 | # Must use GNUInstallDirs to install libraries into correct |
| 50 | # locations on all platforms. |
| 51 | include( GNUInstallDirs ) |
| 52 | |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 53 | # nng installs using LIBDIR as established by the gnu include; it varies from system |
| 54 | # to system, and we don't trust that it is always set, so we default to lib if it is missing. |
E. Scott Daniels | a943533 | 2019-05-09 14:39:19 +0000 | [diff] [blame] | 55 | # |
| 56 | if( NOT CMAKE_INSTALL_LIBDIR ) |
| 57 | set( CMAKE_INSTALL_LIBDIR "lib" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 58 | endif() |
| 59 | |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 60 | if( IGNORE_LIBDIR ) # if set, then force to lib otherwise use "system preference" |
| 61 | set( install_lib "lib" ) |
| 62 | else() |
| 63 | set( install_lib "${CMAKE_INSTALL_LIBDIR}" ) |
| 64 | endif() |
| 65 | unset(IGNORE_LIBDIR CACHE ) # we don't want this to persist |
| 66 | message( "+++ RMR library install target directory: ${install_lib}" ) |
| 67 | |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 68 | # ---------------- extract some things from git ------------------------------ |
| 69 | |
| 70 | # commit id for the version string |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 71 | execute_process( |
| 72 | COMMAND bash -c "git rev-parse --short HEAD|awk '{printf\"%s\", $0}'" |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 73 | OUTPUT_VARIABLE git_id |
| 74 | ) |
| 75 | |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 76 | # version information for library names and version string |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 77 | execute_process( |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 78 | COMMAND bash -c "git describe --tags --abbrev=0 HEAD 2>/dev/null | awk -v tag=0.0.4095 ' { tag=$1 } END{ print tag suffix }'|sed 's/\\./;/g' " |
| 79 | OUTPUT_VARIABLE mmp_version_str |
| 80 | ERROR_QUIET OUTPUT_STRIP_TRAILING_WHITESPACE |
| 81 | ) |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 82 | message( "+++ mmp version from tag: '${mmp_version_str}'" ) |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 83 | |
| 84 | # extra indicator to show that the build was based on modified file(s) and not the true commit |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 85 | # (no hope of reproducing the exact library for debugging). Used only for the internal version |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 86 | # string. |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 87 | execute_process( |
| 88 | COMMAND bash -c "git diff --shortstat|awk -v fmt=%s -v r=-rotten '{ s=r } END { printf( fmt, s ) }'" |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 89 | OUTPUT_VARIABLE spoiled_str |
| 90 | ) |
| 91 | |
E. Scott Daniels | d710957 | 2019-04-18 14:01:16 +0000 | [diff] [blame] | 92 | # uncomment these lines once CI starts adding a tag on merge |
| 93 | #set( mmp_version ${mmp_version_str} ) |
| 94 | #list( GET mmp_version 0 major_version ) |
| 95 | #list( GET mmp_version 1 minor_version ) |
| 96 | #list( GET mmp_version 2 patch_level ) |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 97 | |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 98 | |
| 99 | # define constants used in the version string |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 100 | add_definitions( |
| 101 | -DGIT_ID=${git_id} |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 102 | -DMAJOR_VER=${major_version} |
| 103 | -DMINOR_VER=${minor_version} |
E. Scott Daniels | d4f18ba | 2019-06-17 15:08:17 -0400 | [diff] [blame] | 104 | -DPATCH_VER=${patch_level} |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 105 | ) |
| 106 | |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 107 | # ---------------- suss out pkg gen tools so we don't fail generating packages that the system cannot support -------------- |
| 108 | |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 109 | # deb packages use underbars, and package manager(s) seem to flip the *_64 processor type |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 110 | # to the old (non-standard) amd64 string, so we do it here for consistency. Set -DPRESERVE_PTYPE=1 |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 111 | # to prevent the flip. RPM packages will always be given the system generated processor type string. |
| 112 | # |
| 113 | if( ${CMAKE_SYSTEM_PROCESSOR} MATCHES "x86_64" ) |
| 114 | if( NOT PRESERVE_PTYPE ) |
| 115 | set( deb_sys_name "amd64" ) |
| 116 | else() |
| 117 | set( deb_sys_name ${CMAKE_SYSTEM_PROCESSOR} ) |
| 118 | endif() |
| 119 | else() |
| 120 | set( deb_sys_name ${CMAKE_SYSTEM_PROCESSOR} ) |
| 121 | endif() |
| 122 | unset( PRESERVE_PTYPE CACHE ) # we don't want this to persist |
| 123 | |
| 124 | set( rpm_sys_name ${CMAKE_SYSTEM_PROCESSOR} ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 125 | |
| 126 | if( DEV_PKG ) |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 127 | set( deb_pkg_name "rmr-dev" ) |
| 128 | set( rpm_pkg_name "rmr-devel" ) |
E. Scott Daniels | d4f18ba | 2019-06-17 15:08:17 -0400 | [diff] [blame] | 129 | else() |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 130 | set( deb_pkg_name "rmr" ) |
| 131 | set( rpm_pkg_name "rmr" ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 132 | endif() |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 133 | |
| 134 | set( pkg_label "rmr${spoiled_str}-${major_version}.${minor_version}.${patch_level}-${sys_name}" ) |
| 135 | set( rpm_pkg_label "${rpm_pkg_name}${spoiled_str}-${major_version}.${minor_version}.${patch_level}-${rpm_sys_name}" ) |
| 136 | set( deb_pkg_label "${deb_pkg_name}${spoiled_str}_${major_version}.${minor_version}.${patch_level}_${deb_sys_name}" ) |
| 137 | message( "+++ pkg name: ${deb_pkg_label}.deb" ) |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 138 | |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 139 | #set( out_yml /tmp/build_output.yml ) # we will record package names (we record only untainted names) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 140 | find_program( rpm NAMES rpmbuild ) # rpm package gen requires this to be installed |
| 141 | |
| 142 | set( gen_rpm 0 ) |
| 143 | if( "${rpm}" MATCHES "rpm-NOTFOUND" ) # cannot build rpm |
| 144 | set( pkg_list "DEB" ) |
| 145 | message( "### make package will generate only deb package; cannot find support to generate rpm packages" ) |
| 146 | else() |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 147 | message( "+++ pkg name: ${rpm_pkg_label}.rpm" ) # debugging if we think we can gen rpm too |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 148 | set( pkg_list "DEB;RPM" ) |
| 149 | set( gen_rpm 1 ) |
| 150 | message( "+++ make package will generate both deb and rpm packages" ) |
| 151 | endif() |
| 152 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 153 | # ---------------- setup nano/nng things --------------------------------------- |
| 154 | if( NOT SKIP_EXTERNALS ) |
| 155 | set( need_ext 1 ) # we force dependences on these for right build order |
| 156 | execute_process( COMMAND git submodule update --init -- ext/nng |
| 157 | WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} |
| 158 | ) |
| 159 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 160 | if( NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/ext/nng/CMakeLists.txt ) |
| 161 | message( FATAL_ERROR "cannot find nng in our git source as a submodule: Giving up" ) # this will abort which seems wrong, but tdam. |
| 162 | endif() |
| 163 | |
| 164 | include( ExternalProject ) |
| 165 | ExternalProject_Add( |
| 166 | ext_nng |
| 167 | SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/nng" |
| 168 | CMAKE_ARGS "-DBUILD_SHARED_LIBS=1" |
| 169 | CMAKE_ARGS "-DCMAKE_INSTALL_PREFIX=${CMAKE_CURRENT_BINARY_DIR}" |
| 170 | BUILD_COMMAND "make" |
| 171 | UPDATE_COMMAND "" |
| 172 | TEST_COMMAND "" |
| 173 | STEP_TARGETS build |
| 174 | ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 175 | |
| 176 | # it seems impossible to install everything that lands in {bin}/lib, so we need to |
| 177 | # hard code (shudder) some things. Even worse, we have to make exceptions for |
| 178 | # builds on apple (osx) since their naming convention wandered off the path. |
| 179 | set( nng_major 1 ) |
| 180 | set( nng_minor 1.0 ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 181 | set( so ${CMAKE_SHARED_LIBRARY_SUFFIX} ) # cmake variables are impossibly long :( |
| 182 | if( NOT APPLE ) # probably breaks in windows, but idc |
| 183 | set( nng_so_suffix ${so} ) |
| 184 | set( nng_so_suffix_m ${so}.${nng_major} ) |
| 185 | set( nng_so_suffix_mm ${so}.${nng_major}.${nng_minor} ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 186 | else() |
| 187 | # of course apple puts versions before the suffix :( |
| 188 | set( nng_so_suffix ${so} ) # so has a lead dot, so NOT needed |
| 189 | set( nng_so_suffix_m ".${nng_major}${so}" ) # these need leading dots |
| 190 | set( nng_so_suffix_mm ".${nng_major}.${nng_minor}${so}" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 191 | endif() |
| 192 | |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 193 | message( "+++ building with nng: ${nng_major}.${nng_minor}" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 194 | else() |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 195 | if( PACK_EXTERNALS ) |
E. Scott Daniels | e30fc3a | 2019-07-16 12:03:45 -0400 | [diff] [blame] | 196 | # This makes some stand-alone unit testing possible for bindings and transport layer testing; |
| 197 | # it is not meant for production packages. |
| 198 | # |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 199 | unset( SKIP_EXTERNALS CACHE ) # must remove so as not to trap user into a never ending failure |
| 200 | unset( PACK_EXTERNALS CACHE ) |
| 201 | message( FATAL_ERROR "ERROR: PACK_EXTERNALS can be set only if SKIP_EXTERNALS is unset (=0, or not supplied on command line)" ) |
| 202 | endif() |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 203 | set( need_ext 0 ) |
| 204 | endif() |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 205 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 206 | |
| 207 | |
| 208 | # this gets us round a chicken/egg problem. include files don't exist until make is run |
| 209 | # but Cmake insists on having these exist when we add them to include directories to |
| 210 | # enable rmr code to find them after we build them. |
| 211 | # |
| 212 | execute_process( COMMAND "mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/include/nng" ) |
| 213 | include_directories( "${CMAKE_CURRENT_BINARY_DIR}/include" ) |
| 214 | |
| 215 | |
| 216 | # Compiler flags |
| 217 | # |
| 218 | set( CMAKE_POSITION_INDEPENDENT_CODE ON ) |
| 219 | set( CMAKE_CXX_FLAGS "-g -Wall " ) |
| 220 | |
| 221 | # Include modules |
E. Scott Daniels | 68c1ab2 | 2019-05-17 17:50:59 +0000 | [diff] [blame] | 222 | add_subdirectory( src/rmr/common ) |
E. Scott Daniels | 68c1ab2 | 2019-05-17 17:50:59 +0000 | [diff] [blame] | 223 | add_subdirectory( src/rmr/nng ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 224 | add_subdirectory( doc ) # this will auto skip if {X}fm is not available |
| 225 | |
| 226 | |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 227 | # shared and static libraries are built from the same object files. |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 228 | # librmr_nng is a combination of common and nng specific rmr functions. |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 229 | # |
E. Scott Daniels | 68c5cf1 | 2019-04-12 15:14:40 +0000 | [diff] [blame] | 230 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 231 | add_library( rmr_nng_shared SHARED "$<TARGET_OBJECTS:nng_objects>;$<TARGET_OBJECTS:common_objects>" ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 232 | set_target_properties( rmr_nng_shared |
| 233 | PROPERTIES |
| 234 | OUTPUT_NAME "rmr_nng" |
| 235 | SOVERSION ${major_version} |
| 236 | VERSION ${major_version}.${minor_version}.${patch_level} ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 237 | |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 238 | # we only build/export the static archive (.a) if generating a dev package |
| 239 | if( DEV_PKG ) |
| 240 | add_library( rmr_nng_static STATIC "$<TARGET_OBJECTS:nng_objects>;$<TARGET_OBJECTS:common_objects>" ) |
| 241 | set_target_properties( rmr_nng_static |
| 242 | PROPERTIES |
| 243 | OUTPUT_NAME "rmr_nng" |
| 244 | SOVERSION ${major_version} |
| 245 | VERSION ${major_version}.${minor_version}.${patch_level} ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 246 | endif() |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 247 | |
| 248 | # if externals need to be built, then we must force them to be built first by depending on them |
| 249 | if( need_ext ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 250 | if( DEV_PKG ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 251 | add_dependencies( rmr_nng_shared;rmr_nng_static ext_nng ) |
| 252 | else() |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 253 | add_dependencies( rmr_nng_shared ext_nng ) |
| 254 | endif() |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 255 | endif() |
| 256 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 257 | # |
| 258 | if( APPLE ) |
| 259 | message( "### apple hack: forcing hard coded library paths for nng/nano dynamic libraries" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 260 | target_link_libraries( rmr_nng_shared ${CMAKE_CURRENT_BINARY_DIR}/lib/libnng${nng_so_suffix} ) |
| 261 | endif() |
| 262 | |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 263 | # Define what should be installed, and where they should go. For dev package we install |
| 264 | # only the RMr headers, man pages and archive (.a) files. The run-time package gets just |
| 265 | # the library (.so) files and nothing more. |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 266 | # |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 267 | if( DEV_PKG ) |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 268 | set( target_list "rmr_nng_static" ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 269 | else() |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 270 | set( target_list "rmr_nng_shared" ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 271 | endif() |
| 272 | |
| 273 | install( TARGETS ${target_list} EXPORT LibraryConfig |
| 274 | LIBRARY DESTINATION ${install_lib} |
| 275 | ARCHIVE DESTINATION ${install_lib} |
| 276 | PUBLIC_HEADER DESTINATION ${install_inc} |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 277 | ) |
| 278 | |
| 279 | |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 280 | unset( DEV_PKG CACHE ) # prevent from being a hidden setting if user redoes things |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 281 | |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 282 | # install any nano/nng libraries in to the deb as well, but ONLY if asked for on the 'cmake ..' command |
| 283 | # (sure would be nice if FILEs allowed for globbing; sadlyy it does not.) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 284 | # |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 285 | if( PACK_EXTERNALS ) |
E. Scott Daniels | 257323c | 2019-06-14 12:30:21 -0400 | [diff] [blame] | 286 | message( "+++ including nano and nng libraries in the deb" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 287 | install( FILES |
E. Scott Daniels | a943533 | 2019-05-09 14:39:19 +0000 | [diff] [blame] | 288 | ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libnng${nng_so_suffix} |
| 289 | ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libnng${nng_so_suffix_m} |
| 290 | ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR}/libnng${nng_so_suffix_mm} |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 291 | |
| 292 | DESTINATION ${install_lib} |
| 293 | ) |
| 294 | endif() |
| 295 | |
E. Scott Daniels | 257323c | 2019-06-14 12:30:21 -0400 | [diff] [blame] | 296 | unset( SKIP_EXTERNALS CACHE ) # prevent these from being applied next build unless specifically set on comd line |
| 297 | unset( PACK_EXTERNALS CACHE ) |
| 298 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 299 | IF( EXISTS "${CMAKE_ROOT}/Modules/CPack.cmake" ) |
| 300 | include( InstallRequiredSystemLibraries ) |
| 301 | |
E. Scott Daniels | 78da4c9 | 2019-06-19 10:59:18 -0400 | [diff] [blame] | 302 | set( CPACK_DEBIAN_PACKAGE_NAME ${deb_pkg_name} ) |
| 303 | set( CPACK_RPM_PACKAGE_NAME ${rpm_pkg_name} ) |
| 304 | |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 305 | set( CPACK_set_DESTDIR "on" ) |
| 306 | set( CPACK_PACKAGING_INSTALL_PREFIX "${install_root}" ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 307 | set( CPACK_GENERATOR "${pkg_list}" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 308 | |
| 309 | set( CPACK_PACKAGE_DESCRIPTION "Thin library for RIC xAPP messaging routed based on message type." ) |
| 310 | set( CPACK_PACKAGE_DESCRIPTION_SUMMARY "RIC message routing library" ) |
| 311 | set( CPACK_PACKAGE_VENDOR "None" ) |
| 312 | set( CPACK_PACKAGE_CONTACT "None" ) |
| 313 | set( CPACK_PACKAGE_VERSION_MAJOR "${major_version}" ) |
| 314 | set( CPACK_PACKAGE_VERSION_MINOR "${minor_version}" ) |
| 315 | set( CPACK_PACKAGE_VERSION_PATCH "${patch_level}" ) |
E. Scott Daniels | f6f4f12 | 2019-06-18 16:02:17 -0400 | [diff] [blame] | 316 | set( CPACK_PACKAGE "${pkg_label}" ) # generic name for old versions of cpack |
E. Scott Daniels | d4f18ba | 2019-06-17 15:08:17 -0400 | [diff] [blame] | 317 | set( CPACK_DEBIAN_FILE_NAME "${deb_pkg_label}.deb" ) |
| 318 | set( CPACK_RPM_FILE_NAME "${rpm_pkg_label}.rpm" ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 319 | |
E. Scott Daniels | b0ba22e | 2019-08-06 13:26:12 -0400 | [diff] [blame] | 320 | # there is not an NNG package, so we cannot define a dependency |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 321 | |
| 322 | set( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" ) |
| 323 | set( CPACK_DEBIAN_PACKAGE_SECTION "ric" ) |
| 324 | set( CPACK_DEBIAN_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR} ) |
E. Scott Daniels | 29d8716 | 2019-06-12 13:48:25 -0400 | [diff] [blame] | 325 | set( CPACK_RPM_ARCHITECTURE ${CMAKE_SYSTEM_PROCESSOR} ) |
Ashwin Sridharan | fd9cc7a | 2019-04-03 16:47:02 -0400 | [diff] [blame] | 326 | |
| 327 | # this seems ingnored if included |
| 328 | #set( CPACK_COMPONENTS_ALL Libraries ApplicationData ) |
| 329 | |
| 330 | INCLUDE( CPack ) |
| 331 | ENDIF() |