Skip to content

Commit

Permalink
Using GR_LIBRARY_FOO function for versioning
Browse files Browse the repository at this point in the history
  • Loading branch information
dl1ksv committed Mar 20, 2016
1 parent 0b2d591 commit 430dd31
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 40 deletions.
51 changes: 24 additions & 27 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

########################################################################
#
Expand Down Expand Up @@ -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
########################################################################
Expand Down Expand Up @@ -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(
Expand All @@ -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}")
Expand Down
11 changes: 11 additions & 0 deletions cmake/Modules/FindGnuradioModules.cmake
Original file line number Diff line number Diff line change
@@ -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
)
16 changes: 3 additions & 13 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
# Setup library
########################################################################
include(GrPlatform) #define LIB_SUFFIX
include(GrMiscUtils)
include(GrPython)

include_directories(${Boost_INCLUDE_DIR})
Expand Down Expand Up @@ -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)

0 comments on commit 430dd31

Please sign in to comment.