2014-09-07 23:56:09 +00:00
#
2015-01-08 18:49:59 +00:00
# Copyright (C) 2010-2015 (see AUTHORS file for a list of contributors)
2014-09-07 23:56:09 +00:00
#
2014-11-07 17:02:52 +00:00
# This file is part of GNSS-SDR.
#
# GNSS-SDR is free software: you can redistribute it and/or modify
2014-09-07 23:56:09 +00:00
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
2014-11-07 17:02:52 +00:00
# GNSS-SDR is distributed in the hope that it will be useful,
2014-09-07 23:56:09 +00:00
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
2014-11-07 17:02:52 +00:00
# along with GNSS-SDR. If not, see <http://www.gnu.org/licenses/>.
2014-09-07 23:56:09 +00:00
#
########################################################################
# Project setup
########################################################################
cmake_minimum_required ( VERSION 2.6 )
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
2016-05-31 18:56:19 +00:00
set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
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 )
2016-02-25 14:26:32 +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
2016-01-12 19:15:16 +00:00
list ( INSERT CMAKE_MODULE_PATH 0 ${ CMAKE_CURRENT_SOURCE_DIR } /cmake/Modules ) #location for custom "Modules"
include ( VolkBuildTypes )
#select the release build type by default to get optimization flags
if ( NOT CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE "Release" )
message ( STATUS "Build type not specified: defaulting to release." )
endif ( )
VOLK_CHECK_BUILD_TYPE ( ${ CMAKE_BUILD_TYPE } )
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 )
2016-05-20 23:09:17 +00:00
set ( VERSION_INFO_MAINT_VERSION 7.git )
2016-01-12 19:15:16 +00:00
include ( VolkVersion ) #setup version info
2014-09-07 23:56:09 +00:00
########################################################################
# Environment setup
########################################################################
2016-07-02 10:02:13 +00:00
IF ( NOT DEFINED BOOST_ROOT AND NOT DEFINED ENV{BOOST_ROOT} )
2014-09-07 23:56:09 +00:00
SET ( BOOST_ROOT ${ CMAKE_INSTALL_PREFIX } )
ENDIF ( )
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" )
########################################################################
# Dependencies setup
########################################################################
2016-01-12 19:15:16 +00:00
# Python
include ( VolkPython ) #sets PYTHON_EXECUTABLE and PYTHON_DASH_B
2014-09-07 23:56:09 +00:00
VOLK_PYTHON_CHECK_MODULE ( "python >= 2.5" sys "sys.version.split()[0] >= '2.5'" PYTHON_MIN_VER_FOUND )
VOLK_PYTHON_CHECK_MODULE ( "Cheetah >= 2.0.0" Cheetah "Cheetah.Version >= '2.0.0'" CHEETAH_FOUND )
if ( NOT PYTHON_MIN_VER_FOUND )
2014-11-12 22:08:06 +00:00
message ( FATAL_ERROR "Python 2.5 or greater required to build VOLK_GNSSSDR" )
2014-09-07 23:56:09 +00:00
endif ( )
2016-01-12 19:15:16 +00:00
# Cheetah
2014-09-07 23:56:09 +00:00
if ( NOT CHEETAH_FOUND )
2014-11-12 22:08:06 +00:00
message ( FATAL_ERROR "Cheetah templates required to build VOLK_GNSSSDR" )
2014-09-07 23:56:09 +00:00
endif ( )
2016-01-12 19:15:16 +00:00
# Boost
2014-09-07 23:56:09 +00:00
if ( MSVC )
if ( NOT DEFINED BOOST_ALL_DYN_LINK )
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 )
add_definitions ( -DBOOST_ALL_DYN_LINK ) #setup boost auto-linking in msvc
else ( BOOST_ALL_DYN_LINK )
unset ( BOOST_REQUIRED_COMPONENTS ) #empty components list for static link
endif ( BOOST_ALL_DYN_LINK )
endif ( MSVC )
2016-01-12 19:15:16 +00:00
2014-09-07 23:56:09 +00:00
include ( VolkBoost )
if ( NOT Boost_FOUND )
2014-11-12 22:08:06 +00:00
message ( FATAL_ERROR "VOLK_GNSSSDR Requires boost to build" )
2014-09-07 23:56:09 +00:00
endif ( )
2016-01-12 19:15:16 +00:00
# Orc
2014-09-07 23:56:09 +00:00
option ( ENABLE_ORC "Enable Orc" True )
if ( ENABLE_ORC )
find_package ( ORC )
else ( ENABLE_ORC )
message ( STATUS "Disabling use of ORC" )
endif ( ENABLE_ORC )
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
2016-01-12 19:15:16 +00:00
@ O N L Y )
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
)
endif ( DOXYGEN_FOUND )
2014-09-07 23:56:09 +00:00
########################################################################
# Setup the package config file
########################################################################
#set variables found in the pc.in file
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
@ O N L Y )
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
########################################################################
set ( VOLK_RUNTIME_DIR bin )
set ( VOLK_LIBRARY_DIR lib ${ LIB_SUFFIX } )
set ( VOLK_INCLUDE_DIR include )
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
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
$ { 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
$ { 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
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
2014-09-07 23:56:09 +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 )
endif ( NOT CMAKE_INSTALL_NAME_DIR )
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
2014-09-07 23:56:09 +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 )
endif ( NOT CMAKE_INSTALL_RPATH )
if ( NOT CMAKE_BUILD_WITH_INSTALL_RPATH )
set ( CMAKE_BUILD_WITH_INSTALL_RPATH ON CACHE
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 )
endif ( NOT CMAKE_BUILD_WITH_INSTALL_RPATH )
endif ( APPLE )
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
@ O N L Y )
# 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:
# http://www.cmake.org/Wiki/CMake/Tutorials/Packaging
########################################################################
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 / M o d u l e s / V o l k 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 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
@ O N L Y )
########################################################################
# Install cmake search routine for external use
########################################################################
if ( NOT CMAKE_MODULES_DIR )
set ( CMAKE_MODULES_DIR lib ${ LIB_SUFFIX } /cmake )
endif ( NOT CMAKE_MODULES_DIR )
install (
F I L E S
$ { C M A K E _ C U R R E N 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 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 C o n f i g V e r s i o n . c m a k e
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 "
)
########################################################################
# Option to enable QA testing, on by default
########################################################################
OPTION ( ENABLE_TESTING "Enable QA testing" ON )
if ( ENABLE_TESTING )
message ( STATUS "QA Testing is enabled." )
else ( )
message ( STATUS "QA Testing is disabled." )
endif ( )
message ( STATUS " Modify using: -DENABLE_TESTING=ON/OFF" )
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}" )