2014-09-07 23:56:09 +00:00
#
2014-11-07 17:02:52 +00:00
# Copyright (C) 2010-2014 (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 )
if ( NOT DEFINED CMAKE_BUILD_TYPE )
set ( CMAKE_BUILD_TYPE Release )
endif ( )
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 ( )
set ( VERSION 0.1 )
set ( LIBVER 0.0.0 )
2014-11-14 00:40:43 +00:00
option ( ENABLE_STRIP "Create a stripped volk_gnsssdr_profile binary (without shared libraries)" OFF )
2014-09-07 23:56:09 +00:00
set ( CMAKE_SOURCE_DIR ${ CMAKE_CURRENT_SOURCE_DIR } ) #allows this to be a sub-project
set ( CMAKE_BINARY_DIR ${ CMAKE_CURRENT_BINARY_DIR } ) #allows this to be a sub-project
set ( CMAKE_MODULE_PATH ${ CMAKE_CURRENT_SOURCE_DIR } /cmake ) #location for custom "Modules"
2014-11-07 17:50:40 +00:00
set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11" )
2014-09-07 23:56:09 +00:00
########################################################################
# Environment setup
########################################################################
IF ( NOT DEFINED BOOST_ROOT )
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
########################################################################
include ( GrPython ) #sets PYTHON_EXECUTABLE and PYTHON_DASH_B
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 ( )
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 ( )
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 )
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 ( )
option ( ENABLE_ORC "Enable Orc" True )
if ( ENABLE_ORC )
find_package ( ORC )
else ( ENABLE_ORC )
message ( STATUS "Disabling use of ORC" )
endif ( ENABLE_ORC )
########################################################################
# 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 (
D I R E C T O R Y $ { C M A K E _ 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
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
$ { C M A K E _ 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
$ { C M A K E _ 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
$ { C M A K E _ 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
$ { C M A K E _ 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
$ { C M A K E _ 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
$ { C M A K E _ 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
$ { C M A K E _ 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
$ { C M A K E _ 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
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 "
)
########################################################################
# 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 / V o l k C o n f i g . 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 "
)
########################################################################
# 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
2014-11-12 22:08:06 +00:00
$ { C M A K E _ I N S T A L L _ P R E F I X } / l i b 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
2014-11-12 22:08:06 +00:00
$ { C M A K E _ I N S T A L L _ P R E F I X } / l i b 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 )
########################################################################
# 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
########################################################################
# Create uninstall target
########################################################################
configure_file (
$ { 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 / c m a k e _ u n i n s t a l l . c m a k e . i n
$ { 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 )
add_custom_target ( uninstall
C O M M A N D $ { 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 )
2014-09-07 23:56:09 +00:00
########################################################################
# Print summary
########################################################################
message ( STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}" )