diff options
author | Tom Rondeau <trondeau@vt.edu> | 2013-03-03 17:39:55 -0500 |
---|---|---|
committer | Tom Rondeau <trondeau@vt.edu> | 2013-03-03 17:39:55 -0500 |
commit | dea9e149718cf900f509f79abbb4ace2c40d6ce5 (patch) | |
tree | fab791d34bfe3117d1109a8e1dacf9b624f36c85 /gr-howto-write-a-block | |
parent | 47e6a7a0cdd65136735b2ae89fe86990431d230f (diff) | |
parent | 5fe234f18360b4680a7b9fef1eb710cb7fe37a07 (diff) |
Merge branch 'master' into next
Conflicts:
gnuradio-core/CMakeLists.txt
gnuradio-core/gnuradio-core.conf
gnuradio-core/src/lib/filter/gr_fir_sysconfig_x86.cc
gnuradio-core/src/lib/runtime/runtime.i
gr-atsc/src/lib/CMakeLists.txt
gr-audio/lib/CMakeLists.txt
gr-comedi/src/CMakeLists.txt
gr-digital/lib/CMakeLists.txt
gr-howto-write-a-block/CMakeLists.txt
gr-howto-write-a-block/lib/CMakeLists.txt
gr-noaa/lib/CMakeLists.txt
gr-qtgui/lib/CMakeLists.txt
gr-trellis/src/lib/CMakeLists.txt
gr-uhd/lib/CMakeLists.txt
gr-video-sdl/src/CMakeLists.txt
gr-vocoder/lib/CMakeLists.txt
gr-wavelet/lib/CMakeLists.txt
Diffstat (limited to 'gr-howto-write-a-block')
-rw-r--r-- | gr-howto-write-a-block/CMakeLists.txt | 6 | ||||
-rw-r--r-- | gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake | 28 | ||||
-rw-r--r-- | gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake | 32 | ||||
-rw-r--r-- | gr-howto-write-a-block/lib/CMakeLists.txt | 8 |
4 files changed, 73 insertions, 1 deletions
diff --git a/gr-howto-write-a-block/CMakeLists.txt b/gr-howto-write-a-block/CMakeLists.txt index f86fd91488..cd7e447f6f 100644 --- a/gr-howto-write-a-block/CMakeLists.txt +++ b/gr-howto-write-a-block/CMakeLists.txt @@ -99,6 +99,10 @@ if(NOT CPPUNIT_FOUND) message(FATAL_ERROR "CppUnit required to compile howto") endif() +# Handle gr_log enable/disable +include(GrMiscUtils) #define LIB_SUFFIX +GR_LOGGING() + ######################################################################## # Setup the include and linker paths ######################################################################## @@ -106,6 +110,7 @@ include_directories( ${CMAKE_SOURCE_DIR}/include ${GNURADIO_CORE_INCLUDE_DIRS} ${GRUEL_INCLUDE_DIRS} + ${LOG4CXX_INCLUDE_DIRS} ${Boost_INCLUDE_DIRS} ${CPPUNIT_INCLUDE_DIRS} ) @@ -113,6 +118,7 @@ include_directories( link_directories( ${GNURADIO_CORE_LIBRARY_DIRS} ${GRUEL_LIBRARY_DIRS} + ${LOG4CXX_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${CPPUNIT_LIBRARY_DIRS} ) diff --git a/gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake b/gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake new file mode 100644 index 0000000000..b1e4f6f1f7 --- /dev/null +++ b/gr-howto-write-a-block/cmake/Modules/FindLog4cxx.cmake @@ -0,0 +1,28 @@ +# CMake module to find LOG4CXX library + +INCLUDE(FindPkgConfig) +PKG_CHECK_MODULES(PC_LOG4CXX liblog4cxx) + +FIND_PATH( + LOG4CXX_INCLUDE_DIRS + NAMES log4cxx/log4cxx.h + HINTS $ENV{LOG4CXX_DIR}/include + ${PC_LOG4CXX_INCLUDE_DIRS} + PATHS /usr/local/include + /usr/include +) + +FIND_LIBRARY( + LOG4CXX_LIBRARIES + NAMES log4cxx + HINTS $ENV{LOG4CXX_DIR}/lib + ${PC_LOG4CXX_LIBRARIES} + PATHS /usr/local/lib + /usr/local/lib64 + /usr/lib + /usr/lib64 +) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(LOG4CXX DEFAULT_MSG LOG4CXX_LIBRARIES LOG4CXX_INCLUDE_DIRS) +MARK_AS_ADVANCED(LOG4CXX_LIBRARIES LOG4CXX_INCLUDE_DIRS) diff --git a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake index 9331d5debc..cffe2f6540 100644 --- a/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake +++ b/gr-howto-write-a-block/cmake/Modules/GrMiscUtils.cmake @@ -208,3 +208,35 @@ function(GR_GEN_TARGET_DEPS name var) set(${var} "DEPENDS;${name};COMMAND;${name}" PARENT_SCOPE) endif() endfunction(GR_GEN_TARGET_DEPS) + + +######################################################################## +# Control use of gr_log +# Usage: +# GR_LOGGING() +# +# Will set ENABLE_GR_LOG to 1 by default. +# Can manually set with -DENABLE_GR_LOG=0|1 +######################################################################## +function(GR_LOGGING) + find_package(Log4cxx) + + OPTION(ENABLE_GR_LOG "Use gr_log" ON) + + if(NOT LOG4CXX_FOUND) + SET(ENABLE_GR_LOG OFF) + endif(NOT LOG4CXX_FOUND) + + message(STATUS "ENABLE_GR_LOG set to ${ENABLE_GR_LOG}.") + + if(ENABLE_GR_LOG) + add_definitions( -DENABLE_GR_LOG ) + else(ENABLE_GR_LOG) + # If not enabled or available, set these variable to + # blank so we can use them later without having to + # check ENABLE_GR_LOG each time. + SET(LOG4CXX_INCLUDE_DIRS "" CACHE INTERNAL "" FORCE) + SET(LOG4CXX_LIBRARY_DIRS "" CACHE INTERNAL "" FORCE) + SET(LOG4CXX_LIBRARIES "" CACHE INTERNAL "" FORCE) + endif(ENABLE_GR_LOG) +endfunction(GR_LOGGING) diff --git a/gr-howto-write-a-block/lib/CMakeLists.txt b/gr-howto-write-a-block/lib/CMakeLists.txt index f847d757f6..2c995b868b 100644 --- a/gr-howto-write-a-block/lib/CMakeLists.txt +++ b/gr-howto-write-a-block/lib/CMakeLists.txt @@ -26,7 +26,13 @@ include_directories(${Boost_INCLUDE_DIR}) link_directories(${Boost_LIBRARY_DIRS}) add_library(gnuradio-howto SHARED square_ff_impl.cc square2_ff_impl.cc) -target_link_libraries(gnuradio-howto ${Boost_LIBRARIES} ${GRUEL_LIBRARIES} ${GNURADIO_CORE_LIBRARIES}) +target_link_libraries(gnuradio-howto + ${Boost_LIBRARIES} + ${GRUEL_LIBRARIES} + ${GNURADIO_CORE_LIBRARIES} + ${LOG4CXX_LIBRARIES} +) + set_target_properties(gnuradio-howto PROPERTIES DEFINE_SYMBOL "gnuradio_howto_EXPORTS") if(ENABLE_GR_CTRLPORT) |