From 430dd31a240e091d134b6af2b93beaf98c658cfc Mon Sep 17 00:00:00 2001 From: dl1ksv Date: Sun, 20 Mar 2016 17:50:06 +0100 Subject: [PATCH] Using GR_LIBRARY_FOO function for versioning --- CMakeLists.txt | 51 ++++++++++++------------- cmake/Modules/FindGnuradioModules.cmake | 11 ++++++ lib/CMakeLists.txt | 16 ++------ 3 files changed, 38 insertions(+), 40 deletions(-) create mode 100644 cmake/Modules/FindGnuradioModules.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 81086e0..b8d87aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -85,17 +85,36 @@ set(GR_REQUIRED_COMPONENTS RUNTIME) ######################################################################## find_package(Gnuradio "3.7" REQUIRED PATHS ${CMAKE_INSTALL_PREFIX} NO_DEFAULT_PATH) - if(NOT GNURADIO_RUNTIME_FOUND) message(FATAL_ERROR "GnuRadio Runtime required to compile display") endif() +find_package(Qt4 REQUIRED ) +include(${QT_USE_FILE}) +find_package(PythonLibs) +find_package(SWIG) + +if(NOT SWIG_FOUND) + message(FATAL_ERROR "Swig required to build gr-display") +endif() + +find_package(Doxygen) + ######################################################################## # # set search path for cmake modules to OOT, Gnuradio # ######################################################################## set( CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules") -list(APPEND CMAKE_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/lib/cmake/gnuradio") +include(FindGnuradioModules) + +if(${GNURADIO_MODULE_DIRECTORY} STREQUAL "GNURADIO_MODULE_DIRECTORY-NOTFOUND") + message(FATAL_ERROR "Cannot find gnuradio cmake Modules directory") +else() + message(STATUS "Modules found in ${GNURADIO_MODULE_DIRECTORY}") +endif() +list(APPEND CMAKE_MODULE_PATH "${GNURADIO_MODULE_DIRECTORY}" ) +include(GrPython) +GR_PYTHON_CHECK_MODULE("PyQt4" PyQt4 True PYQT4_FOUND) ######################################################################## # @@ -145,28 +164,6 @@ if(APPLE) BOOL "Do Build Using Library Install RPath" FORCE) endif(NOT CMAKE_BUILD_WITH_INSTALL_RPATH) endif(APPLE) - -######################################################################## -# Find gnuradio build dependencies -######################################################################## -set(GR_REQUIRED_COMPONENTS RUNTIME) -find_package(Gnuradio "3.7") - - -if(NOT GNURADIO_RUNTIME_FOUND) - message(FATAL_ERROR "GnuRadio Runtime required to compile display") -endif() - -find_package(Qt4 REQUIRED ) -include(${QT_USE_FILE}) -find_package(PythonLibs) -find_package(SWIG) - -include(GrPython) -GR_PYTHON_CHECK_MODULE("PyQt4" PyQt4 True PYQT4_FOUND) - -find_package(Doxygen) - ######################################################################## # Setup the include and linker paths ######################################################################## @@ -215,8 +212,7 @@ add_subdirectory(docs) ######################################################################## # fake gnuradio cpack behavior as long as we don't use it directly set(CPACK_PACKAGE_NAME "gnuradio-display") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio block to display text and png -images") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "GNU Radio block to display text and png images") set(CPACK_PACKAGE_VERSION ${VERSION}) configure_file( @@ -233,7 +229,8 @@ install( # Print Summary ######################################################################## MESSAGE(STATUS "================ Build Summary =========================") -MESSAGE(STATUS "Building gr-display :${VERSION} / ${LIBVER} for ${CMAKE_SYSTEM_NAME} ") +MESSAGE(STATUS "Building gr-display : ${LIBVER} for ${CMAKE_SYSTEM_NAME} ") +MESSAGE(STATUS "Building for gnuradio : ${Gnuradio_VERSION}") MESSAGE(STATUS "Using CMAKE Module path: ${CMAKE_MODULE_PATH}" ) MESSAGE(STATUS "GNURADIO INCLUDES IN : ${GNURADIO_RUNTIME_INCLUDE_DIRS}") MESSAGE(STATUS "Using install prefix : ${CMAKE_INSTALL_PREFIX}") diff --git a/cmake/Modules/FindGnuradioModules.cmake b/cmake/Modules/FindGnuradioModules.cmake new file mode 100644 index 0000000..acd855b --- /dev/null +++ b/cmake/Modules/FindGnuradioModules.cmake @@ -0,0 +1,11 @@ +# - Try to find the cmake/Modules directory of an installed gnuradio +# - This might be not the standard location +# - Look for GrVersion.cmake + +find_path(GNURADIO_MODULE_DIRECTORY + NAMES GrVersion.cmake + HINTS ${CMAKE_INSTALL_PREFIX}/lib/cmake/gnuradio + PATHS + /usr/lib64/cmake/gnuradio + /usr/lib/cmake/gnuradio +) diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 5a405a7..d869822 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -21,6 +21,7 @@ # Setup library ######################################################################## include(GrPlatform) #define LIB_SUFFIX +include(GrMiscUtils) include(GrPython) include_directories(${Boost_INCLUDE_DIR}) @@ -55,23 +56,12 @@ endif(NOT display_sources) add_library(gnuradio-display SHARED ${display_sources}) target_link_libraries(gnuradio-display ${Boost_LIBRARIES} ${GNURADIO_RUNTIME_LIBRARIES} ${QT_LIBRARIES} ${PYTHON_LIBRARIES}) -set_target_properties(gnuradio-display PROPERTIES DEFINE_SYMBOL "gnuradio_display_EXPORTS") -set_target_properties(gnuradio-display PROPERTIES VERSION 0.0.0) if(APPLE) set_target_properties(gnuradio-display PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" ) - set_target_properties(gnuradio-display PROPERTIES SOVERSION 0) -else(APPLE) - set_target_properties(gnuradio-display PROPERTIES SOVERSION ${LIBVER}) endif(APPLE) -######################################################################## -# Install built library files -######################################################################## -install(TARGETS gnuradio-display - LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file - ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file - RUNTIME DESTINATION bin # .dll file -) +set_target_properties(gnuradio-display PROPERTIES DEFINE_SYMBOL "gnuradio_display_EXPORTS") +GR_LIBRARY_FOO(gnuradio-display)