summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorTom Rondeau <trondeau@vt.edu>2011-10-25 18:31:50 -0400
committerTom Rondeau <trondeau@vt.edu>2011-10-25 18:31:50 -0400
commita23f6624c6da8c850ed144916947a3dbff0db885 (patch)
tree166d346651fcf106a9e23160a3cac116c8554e0f /cmake
parentad47d75bc010608d94abce0ba809e012a0f4b7a4 (diff)
parent76c7d75559762e833d8f6108717d711f364258a4 (diff)
Merge remote branch 'jblum/master'
Diffstat (limited to 'cmake')
-rw-r--r--cmake/Modules/CMakeMacroLibtoolFile.cmake5
-rw-r--r--cmake/Modules/GrComponent.cmake1
-rw-r--r--cmake/Modules/GrMiscUtils.cmake7
-rw-r--r--cmake/Modules/GrPython.cmake82
-rw-r--r--cmake/Modules/GrSwig.cmake7
-rw-r--r--cmake/Modules/GrVersion.cmake20
-rw-r--r--cmake/Toolchains/arm_cortex_a8_native.cmake8
-rw-r--r--cmake/msvc/config.h7
8 files changed, 97 insertions, 40 deletions
diff --git a/cmake/Modules/CMakeMacroLibtoolFile.cmake b/cmake/Modules/CMakeMacroLibtoolFile.cmake
index a9e7f4bcb5..2ec7912077 100644
--- a/cmake/Modules/CMakeMacroLibtoolFile.cmake
+++ b/cmake/Modules/CMakeMacroLibtoolFile.cmake
@@ -6,6 +6,11 @@
#ADD_LIBRARY(foo SHARED kfoo1.cpp kfoo2.cpp)
#CREATE_LIBTOOL_FILE(foo /lib/kde3)
+if(DEFINED __INCLUDED_CREATE_LIBTOOL_FILE)
+ return()
+endif()
+set(__INCLUDED_CREATE_LIBTOOL_FILE TRUE)
+
MACRO(GET_TARGET_PROPERTY_WITH_DEFAULT _variable _target _property _default_value)
GET_TARGET_PROPERTY (${_variable} ${_target} ${_property})
IF (${_variable} MATCHES NOTFOUND)
diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake
index d45b8003c5..708f035ae7 100644
--- a/cmake/Modules/GrComponent.cmake
+++ b/cmake/Modules/GrComponent.cmake
@@ -68,6 +68,7 @@ function(GR_REGISTER_COMPONENT name var)
#setup the dependent option for this component
CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${ENABLE_DEFAULT} "${comp_deps}" OFF)
+ set(${var} "${${var}}" PARENT_SCOPE)
set(${var}_cached "${${var}}" CACHE INTERNAL "" FORCE)
#force was specified, but the dependencies were not met
diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake
index 9d947e9a59..22bfc8324a 100644
--- a/cmake/Modules/GrMiscUtils.cmake
+++ b/cmake/Modules/GrMiscUtils.cmake
@@ -128,8 +128,11 @@ function(GR_LIBRARY_FOO target)
if(LIBRARY_EXTRAS)
#create .la file before changing props
- include(CMakeMacroLibtoolFile)
- CREATE_LIBTOOL_FILE(${target} /${GR_LIBRARY_DIR})
+ find_program(LIBTOOL libtool)
+ if(LIBTOOL)
+ include(CMakeMacroLibtoolFile)
+ CREATE_LIBTOOL_FILE(${target} /${GR_LIBRARY_DIR})
+ endif(LIBTOOL)
#give the library a special name with ultra-zero soversion
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0")
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index 10e93ed751..efdddf371f 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -1,17 +1,17 @@
# 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,
@@ -127,32 +127,55 @@ function(GR_PYTHON_INSTALL)
####################################################################
install(${ARGN}) #installs regular python files
+ #create a list of all generated files
+ unset(pysrcfiles)
+ unset(pycfiles)
+ unset(pyofiles)
foreach(pyfile ${GR_PYTHON_INSTALL_FILES})
- get_filename_component(pyfile_name ${pyfile} NAME)
get_filename_component(pyfile ${pyfile} ABSOLUTE)
- string(REPLACE "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" pycfile "${pyfile}c")
- list(APPEND python_install_gen_targets ${pycfile})
+ list(APPEND pysrcfiles ${pyfile})
+
+ #determine if this file is in the source or binary directory
+ file(RELATIVE_PATH source_rel_path ${CMAKE_CURRENT_SOURCE_DIR} ${pyfile})
+ string(LENGTH "${source_rel_path}" source_rel_path_len)
+ file(RELATIVE_PATH binary_rel_path ${CMAKE_CURRENT_BINARY_DIR} ${pyfile})
+ string(LENGTH "${binary_rel_path}" binary_rel_path_len)
+
+ #and set the generated path appropriately
+ if(${source_rel_path_len} GREATER ${binary_rel_path_len})
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${binary_rel_path})
+ else()
+ set(pygenfile ${CMAKE_CURRENT_BINARY_DIR}/${source_rel_path})
+ endif()
+ list(APPEND pycfiles ${pygenfile}c)
+ list(APPEND pyofiles ${pygenfile}o)
- get_filename_component(pycfile_path ${pycfile} PATH)
- file(MAKE_DIRECTORY ${pycfile_path})
+ #ensure generation path exists
+ get_filename_component(pygen_path ${pygenfile} PATH)
+ file(MAKE_DIRECTORY ${pygen_path})
- #create a command to generate the byte-compiled pyc file
- add_custom_command(
- OUTPUT ${pycfile} DEPENDS ${pyfile}
- COMMAND ${PYTHON_EXECUTABLE} -c
- \"import py_compile\; py_compile.compile(file='${pyfile}', cfile='${pycfile}', doraise=True)\"
- COMMENT "Byte-compiling ${pyfile_name}"
- )
- install(FILES ${pycfile}
- DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
- COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
- )
endforeach(pyfile)
- # Creates .pyo files
- install(CODE "MESSAGE(\"-- Optimizing: ${CMAKE_INSTALL_PREFIX}/${GR_PYTHON_INSTALL_DESTINATION}\")")
- install(CODE "execute_process(COMMAND ${PYTHON_EXECUTABLE} -O -m compileall -q ${CMAKE_INSTALL_PREFIX}/${GR_PYTHON_INSTALL_DESTINATION})")
-
+ #the command to generate the pyc files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pycfiles}
+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pycfiles}
+ )
+
+ #the command to generate the pyo files
+ add_custom_command(
+ DEPENDS ${pysrcfiles} OUTPUT ${pyofiles}
+ COMMAND ${PYTHON_EXECUTABLE} -O ${CMAKE_BINARY_DIR}/python_compile_helper.py ${pysrcfiles} ${pyofiles}
+ )
+
+ #create install rule and add generated files to target list
+ set(python_install_gen_targets ${pycfiles} ${pyofiles})
+ install(FILES ${python_install_gen_targets}
+ DESTINATION ${GR_PYTHON_INSTALL_DESTINATION}
+ COMPONENT ${GR_PYTHON_INSTALL_COMPONENT}
+ )
+
+
####################################################################
elseif(GR_PYTHON_INSTALL_PROGRAMS)
####################################################################
@@ -191,3 +214,14 @@ function(GR_PYTHON_INSTALL)
GR_UNIQUE_TARGET("pygen" ${python_install_gen_targets})
endfunction(GR_PYTHON_INSTALL)
+
+########################################################################
+# Write the python helper script that generates byte code files
+########################################################################
+file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
+import sys, py_compile
+files = sys.argv[1:]
+srcs, gens = files[:len(files)/2], files[len(files)/2:]
+for src, gen in zip(srcs, gens):
+ py_compile.compile(file=src, cfile=gen, doraise=True)
+")
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index 7f2018b53f..6055c63569 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -83,7 +83,6 @@ endmacro(GR_SWIG_MAKE)
########################################################################
macro(GR_SWIG_INSTALL)
- include(CMakeMacroLibtoolFile)
include(CMakeParseArgumentsCopy)
CMAKE_PARSE_ARGUMENTS(GR_SWIG_INSTALL "" "DESTINATION;COMPONENT" "TARGETS" ${ARGN})
@@ -99,7 +98,11 @@ macro(GR_SWIG_INSTALL)
COMPONENT ${GR_SWIG_INSTALL_COMPONENT}
)
- CREATE_LIBTOOL_FILE(${SWIG_MODULE_${name}_REAL_NAME} /${GR_SWIG_INSTALL_DESTINATION})
+ find_program(LIBTOOL libtool)
+ if(LIBTOOL)
+ include(CMakeMacroLibtoolFile)
+ CREATE_LIBTOOL_FILE(${SWIG_MODULE_${name}_REAL_NAME} /${GR_SWIG_INSTALL_DESTINATION})
+ endif(LIBTOOL)
endforeach(name)
diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake
index 666c6f126c..7baa8eabbd 100644
--- a/cmake/Modules/GrVersion.cmake
+++ b/cmake/Modules/GrVersion.cmake
@@ -44,16 +44,16 @@ set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION})
########################################################################
find_package(Git)
-#if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
-# message(STATUS "Extracting version information from git describe...")
-# execute_process(
-# COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8
-# OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE
-# WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-# )
-#else()
-# set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown")
-#endif()
+if(GIT_FOUND AND EXISTS ${CMAKE_SOURCE_DIR}/.git)
+ message(STATUS "Extracting version information from git describe...")
+ execute_process(
+ COMMAND ${GIT_EXECUTABLE} describe --always --abbrev=8
+ OUTPUT_VARIABLE GIT_DESCRIBE OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+ )
+else()
+ set(GIT_DESCRIBE "v${MAJOR_VERSION}.${API_COMPAT}.x-xxx-xunknown")
+endif()
########################################################################
# Use the logic below to set the version constants
diff --git a/cmake/Toolchains/arm_cortex_a8_native.cmake b/cmake/Toolchains/arm_cortex_a8_native.cmake
new file mode 100644
index 0000000000..7dbb800499
--- /dev/null
+++ b/cmake/Toolchains/arm_cortex_a8_native.cmake
@@ -0,0 +1,8 @@
+########################################################################
+# Toolchain file for building native on a ARM Cortex A8 w/ NEON
+# Usage: cmake -DCMAKE_TOOLCHAIN_FILE=<this file> <source directory>
+########################################################################
+set(CMAKE_CXX_COMPILER g++)
+set(CMAKE_C_COMPILER gcc)
+set(CMAKE_CXX_FLAGS "-march=armv7-a -mtune=cortex-a8 -mfpu=neon -mfloat-abi=softfp")
+set(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) #same flags for C sources
diff --git a/cmake/msvc/config.h b/cmake/msvc/config.h
index 71e94c8322..43792c7837 100644
--- a/cmake/msvc/config.h
+++ b/cmake/msvc/config.h
@@ -21,10 +21,13 @@ typedef ptrdiff_t ssize_t;
////////////////////////////////////////////////////////////////////////
// rint functions
////////////////////////////////////////////////////////////////////////
+#include <math.h>
static inline long lrint(double x){return (long)(x > 0.0 ? x + 0.5 : x - 0.5);}
static inline long lrintf(float x){return (long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
-static inline double rint(double x){return (double)lrint(x);}
-static inline float rintf(float x){return (float)lrintf(x);}
+static inline long long llrint(double x){return (long long)(x > 0.0 ? x + 0.5 : x - 0.5);}
+static inline long long llrintf(float x){return (long long)(x > 0.0f ? x + 0.5f : x - 0.5f);}
+static inline double rint(double x){return (x > 0.0)? floor(x + 0.5) : ceil(x - 0.5);}
+static inline float rintf(float x){return (x > 0.0f)? floorf(x + 0.5f) : ceilf(x - 0.5f);}
////////////////////////////////////////////////////////////////////////
// math constants