2014-09-07 23:56:09 +00:00
#
2020-02-11 23:04:29 +00:00
# Copyright (C) 2010-2020 (see AUTHORS file for a list of contributors)
#
# GNSS-SDR is a software-defined Global Navigation Satellite Systems receiver
2014-09-07 23:56:09 +00:00
#
2014-11-07 17:02:52 +00:00
# This file is part of GNSS-SDR.
#
2020-02-08 00:20:02 +00:00
# SPDX-License-Identifier: GPL-3.0-or-later
2014-09-07 23:56:09 +00:00
#
########################################################################
# Project setup
########################################################################
2019-01-31 11:12:04 +00:00
cmake_minimum_required ( VERSION 2.8.12 )
2014-09-07 23:56:09 +00:00
set ( CMAKE_BUILD_TYPE ${ CMAKE_BUILD_TYPE } CACHE STRING "Choose build type: None Debug Release RelWithDebInfo MinSizeRel" )
project ( volk_gnsssdr )
enable_language ( CXX )
enable_language ( C )
enable_testing ( )
2016-01-12 19:15:16 +00:00
2019-06-09 17:25:04 +00:00
set ( PROJECT_SOURCE_DIR ${ CMAKE_CURRENT_SOURCE_DIR } ) # allows this to be a sub-project
set ( PROJECT_BINARY_DIR ${ CMAKE_CURRENT_BINARY_DIR } ) # allows this to be a sub-project
list ( INSERT CMAKE_MODULE_PATH 0 ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/Modules ) # location for custom "Modules"
if ( POLICY CMP0042 )
cmake_policy ( SET CMP0042 NEW )
endif ( )
if ( POLICY CMP0068 )
cmake_policy ( SET CMP0068 NEW )
endif ( )
if ( POLICY CMP0057 )
cmake_policy ( SET CMP0057 NEW )
endif ( )
2018-04-07 15:03:25 +00:00
# Set compiler flags
set ( GNSSSDR_CLANG_MIN_VERSION "3.4.0" )
set ( GNSSSDR_APPLECLANG_MIN_VERSION "500" )
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
execute_process ( COMMAND
$ { C M A K E _ C X X _ C O M P I L E R } - v
R E S U L T _ V A R I A B L E _ r e s E R R O R _ V A R I A B L E _ e r r
E R R O R _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( ${ _res } STREQUAL "0" )
# output is in error stream
string ( REGEX MATCH "^Apple.*" IS_APPLE ${ _err } )
if ( "${IS_APPLE}" STREQUAL "" )
set ( MIN_VERSION ${ GNSSSDR_CLANG_MIN_VERSION } )
set ( APPLE_STR "" )
# retrieve the compiler's version from it
string ( REGEX MATCH "clang version [0-9.]+" CLANG_OTHER_VERSION ${ _err } )
string ( REGEX MATCH "[0-9.]+" CLANG_VERSION ${ CLANG_OTHER_VERSION } )
2018-11-25 09:32:21 +00:00
else ( )
2018-04-07 15:03:25 +00:00
set ( MIN_VERSION ${ GNSSSDR_APPLECLANG_MIN_VERSION } )
set ( APPLE_STR "Apple " )
# retrieve the compiler's version from it
string ( REGEX MATCH "(clang-[0-9.]+)" CLANG_APPLE_VERSION ${ _err } )
string ( REGEX MATCH "[0-9.]+" CLANG_VERSION ${ CLANG_APPLE_VERSION } )
2018-11-25 09:32:21 +00:00
endif ( )
2018-04-07 15:03:25 +00:00
if ( ${ CLANG_VERSION } VERSION_LESS "${MIN_VERSION}" )
message ( WARNING "\nThe compiler selected to build VOLK-GNSSSDR (${APPLE_STR}Clang version ${CLANG_VERSION} : ${CMAKE_CXX_COMPILER}) is older than that officially supported (${MIN_VERSION} minimum). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent." )
2018-11-25 09:32:21 +00:00
endif ( )
else ( )
2018-04-07 15:03:25 +00:00
message ( WARNING "\nCannot determine the version of the compiler selected to build VOLK-GNSSSDR (${APPLE_STR}Clang : ${CMAKE_CXX_COMPILER}). This build may or not work. We highly recommend using Apple Clang version ${APPLECLANG_MIN_VERSION} or more recent, or Clang version ${CLANG_MIN_VERSION} or more recent." )
2018-11-25 09:32:21 +00:00
endif ( )
endif ( )
2018-04-07 15:03:25 +00:00
2019-06-09 00:33:17 +00:00
#### Set C++ standard
set ( CMAKE_CXX_EXTENSIONS OFF )
2018-04-12 18:44:15 +00:00
2019-06-09 00:33:17 +00:00
# Check if we have std::filesystem
if ( CMAKE_VERSION VERSION_LESS 3.8 )
2019-06-09 17:25:04 +00:00
set ( FILESYSTEM_FOUND FALSE )
2019-06-09 00:33:17 +00:00
else ( )
2019-06-11 20:56:24 +00:00
find_package ( FILESYSTEM COMPONENTS Final Experimental )
2019-06-09 00:33:17 +00:00
endif ( )
2018-11-17 13:31:06 +00:00
if ( ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) AND NOT WIN32 )
2018-04-07 15:03:25 +00:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.1.1" )
2019-06-09 17:25:04 +00:00
if ( CMAKE_VERSION VERSION_LESS "3.1" )
set ( MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11" )
else ( )
set ( CMAKE_CXX_STANDARD 11 )
endif ( )
2018-11-25 09:32:21 +00:00
else ( )
2018-04-07 15:03:25 +00:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "8.0.0" )
2019-06-09 00:33:17 +00:00
set ( CMAKE_CXX_STANDARD 14 )
2018-11-25 09:32:21 +00:00
else ( )
2019-06-09 17:25:04 +00:00
if ( ${ FILESYSTEM_FOUND } )
2019-06-14 12:10:30 +00:00
if ( CMAKE_VERSION VERSION_LESS 3.12 )
set ( CMAKE_CXX_STANDARD 17 )
else ( )
set ( CMAKE_CXX_STANDARD 20 )
endif ( )
2019-06-09 00:33:17 +00:00
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
else ( )
set ( CMAKE_CXX_STANDARD 14 )
endif ( )
2018-11-25 09:32:21 +00:00
endif ( )
endif ( )
2020-02-05 20:24:46 +00:00
set ( MY_CXX_FLAGS "${MY_CXX_FLAGS} -Wall -Wextra" ) # Add warning flags: For "-Wall" see https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
2018-11-25 09:32:21 +00:00
endif ( )
2018-04-07 15:03:25 +00:00
if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
2019-06-09 00:33:17 +00:00
if ( CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" )
2018-04-07 15:03:25 +00:00
# See https://trac.macports.org/wiki/XcodeVersionInfo for Apple Clang version equivalences
if ( CLANG_VERSION VERSION_LESS "600" )
2019-06-09 00:33:17 +00:00
set ( CMAKE_CXX_STANDARD 11 )
2018-11-25 09:32:21 +00:00
else ( )
2019-06-09 00:33:17 +00:00
if ( CLANG_VERSION VERSION_LESS "1000" )
set ( CMAKE_CXX_STANDARD 14 )
else ( )
2019-06-09 17:25:04 +00:00
if ( ${ FILESYSTEM_FOUND } )
2019-06-09 00:33:17 +00:00
set ( CMAKE_CXX_STANDARD 17 )
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
else ( )
set ( CMAKE_CXX_STANDARD 14 )
endif ( )
endif ( )
2018-11-25 09:32:21 +00:00
endif ( )
else ( )
2018-04-07 15:03:25 +00:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.5.0" )
2019-06-09 17:25:04 +00:00
if ( CMAKE_VERSION VERSION_LESS "3.1" )
set ( MY_CXX_FLAGS "${MY_CXX_FLAGS} -std=c++11" )
else ( )
set ( CMAKE_CXX_STANDARD 11 )
endif ( )
2018-11-25 09:32:21 +00:00
else ( )
2018-04-07 15:03:25 +00:00
if ( CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0.0" )
2019-06-09 00:33:17 +00:00
set ( CMAKE_CXX_STANDARD 14 )
2018-11-25 09:32:21 +00:00
else ( )
2019-06-09 17:25:04 +00:00
if ( ${ FILESYSTEM_FOUND } )
2019-06-15 20:25:22 +00:00
if ( CMAKE_VERSION VERSION_LESS 3.12 )
set ( CMAKE_CXX_STANDARD 17 )
else ( )
set ( CMAKE_CXX_STANDARD 20 )
endif ( )
2019-06-09 00:33:17 +00:00
set ( CMAKE_CXX_STANDARD_REQUIRED ON )
else ( )
set ( CMAKE_CXX_STANDARD 14 )
endif ( )
2018-11-25 09:32:21 +00:00
endif ( )
endif ( )
endif ( )
endif ( )
2018-04-07 15:03:25 +00:00
2018-11-17 13:31:06 +00:00
if ( NOT ( ( CMAKE_CXX_COMPILER_ID STREQUAL "GNU" ) AND NOT WIN32 ) AND NOT ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) )
2018-04-07 15:03:25 +00:00
if ( NOT ( CMAKE_VERSION VERSION_LESS "3.1" ) )
set ( CMAKE_C_STANDARD 11 )
set ( CMAKE_CXX_STANDARD 11 )
2018-11-25 09:32:21 +00:00
endif ( )
endif ( )
2018-04-07 15:03:25 +00:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MY_CXX_FLAGS} -Wall" )
2016-05-31 18:56:19 +00:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall" )
2014-09-07 23:56:09 +00:00
2014-11-14 00:40:43 +00:00
option ( ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without shared libraries)" OFF )
2019-08-03 18:31:53 +00:00
if ( ENABLE_STRIP )
set ( CMAKE_VERBOSE_MAKEFILE ON )
endif ( )
2014-11-14 00:40:43 +00:00
2016-01-12 19:15:16 +00:00
include ( VolkBuildTypes )
2019-06-09 00:33:17 +00:00
# select the release build type by default to get optimization flags
2016-01-12 19:15:16 +00:00
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE "Release" )
message ( STATUS "Build type not specified: defaulting to release." )
endif ( )
2018-11-25 09:32:21 +00:00
volk_check_build_type ( ${ CMAKE_BUILD_TYPE } )
2016-01-12 19:15:16 +00:00
set ( CMAKE_BUILD_TYPE ${ CMAKE_BUILD_TYPE } CACHE STRING "" )
message ( STATUS "Build type set to ${CMAKE_BUILD_TYPE}." )
set ( VERSION_INFO_MAJOR_VERSION 0 )
set ( VERSION_INFO_MINOR_VERSION 0 )
2019-08-18 23:29:04 +00:00
set ( VERSION_INFO_MAINT_VERSION 11.git )
2019-06-09 00:33:17 +00:00
include ( VolkVersion ) # setup version info
2016-01-12 19:15:16 +00:00
2014-09-07 23:56:09 +00:00
########################################################################
# Environment setup
########################################################################
2018-11-25 09:32:21 +00:00
if ( NOT DEFINED BOOST_ROOT AND NOT DEFINED ENV{BOOST_ROOT} )
set ( BOOST_ROOT ${ CMAKE_INSTALL_PREFIX } )
endif ( )
2014-09-07 23:56:09 +00:00
2018-11-25 09:32:21 +00:00
if ( NOT DEFINED CROSSCOMPILE_MULTILIB )
set ( CROSSCOMPILE_MULTILIB "" )
endif ( )
set ( CROSSCOMPILE_MULTILIB ${ CROSSCOMPILE_MULTILIB } CACHE STRING "Define \" true\ " if you have and want to use multiple C development libs installed for cross compile" )
2014-09-07 23:56:09 +00:00
2017-01-20 19:54:53 +00:00
if ( MSVC )
2019-06-09 00:33:17 +00:00
add_definitions ( -D_USE_MATH_DEFINES ) # enables math constants on all supported versions of MSVC
add_compile_options ( /W1 ) # reduce warnings
2017-01-20 19:54:53 +00:00
add_compile_options ( /wo4309 )
add_compile_options ( /wd4752 )
add_compile_options ( /wo4273 )
add_compile_options ( /wo4838 )
2018-11-25 09:32:21 +00:00
endif ( )
2014-09-07 23:56:09 +00:00
2017-04-14 08:28:57 +00:00
# allow 'large' files in 32 bit builds
if ( UNIX )
2018-11-25 09:32:21 +00:00
add_definitions ( -D_LARGEFILE_SOURCE
- D _ F I L E _ O F F S E T _ B I T S = 6 4
- D _ L A R G E _ F I L E S
- D _ F O R T I F Y _ S O U R C E = 2
)
endif ( )
2017-04-14 08:28:57 +00:00
2017-11-04 11:09:56 +00:00
2014-09-07 23:56:09 +00:00
########################################################################
# Dependencies setup
########################################################################
2016-01-12 19:15:16 +00:00
# Python
2019-06-09 00:33:17 +00:00
include ( VolkPython ) # sets PYTHON_EXECUTABLE and PYTHON_DASH_B
2018-11-25 09:32:21 +00:00
volk_python_check_module ( "python >= 2.7" sys "sys.version.split()[0] >= '2.7'" PYTHON_MIN_VER_FOUND )
volk_python_check_module ( "mako >= 0.4.2" mako "mako.__version__ >= '0.4.2'" MAKO_FOUND )
volk_python_check_module ( "six - python 2 and 3 compatibility library" six "True" SIX_FOUND )
2014-09-07 23:56:09 +00:00
if ( NOT PYTHON_MIN_VER_FOUND )
2016-12-25 14:44:45 +00:00
message ( FATAL_ERROR "Python 2.7 or greater required to build VOLK_GNSSSDR" )
2014-09-07 23:56:09 +00:00
endif ( )
2019-12-15 15:43:07 +00:00
# Mako
2016-07-15 02:34:49 +00:00
if ( NOT MAKO_FOUND )
message ( FATAL_ERROR "Mako templates required to build VOLK_GNSSSDR" )
2014-09-07 23:56:09 +00:00
endif ( )
2016-12-25 14:44:45 +00:00
# Six
if ( NOT SIX_FOUND )
message ( FATAL_ERROR "six - python 2 and 3 compatibility library required to build VOLK" )
endif ( )
2014-09-07 23:56:09 +00:00
2016-01-12 19:15:16 +00:00
# Boost
2014-09-07 23:56:09 +00:00
if ( MSVC )
2018-11-25 09:32:21 +00:00
if ( NOT DEFINED BOOST_ALL_DYN_LINK )
2014-09-07 23:56:09 +00:00
set ( BOOST_ALL_DYN_LINK TRUE )
endif ( )
set ( BOOST_ALL_DYN_LINK "${BOOST_ALL_DYN_LINK}" CACHE BOOL "boost enable dynamic linking" )
if ( BOOST_ALL_DYN_LINK )
2019-06-09 00:33:17 +00:00
add_definitions ( -DBOOST_ALL_DYN_LINK ) # setup boost auto-linking in msvc
2018-11-25 09:32:21 +00:00
else ( )
2019-06-09 00:33:17 +00:00
unset ( BOOST_REQUIRED_COMPONENTS ) # empty components list for static link
2018-11-25 09:32:21 +00:00
endif ( )
endif ( )
2019-12-15 15:43:07 +00:00
if ( NOT ${ FILESYSTEM_FOUND } )
2019-06-09 00:33:17 +00:00
include ( VolkBoost )
if ( NOT Boost_FOUND )
message ( FATAL_ERROR "VOLK-GNSSSDR requires Boost to build" )
endif ( )
2014-09-07 23:56:09 +00:00
endif ( )
2020-02-13 18:44:24 +00:00
########################################################################
# check for aligned_alloc, since some compilers lack this C11 feature.
# For Apple-clang use `posix_memalign`
# For MSVC use `_aligned_malloc`.
########################################################################
include ( CheckSymbolExists )
if ( NOT ( ${ CMAKE_SYSTEM_NAME } MATCHES "Darwin" ) )
check_symbol_exists ( aligned_alloc stdlib.h USE_ALIGNED_ALLOC )
endif ( )
if ( NOT USE_ALIGNED_ALLOC )
check_symbol_exists ( posix_memalign stdlib.h HAVE_POSIX_MEMALIGN )
endif ( )
########################################################################
# Check if Orc is available
########################################################################
2019-06-09 00:33:17 +00:00
option ( ENABLE_ORC "Enable Orc" TRUE )
2014-09-07 23:56:09 +00:00
if ( ENABLE_ORC )
2019-12-15 15:43:07 +00:00
find_package ( ORC )
2018-11-25 09:32:21 +00:00
else ( )
2019-12-15 15:43:07 +00:00
message ( STATUS "Disabling use of ORC" )
2018-11-25 09:32:21 +00:00
endif ( )
2014-09-07 23:56:09 +00:00
2016-01-12 19:15:16 +00:00
########################################################################
# Setup doxygen
########################################################################
find_package ( Doxygen )
if ( DOXYGEN_FOUND )
configure_file (
2016-02-25 14:26:32 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / D o x y f i l e . i n
$ { P R O J E C T _ B I N A R Y _ D I R } / D o x y f i l e
2019-12-15 15:43:07 +00:00
@ O N L Y
)
2016-01-12 19:15:16 +00:00
add_custom_target ( doc
2016-02-25 14:26:32 +00:00
$ { D O X Y G E N _ E X E C U T A B L E } $ { P R O J E C T _ B I N A R Y _ D I R } / D o x y f i l e
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R }
2016-01-12 19:15:16 +00:00
C O M M E N T " G e n e r a t i n g d o c u m e n t a t i o n w i t h D o x y g e n " V E R B A T I M
)
2018-11-25 09:32:21 +00:00
endif ( )
2016-01-12 19:15:16 +00:00
2014-09-07 23:56:09 +00:00
########################################################################
# Setup the package config file
########################################################################
2019-06-09 00:33:17 +00:00
# set variables found in the pc.in file
2014-09-07 23:56:09 +00:00
set ( prefix ${ CMAKE_INSTALL_PREFIX } )
set ( exec_prefix "\${prefix}" )
set ( libdir "\${exec_prefix}/lib${LIB_SUFFIX}" )
set ( includedir "\${prefix}/include" )
configure_file (
$ { C M A K E _ C U R R E N T _ S O U R C E _ D I R } / v o l k _ g n s s s d r . p c . i n
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / v o l k _ g n s s s d r . p c
2018-11-25 09:32:21 +00:00
@ O N L Y
)
2014-09-07 23:56:09 +00:00
install (
F I L E S $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / v o l k _ g n s s s d r . p c
D E S T I N A T I O N l i b $ { L I B _ S U F F I X } / p k g c o n f i g
C O M P O N E N T " v o l k _ g n s s s d r _ d e v e l "
)
########################################################################
# Install all headers in the include directories
########################################################################
2019-12-15 15:43:07 +00:00
set ( VOLK_RUNTIME_DIR bin )
set ( VOLK_LIBRARY_DIR lib ${ LIB_SUFFIX } )
set ( VOLK_INCLUDE_DIR include )
2014-09-07 23:56:09 +00:00
install (
2016-02-25 14:26:32 +00:00
D I R E C T O R Y $ { P R O J E C T _ S O U R C E _ D I R } / k e r n e l s / v o l k _ g n s s s d r
2014-09-07 23:56:09 +00:00
D E S T I N A T I O N i n c l u d e C O M P O N E N T " v o l k _ g n s s s d r _ d e v e l "
F I L E S _ M A T C H I N G P A T T E R N " * . h "
)
install ( FILES
2019-10-26 20:24:42 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ a l l o c . h
2016-02-25 14:26:32 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ p r e f s . h
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ c o m p l e x . h
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ c o m m o n . h
2017-10-13 09:35:12 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / s a t u r a t i o n _ a r i t h m e t i c . h
2016-02-25 14:26:32 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ a v x _ i n t r i n s i c s . h
2017-10-13 09:35:12 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ s s e _ i n t r i n s i c s . h
2016-02-25 14:26:32 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ s s e 3 _ i n t r i n s i c s . h
2016-03-18 18:46:18 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ n e o n _ i n t r i n s i c s . h
2016-02-25 14:26:32 +00:00
$ { P R O J E C T _ B I N A R Y _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r . h
$ { P R O J E C T _ B I N A R Y _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ c p u . h
$ { P R O J E C T _ B I N A R Y _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ c o n f i g _ f i x e d . h
$ { P R O J E C T _ B I N A R Y _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ t y p e d e f s . h
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ m a l l o c . h
2016-03-21 16:55:33 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / v o l k _ g n s s s d r _ s i n e _ t a b l e . h
2019-08-23 20:41:13 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / i n c l u d e / v o l k _ g n s s s d r / c o n s t a n t s . h
2014-09-07 23:56:09 +00:00
D E S T I N A T I O N i n c l u d e / v o l k _ g n s s s d r
C O M P O N E N T " v o l k _ g n s s s d r _ d e v e l "
)
########################################################################
# On Apple only, set install name and use rpath correctly, if not already set
########################################################################
if ( APPLE )
if ( NOT CMAKE_INSTALL_NAME_DIR )
set ( CMAKE_INSTALL_NAME_DIR
2016-01-12 19:15:16 +00:00
$ { C M A K E _ I N S T A L L _ P R E F I X } / $ { V O L K _ L I B R A R Y _ D I R } C A C H E
2019-12-15 15:43:07 +00:00
P A T H " L i b r a r y I n s t a l l N a m e D e s t i n a t i o n D i r e c t o r y " F O R C E
)
2018-11-25 09:32:21 +00:00
endif ( )
2014-09-07 23:56:09 +00:00
if ( NOT CMAKE_INSTALL_RPATH )
set ( CMAKE_INSTALL_RPATH
2016-01-12 19:15:16 +00:00
$ { C M A K E _ I N S T A L L _ P R E F I X } / $ { V O L K _ L I B R A R Y _ D I R } C A C H E
2019-12-15 15:43:07 +00:00
P A T H " L i b r a r y I n s t a l l R P a t h " F O R C E
)
2018-11-25 09:32:21 +00:00
endif ( )
2014-09-07 23:56:09 +00:00
if ( NOT CMAKE_BUILD_WITH_INSTALL_RPATH )
set ( CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
2019-12-15 15:43:07 +00:00
B O O L " D o B u i l d U s i n g L i b r a r y I n s t a l l R P a t h " F O R C E
)
2018-11-25 09:32:21 +00:00
endif ( )
endif ( )
2014-09-07 23:56:09 +00:00
2016-01-12 19:15:16 +00:00
########################################################################
# Create uninstall target
########################################################################
configure_file (
2016-02-25 14:26:32 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / c m a k e / c m a k e _ u n i n s t a l l . c m a k e . i n
2016-01-12 19:15:16 +00:00
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e
2019-12-15 15:43:07 +00:00
@ O N L Y
)
2016-01-12 19:15:16 +00:00
# Only add the target if there isn't one defined already
if ( NOT TARGET uninstall )
add_custom_target ( uninstall
$ { C M A K E _ C O M M A N D } - P $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e _ u n i n s t a l l . c m a k e
)
endif ( )
########################################################################
# Install our Cmake modules into $prefix/lib/cmake/volk_gnsssdr
# See "Package Configuration Files" on page:
2020-02-05 20:24:46 +00:00
# https://www.cmake.org/Wiki/CMake/Tutorials/Packaging
2016-01-12 19:15:16 +00:00
########################################################################
configure_file (
2019-12-15 15:43:07 +00:00
$ { C M A K E _ S O U R C E _ D I R } / c m a k e / M o d u l e s / V o l k G n s s s d r C o n f i g . c m a k e . i n
$ { C M A K E _ B I N A R Y _ D I R } / c m a k e / M o d u l e s / V o l k G n s s s d r C o n f i g . c m a k e
@ O N L Y
)
2016-07-02 18:10:18 +00:00
configure_file (
2019-12-15 15:43:07 +00:00
$ { P R O J E C T _ S O U R C E _ D I R } / c m a k e / M o d u l e s / V o l k G n s s s d r C o n f i g V e r s i o n . c m a k e . i n
$ { P R O J E C T _ B I N A R Y _ D I R } / c m a k e / M o d u l e s / V o l k G n s s s d r C o n f i g V e r s i o n . c m a k e
@ O N L Y
)
2016-01-12 19:15:16 +00:00
########################################################################
# Install cmake search routine for external use
########################################################################
if ( NOT CMAKE_MODULES_DIR )
set ( CMAKE_MODULES_DIR lib ${ LIB_SUFFIX } /cmake )
2018-11-25 09:32:21 +00:00
endif ( )
2016-01-12 19:15:16 +00:00
install (
F I L E S
2016-07-02 18:10:18 +00:00
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e / M o d u l e s / V o l k G n s s s d r C o n f i g . c m a k e
$ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } / c m a k e / M o d u l e s / V o l k G n s s s d r C o n f i g V e r s i o n . c m a k e
2016-01-12 19:15:16 +00:00
D E S T I N A T I O N $ { C M A K E _ M O D U L E S _ D I R } / v o l k _ g n s s s d r
C O M P O N E N T " v o l k _ g n s s s d r _ d e v e l "
)
2019-01-31 11:12:04 +00:00
install ( EXPORT VOLK_GNSSSDR-export FILE VolkGnsssdrTargets.cmake
N A M E S P A C E V o l k G n s s s d r : : D E S T I N A T I O N $ { C M A K E _ M O D U L E S _ D I R } / v o l k _ g n s s s d r
)
2016-01-12 19:15:16 +00:00
########################################################################
# Option to enable QA testing, on by default
########################################################################
2018-11-25 09:32:21 +00:00
option ( ENABLE_TESTING "Enable QA testing" ON )
2016-01-12 19:15:16 +00:00
if ( ENABLE_TESTING )
2019-12-15 15:43:07 +00:00
message ( STATUS "QA Testing is enabled." )
2016-01-12 19:15:16 +00:00
else ( )
2019-12-15 15:43:07 +00:00
message ( STATUS "QA Testing is disabled." )
2016-01-12 19:15:16 +00:00
endif ( )
message ( STATUS " Modify using: -DENABLE_TESTING=ON/OFF" )
2016-07-02 11:34:00 +00:00
########################################################################
# Option to enable post-build profiling using volk_profile, off by default
########################################################################
2018-11-25 09:32:21 +00:00
option ( ENABLE_PROFILING "Launch system profiler after build" OFF )
2016-07-02 17:14:05 +00:00
if ( ENABLE_PROFILING )
2019-12-15 15:43:07 +00:00
set ( ENABLE_STATIC_LIBS ON )
if ( DEFINED VOLK_CONFIGPATH )
get_filename_component ( VOLK_CONFIGPATH ${ VOLK_CONFIGPATH } ABSOLUTE )
set ( VOLK_CONFIGPATH "${VOLK_CONFIGPATH}/volk_gnsssdr" )
message ( STATUS "System profiling is enabled, using path: ${VOLK_CONFIGPATH}" )
elseif ( DEFINED ENV{VOLK_CONFIGPATH} )
set ( VOLK_CONFIGPATH "$ENV{VOLK_CONFIGPATH}/volk_gnsssdr" )
message ( STATUS "System profiling is enabled, using env path: $ENV{VOLK_CONFIGPATH}" )
else ( )
message ( STATUS "System profiling is enabled with default paths." )
if ( DEFINED ENV{HOME} )
set ( VOLK_CONFIGPATH "$ENV{HOME}/.volk_gnsssdr" )
elseif ( DEFINED ENV{APPDATA} )
set ( VOLK_CONFIGPATH "$ENV{APPDATA}/.volk_gnsssdr" )
endif ( )
2016-07-02 11:34:00 +00:00
endif ( )
else ( )
2019-12-15 15:43:07 +00:00
message ( STATUS "System profiling is disabled." )
2016-07-02 11:34:00 +00:00
endif ( )
message ( STATUS " Modify using: -DENABLE_PROFILING=ON/OFF" )
########################################################################
2018-02-05 13:53:07 +00:00
2014-09-07 23:56:09 +00:00
########################################################################
# Setup the library
########################################################################
add_subdirectory ( lib )
########################################################################
# And the utility apps
########################################################################
add_subdirectory ( apps )
add_subdirectory ( python/volk_gnsssdr_modtool )
2014-11-09 20:21:46 +00:00
2014-09-07 23:56:09 +00:00
########################################################################
# Print summary
########################################################################
message ( STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}" )