diff options
author | Luke Berndt <lukekb@gmail.com> | 2021-10-09 11:14:43 -0400 |
---|---|---|
committer | Luke Berndt <lukekb@gmail.com> | 2021-10-09 11:14:43 -0400 |
commit | 70698818065b24a494fc5488c82445609eab9ebc (patch) | |
tree | ffef40a068016b2ec3a7d6bb46a7d3380e930d6f /cmake | |
parent | 14b97a17e135f9c05a0561e57fc791c6fbf86bb8 (diff) |
Revert "removing changes"
This reverts commit 14b97a17e135f9c05a0561e57fc791c6fbf86bb8.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindCppUnit.cmake | 36 | ||||
-rw-r--r-- | cmake/Modules/FindGRPC.cmake | 126 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioAudio.cmake | 26 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioCore.cmake | 29 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioFCD.cmake | 34 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioFCDPP.cmake | 34 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioIQBalance.cmake | 29 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioOsmosdr.cmake | 43 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioRuntime.cmake | 37 | ||||
-rw-r--r-- | cmake/Modules/FindGnuradioUHD.cmake | 3 | ||||
-rw-r--r-- | cmake/Modules/FindGrOsmoSDR.cmake | 54 | ||||
-rw-r--r-- | cmake/Modules/FindLibHackRF.cmake | 4 | ||||
-rw-r--r-- | cmake/Modules/FindLibOsmoSDR.cmake | 41 | ||||
-rw-r--r-- | cmake/Modules/FindLibUHD.cmake (renamed from cmake/Modules/FindUHD.cmake) | 4 | ||||
-rw-r--r-- | cmake/Modules/FindProtobuf.cmake | 126 | ||||
-rw-r--r-- | cmake/Modules/GrComponent.cmake | 115 | ||||
-rw-r--r-- | cmake/Modules/GrMiscUtils.cmake | 210 | ||||
-rw-r--r-- | cmake/Modules/GrPlatform.cmake | 46 | ||||
-rw-r--r-- | cmake/Modules/GrTest.cmake | 133 | ||||
-rw-r--r-- | cmake/Modules/GrVersion.cmake | 82 |
20 files changed, 299 insertions, 913 deletions
diff --git a/cmake/Modules/FindCppUnit.cmake b/cmake/Modules/FindCppUnit.cmake deleted file mode 100644 index 9af308f8..00000000 --- a/cmake/Modules/FindCppUnit.cmake +++ /dev/null @@ -1,36 +0,0 @@ -# http://www.cmake.org/pipermail/cmake/2006-October/011446.html -# Modified to use pkg config and use standard var names - -# -# Find the CppUnit includes and library -# -# This module defines -# CPPUNIT_INCLUDE_DIR, 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(PC_CPPUNIT "cppunit") - -FIND_PATH(CPPUNIT_INCLUDE_DIRS - NAMES cppunit/TestCase.h - HINTS ${PC_CPPUNIT_INCLUDE_DIR} - PATHS - /usr/local/include - /usr/include -) - -FIND_LIBRARY(CPPUNIT_LIBRARIES - NAMES cppunit - HINTS ${PC_CPPUNIT_LIBDIR} - PATHS - ${CPPUNIT_INCLUDE_DIRS}/../lib - /usr/local/lib - /usr/lib -) - -LIST(APPEND CPPUNIT_LIBRARIES ${CMAKE_DL_LIBS}) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(CPPUNIT DEFAULT_MSG CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) -MARK_AS_ADVANCED(CPPUNIT_LIBRARIES CPPUNIT_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGRPC.cmake b/cmake/Modules/FindGRPC.cmake new file mode 100644 index 00000000..513e57fc --- /dev/null +++ b/cmake/Modules/FindGRPC.cmake @@ -0,0 +1,126 @@ +# +# Locate and configure the gRPC library +# +# Adds the following targets: +# +# gRPC::grpc - gRPC library +# gRPC::grpc++ - gRPC C++ library +# gRPC::grpc++_reflection - gRPC C++ reflection library +# gRPC::grpc_cpp_plugin - C++ generator plugin for Protocol Buffers +# + +# +# Generates C++ sources from the .proto files +# +# grpc_generate_cpp (<SRCS> <HDRS> <DEST> [<ARGN>...]) +# +# SRCS - variable to define with autogenerated source files +# HDRS - variable to define with autogenerated header files +# DEST - directory where the source files will be created +# ARGN - .proto files +# +function(GRPC_GENERATE_CPP SRCS HDRS DEST) + if(NOT ARGN) + message(SEND_ERROR "Error: GRPC_GENERATE_CPP() called without any proto files") + return() + endif() + + if(GRPC_GENERATE_CPP_APPEND_PATH) + # Create an include path for each file specified + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(ABS_PATH ${ABS_FIL} PATH) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + if(DEFINED PROTOBUF_IMPORT_DIRS) + foreach(DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + + set(${SRCS}) + set(${HDRS}) + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(FIL_WE ${FIL} NAME_WE) + + list(APPEND ${SRCS} "${DEST}/${FIL_WE}.grpc.pb.cc") + list(APPEND ${HDRS} "${DEST}/${FIL_WE}.grpc.pb.h") + + add_custom_command( + OUTPUT "${DEST}/${FIL_WE}.grpc.pb.cc" + "${DEST}/${FIL_WE}.grpc.pb.h" + COMMAND protobuf::protoc + ARGS --grpc_out ${DEST} ${_protobuf_include_path} --plugin=protoc-gen-grpc=${GRPC_CPP_PLUGIN} ${ABS_FIL} + DEPENDS ${ABS_FIL} protobuf::protoc gRPC::grpc_cpp_plugin + COMMENT "Running C++ gRPC compiler on ${FIL}" + VERBATIM ) + endforeach() + + set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) + set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) +endfunction() + +# By default have GRPC_GENERATE_CPP macro pass -I to protoc +# for each directory where a proto file is referenced. +if(NOT DEFINED GRPC_GENERATE_CPP_APPEND_PATH) + set(GRPC_GENERATE_CPP_APPEND_PATH TRUE) +endif() + +# Find gRPC include directory +find_path(GRPC_INCLUDE_DIR grpc/grpc.h) +mark_as_advanced(GRPC_INCLUDE_DIR) + +# Find gRPC library +find_library(GRPC_LIBRARY NAMES grpc) +mark_as_advanced(GRPC_LIBRARY) +add_library(gRPC::grpc UNKNOWN IMPORTED) +set_target_properties(gRPC::grpc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${GRPC_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES "-lpthread;-ldl" + IMPORTED_LOCATION ${GRPC_LIBRARY} +) + +# Find gRPC C++ library +find_library(GRPC_GRPC++_LIBRARY NAMES grpc++) +mark_as_advanced(GRPC_GRPC++_LIBRARY) +add_library(gRPC::grpc++ UNKNOWN IMPORTED) +set_target_properties(gRPC::grpc++ PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${GRPC_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES gRPC::grpc + IMPORTED_LOCATION ${GRPC_GRPC++_LIBRARY} +) + +# Find gRPC C++ reflection library +find_library(GRPC_GRPC++_REFLECTION_LIBRARY NAMES grpc++_reflection) +mark_as_advanced(GRPC_GRPC++_REFLECTION_LIBRARY) +add_library(gRPC::grpc++_reflection UNKNOWN IMPORTED) +set_target_properties(gRPC::grpc++_reflection PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${GRPC_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES gRPC::grpc++ + IMPORTED_LOCATION ${GRPC_GRPC++_REFLECTION_LIBRARY} +) + +# Find gRPC CPP generator +find_program(GRPC_CPP_PLUGIN NAMES grpc_cpp_plugin) +mark_as_advanced(GRPC_CPP_PLUGIN) +add_executable(gRPC::grpc_cpp_plugin IMPORTED) +set_target_properties(gRPC::grpc_cpp_plugin PROPERTIES + IMPORTED_LOCATION ${GRPC_CPP_PLUGIN} +) + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(gRPC DEFAULT_MSG + GRPC_LIBRARY GRPC_INCLUDE_DIR GRPC_GRPC++_REFLECTION_LIBRARY GRPC_CPP_PLUGIN)
\ No newline at end of file diff --git a/cmake/Modules/FindGnuradioAudio.cmake b/cmake/Modules/FindGnuradioAudio.cmake deleted file mode 100644 index 246568f5..00000000 --- a/cmake/Modules/FindGnuradioAudio.cmake +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_AUDIO gnuradio-audio) - -FIND_PATH( - GNURADIO_AUDIO_INCLUDE_DIRS - NAMES gnuradio/gr_audio_api.h - HINTS $ENV{GNURADIO_AUDIO_DIR}/include - ${PC_GNURADIO_AUDIO_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GNURADIO_AUDIO_LIBRARIES - NAMES gnuradio-audio - HINTS $ENV{GNURADIO_AUDIO_DIR}/lib - ${PC_GNURADIO_AUDIO_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_AUDIO DEFAULT_MSG GNURADIO_AUDIO_LIBRARIES GNURADIO_AUDIO_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_AUDIO_LIBRARIES GNURADIO_AUDIO_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioCore.cmake b/cmake/Modules/FindGnuradioCore.cmake deleted file mode 100644 index 6b4386ee..00000000 --- a/cmake/Modules/FindGnuradioCore.cmake +++ /dev/null @@ -1,29 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_CORE gnuradio-core) - -FIND_PATH( - GNURADIO_CORE_INCLUDE_DIRS - NAMES gr_core_api.h - HINTS $ENV{GNURADIO_CORE_DIR}/include/gnuradio - ${PC_GNURADIO_CORE_INCLUDEDIR} - ${CMAKE_INSTALL_PREFIX}/include/gnuradio - PATHS /usr/local/include/gnuradio - /usr/include/gnuradio -) - -FIND_LIBRARY( - GNURADIO_CORE_LIBRARIES - NAMES gnuradio-core - HINTS $ENV{GNURADIO_CORE_DIR}/lib - ${PC_GNURADIO_CORE_LIBDIR} - ${CMAKE_INSTALL_PREFIX}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_CORE DEFAULT_MSG GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_CORE_LIBRARIES GNURADIO_CORE_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioFCD.cmake b/cmake/Modules/FindGnuradioFCD.cmake deleted file mode 100644 index bbde8350..00000000 --- a/cmake/Modules/FindGnuradioFCD.cmake +++ /dev/null @@ -1,34 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_FCD gnuradio-fcd) - -FIND_PATH( - GNURADIO_FCD_INCLUDE_DIRS - NAMES gnuradio/fcd_api.h - HINTS $ENV{GNURADIO_FCD_DIR}/include - ${PC_GNURADIO_FCD_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GNURADIO_FCD_LIBRARIES - NAMES gnuradio-fcd - HINTS $ENV{GNURADIO_FCD_DIR}/lib - ${PC_GNURADIO_FCD_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -if(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES) - set(GNURADIO_FCD_FOUND TRUE CACHE INTERNAL "gnuradio-fcd found") - message(STATUS "Found gnuradio-fcd: ${GNURADIO_FCD_INCLUDE_DIRS}, ${GNURADIO_FCD_LIBRARIES}") -else(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES) - set(GNURADIO_FCD_FOUND FALSE CACHE INTERNAL "gnuradio-fcd found") - message(STATUS "gnuradio-fcd not found.") -endif(GNURADIO_FCD_INCLUDE_DIRS AND GNURADIO_FCD_LIBRARIES) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FCD DEFAULT_MSG GNURADIO_FCD_LIBRARIES GNURADIO_FCD_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_FCD_LIBRARIES GNURADIO_FCD_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioFCDPP.cmake b/cmake/Modules/FindGnuradioFCDPP.cmake deleted file mode 100644 index c6f03f1f..00000000 --- a/cmake/Modules/FindGnuradioFCDPP.cmake +++ /dev/null @@ -1,34 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_FCDPP gnuradio-fcdproplus) - -FIND_PATH( - GNURADIO_FCDPP_INCLUDE_DIRS - NAMES fcdproplus/api.h - HINTS $ENV{GNURADIO_FCDPP_DIR}/include - ${PC_GNURADIO_FCDPP_INCLUDEDIR} - PATHS /usr/local/include - /usr/include -) - -FIND_LIBRARY( - GNURADIO_FCDPP_LIBRARIES - NAMES gnuradio-fcdproplus - HINTS $ENV{GNURADIO_FCDPP_DIR}/lib - ${PC_GNURADIO_FCDPP_LIBDIR} - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -if(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES) - set(GNURADIO_FCDPP_FOUND TRUE CACHE INTERNAL "gnuradio-fcdproplus found") - message(STATUS "Found gnuradio-fcdproplus: ${GNURADIO_FCDPP_INCLUDE_DIRS}, ${GNURADIO_FCDPP_LIBRARIES}") -else(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES) - set(GNURADIO_FCDPP_FOUND FALSE CACHE INTERNAL "gnuradio-fcdproplus found") - message(STATUS "gnuradio-fcdproplus not found.") -endif(GNURADIO_FCDPP_INCLUDE_DIRS AND GNURADIO_FCDPP_LIBRARIES) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_FCDPP DEFAULT_MSG GNURADIO_FCDPP_LIBRARIES GNURADIO_FCDPP_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_FCDPP_LIBRARIES GNURADIO_FCDPP_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioIQBalance.cmake b/cmake/Modules/FindGnuradioIQBalance.cmake deleted file mode 100644 index 642ee3f7..00000000 --- a/cmake/Modules/FindGnuradioIQBalance.cmake +++ /dev/null @@ -1,29 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_IQBALANCE gnuradio-iqbalance) - -FIND_PATH( - GNURADIO_IQBALANCE_INCLUDE_DIRS - NAMES iqbalance_api.h - HINTS $ENV{GNURADIO_IQBALANCE_DIR}/include/iqbalance - ${PC_GNURADIO_IQBALANCE_INCLUDEDIR} - ${CMAKE_INSTALL_PREFIX}/include/iqbalance - PATHS /usr/local/include/iqbalance - /usr/include/iqbalance -) - -FIND_LIBRARY( - GNURADIO_IQBALANCE_LIBRARIES - NAMES gnuradio-iqbalance - HINTS $ENV{GNURADIO_IQBALANCE_DIR}/lib - ${PC_GNURADIO_IQBALANCE_LIBDIR} - ${CMAKE_INSTALL_PREFIX}/lib64 - ${CMAKE_INSTALL_PREFIX}/lib - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 -) - -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_IQBALANCE DEFAULT_MSG GNURADIO_IQBALANCE_LIBRARIES GNURADIO_IQBALANCE_INCLUDE_DIRS) -MARK_AS_ADVANCED(GNURADIO_IQBALANCE_LIBRARIES GNURADIO_IQBALANCE_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioOsmosdr.cmake b/cmake/Modules/FindGnuradioOsmosdr.cmake new file mode 100644 index 00000000..bd9ef994 --- /dev/null +++ b/cmake/Modules/FindGnuradioOsmosdr.cmake @@ -0,0 +1,43 @@ +PKG_CHECK_MODULES(GNURADIO_OSMOSDR gnuradio-osmosdr) + +FIND_PATH( + GNURADIO_OSMOSDR_INCLUDE_DIRS + NAMES osmosdr/source.h + HINTS $ENV{GNURADIO_OSMOSDR_DIR}/include + ${GNURADIO_OSMOSDR_INCLUDEDIR} + ${GNURADIO_OSMOSDR_INCLUDE_DIRS} + ${CMAKE_INSTALL_PREFIX}/include/osmosdr + PATHS /usr/local/include/osmosdr + /usr/include/osmosdr + /opt/local/include +) + +FIND_LIBRARY( + GNURADIO_OSMOSDR_LIBRARIES + NAMES gnuradio-osmosdr + HINTS $ENV{GNURADIO_OSMOSDR_DIR}/lib + ${GNURADIO_OSMOSDR_LIBRARY_DIRS} + ${GNURADIO_OSMOSDR_LIBDIR} + ${CMAKE_INSTALL_PREFIX}/lib + ${CMAKE_INSTALL_PREFIX}/lib64 + PATHS /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 + /opt/local/lib +) + + +if(GNURADIO_OSMOSDR_INCLUDE_DIRS AND GNURADIO_OSMOSDR_LIBRARIES) + set(GNURADIO_OSMOSDR_FOUND TRUE CACHE INTERNAL "gnuradio-osmosdr found") + message(STATUS "Found gnuradio-osmosdr: ${GNURADIO_OSMOSDR_INCLUDE_DIRS}, ${GNURADIO_OSMOSDR_LIBRARIES}") +else(GNURADIO_OSMOSDR_INCLUDE_DIRS AND GNURADIO_OSMOSDR_LIBRARIES) + set(GNURADIO_OSMOSDR_FOUND FALSE CACHE INTERNAL "gnuradio-osmosdr found") + message(STATUS "gnuradio-osmosdr not found.") + message(STATUS "Found gnuradio-osmosdr: ${GNURADIO_OSMOSDR_INCLUDE_DIRS}, ${GNURADIO_OSMOSDR_LIBRARIES}") +endif(GNURADIO_OSMOSDR_INCLUDE_DIRS AND GNURADIO_OSMOSDR_LIBRARIES) + + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuradioOsmosdr DEFAULT_MSG GNURADIO_OSMOSDR_LIBRARIES GNURADIO_OSMOSDR_INCLUDE_DIRS) +MARK_AS_ADVANCED(GNURADIO_OSMOSDR_LIBRARIES GNURADIO_OSMOSDR_INCLUDE_DIRS)
\ No newline at end of file diff --git a/cmake/Modules/FindGnuradioRuntime.cmake b/cmake/Modules/FindGnuradioRuntime.cmake deleted file mode 100644 index 6990b148..00000000 --- a/cmake/Modules/FindGnuradioRuntime.cmake +++ /dev/null @@ -1,37 +0,0 @@ -INCLUDE(FindPkgConfig) -PKG_CHECK_MODULES(PC_GNURADIO_RUNTIME gnuradio-runtime) - -if(PC_GNURADIO_RUNTIME_FOUND) - # look for include files - FIND_PATH( - GNURADIO_RUNTIME_INCLUDE_DIRS - NAMES gnuradio/top_block.h - HINTS $ENV{GNURADIO_RUNTIME_DIR}/include - ${PC_GNURADIO_RUNTIME_INCLUDE_DIRS} - ${CMAKE_INSTALL_PREFIX}/include - PATHS /usr/local/include - /usr/include - ) - - # look for libs - FIND_LIBRARY( - GNURADIO_RUNTIME_LIBRARIES - NAMES gnuradio-runtime - HINTS $ENV{GNURADIO_RUNTIME_DIR}/lib - ${PC_GNURADIO_RUNTIME_LIBDIR} - ${CMAKE_INSTALL_PREFIX}/lib/ - ${CMAKE_INSTALL_PREFIX}/lib64/ - PATHS /usr/local/lib - /usr/local/lib64 - /usr/lib - /usr/lib64 - /usr/lib/x86_64-linux-gnu/lib - ) - - set(GNURADIO_RUNTIME_FOUND ${PC_GNURADIO_RUNTIME_FOUND}) -endif(PC_GNURADIO_RUNTIME_FOUND) - -INCLUDE(FindPackageHandleStandardArgs) -# do not check GNURADIO_RUNTIME_INCLUDE_DIRS, is not set when default include path us used. -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_RUNTIME DEFAULT_MSG GNURADIO_RUNTIME_LIBRARIES) -MARK_AS_ADVANCED(GNURADIO_RUNTIME_LIBRARIES GNURADIO_RUNTIME_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGnuradioUHD.cmake b/cmake/Modules/FindGnuradioUHD.cmake index f99daf09..357948ac 100644 --- a/cmake/Modules/FindGnuradioUHD.cmake +++ b/cmake/Modules/FindGnuradioUHD.cmake @@ -1,4 +1,3 @@ -INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_GNURADIO_UHD gnuradio-uhd) FIND_PATH( @@ -30,5 +29,5 @@ else(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES) endif(GNURADIO_UHD_INCLUDE_DIRS AND GNURADIO_UHD_LIBRARIES) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(GNURADIO_UHD DEFAULT_MSG GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(GnuradioUHD DEFAULT_MSG GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS) MARK_AS_ADVANCED(GNURADIO_UHD_LIBRARIES GNURADIO_UHD_INCLUDE_DIRS) diff --git a/cmake/Modules/FindGrOsmoSDR.cmake b/cmake/Modules/FindGrOsmoSDR.cmake deleted file mode 100644 index 5bc072f1..00000000 --- a/cmake/Modules/FindGrOsmoSDR.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# Tries to find gr-osmosdr. -# -# Usage of this module as follows: -# -# find_package(GrOsmoSDR) -# -# Variables used by this module, they can change the default behaviour and need -# to be set before calling find_package: -# -# GrOsmoSDR_ROOT_DIR Set this variable to the root installation of -# gr-osmosdr if the module has problems finding -# the proper installation path. -# -# Variables defined by this module: -# -# GROSMOSDR_FOUND System has gr-osmosdr libs/headers -# GROSMOSDR_LIBRARIES The gr-osmosdr libraries (gnuradio-osmosdr) -# GROSMOSDR_INCLUDE_DIR The location of gr-osmosdr headers - -pkg_check_modules (GROSMOSDR_PKG gnuradio-osmosdr) - -FIND_PATH(GROSMOSDR_INCLUDE_DIR - NAMES osmosdr/source_c.h - osmosdr/api.h - HINTS ${GROSMOSDR_PKG_INCLUDE_DIRS} - PATHS /usr/local/include - /usr/include -) - - -find_library(GROSMOSDR_LIBRARIES - NAMES gnuradio-osmosdr - HINTS ${GROSMOSDR_PKG_LIBRARY_DIRS} - PATHS /usr/local/lib - /usr/lib - ) - - -include(FindPackageHandleStandardArgs) -find_package_handle_standard_args( - GrOsmoSDR - DEFAULT_MSG - GROSMOSDR_LIBRARIES - GROSMOSDR_INCLUDE_DIR -) - - -mark_as_advanced( - GROSMOSDR_LIBRARIES - GROSMOSDR_INCLUDE_DIR -) - -message(STATUS "Pkg: ${LIBDSD_PKG}, ${LIBDSD_PKG_INCLUDE_DIRS}, ${LIBDSD_PKG_LIBRARY_DIRS}") -message(STATUS "Vars: ${GROSMOSDR_INCLUDE_DIR}, ${GROSMOSDR_LIBRARIES}") diff --git a/cmake/Modules/FindLibHackRF.cmake b/cmake/Modules/FindLibHackRF.cmake index 73e97f30..3567a3ea 100644 --- a/cmake/Modules/FindLibHackRF.cmake +++ b/cmake/Modules/FindLibHackRF.cmake @@ -1,4 +1,3 @@ -INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_LIBHACKRF libhackrf) FIND_PATH( @@ -19,6 +18,7 @@ FIND_LIBRARY( /usr/lib ) + INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBHACKRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibHackRF DEFAULT_MSG LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS) MARK_AS_ADVANCED(LIBHACKRF_LIBRARIES LIBHACKRF_INCLUDE_DIRS) diff --git a/cmake/Modules/FindLibOsmoSDR.cmake b/cmake/Modules/FindLibOsmoSDR.cmake deleted file mode 100644 index 9d95e39f..00000000 --- a/cmake/Modules/FindLibOsmoSDR.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# Tries to find libosmosdr. -# -# Usage of this module as follows: -# -# find_package(LibOsmoSDR) -# -# -# Variables defined by this module: -# -# LIBOSMOSDR_FOUND System has libosmosdr libs/headers -# LIBOSMOSDR_LIBRARIES The libosmosdr libraries -# LIBOSMOSDR_INCLUDE_DIR The location of libosmosdr headers - - -if(NOT LIBOSMOSDR_FOUND) - pkg_check_modules (LIBOSMOSDR_PKG libosmosdr) - find_path(LIBOSMOSDR_INCLUDE_DIR NAMES osmosdr.h - PATHS - ${LIBOSMOSDR_PKG_INCLUDE_DIRS} - /usr/include - /usr/local/include - ) - - find_library(LIBOSMOSDR_LIBRARIES NAMES osmosdr - PATHS - ${LIBOSMOSDR_PKG_LIBRARY_DIRS} - /usr/lib - /usr/local/lib - ) - - if(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES) - set(LIBOSMOSDR_FOUND TRUE CACHE INTERNAL "libosmosdr found") - message(STATUS "Found libosmosdr: ${LIBOSMOSDR_INCLUDE_DIR}, ${LIBOSMOSDR_LIBRARIES}") - else(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES) - set(LIBOSMOSDR_FOUND FALSE CACHE INTERNAL "libosmosdr found") - message(STATUS "libosmosdr not found.") - endif(LIBOSMOSDR_INCLUDE_DIR AND LIBOSMOSDR_LIBRARIES) - -mark_as_advanced(LIBOSMOSDR_INCLUDE_DIR LIBOSMOSDR_LIBRARIES) - -endif(NOT LIBOSMOSDR_FOUND) diff --git a/cmake/Modules/FindUHD.cmake b/cmake/Modules/FindLibUHD.cmake index b4d12b6d..6ac4eb56 100644 --- a/cmake/Modules/FindUHD.cmake +++ b/cmake/Modules/FindLibUHD.cmake @@ -1,8 +1,6 @@ ######################################################################## # Find the library for the USRP Hardware Driver ######################################################################## - -INCLUDE(FindPkgConfig) PKG_CHECK_MODULES(PC_UHD uhd) FIND_PATH( @@ -24,5 +22,5 @@ FIND_LIBRARY( ) INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(UHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibUHD DEFAULT_MSG UHD_LIBRARIES UHD_INCLUDE_DIRS) MARK_AS_ADVANCED(UHD_LIBRARIES UHD_INCLUDE_DIRS) diff --git a/cmake/Modules/FindProtobuf.cmake b/cmake/Modules/FindProtobuf.cmake new file mode 100644 index 00000000..3050e734 --- /dev/null +++ b/cmake/Modules/FindProtobuf.cmake @@ -0,0 +1,126 @@ +# +# Locate and configure the Google Protocol Buffers library +# +# Adds the following targets: +# +# protobuf::libprotobuf - Protobuf library +# protobuf::libprotobuf-lite - Protobuf lite library +# protobuf::libprotoc - Protobuf Protoc Library +# protobuf::protoc - protoc executable +# + +# +# Generates C++ sources from the .proto files +# +# protobuf_generate_cpp (<SRCS> <HDRS> <DEST> [<ARGN>...]) +# +# SRCS - variable to define with autogenerated source files +# HDRS - variable to define with autogenerated header files +# DEST - directory where the source files will be created +# ARGN - .proto files +# +function(PROTOBUF_GENERATE_CPP SRCS HDRS DEST) + if(NOT ARGN) + message(SEND_ERROR "Error: PROTOBUF_GENERATE_CPP() called without any proto files") + return() + endif() + + if(PROTOBUF_GENERATE_CPP_APPEND_PATH) + # Create an include path for each file specified + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(ABS_PATH ${ABS_FIL} PATH) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + else() + set(_protobuf_include_path -I ${CMAKE_CURRENT_SOURCE_DIR}) + endif() + + if(DEFINED PROTOBUF_IMPORT_DIRS) + foreach(DIR ${PROTOBUF_IMPORT_DIRS}) + get_filename_component(ABS_PATH ${DIR} ABSOLUTE) + list(FIND _protobuf_include_path ${ABS_PATH} _contains_already) + if(${_contains_already} EQUAL -1) + list(APPEND _protobuf_include_path -I ${ABS_PATH}) + endif() + endforeach() + endif() + + set(${SRCS}) + set(${HDRS}) + foreach(FIL ${ARGN}) + get_filename_component(ABS_FIL ${FIL} ABSOLUTE) + get_filename_component(FIL_WE ${FIL} NAME_WE) + + list(APPEND ${SRCS} "${DEST}/${FIL_WE}.pb.cc") + list(APPEND ${HDRS} "${DEST}/${FIL_WE}.pb.h") + + add_custom_command( + OUTPUT "${DEST}/${FIL_WE}.pb.cc" + "${DEST}/${FIL_WE}.pb.h" + COMMAND protobuf::protoc + ARGS --cpp_out ${DEST} ${_protobuf_include_path} ${ABS_FIL} + DEPENDS ${ABS_FIL} protobuf::protoc + COMMENT "Running C++ protocol buffer compiler on ${FIL}" + VERBATIM ) + endforeach() + + set_source_files_properties(${${SRCS}} ${${HDRS}} PROPERTIES GENERATED TRUE) + set(${SRCS} ${${SRCS}} PARENT_SCOPE) + set(${HDRS} ${${HDRS}} PARENT_SCOPE) +endfunction() + +# By default have PROTOBUF_GENERATE_CPP macro pass -I to protoc +# for each directory where a proto file is referenced. +if(NOT DEFINED PROTOBUF_GENERATE_CPP_APPEND_PATH) + set(PROTOBUF_GENERATE_CPP_APPEND_PATH TRUE) +endif() + +# Find the include directory +find_path(PROTOBUF_INCLUDE_DIR google/protobuf/service.h) +mark_as_advanced(PROTOBUF_INCLUDE_DIR) + +# The Protobuf library +find_library(PROTOBUF_LIBRARY NAMES protobuf) +mark_as_advanced(PROTOBUF_LIBRARY) +add_library(protobuf::libprotobuf UNKNOWN IMPORTED) +set_target_properties(protobuf::libprotobuf PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${PROTOBUF_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES pthread + IMPORTED_LOCATION ${PROTOBUF_LIBRARY} +) + +# The Protobuf lite library +find_library(PROTOBUF_LITE_LIBRARY NAMES protobuf-lite) +mark_as_advanced(PROTOBUF_LITE_LIBRARY) +add_library(protobuf::libprotobuf-lite UNKNOWN IMPORTED) +set_target_properties(protobuf::libprotobuf-lite PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${PROTOBUF_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES pthread + IMPORTED_LOCATION ${PROTOBUF_LITE_LIBRARY} +) + +# The Protobuf Protoc Library +find_library(PROTOBUF_PROTOC_LIBRARY NAMES protoc) +mark_as_advanced(PROTOBUF_PROTOC_LIBRARY) +add_library(protobuf::libprotoc UNKNOWN IMPORTED) +set_target_properties(protobuf::libprotoc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${PROTOBUF_INCLUDE_DIR} + INTERFACE_LINK_LIBRARIES protobuf::libprotobuf + IMPORTED_LOCATION ${PROTOBUF_PROTOC_LIBRARY} +) + +# Find the protoc Executable +find_program(PROTOBUF_PROTOC_EXECUTABLE NAMES protoc) +mark_as_advanced(PROTOBUF_PROTOC_EXECUTABLE) +add_executable(protobuf::protoc IMPORTED) +set_target_properties(protobuf::protoc PROPERTIES + IMPORTED_LOCATION ${PROTOBUF_PROTOC_EXECUTABLE} +) + +include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Protobuf DEFAULT_MSG + PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR PROTOBUF_PROTOC_EXECUTABLE)
\ No newline at end of file diff --git a/cmake/Modules/GrComponent.cmake b/cmake/Modules/GrComponent.cmake deleted file mode 100644 index 22b0ea4e..00000000 --- a/cmake/Modules/GrComponent.cmake +++ /dev/null @@ -1,115 +0,0 @@ -# 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(DEFINED __INCLUDED_GR_COMPONENT_CMAKE) - return() -endif() -set(__INCLUDED_GR_COMPONENT_CMAKE TRUE) - -set(_gr_enabled_components "" CACHE INTERNAL "" FORCE) -set(_gr_disabled_components "" CACHE INTERNAL "" FORCE) - -if(NOT DEFINED ENABLE_DEFAULT) - set(ENABLE_DEFAULT ON) - message(STATUS "") - message(STATUS "The build system will automatically enable all components.") - message(STATUS "Use -DENABLE_DEFAULT=OFF to disable components by default.") -endif() - -######################################################################## -# Register a component into the system -# - name: canonical component name -# - var: variable for enabled status -# - argn: list of dependencies -######################################################################## -function(GR_REGISTER_COMPONENT name var) - include(CMakeDependentOption) - message(STATUS "") - message(STATUS "Configuring ${name} support...") - foreach(dep ${ARGN}) - message(STATUS " Dependency ${dep} = ${${dep}}") - endforeach(dep) - - #if the user set the var to force, we note this - if("${${var}}" STREQUAL "FORCE") - set(${var} ON) - set(var_force TRUE) - else() - set(var_force FALSE) - endif() - - #rewrite the dependency list so that deps that are also components use the cached version - unset(comp_deps) - foreach(dep ${ARGN}) - list(FIND _gr_enabled_components ${dep} dep_enb_index) - list(FIND _gr_disabled_components ${dep} dep_dis_index) - if (${dep_enb_index} EQUAL -1 AND ${dep_dis_index} EQUAL -1) - list(APPEND comp_deps ${dep}) - else() - list(APPEND comp_deps ${dep}_cached) #is a component, use cached version - endif() - endforeach(dep) - - #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 - if(NOT ${var} AND var_force) - message(FATAL_ERROR "user force-enabled ${name} but configuration checked failed") - endif() - - #append the component into one of the lists - if(${var}) - message(STATUS " Enabling ${name} support.") - list(APPEND _gr_enabled_components ${name}) - else(${var}) - message(STATUS " Disabling ${name} support.") - list(APPEND _gr_disabled_components ${name}) - endif(${var}) - message(STATUS " Override with -D${var}=ON/OFF") - - #make components lists into global variables - set(_gr_enabled_components ${_gr_enabled_components} CACHE INTERNAL "" FORCE) - set(_gr_disabled_components ${_gr_disabled_components} CACHE INTERNAL "" FORCE) -endfunction(GR_REGISTER_COMPONENT) - -######################################################################## -# Print the registered component summary -######################################################################## -function(GR_PRINT_COMPONENT_SUMMARY) - message(STATUS "") - message(STATUS "######################################################") - message(STATUS "# gr-osmosdr enabled components ") - message(STATUS "######################################################") - foreach(comp ${_gr_enabled_components}) - message(STATUS " * ${comp}") - endforeach(comp) - - message(STATUS "") - message(STATUS "######################################################") - message(STATUS "# gr-osmosdr disabled components ") - message(STATUS "######################################################") - foreach(comp ${_gr_disabled_components}) - message(STATUS " * ${comp}") - endforeach(comp) - - message(STATUS "") -endfunction(GR_PRINT_COMPONENT_SUMMARY) diff --git a/cmake/Modules/GrMiscUtils.cmake b/cmake/Modules/GrMiscUtils.cmake deleted file mode 100644 index 9331d5de..00000000 --- a/cmake/Modules/GrMiscUtils.cmake +++ /dev/null @@ -1,210 +0,0 @@ -# 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(DEFINED __INCLUDED_GR_MISC_UTILS_CMAKE) - return() -endif() -set(__INCLUDED_GR_MISC_UTILS_CMAKE TRUE) - -######################################################################## -# Set global variable macro. -# Used for subdirectories to export settings. -# Example: include and library paths. -######################################################################## -function(GR_SET_GLOBAL var) - set(${var} ${ARGN} CACHE INTERNAL "" FORCE) -endfunction(GR_SET_GLOBAL) - -######################################################################## -# Set the pre-processor definition if the condition is true. -# - def the pre-processor definition to set and condition name -######################################################################## -function(GR_ADD_COND_DEF def) - if(${def}) - add_definitions(-D${def}) - endif(${def}) -endfunction(GR_ADD_COND_DEF) - -######################################################################## -# Check for a header and conditionally set a compile define. -# - hdr the relative path to the header file -# - def the pre-processor definition to set -######################################################################## -function(GR_CHECK_HDR_N_DEF hdr def) - include(CheckIncludeFileCXX) - CHECK_INCLUDE_FILE_CXX(${hdr} ${def}) - GR_ADD_COND_DEF(${def}) -endfunction(GR_CHECK_HDR_N_DEF) - -######################################################################## -# Include subdirectory macro. -# Sets the CMake directory variables, -# includes the subdirectory CMakeLists.txt, -# resets the CMake directory variables. -# -# This macro includes subdirectories rather than adding them -# so that the subdirectory can affect variables in the level above. -# This provides a work-around for the lack of convenience libraries. -# This way a subdirectory can append to the list of library sources. -######################################################################## -macro(GR_INCLUDE_SUBDIRECTORY subdir) - #insert the current directories on the front of the list - list(INSERT _cmake_source_dirs 0 ${CMAKE_CURRENT_SOURCE_DIR}) - list(INSERT _cmake_binary_dirs 0 ${CMAKE_CURRENT_BINARY_DIR}) - - #set the current directories to the names of the subdirs - set(CMAKE_CURRENT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}) - set(CMAKE_CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/${subdir}) - - #include the subdirectory CMakeLists to run it - file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - include(${CMAKE_CURRENT_SOURCE_DIR}/CMakeLists.txt) - - #reset the value of the current directories - list(GET _cmake_source_dirs 0 CMAKE_CURRENT_SOURCE_DIR) - list(GET _cmake_binary_dirs 0 CMAKE_CURRENT_BINARY_DIR) - - #pop the subdir names of the front of the list - list(REMOVE_AT _cmake_source_dirs 0) - list(REMOVE_AT _cmake_binary_dirs 0) -endmacro(GR_INCLUDE_SUBDIRECTORY) - -######################################################################## -# Check if a compiler flag works and conditionally set a compile define. -# - flag the compiler flag to check for -# - have the variable to set with result -######################################################################## -macro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE flag have) - include(CheckCXXCompilerFlag) - CHECK_CXX_COMPILER_FLAG(${flag} ${have}) - if(${have}) - add_definitions(${flag}) - endif(${have}) -endmacro(GR_ADD_CXX_COMPILER_FLAG_IF_AVAILABLE) - -######################################################################## -# Generates the .la libtool file -# This appears to generate libtool files that cannot be used by auto*. -# Usage GR_LIBTOOL(TARGET [target] DESTINATION [dest]) -# Notice: there is not COMPONENT option, these will not get distributed. -######################################################################## -function(GR_LIBTOOL) - if(NOT DEFINED GENERATE_LIBTOOL) - set(GENERATE_LIBTOOL OFF) #disabled by default - endif() - - if(GENERATE_LIBTOOL) - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBTOOL "" "TARGET;DESTINATION" "" ${ARGN}) - - find_program(LIBTOOL libtool) - if(LIBTOOL) - include(CMakeMacroLibtoolFile) - CREATE_LIBTOOL_FILE(${GR_LIBTOOL_TARGET} /${GR_LIBTOOL_DESTINATION}) - endif(LIBTOOL) - endif(GENERATE_LIBTOOL) - -endfunction(GR_LIBTOOL) - -######################################################################## -# Do standard things to the library target -# - set target properties -# - make install rules -# Also handle gnuradio custom naming conventions w/ extras mode. -######################################################################## -function(GR_LIBRARY_FOO target) - #parse the arguments for component names - include(CMakeParseArgumentsCopy) - CMAKE_PARSE_ARGUMENTS(GR_LIBRARY "" "RUNTIME_COMPONENT;DEVEL_COMPONENT" "" ${ARGN}) - - #set additional target properties - set_target_properties(${target} PROPERTIES SOVERSION ${LIBVER}) - - #install the generated files like so... - install(TARGETS ${target} - LIBRARY DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .so/.dylib file - ARCHIVE DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_DEVEL_COMPONENT} # .lib file - RUNTIME DESTINATION ${GR_RUNTIME_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} # .dll file - ) - - #extras mode enabled automatically on linux - if(NOT DEFINED LIBRARY_EXTRAS) - set(LIBRARY_EXTRAS ${LINUX}) - endif() - - #special extras mode to enable alternative naming conventions - if(LIBRARY_EXTRAS) - - #create .la file before changing props - GR_LIBTOOL(TARGET ${target} DESTINATION ${GR_LIBRARY_DIR}) - - #give the library a special name with ultra-zero soversion - set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_NAME ${target}-${LIBVER} SOVERSION "0.0.0") - set(target_name lib${target}-${LIBVER}.so.0.0.0) - - #custom command to generate symlinks - add_custom_command( - TARGET ${target} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so - COMMAND ${CMAKE_COMMAND} -E create_symlink ${target_name} ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 - COMMAND ${CMAKE_COMMAND} -E touch ${target_name} #so the symlinks point to something valid so cmake 2.6 will install - ) - - #and install the extra symlinks - install( - FILES - ${CMAKE_CURRENT_BINARY_DIR}/lib${target}.so - ${CMAKE_CURRENT_BINARY_DIR}/lib${target}-${LIBVER}.so.0 - DESTINATION ${GR_LIBRARY_DIR} COMPONENT ${GR_LIBRARY_RUNTIME_COMPONENT} - ) - - endif(LIBRARY_EXTRAS) -endfunction(GR_LIBRARY_FOO) - -######################################################################## -# Create a dummy custom command that depends on other targets. -# Usage: -# GR_GEN_TARGET_DEPS(unique_name target_deps <target1> <target2> ...) -# ADD_CUSTOM_COMMAND(<the usual args> ${target_deps}) -# -# Custom command cant depend on targets, but can depend on executables, -# and executables can depend on targets. So this is the process: -######################################################################## -function(GR_GEN_TARGET_DEPS name var) - file( - WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in - "int main(void){return 0;}\n" - ) - execute_process( - COMMAND ${CMAKE_COMMAND} -E copy_if_different - ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp.in - ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp - ) - add_executable(${name} ${CMAKE_CURRENT_BINARY_DIR}/${name}.cpp) - if(ARGN) - add_dependencies(${name} ${ARGN}) - endif(ARGN) - - if(CMAKE_CROSSCOMPILING) - set(${var} "DEPENDS;${name}" PARENT_SCOPE) #cant call command when cross - else() - set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) - endif() -endfunction(GR_GEN_TARGET_DEPS) diff --git a/cmake/Modules/GrPlatform.cmake b/cmake/Modules/GrPlatform.cmake deleted file mode 100644 index a2e4f3b3..00000000 --- a/cmake/Modules/GrPlatform.cmake +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 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(DEFINED __INCLUDED_GR_PLATFORM_CMAKE) - return() -endif() -set(__INCLUDED_GR_PLATFORM_CMAKE TRUE) - -######################################################################## -# Setup additional defines for OS types -######################################################################## -if(CMAKE_SYSTEM_NAME STREQUAL "Linux") - set(LINUX TRUE) -endif() - -if(LINUX AND EXISTS "/etc/debian_version") - set(DEBIAN TRUE) -endif() - -if(LINUX AND EXISTS "/etc/redhat-release") - set(REDHAT TRUE) -endif() - -######################################################################## -# when the library suffix should be 64 (applies to redhat linux family) -######################################################################## -if(NOT DEFINED LIB_SUFFIX AND REDHAT AND CMAKE_SYSTEM_PROCESSOR MATCHES "64$") - set(LIB_SUFFIX 64) -endif() -set(LIB_SUFFIX ${LIB_SUFFIX} CACHE STRING "lib directory suffix") diff --git a/cmake/Modules/GrTest.cmake b/cmake/Modules/GrTest.cmake deleted file mode 100644 index 6174c034..00000000 --- a/cmake/Modules/GrTest.cmake +++ /dev/null @@ -1,133 +0,0 @@ -# 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(DEFINED __INCLUDED_GR_TEST_CMAKE) - return() -endif() -set(__INCLUDED_GR_TEST_CMAKE TRUE) - -######################################################################## -# 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: -# GR_TEST_TARGET_DEPS - built targets for the library path -# GR_TEST_LIBRARY_DIRS - directories for the library path -# GR_TEST_PYTHON_DIRS - directories for the python path -######################################################################## -function(GR_ADD_TEST test_name) - - if(WIN32) - #Ensure that the build exe also appears in the PATH. - list(APPEND GR_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 ${GR_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 GR_TEST_LIBRARY_DIRS ${path}) - endif(location) - endforeach(target) - - #SWIG generates the python library files into a subdirectory. - #Therefore, we must append this subdirectory into PYTHONPATH. - #Only do this for the python directories matching the following: - foreach(pydir ${GR_TEST_PYTHON_DIRS}) - get_filename_component(name ${pydir} NAME) - if(name MATCHES "^(swig|lib|src)$") - list(APPEND GR_TEST_PYTHON_DIRS ${pydir}/${CMAKE_BUILD_TYPE}) - endif() - endforeach(pydir) - endif(WIN32) - - file(TO_NATIVE_PATH ${CMAKE_CURRENT_SOURCE_DIR} srcdir) - file(TO_NATIVE_PATH "${GR_TEST_LIBRARY_DIRS}" libpath) #ok to use on dir list? - file(TO_NATIVE_PATH "${GR_TEST_PYTHON_DIRS}" pypath) #ok to use on dir list? - - set(environs "GR_DONT_LOAD_PREFS=1" "srcdir=${srcdir}") - - #http://www.cmake.org/pipermail/cmake/2009-May/029464.html - #Replaced this add test + set environs code with the shell script generation. - #Its nicer to be able to manually run the shell script to diagnose problems. - #ADD_TEST(${ARGV}) - #SET_TESTS_PROPERTIES(${test_name} PROPERTIES ENVIRONMENT "${environs}") - - if(UNIX) - set(binpath "${CMAKE_CURRENT_BINARY_DIR}:$PATH") - #set both LD and DYLD paths to cover multiple UNIX OS library paths - list(APPEND libpath "$LD_LIBRARY_PATH" "$DYLD_LIBRARY_PATH") - list(APPEND pypath "$PYTHONPATH") - - #replace list separator with the path separator - string(REPLACE ";" ":" libpath "${libpath}") - string(REPLACE ";" ":" pypath "${pypath}") - list(APPEND environs "PATH=${binpath}" "LD_LIBRARY_PATH=${libpath}" "DYLD_LIBRARY_PATH=${libpath}" "PYTHONPATH=${pypath}") - - #generate a bat file that sets the environment and runs the test - find_program(SHELL sh) - set(sh_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.sh) - file(WRITE ${sh_file} "#!${SHELL}\n") - #each line sets an environment variable - foreach(environ ${environs}) - file(APPEND ${sh_file} "export ${environ}\n") - endforeach(environ) - #load the command to run with its arguments - foreach(arg ${ARGN}) - file(APPEND ${sh_file} "${arg} ") - endforeach(arg) - file(APPEND ${sh_file} "\n") - - #make the shell file executable - execute_process(COMMAND chmod +x ${sh_file}) - - add_test(${test_name} ${SHELL} ${sh_file}) - - endif(UNIX) - - if(WIN32) - list(APPEND libpath ${DLL_PATHS} "%PATH%") - list(APPEND pypath "%PYTHONPATH%") - - #replace list separator with the path separator (escaped) - string(REPLACE ";" "\\;" libpath "${libpath}") - string(REPLACE ";" "\\;" pypath "${pypath}") - list(APPEND environs "PATH=${libpath}" "PYTHONPATH=${pypath}") - - #generate a bat file that sets the environment and runs the test - set(bat_file ${CMAKE_CURRENT_BINARY_DIR}/${test_name}_test.bat) - file(WRITE ${bat_file} "@echo off\n") - #each line sets an environment variable - foreach(environ ${environs}) - file(APPEND ${bat_file} "SET ${environ}\n") - endforeach(environ) - #load the command to run with its arguments - foreach(arg ${ARGN}) - file(APPEND ${bat_file} "${arg} ") - endforeach(arg) - file(APPEND ${bat_file} "\n") - - add_test(${test_name} ${bat_file}) - endif(WIN32) - -endfunction(GR_ADD_TEST) diff --git a/cmake/Modules/GrVersion.cmake b/cmake/Modules/GrVersion.cmake deleted file mode 100644 index bafd0a73..00000000 --- a/cmake/Modules/GrVersion.cmake +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright 2011,2013 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(DEFINED __INCLUDED_GR_VERSION_CMAKE) - return() -endif() -set(__INCLUDED_GR_VERSION_CMAKE TRUE) - -#eventually, replace version.sh and fill in the variables below -set(MAJOR_VERSION ${VERSION_INFO_MAJOR_VERSION}) -set(API_COMPAT ${VERSION_INFO_API_COMPAT}) -set(MINOR_VERSION ${VERSION_INFO_MINOR_VERSION}) -set(MAINT_VERSION ${VERSION_INFO_MAINT_VERSION}) - -######################################################################## -# Extract the version string from git describe. -######################################################################## -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 --long - 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 -######################################################################## -if("${MINOR_VERSION}" STREQUAL "git") - # VERSION: 3.3git-xxx-gxxxxxxxx - # DOCVER: 3.3git - # LIBVER: 3.3git - set(VERSION "${GIT_DESCRIBE}") - set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}") - set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}${MINOR_VERSION}") - set(RC_MINOR_VERSION "0") - set(RC_MAINT_VERSION "0") -elseif("${MAINT_VERSION}" STREQUAL "git") - # VERSION: 3.3.1git-xxx-gxxxxxxxx - # DOCVER: 3.3.1git - # LIBVER: 3.3.1git - set(VERSION "${GIT_DESCRIBE}") - set(DOCVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}") - set(LIBVER "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}${MAINT_VERSION}") - math(EXPR RC_MINOR_VERSION "${MINOR_VERSION} - 1") - set(RC_MAINT_VERSION "0") -else() - # This is a numbered release. - # VERSION: 3.3.1{.x} - # DOCVER: 3.3.1{.x} - # LIBVER: 3.3.1{.x} - if("${MAINT_VERSION}" STREQUAL "0") - set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}") - else() - set(VERSION "${MAJOR_VERSION}.${API_COMPAT}.${MINOR_VERSION}.${MAINT_VERSION}") - endif() - set(DOCVER "${VERSION}") - set(LIBVER "${VERSION}") - set(RC_MINOR_VERSION ${MINOR_VERSION}) - set(RC_MAINT_VERSION ${MAINT_VERSION}) -endif() |