diff options
Diffstat (limited to 'host/cmake')
-rw-r--r-- | host/cmake/Modules/CheckCXXSymbolExistsCopy.cmake | 43 | ||||
-rw-r--r-- | host/cmake/Modules/CheckSymbolExistsCopy.cmake | 125 | ||||
-rw-r--r-- | host/cmake/Modules/FindGPSD.cmake | 62 | ||||
-rw-r--r-- | host/cmake/Modules/FindORC.cmake | 36 | ||||
-rw-r--r-- | host/cmake/Modules/FindUSB1.cmake | 7 | ||||
-rw-r--r-- | host/cmake/Modules/UHDComponent.cmake | 17 | ||||
-rw-r--r-- | host/cmake/Modules/UHDGlobalDefs.cmake | 2 | ||||
-rw-r--r-- | host/cmake/Modules/UHDPackage.cmake | 8 | ||||
-rw-r--r-- | host/cmake/Modules/UHDPython.cmake | 2 | ||||
-rw-r--r-- | host/cmake/Modules/UHDUnitTest.cmake | 39 | ||||
-rw-r--r-- | host/cmake/Modules/UHDVersion.cmake | 10 | ||||
-rw-r--r-- | host/cmake/Toolchains/mingw_cross.cmake | 65 | ||||
-rw-r--r-- | host/cmake/Toolchains/oe-sdk_cross.cmake | 2 | ||||
-rw-r--r-- | host/cmake/msvc/stdbool.h | 33 |
14 files changed, 308 insertions, 143 deletions
diff --git a/host/cmake/Modules/CheckCXXSymbolExistsCopy.cmake b/host/cmake/Modules/CheckCXXSymbolExistsCopy.cmake index d2cfac55e..2f16ba677 100644 --- a/host/cmake/Modules/CheckCXXSymbolExistsCopy.cmake +++ b/host/cmake/Modules/CheckCXXSymbolExistsCopy.cmake @@ -1,26 +1,33 @@ -# - Check if a symbol exists as a function, variable, or macro in C++ +#.rst: +# CheckCXXSymbolExists +# -------------------- +# +# Check if a symbol exists as a function, variable, or macro in C++ +# # CHECK_CXX_SYMBOL_EXISTS(<symbol> <files> <variable>) # # Check that the <symbol> is available after including given header -# <files> and store the result in a <variable>. Specify the list -# of files in one argument as a semicolon-separated list. -# CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as opposed -# to CHECK_SYMBOL_EXISTS(), which works only for C. +# <files> and store the result in a <variable>. Specify the list of +# files in one argument as a semicolon-separated list. +# CHECK_CXX_SYMBOL_EXISTS() can be used to check in C++ files, as +# opposed to CHECK_SYMBOL_EXISTS(), which works only for C. # # If the header files define the symbol as a macro it is considered -# available and assumed to work. If the header files declare the -# symbol as a function or variable then the symbol must also be -# available for linking. If the symbol is a type or enum value -# it will not be recognized (consider using CheckTypeSize or -# CheckCSourceCompiles). -# -# The following variables may be set before calling this macro to -# modify the way the check is run: -# -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# available and assumed to work. If the header files declare the symbol +# as a function or variable then the symbol must also be available for +# linking. If the symbol is a type or enum value it will not be +# recognized (consider using CheckTypeSize or CheckCSourceCompiles). +# +# The following variables may be set before calling this macro to modify +# the way the check is run: +# +# :: +# +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. diff --git a/host/cmake/Modules/CheckSymbolExistsCopy.cmake b/host/cmake/Modules/CheckSymbolExistsCopy.cmake index 183b2bbe6..79c5ba78e 100644 --- a/host/cmake/Modules/CheckSymbolExistsCopy.cmake +++ b/host/cmake/Modules/CheckSymbolExistsCopy.cmake @@ -1,26 +1,35 @@ -# - Check if a symbol exists as a function, variable, or macro +#.rst: +# CheckSymbolExists +# ----------------- +# +# Check if a symbol exists as a function, variable, or macro +# # CHECK_SYMBOL_EXISTS(<symbol> <files> <variable>) # # Check that the <symbol> is available after including given header -# <files> and store the result in a <variable>. Specify the list -# of files in one argument as a semicolon-separated list. +# <files> and store the result in a <variable>. Specify the list of +# files in one argument as a semicolon-separated list. +# <variable> will be created as an internal cache variable. # # If the header files define the symbol as a macro it is considered -# available and assumed to work. If the header files declare the -# symbol as a function or variable then the symbol must also be -# available for linking. If the symbol is a type or enum value -# it will not be recognized (consider using CheckTypeSize or -# CheckCSourceCompiles). -# If the check needs to be done in C++, consider using CHECK_CXX_SYMBOL_EXISTS(), -# which does the same as CHECK_SYMBOL_EXISTS(), but in C++. +# available and assumed to work. If the header files declare the symbol +# as a function or variable then the symbol must also be available for +# linking. If the symbol is a type or enum value it will not be +# recognized (consider using CheckTypeSize or CheckCSourceCompiles). If +# the check needs to be done in C++, consider using +# CHECK_CXX_SYMBOL_EXISTS(), which does the same as +# CHECK_SYMBOL_EXISTS(), but in C++. +# +# The following variables may be set before calling this macro to modify +# the way the check is run: # -# The following variables may be set before calling this macro to -# modify the way the check is run: +# :: # -# CMAKE_REQUIRED_FLAGS = string of compile command line flags -# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) -# CMAKE_REQUIRED_INCLUDES = list of include directories -# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_FLAGS = string of compile command line flags +# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar) +# CMAKE_REQUIRED_INCLUDES = list of include directories +# CMAKE_REQUIRED_LIBRARIES = list of libraries to link +# CMAKE_REQUIRED_QUIET = execute quietly without messages #============================================================================= # Copyright 2003-2011 Kitware, Inc. @@ -35,62 +44,70 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) -MACRO(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) + + +macro(CHECK_SYMBOL_EXISTS SYMBOL FILES VARIABLE) _CHECK_SYMBOL_EXISTS("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckSymbolExists.c" "${SYMBOL}" "${FILES}" "${VARIABLE}" ) -ENDMACRO(CHECK_SYMBOL_EXISTS) +endmacro() -MACRO(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) - IF("${VARIABLE}" MATCHES "^${VARIABLE}$") - SET(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") - SET(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) - IF(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_SYMBOL_EXISTS_LIBS - "-DLINK_LIBRARIES:STRING=${CMAKE_REQUIRED_LIBRARIES}") - ELSE(CMAKE_REQUIRED_LIBRARIES) - SET(CHECK_SYMBOL_EXISTS_LIBS) - ENDIF(CMAKE_REQUIRED_LIBRARIES) - IF(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_SYMBOL_EXISTS_INCLUDES +macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) + if(NOT DEFINED "${VARIABLE}" OR "x${${VARIABLE}}" STREQUAL "x${VARIABLE}") + set(CMAKE_CONFIGURABLE_FILE_CONTENT "/* */\n") + set(MACRO_CHECK_SYMBOL_EXISTS_FLAGS ${CMAKE_REQUIRED_FLAGS}) + if(CMAKE_REQUIRED_LIBRARIES) + set(CHECK_SYMBOL_EXISTS_LIBS + LINK_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) + else() + set(CHECK_SYMBOL_EXISTS_LIBS) + endif() + if(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_SYMBOL_EXISTS_INCLUDES "-DINCLUDE_DIRECTORIES:STRING=${CMAKE_REQUIRED_INCLUDES}") - ELSE(CMAKE_REQUIRED_INCLUDES) - SET(CMAKE_SYMBOL_EXISTS_INCLUDES) - ENDIF(CMAKE_REQUIRED_INCLUDES) - FOREACH(FILE ${FILES}) - SET(CMAKE_CONFIGURABLE_FILE_CONTENT + else() + set(CMAKE_SYMBOL_EXISTS_INCLUDES) + endif() + foreach(FILE ${FILES}) + set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n") - ENDFOREACH(FILE) - SET(CMAKE_CONFIGURABLE_FILE_CONTENT - "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nvoid cmakeRequireSymbol(int dummy,...){(void)dummy;}\nint main()\n{\n#ifndef ${SYMBOL}\n cmakeRequireSymbol(0,&${SYMBOL});\n#endif\n return 0;\n}\n") + endforeach() + set(CMAKE_CONFIGURABLE_FILE_CONTENT + "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n") - CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" - "${SOURCEFILE}" @ONLY IMMEDIATE) + configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" + "${SOURCEFILE}" @ONLY) - MESSAGE(STATUS "Looking for ${SYMBOL}") - TRY_COMPILE(${VARIABLE} + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL}") + endif() + try_compile(${VARIABLE} ${CMAKE_BINARY_DIR} "${SOURCEFILE}" COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} + ${CHECK_SYMBOL_EXISTS_LIBS} CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_SYMBOL_EXISTS_FLAGS} - "${CHECK_SYMBOL_EXISTS_LIBS}" "${CMAKE_SYMBOL_EXISTS_INCLUDES}" OUTPUT_VARIABLE OUTPUT) - IF(${VARIABLE}) - MESSAGE(STATUS "Looking for ${SYMBOL} - found") - SET(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + if(${VARIABLE}) + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL} - found") + endif() + set(${VARIABLE} 1 CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Determining if the ${SYMBOL} " "exist passed with the following output:\n" "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") - ELSE(${VARIABLE}) - MESSAGE(STATUS "Looking for ${SYMBOL} - not found.") - SET(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") - FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + else() + if(NOT CMAKE_REQUIRED_QUIET) + message(STATUS "Looking for ${SYMBOL} - not found") + endif() + set(${VARIABLE} "" CACHE INTERNAL "Have symbol ${SYMBOL}") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the ${SYMBOL} " "exist failed with the following output:\n" "${OUTPUT}\nFile ${SOURCEFILE}:\n" "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n") - ENDIF(${VARIABLE}) - ENDIF("${VARIABLE}" MATCHES "^${VARIABLE}$") -ENDMACRO(_CHECK_SYMBOL_EXISTS) + endif() + endif() +endmacro() diff --git a/host/cmake/Modules/FindGPSD.cmake b/host/cmake/Modules/FindGPSD.cmake new file mode 100644 index 000000000..46fbc7b59 --- /dev/null +++ b/host/cmake/Modules/FindGPSD.cmake @@ -0,0 +1,62 @@ +# +# Copyright 2015 Ettus Research LLC +# +# This program 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 of the License, or +# (at your option) any later version. +# +# This program 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 this program. If not, see <http://www.gnu.org/licenses/>. +# +# - Find libgps +# Find the Gpsd includes and client library +# This module defines +# LIBGPS_INCLUDE_DIR, where to find gps.h +# LIBGPS_LIBRARIES, the libraries needed by a GPSD client. +# LIBGPS_FOUND, If false, do not try to use GPSD. +# also defined, but not for general use are +# LIBGPS_LIBRARY, where to find the GPSD library. + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(PC_GPSD "libgps") +PKG_CHECK_MODULES(PC_GPSD_V3_11 "libgps >= 3.11") + +IF(PC_GPSD_FOUND AND NOT PC_GPSD_V3_11_FOUND) + MESSAGE(WARNING "GPSD version found is too old") +ENDIF(PC_GPSD_FOUND AND NOT PC_GPSD_V3_11_FOUND) + +IF(PC_GPSD_V3_11_FOUND) + FIND_PATH( + LIBGPS_INCLUDE_DIR + NAMES gps.h + HINTS ${PC_GPSD_INCLUDE_DIR} + ) + + SET( + LIBGPS_NAMES + ${LIBGPS_NAMES} gps + ) + + FIND_LIBRARY( + LIBGPS_LIBRARY + NAMES ${LIBGPS_NAMES} + HINTS ${PC_GPSD_LIBDIR} + ) +ENDIF(PC_GPSD_V3_11_FOUND) + +# handle the QUIETLY and REQUIRED arguments and set LIBGPS_FOUND to TRUE if +# all listed variables are TRUE +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBGPS DEFAULT_MSG LIBGPS_LIBRARY LIBGPS_INCLUDE_DIR) + +IF(LIBGPS_FOUND) + SET(LIBGPS_LIBRARIES ${LIBGPS_LIBRARY}) +ENDIF(LIBGPS_FOUND) + +MARK_AS_ADVANCED(LIBGPS_LIBRARY LIBGPS_INCLUDE_DIR) diff --git a/host/cmake/Modules/FindORC.cmake b/host/cmake/Modules/FindORC.cmake deleted file mode 100644 index e13eae235..000000000 --- a/host/cmake/Modules/FindORC.cmake +++ /dev/null @@ -1,36 +0,0 @@ -######################################################################## -# Find the library for ORC development files -######################################################################## - -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_ORC "orc-0.4") -PKG_CHECK_MODULES(PC_ORC_V4_11 "orc-0.4 > 0.4.11") - -#we are using the pkg config as a version check -#if we have pkg config, the right version must be found -#the alternative is that no pkg config orc is found -if (PC_ORC_V4_11_FOUND OR NOT PC_ORC_FOUND) - -FIND_PATH( - ORC_INCLUDE_DIRS - NAMES orc/orc.h - HINTS $ENV{ORC_DIR}/include/orc-0.4 - ${PC_ORC_INCLUDEDIR} - PATHS /usr/local/include/orc-0.4 - /usr/include/orc-0.4 -) - -FIND_LIBRARY( - ORC_LIBRARIES - NAMES orc-0.4 - HINTS $ENV{ORC_DIR}/lib - ${PC_ORC_LIBDIR} - PATHS /usr/local/lib - /usr/lib -) - -endif() #both PC ORC FOUND - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ORC DEFAULT_MSG ORC_LIBRARIES ORC_INCLUDE_DIRS) -MARK_AS_ADVANCED(ORC_LIBRARIES ORC_INCLUDE_DIRS) diff --git a/host/cmake/Modules/FindUSB1.cmake b/host/cmake/Modules/FindUSB1.cmake index 1e8e3ba03..7c4a8fb6b 100644 --- a/host/cmake/Modules/FindUSB1.cmake +++ b/host/cmake/Modules/FindUSB1.cmake @@ -8,7 +8,7 @@ PKG_CHECK_MODULES(PC_LIBUSB QUIET libusb-1.0) FIND_PATH(LIBUSB_INCLUDE_DIRS NAMES libusb.h - HINTS $ENV{LIBUSB_DIR}/include $ENV{LIBUSB_DIR}/include/libusb-1.0 + HINTS $ENV{LIBUSB_DIR}/include $ENV{LIBUSB_DIR}/include/libusb-1.0 ${PC_LIBUSB_INCLUDEDIR} ${PC_LIBUSB_INCLUDEDIR}/libusb-1.0 PATHS /usr/local/include/libusb-1.0 /usr/local/include /usr/include/libusb-1.0 /usr/include @@ -52,6 +52,11 @@ if(HAVE_LIBUSB_ERROR_NAME) list(APPEND LIBUSB_DEFINITIONS "HAVE_LIBUSB_ERROR_NAME=1") endif(HAVE_LIBUSB_ERROR_NAME) +CHECK_FUNCTION_EXISTS("libusb_strerror" HAVE_LIBUSB_STRERROR) +if(HAVE_LIBUSB_STRERROR) + list(APPEND LIBUSB_DEFINITIONS "HAVE_LIBUSB_STRERROR=1") +endif(HAVE_LIBUSB_STRERROR) + include(FindPackageHandleStandardArgs) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUSB DEFAULT_MSG LIBUSB_LIBRARIES LIBUSB_INCLUDE_DIRS) MARK_AS_ADVANCED(LIBUSB_INCLUDE_DIRS LIBUSB_LIBRARIES) diff --git a/host/cmake/Modules/UHDComponent.cmake b/host/cmake/Modules/UHDComponent.cmake index bf4a50e33..5a7dd8c86 100644 --- a/host/cmake/Modules/UHDComponent.cmake +++ b/host/cmake/Modules/UHDComponent.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010-2011,2013 Ettus Research LLC +# Copyright 2010-2011,2013,2015 Ettus Research LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -26,18 +26,31 @@ SET(_uhd_disabled_components "" CACHE INTERNAL "" FORCE) # - enb the default enable setting # - deps a list of dependencies # - dis the default disable setting +# - req fail if dependencies not met (unless specifically disabled) ######################################################################## -MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis) +MACRO(LIBUHD_REGISTER_COMPONENT name var enb deps dis req) MESSAGE(STATUS "") MESSAGE(STATUS "Configuring ${name} support...") FOREACH(dep ${deps}) MESSAGE(STATUS " Dependency ${dep} = ${${dep}}") ENDFOREACH(dep) + #if user specified option, store here + IF("${${var}}" STREQUAL "OFF") + SET(user_disabled TRUE) + ELSE() + SET(user_disabled FALSE) + ENDIF("${${var}}" STREQUAL "OFF") + #setup the dependent option for this component INCLUDE(CMakeDependentOption) CMAKE_DEPENDENT_OPTION(${var} "enable ${name} support" ${enb} "${deps}" ${dis}) + #if a required option's dependencies aren't met, fail unless user specifies otherwise + IF(NOT ${var} AND ${req} AND NOT user_disabled) + MESSAGE(FATAL_ERROR "Dependencies for required component ${name} not met.") + ENDIF(NOT ${var} AND ${req} AND NOT user_disabled) + #append the component into one of the lists IF(${var}) MESSAGE(STATUS " Enabling ${name} support.") diff --git a/host/cmake/Modules/UHDGlobalDefs.cmake b/host/cmake/Modules/UHDGlobalDefs.cmake index 78a69d46d..58c0b1287 100644 --- a/host/cmake/Modules/UHDGlobalDefs.cmake +++ b/host/cmake/Modules/UHDGlobalDefs.cmake @@ -20,7 +20,7 @@ INCLUDE(CheckCXXSymbolExistsCopy) ## Check for std::log2 -CHECK_CXX_SYMBOL_EXISTS("log2" "cmath" HAVE_LOG2) +CHECK_CXX_SYMBOL_EXISTS(log2 cmath HAVE_LOG2) ## Macros for the version number IF(UHD_VERSION_DEVEL) diff --git a/host/cmake/Modules/UHDPackage.cmake b/host/cmake/Modules/UHDPackage.cmake index 298b9d33a..640935830 100644 --- a/host/cmake/Modules/UHDPackage.cmake +++ b/host/cmake/Modules/UHDPackage.cmake @@ -99,6 +99,8 @@ IF(${CPACK_GENERATOR} STREQUAL NSIS) SET(MSVC_VERSION "VS2012") ELSEIF(MSVC12) # Visual Studio 2013 (12.0) SET(MSVC_VERSION "VS2013") + ELSEIF(MSVC14) # Visual Studio 2015 (14.0) + SET(MSVC_VERSION "VS2015") ENDIF() SET(CPACK_PACKAGE_FILE_NAME "uhd_${UHD_VERSION}_Win${BIT_WIDTH}_${MSVC_VERSION}") ELSE() @@ -210,10 +212,10 @@ SET(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS " DeleteRegValue HKLM ${HLKM_ENV} \\\"UHD_PKG_PATH\\\" ") -IF(MSVC) - #Install necessary MSVC runtime DLL's +IF(WIN32) + #Install necessary runtime DLL's INCLUDE(InstallRequiredSystemLibraries) -ENDIF(MSVC) +ENDIF(WIN32) ######################################################################## IF(NOT ${CPACK_GENERATOR} STREQUAL NSIS) diff --git a/host/cmake/Modules/UHDPython.cmake b/host/cmake/Modules/UHDPython.cmake index fdcdccb4b..a3da150a1 100644 --- a/host/cmake/Modules/UHDPython.cmake +++ b/host/cmake/Modules/UHDPython.cmake @@ -51,7 +51,7 @@ MESSAGE(STATUS "Python interpreter: ${PYTHON_EXECUTABLE}") MESSAGE(STATUS "Override with: -DPYTHON_EXECUTABLE=<path-to-python>") IF(NOT PYTHONINTERP_FOUND) - MESSAGE(FATAL_ERROR "Error: Python interpretor required by the build system.") + MESSAGE(FATAL_ERROR "Error: Python interpreter required by the build system.") ENDIF(NOT PYTHONINTERP_FOUND) MACRO(PYTHON_CHECK_MODULE desc mod cmd have) diff --git a/host/cmake/Modules/UHDUnitTest.cmake b/host/cmake/Modules/UHDUnitTest.cmake index 76fec14b8..f3e848906 100644 --- a/host/cmake/Modules/UHDUnitTest.cmake +++ b/host/cmake/Modules/UHDUnitTest.cmake @@ -1,5 +1,5 @@ # -# Copyright 2010-2012 Ettus Research LLC +# Copyright 2010-2012,2015 Ettus Research LLC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,31 +18,30 @@ ######################################################################## # Add a unit test and setup the environment for a unit test. # Takes the same arguments as the ADD_TEST function. -# -# Before calling set the following variables: -# UHD_TEST_TARGET_DEPS - built targets for the library path -# UHD_TEST_LIBRARY_DIRS - directories for the library path ######################################################################## function(UHD_ADD_TEST test_name) #Ensure that the build exe also appears in the PATH. list(APPEND UHD_TEST_TARGET_DEPS ${ARGN}) - #In the land of windows, all libraries must be in the PATH. - #Since the dependent libraries are not yet installed, - #we must manually set them in the PATH to run tests. - #The following appends the path of a target dependency. - foreach(target ${UHD_TEST_TARGET_DEPS}) - get_target_property(location ${target} LOCATION) - if(location) - get_filename_component(path ${location} PATH) - string(REGEX REPLACE "\\$\\(.*\\)" ${CMAKE_BUILD_TYPE} path ${path}) - list(APPEND UHD_TEST_LIBRARY_DIRS ${path}) - endif(location) - endforeach(target) - - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) - file(TO_NATIVE_PATH "${UHD_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? + #We need to put the directory with the .so/.dll file in the + #appropriate environment variable, as well as the test + #directory itself. + if(WIN32) + set(UHD_TEST_LIBRARY_DIRS + "${Boost_LIBRARY_DIRS}" + "${CMAKE_BINARY_DIR}/lib/${CMAKE_BUILD_TYPE}" + "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}" + ) + else() + set(UHD_TEST_LIBRARY_DIRS + "${Boost_LIBRARY_DIRS}" + "${CMAKE_BINARY_DIR}/lib" + "${CMAKE_CURRENT_BINARY_DIR}" + ) + endif(WIN32) + + file(TO_NATIVE_PATH "${UHD_TEST_LIBRARY_DIRS}" libpath) #http://www.cmake.org/pipermail/cmake/2009-May/029464.html #Replaced this add test + set environs code with the shell script generation. diff --git a/host/cmake/Modules/UHDVersion.cmake b/host/cmake/Modules/UHDVersion.cmake index 66b4402ed..2767bf110 100644 --- a/host/cmake/Modules/UHDVersion.cmake +++ b/host/cmake/Modules/UHDVersion.cmake @@ -27,8 +27,8 @@ FIND_PACKAGE(Git QUIET) # - set UHD_VERSION_DEVEL to true for master and development branches ######################################################################## SET(UHD_VERSION_MAJOR 003) -SET(UHD_VERSION_MINOR 008) -SET(UHD_VERSION_PATCH 005) +SET(UHD_VERSION_MINOR 009) +SET(UHD_VERSION_PATCH 000) SET(UHD_VERSION_DEVEL FALSE) ######################################################################## @@ -38,7 +38,7 @@ SET(UHD_VERSION_DEVEL FALSE) FUNCTION(DEPAD_NUM input_num output_num) EXECUTE_PROCESS( WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${PYTHON_EXECUTABLE} -c "print int('${input_num}')" + COMMAND ${PYTHON_EXECUTABLE} -c "print(int('${input_num}'))" OUTPUT_VARIABLE depadded_num OUTPUT_STRIP_TRAILING_WHITESPACE ) SET(${output_num} ${depadded_num} PARENT_SCOPE) @@ -69,12 +69,12 @@ EXECUTE_PROCESS( IF(_git_describe_result EQUAL 0) EXECUTE_PROCESS( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[-2]" + COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_describe}'.split('-')[-2])" OUTPUT_VARIABLE UHD_GIT_COUNT OUTPUT_STRIP_TRAILING_WHITESPACE ) EXECUTE_PROCESS( WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - COMMAND ${PYTHON_EXECUTABLE} -c "print '${_git_describe}'.split('-')[-1]" + COMMAND ${PYTHON_EXECUTABLE} -c "print('${_git_describe}'.split('-')[-1])" OUTPUT_VARIABLE UHD_GIT_HASH OUTPUT_STRIP_TRAILING_WHITESPACE ) ENDIF() diff --git a/host/cmake/Toolchains/mingw_cross.cmake b/host/cmake/Toolchains/mingw_cross.cmake new file mode 100644 index 000000000..f1406ec46 --- /dev/null +++ b/host/cmake/Toolchains/mingw_cross.cmake @@ -0,0 +1,65 @@ +# +# Allow the user to specify a MinGW prefix, but fill in +# most likely default if none given. +# + +SET(CMAKE_SYSTEM_NAME Windows) + +IF(NOT DEFINED MINGW_PREFIX) + SET(POSSIBLE_PREFIXES + i586-mingw32msvc + i686-pc-mingw32 + x86_64-pc-mingw32 + i686-w64-mingw32 + x86_64-w64-mingw32 + ) + + SET(MINGW_FOUND 0) + FOREACH(prefix ${POSSIBLE_PREFIXES}) + IF(EXISTS /usr/${prefix}) + SET(MINGW_PREFIX ${prefix}) + SET(MINGW_FOUND 1) + BREAK() + ENDIF(EXISTS /usr/${prefix}) + ENDFOREACH(prefix ${POSSIBLE_PREFIXES}) + + IF(NOT MINGW_FOUND) + MESSAGE(FATAL_ERROR "No MinGW type specified, but none detected in the usual locations.") + ENDIF(NOT MINGW_FOUND) +ENDIF(NOT DEFINED MINGW_PREFIX) + +SET(MINGW_PREFIX ${MINGW_PREFIX} CACHE STRING "MinGW prefix") + +SET(CMAKE_C_COMPILER ${MINGW_PREFIX}-gcc) +SET(CMAKE_CXX_COMPILER ${MINGW_PREFIX}-g++) +SET(CMAKE_RC_COMPILER ${MINGW_PREFIX}-windres) + +IF(NOT DEFINED CMAKE_FIND_ROOT_PATH) + SET(CMAKE_FIND_ROOT_PATH /usr/${MINGW_PREFIX}) +ENDIF(NOT DEFINED CMAKE_FIND_ROOT_PATH) + +SET(CMAKE_INCLUDE_PATH + ${CMAKE_FIND_ROOT_PATH}/local/include + ${CMAKE_FIND_ROOT_PATH}/include +) + +SET(CMAKE_LIBRARY_PATH + ${CMAKE_FIND_ROOT_PATH}/local/lib + ${CMAKE_FIND_ROOT_PATH}/lib +) + +# Adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) + +# Tell pkg-config not to look at the target environment's .pc files. +# Setting PKG_CONFIG_LIBDIR sets the default search directory, but we have to +# set PKG_CONFIG_PATH as well to prevent pkg-config falling back to the host's +# path. +set(ENV{PKG_CONFIG_LIBDIR} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig) +set(ENV{PKG_CONFIG_PATH} ${CMAKE_FIND_ROOT_PATH}/lib/pkgconfig) + +set(ENV{MINGDIR} ${CMAKE_FIND_ROOT_PATH}) diff --git a/host/cmake/Toolchains/oe-sdk_cross.cmake b/host/cmake/Toolchains/oe-sdk_cross.cmake index ea77815c9..f8ef0157c 100644 --- a/host/cmake/Toolchains/oe-sdk_cross.cmake +++ b/host/cmake/Toolchains/oe-sdk_cross.cmake @@ -9,5 +9,3 @@ set( CMAKE_FIND_ROOT_PATH $ENV{OECORE_NATIVE_SYSROOT} $ENV{OECORE_TARGET_SYSROOT set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER ) set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY ) set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY ) -set ( ORC_INCLUDE_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/include/orc-0.4 ) -set ( ORC_LIBRARY_DIRS $ENV{OECORE_TARGET_SYSROOT}/usr/lib ) diff --git a/host/cmake/msvc/stdbool.h b/host/cmake/msvc/stdbool.h new file mode 100644 index 000000000..3a91eea37 --- /dev/null +++ b/host/cmake/msvc/stdbool.h @@ -0,0 +1,33 @@ +// +// Copyright 2015 Ettus Research LLC +// +// This program 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 of the License, or +// (at your option) any later version. +// +// This program 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 this program. If not, see <http://www.gnu.org/licenses/>. +// + +#ifndef INCLUDED_MSC_STDBOOL_H +#define INCLUDED_MSC_STDBOOL_H + +#ifndef _MSC_VER +#error "Use this header only with Microsoft Visual C++ compilers!" +#endif + +#ifndef __cplusplus + +#define bool int +#define true 1 +#define false 0 + +#endif + +#endif /* INCLUDED_MSC_STDBOOL_H */ |