From fc390b32247e954cedcb6ff1fac580e768016014 Mon Sep 17 00:00:00 2001 From: Steve Markgraf Date: Tue, 17 Jul 2012 20:41:27 +0200 Subject: [PATCH] build rtl_fm Signed-off-by: Steve Markgraf --- configure.ac | 3 +++ src/CMakeLists.txt | 12 ++++++++++++ src/Makefile.am | 5 ++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c879f4d..7bc8e1d 100644 --- a/configure.ac +++ b/configure.ac @@ -36,6 +36,9 @@ dnl checks for required libraries dnl pthreads AC_CHECK_LIB(pthread, pthread_create, [LIBS="$LIBS -lpthread"]) +dnl libmath (for rtl_fm) +AC_CHECK_LIB(m, atan2, [LIBS="$LIBS -lm"]) + # The following test is taken from WebKit's webkit.m4 saved_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS -fvisibility=hidden " diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de4a26f..550fa8e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -36,6 +36,10 @@ set_target_properties(rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS") set_target_properties(rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr) set_target_properties(rtlsdr_shared PROPERTIES SOVERSION 0 VERSION 0.0.0) +if(UNIX) + link_libraries(m) +endif(UNIX) + add_library(rtlsdr_static STATIC librtlsdr.c tuner_e4k.c @@ -67,6 +71,8 @@ endif() add_executable(rtl_sdr rtl_sdr.c) add_executable(rtl_tcp rtl_tcp.c) add_executable(rtl_test rtl_test.c) +add_executable(rtl_fm rtl_fm.c) + target_link_libraries(rtl_sdr rtlsdr_shared ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} @@ -79,14 +85,20 @@ target_link_libraries(rtl_test rtlsdr_shared ${LIBUSB_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ) +target_link_libraries(rtl_fm rtlsdr_shared + ${LIBUSB_LIBRARIES} + ${CMAKE_THREAD_LIBS_INIT} +) if(WIN32) target_link_libraries(rtl_sdr libgetopt_static) target_link_libraries(rtl_tcp libgetopt_static) target_link_libraries(rtl_test libgetopt_static) +target_link_libraries(rtl_fm libgetopt_static) set_property(TARGET rtl_sdr APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) set_property(TARGET rtl_tcp APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) set_property(TARGET rtl_test APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) +set_property(TARGET rtl_fm APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" ) endif() ######################################################################## # Install built library files & utilities diff --git a/src/Makefile.am b/src/Makefile.am index c1c4fe8..6693e9c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -10,7 +10,7 @@ lib_LTLIBRARIES = librtlsdr.la librtlsdr_la_SOURCES = librtlsdr.c tuner_e4k.c tuner_fc0012.c tuner_fc0013.c tuner_fc2580.c librtlsdr_la_LDFLAGS = -version-info $(LIBVERSION) -bin_PROGRAMS = rtl_sdr rtl_tcp rtl_test +bin_PROGRAMS = rtl_sdr rtl_tcp rtl_test rtl_fm rtl_sdr_SOURCES = rtl_sdr.c rtl_sdr_LDADD = librtlsdr.la @@ -20,3 +20,6 @@ rtl_tcp_LDADD = librtlsdr.la rtl_test_SOURCES = rtl_test.c rtl_test_LDADD = librtlsdr.la + +rtl_fm_SOURCES = rtl_fm.c +rtl_fm_LDADD = librtlsdr.la $(LIBM)