1
0
Fork 0

Switch to cmake for building.

This commit is contained in:
Joris van Rantwijk 2013-12-31 20:07:11 +01:00
parent 47525ef796
commit 0091737339
3 changed files with 67 additions and 41 deletions

57
CMakeLists.txt Normal file
View File

@ -0,0 +1,57 @@
# CMake definitions for SoftFM
cmake_minimum_required(VERSION 2.4)
project(SoftFM)
find_package(PkgConfig)
find_package(ALSA REQUIRED)
# Find RTL-SDR library (for linking).
pkg_check_modules(PKG_RTLSDR librtlsdr)
find_path(RTLSDR_INCLUDE_DIR rtl-sdr.h
HINT ${PKG_RTLSDR_INCLUDE_DIRS})
find_library(RTLSDR_LIBRARY librtlsdr.a
HINT ${PKG_RTLSDR_LIBRARY_DIRS})
# Find libusb
pkg_check_modules(PKG_LIBUSB libusb-1.0)
find_path(LIBUSB_INCLUDE_DIR libusb.h
HINT ${PKG_LIBUSB_INCLUDE_DIRS}
PATH_SUFFIXES libusb-1.0)
find_library(LIBUSB_LIBRARY usb-1.0
HINT ${PKG_LIBUSB_LIBRARY_DIRS})
if(RTLSDR_INCLUDE_DIR AND RTLSDR_LIBRARY)
message(STATUS "Found librtlsdr: ${RTLSDR_INCLUDE_DIR}, ${RTLSDR_LIBRARY}")
else()
message(WARNING "Can not find Osmocom RTL-SDR library")
message("Try again with environment variable PKG_CONFIG_PATH")
message("or with -DRTLSDR_INCLUDE_DIR=/path/rtlsdr/include")
message(" -DRTLSDR_LIBRARY=/path/rtlsdr/lib/librtlsdr.a")
endif()
set(RTLSDR_INCLUDE_DIRS ${RTLSDR_INCLUDE_DIR} ${LIBUSB_INCLUDE_DIR})
set(RTLSDR_LIBRARIES ${RTLSDR_LIBRARY} ${LIBUSB_LIBRARY})
# Compiler flags.
set(CMAKE_CXX_FLAGS "-Wall -std=c++11 -O2 -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
add_executable(softfm
main.cc
RtlSdrSource.cc
Filter.cc
FmDecode.cc
AudioOutput.cc )
include_directories(
${RTLSDR_INCLUDE_DIRS}
${ALSA_INCLUDE_DIRS}
${EXTRA_INCLUDES} )
target_link_libraries(softfm
${RTLSDR_LIBRARIES}
${ALSA_LIBRARIES}
${EXTRA_LIBS} )
install(TARGETS softfm DESTINATION bin)

View File

@ -1,41 +0,0 @@
# Makefile for SoftFM
# ----- Tweak these settings to configure for your system
CROSS =
CFLAGS_OPT = -O2 -ffast-math -ftree-vectorize
CFLAGS_DEBUG = -g
CFLAGS_ARCH =
CFLAGS_PATH = -I/home/joris/test/rtl-sdr/inst/include
CFLAGS_EXTRA =
LDFLAGS_PATH = -L/home/joris/test/rtl-sdr/inst/lib
LDFLAGS_EXTRA =
LIBS_ALSA = -lasound
LIBS_RTLSDR = /home/joris/test/rtl-sdr/inst/lib/librtlsdr.a -lusb-1.0
LIBS_EXTRA =
# ----- end tweakable settings
CXX = $(CROSS)g++
CXXFLAGS = -std=c++11 -Wall -D_FILE_OFFSET_BITS=64 \
$(CFLAGS_OPT) $(CFLAGS_DEBUG) \
$(CFLAGS_ARCH) $(CFLAGS_PATH) $(CFLAGS_EXTRA)
LDFLAGS = $(LDFLAGS_PATH) $(LDFLAGS_EXTRA)
LDLIBS = $(LIBS_ALSA) $(LIBS_RTLSDR) $(LIBS_EXTRA)
OBJS = RtlSdrSource.o Filter.o FmDecode.o AudioOutput.o main.o
softfm : $(OBJS)
$(CXX) $(LDFLAGS) -o $@ $(OBJS) $(LDLIBS)
RtlSdrSource.o : RtlSdrSource.cc RtlSdrSource.h SoftFM.h
Filter.o : Filter.cc Filter.h SoftFM.h
FmDecode.o : FmDecode.cc FmDecode.h SoftFM.h Filter.h
AudioOutput.o : AudioOutput.cc AudioOutput.h SoftFM.h
main.o : main.cc SoftFM.h RtlSdrSource.h Filter.h FmDecode.h AudioOutput.h
.PHONY: clean
clean:
$(RM) softfm *.o

10
TODO.txt Normal file
View File

@ -0,0 +1,10 @@
* write README.txt
* push to github
* implement WAV file writing
* implement stereo pilot PPS
* implement RDS decoding
* figure out why we sometimes lose stereo lock
* investigate problem at low IF sample rates; apparently librtlsdr is not telling the truth about the actual sample rate.
* look at I/Q balance to improve weak stations
* look at hardware gain settings to improve weak stations
* consider FM demodulation with PLL instead of phase discriminator