Skip to content

Commit

Permalink
gr: squashed cmakelists.txt into one commit
Browse files Browse the repository at this point in the history
  • Loading branch information
guruofquality committed Jul 21, 2011
1 parent f914499 commit accb9f2
Show file tree
Hide file tree
Showing 110 changed files with 8,127 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
/build
#
# NOTE! Don't add files that are generated in specific
# subdirectories here. Add them in the ".gitignore" file
Expand Down
181 changes: 181 additions & 0 deletions CMakeLists.txt
@@ -0,0 +1,181 @@
# Copyright 2010-2011 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# GNU Radio is distributed in the hope that it will be useful,
# 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
# along with GNU Radio; see the file COPYING. If not, write to
# the Free Software Foundation, Inc., 51 Franklin Street,
# Boston, MA 02110-1301, USA.

########################################################################
IF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
MESSAGE(FATAL_ERROR "Prevented in-tree built. This is bad practice.")
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})

########################################################################
# Project setup
########################################################################
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(gnuradio)
ENABLE_LANGUAGE(CXX)
ENABLE_LANGUAGE(C)
ENABLE_TESTING()

#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(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE} CACHE STRING "")

LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)

INCLUDE(GrVersion) #setup version info

########################################################################
# Compiler specific setup
########################################################################
IF(CMAKE_COMPILER_IS_GNUCXX AND NOT WIN32)
#http://gcc.gnu.org/wiki/Visibility
ADD_DEFINITIONS(-fvisibility=hidden)
ENDIF()

IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-Wsign-compare)
ENDIF(CMAKE_COMPILER_IS_GNUCXX)

IF(MSVC)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/cmake/msvc) #missing headers
ADD_DEFINITIONS(-D_WIN32_WINNT=0x0501) #minimum version required is windows xp
ADD_DEFINITIONS(-DNOMINMAX) #disables stupidity and enables std::min and std::max
ADD_DEFINITIONS( #stop all kinds of compatibility warnings
-D_SCL_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_WARNINGS
-D_CRT_SECURE_NO_DEPRECATE
-D_CRT_NONSTDC_NO_DEPRECATE
)
LIST(APPEND GR_COMMON_FLAGS_AND_DEFINES -DHAVE_CONFIG_H)
ADD_DEFINITIONS(/MP) #build with multiple processors
ENDIF(MSVC)

########################################################################
# Install directories
########################################################################
INCLUDE(GrPlatform) #define LIB_SUFFIX
SET(GR_RUNTIME_DIR bin)
SET(GR_LIBRARY_DIR lib${LIB_SUFFIX})
SET(GR_INCLUDE_DIR include)
SET(GR_DATA_DIR share)
SET(GR_PKG_DATA_DIR ${GR_DATA_DIR}/${CMAKE_PROJECT_NAME})
SET(GR_DOC_DIR ${GR_DATA_DIR}/doc)
SET(GR_PKG_DOC_DIR ${GR_DOC_DIR}/${CMAKE_PROJECT_NAME}-${LIBVER})
SET(GR_CONF_DIR etc)
SET(GR_PKG_CONF_DIR ${GR_CONF_DIR}/${CMAKE_PROJECT_NAME})
SET(GR_LIBEXEC_DIR libexec)
SET(GR_PKG_LIBEXEC_DIR ${GR_LIBEXEC_DIR}/${CMAKE_PROJECT_NAME})
SET(GRC_BLOCKS_DIR ${GR_PKG_DATA_DIR}/grc/blocks)

########################################################################
# Variables replaced when configuring the package config files
########################################################################
FILE(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" prefix)
FILE(TO_NATIVE_PATH "\${prefix}" exec_prefix)
FILE(TO_NATIVE_PATH "\${exec_prefix}/${GR_LIBRARY_DIR}" libdir)
FILE(TO_NATIVE_PATH "\${prefix}/${GR_INCLUDE_DIR}" includedir)

########################################################################
# Create uninstall target
########################################################################
CONFIGURE_FILE(
${CMAKE_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
@ONLY)

ADD_CUSTOM_TARGET(uninstall
${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake
)

########################################################################
# Enable python component
########################################################################
FIND_PACKAGE(PythonLibs)
FIND_PACKAGE(SWIG)
INCLUDE(GrComponent)
GR_REGISTER_COMPONENT("python-support" ENABLE_PYTHON
PYTHONLIBS_FOUND
SWIG_FOUND
)

FIND_PACKAGE(CppUnit)
GR_REGISTER_COMPONENT("testing-support" ENABLE_TESTING
CPPUNIT_FOUND
)

########################################################################
# Add optional dlls specified in DLL_PATHS
########################################################################
FOREACH(path ${DLL_PATHS})
FILE(GLOB _dlls "${path}/*.dll")
LIST(APPEND ALL_DLL_FILES ${_dlls})
ENDFOREACH(path)
IF(DEFINED ALL_DLL_FILES)
INCLUDE(GrPackage)
CPACK_COMPONENT("extra_dlls"
DISPLAY_NAME "Extra DLLs"
DESCRIPTION "Extra DLLs for runtime dependency requirements"
)
MESSAGE(STATUS "")
MESSAGE(STATUS "Including the following dlls into the install:")
FOREACH(_dll ${ALL_DLL_FILES})
MESSAGE(STATUS " ${_dll}")
ENDFOREACH(_dll)
INSTALL(FILES ${ALL_DLL_FILES} DESTINATION ${GR_RUNTIME_DIR} COMPONENT "extra_dlls")
ENDIF()

########################################################################
# Setup volk as a subproject
########################################################################
ADD_SUBDIRECTORY(volk)
SET(VOLK_INCLUDE_DIRS
${CMAKE_CURRENT_SOURCE_DIR}/volk/include
${CMAKE_CURRENT_BINARY_DIR}/volk/include
)

########################################################################
# Add subdirectories
########################################################################
ADD_SUBDIRECTORY(gruel)
ADD_SUBDIRECTORY(gnuradio-core)
ADD_SUBDIRECTORY(grc)
ADD_SUBDIRECTORY(docs)

ADD_SUBDIRECTORY(gr-audio)
SET(GR_DIGITAL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/gr-digital/lib) #TODO move to gr-digital when ported
SET(GR_DIGITAL_SWIG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/gr-digital/swig) #TODO move to gr-digital when ported
ADD_SUBDIRECTORY(gr-noaa)
ADD_SUBDIRECTORY(gr-pager)
ADD_SUBDIRECTORY(gr-qtgui)
ADD_SUBDIRECTORY(gr-trellis)
ADD_SUBDIRECTORY(gr-uhd)
ADD_SUBDIRECTORY(gr-wxgui)

#finalize cpack after subdirs processed
INCLUDE(GrPackage)
CPACK_FINALIZE()

########################################################################
# Print summary
########################################################################
GR_PRINT_COMPONENT_SUMMARY()
MESSAGE(STATUS "Using install prefix: ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS "Building for version: ${VERSION}")
138 changes: 138 additions & 0 deletions cmake/Modules/CMakeParseArgumentsCopy.cmake
@@ -0,0 +1,138 @@
# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...)
#
# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for
# parsing the arguments given to that macro or function.
# It processes the arguments and defines a set of variables which hold the
# values of the respective options.
#
# The <options> argument contains all options for the respective macro,
# i.e. keywords which can be used when calling the macro without any value
# following, like e.g. the OPTIONAL keyword of the install() command.
#
# The <one_value_keywords> argument contains all keywords for this macro
# which are followed by one value, like e.g. DESTINATION keyword of the
# install() command.
#
# The <multi_value_keywords> argument contains all keywords for this macro
# which can be followed by more than one value, like e.g. the TARGETS or
# FILES keywords of the install() command.
#
# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the
# keywords listed in <options>, <one_value_keywords> and
# <multi_value_keywords> a variable composed of the given <prefix>
# followed by "_" and the name of the respective keyword.
# These variables will then hold the respective value from the argument list.
# For the <options> keywords this will be TRUE or FALSE.
#
# All remaining arguments are collected in a variable
# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether
# your macro was called with unrecognized parameters.
#
# As an example here a my_install() macro, which takes similar arguments as the
# real install() command:
#
# function(MY_INSTALL)
# set(options OPTIONAL FAST)
# set(oneValueArgs DESTINATION RENAME)
# set(multiValueArgs TARGETS CONFIGURATIONS)
# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
# ...
#
# Assume my_install() has been called like this:
# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub)
#
# After the cmake_parse_arguments() call the macro will have set the following
# variables:
# MY_INSTALL_OPTIONAL = TRUE
# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install()
# MY_INSTALL_DESTINATION = "bin"
# MY_INSTALL_RENAME = "" (was not used)
# MY_INSTALL_TARGETS = "foo;bar"
# MY_INSTALL_CONFIGURATIONS = "" (was not used)
# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL"
#
# You can the continue and process these variables.
#
# Keywords terminate lists of values, e.g. if directly after a one_value_keyword
# another recognized keyword follows, this is interpreted as the beginning of
# the new option.
# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in
# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would
# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor.

#=============================================================================
# Copyright 2010 Alexander Neundorf <neundorf@kde.org>
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)


if(__CMAKE_PARSE_ARGUMENTS_INCLUDED)
return()
endif()
set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE)


function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames)
# first set all result variables to empty/FALSE
foreach(arg_name ${_singleArgNames} ${_multiArgNames})
set(${prefix}_${arg_name})
endforeach(arg_name)

foreach(option ${_optionNames})
set(${prefix}_${option} FALSE)
endforeach(option)

set(${prefix}_UNPARSED_ARGUMENTS)

set(insideValues FALSE)
set(currentArgName)

# now iterate over all arguments and fill the result variables
foreach(currentArg ${ARGN})
list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword
list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword

if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1)
if(insideValues)
if("${insideValues}" STREQUAL "SINGLE")
set(${prefix}_${currentArgName} ${currentArg})
set(insideValues FALSE)
elseif("${insideValues}" STREQUAL "MULTI")
list(APPEND ${prefix}_${currentArgName} ${currentArg})
endif()
else(insideValues)
list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg})
endif(insideValues)
else()
if(NOT ${optionIndex} EQUAL -1)
set(${prefix}_${currentArg} TRUE)
set(insideValues FALSE)
elseif(NOT ${singleArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "SINGLE")
elseif(NOT ${multiArgIndex} EQUAL -1)
set(currentArgName ${currentArg})
set(${prefix}_${currentArgName})
set(insideValues "MULTI")
endif()
endif()

endforeach(currentArg)

# propagate the result variables to the caller:
foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames})
set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE)
endforeach(arg_name)
set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE)

endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs)
36 changes: 36 additions & 0 deletions cmake/Modules/FindALSA.cmake
@@ -0,0 +1,36 @@
# - Try to find ALSA
# Once done, this will define
#
# ALSA_FOUND - system has ALSA (GL and GLU)
# ALSA_INCLUDE_DIRS - the ALSA include directories
# ALSA_LIBRARIES - link these to use ALSA
# ALSA_GL_LIBRARY - only GL
# ALSA_GLU_LIBRARY - only GLU
#
# See documentation on how to write CMake scripts at
# http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries

include(LibFindMacros)

libfind_pkg_check_modules(ALSA_PKGCONF alsa)

find_path(ALSA_INCLUDE_DIR
NAMES alsa/version.h
PATHS ${ALSA_PKGCONF_INCLUDE_DIRS}
)

find_library(ALSA_LIBRARY
NAMES asound
PATHS ${ALSA_PKGCONF_LIBRARY_DIRS}
)

# Extract the version number
IF(ALSA_INCLUDE_DIR)
file(READ "${ALSA_INCLUDE_DIR}/alsa/version.h" _ALSA_VERSION_H_CONTENTS)
string(REGEX REPLACE ".*#define SND_LIB_VERSION_STR[ \t]*\"([^\n]*)\".*" "\\1" ALSA_VERSION "${_ALSA_VERSION_H_CONTENTS}")
ENDIF(ALSA_INCLUDE_DIR)

set(ALSA_PROCESS_INCLUDES ALSA_INCLUDE_DIR)
set(ALSA_PROCESS_LIBS ALSA_LIBRARY)
libfind_process(ALSA)

33 changes: 33 additions & 0 deletions cmake/Modules/FindCppUnit.cmake
@@ -0,0 +1,33 @@
# http://www.cmake.org/pipermail/cmake/2006-October/011446.html
#
# Find the CppUnit includes and library
#
# This module defines
# CPPUNIT_INCLUDE_DIRS, where to find tiff.h, etc.
# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
# CPPUNIT_FOUND, If false, do not try to use CppUnit.

INCLUDE(FindPkgConfig)
PKG_CHECK_MODULES(CPPUNIT "cppunit")
IF(NOT CPPUNIT_FOUND)

FIND_PATH(CPPUNIT_INCLUDE_DIRS cppunit/TestCase.h
/usr/local/include
/usr/include
)

FIND_LIBRARY(CPPUNIT_LIBRARIES cppunit
${CPPUNIT_INCLUDE_DIRS}/../lib
/usr/local/lib
/usr/lib)

IF(CPPUNIT_INCLUDE_DIRS)
IF(CPPUNIT_LIBRARIES)
SET(CPPUNIT_FOUND "YES")
SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARIES} ${CMAKE_DL_LIBS})
ENDIF(CPPUNIT_LIBRARIES)
ENDIF(CPPUNIT_INCLUDE_DIRS)

INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS)
ENDIF(NOT CPPUNIT_FOUND)

0 comments on commit accb9f2

Please sign in to comment.