diff --git a/CMakeLists.txt b/CMakeLists.txt index e101b35..571a26f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,13 @@ project(libsdr) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) include(InstallHeadersWithDirectory) +OPTION(BUILD_EXAMPLES "Build examples" OFF) +OPTION(BUILD_UNIT_TESTS "Build unit tests" OFF) + +SET(libsdr_VERSION_MAJOR "0") +SET(libsdr_VERSION_MINOR "1") +SET(libsdr_VERSION_PATCH "0") + find_package(Qt5Core) find_package(Qt5Widgets) @@ -64,15 +71,38 @@ ENDIF(CMAKE_BUILD_TYPE MATCHES DEBUG) CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/src/config.hh.in ${CMAKE_CURRENT_BINARY_DIR}/src/config.hh) + +# +# Get default install directories under Linux +# +IF(UNIX AND NOT APPLE) + INCLUDE(GNUInstallDirs) +ELSE(UNIX AND NOT APPLE) + SET(CMAKE_INSTALL_LIBDIR "lib") + SET(CMAKE_INSTALL_FULL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + SET(CMAKE_INSTALL_INCLUDEDIR "include") + SET(CMAKE_INSTALL_FULL_INCLUDEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}") + # Set RPATH under MacOS + SET(CMAKE_SKIP_BUILD_RPATH FALSE) + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + #SET(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} "--std=c++98 --stdlib=libc++") + #SET(LIBS ${LIBS} "c++") +ENDIF(UNIX AND NOT APPLE) + # Add core library, and unit tests add_subdirectory(src) +IF(BUILD_UNIT_TESTS) add_subdirectory(test) -add_subdirectory(examples) +ENDIF(BUILD_UNIT_TESTS) +IF(BUILD_EXAMPLES) + add_subdirectory(examples) +ENDIF(BUILD_EXAMPLES) # Source distribution packages: -set(CPACK_PACKAGE_VERSION_MAJOR "0") -set(CPACK_PACKAGE_VERSION_MINOR "1") -set(CPACK_PACKAGE_VERSION_PATCH "0") +set(CPACK_PACKAGE_VERSION_MAJOR ${libsdr_VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${libsdr_VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${libsdr_VERSION_PATCH}) set(CPACK_SOURCE_GENERATOR "TGZ") set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CMAKE_PROJECT_NAME}-${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}") diff --git a/dist/linux/debian.changelog b/dist/linux/debian.changelog new file mode 100644 index 0000000..dd88ce2 --- /dev/null +++ b/dist/linux/debian.changelog @@ -0,0 +1,5 @@ +libsdr (0.1.0-1) unstable; urgency=low + + * Initial official release. + + -- Hannes Matuschek Sun, 07 December 2014 00:00:00 +0000 diff --git a/dist/linux/debian.control b/dist/linux/debian.control new file mode 100644 index 0000000..0d5f3c3 --- /dev/null +++ b/dist/linux/debian.control @@ -0,0 +1,14 @@ +Source: libsdr +Priority: extra +Maintainer: Hannes Matuschek +Build-Depends: cdbs (>= 0.4.51), dh-exec, debhelper (>= 8.0.0), cmake, qtbase5-dev (>= 5.0), portaudio19-dev, librtlsdr-dev, fftw3-dev +Standards-Version: 3.9.2 +Section: hamradio +Homepage: http://github.com/hmatuschek/libsdr + +Package: libsdr +Section: hamradio +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: libsdr + A C++ library for software defined radio. diff --git a/dist/linux/debian.rules b/dist/linux/debian.rules new file mode 100644 index 0000000..a7a1287 --- /dev/null +++ b/dist/linux/debian.rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +include /usr/share/cdbs/1/rules/debhelper.mk +include /usr/share/cdbs/1/class/cmake.mk diff --git a/dist/linux/libsdr.dsc b/dist/linux/libsdr.dsc new file mode 100644 index 0000000..7ebbc59 --- /dev/null +++ b/dist/linux/libsdr.dsc @@ -0,0 +1,10 @@ +Format: 1.0 +Source: libsdr +Binary: libsdr +Version: 3.1.0 +Maintainer: Hannes Matuschek +Architecture: any +Build-Depends: cdbs (>= 0.4.51), dh-exec, debhelper (>= 8.0.0), cmake, qtbase5-dev (>= 5.0), portaudio19-dev, librtlsdr-dev, fftw3-dev +Files: + d57283ebb8157ae919762c58419353c8 133282 libsdr-0.1.0.tar.gz + d57283ebb8157ae919762c58419353c8 133282 libsdr-0.1.0.diff.tar.gz diff --git a/dist/linux/libsdr.spec b/dist/linux/libsdr.spec new file mode 100644 index 0000000..80a07e8 --- /dev/null +++ b/dist/linux/libsdr.spec @@ -0,0 +1,77 @@ +Summary: A C++ library for software defined radios + +%define version 0.1.0 + +License: GPL-2.0+ +Name: libsdr +Group: Development/Libraries/C and C++ +Prefix: /usr +Release: 1 +Source: libsdr-%{version}.tar.gz +URL: https://github.com/hmatuschek/libsdr +Version: %{version} +Buildroot: /tmp/libsdrrpm +BuildRequires: gcc-c++, cmake, portaudio-devel, fftw3-devel, librtlsdr-devel +Requires: portaudio, fftw3, librtlsdr-devel +%if 0%{?suse_version} +BuildRequires: libqt5-qtbase-devel +Requires: libqt5-qtbase +%endif +%if 0%{?fedora} +BuildRequires: qt5-qtbase-devel +Requires: qt5-qtbase +%endif + +%description +A simple C++ library for software defined radios. + + +%package -n libsdr-devel +Summary: A C++ library for software defined radios +Group: Development/Libraries/C and C++ +BuildRequires: gcc-c++, cmake, portaudio-devel, fftw3-devel, librtlsdr-devel +Requires: portaudio, fftw3, librtlsdr +%if 0%{?suse_version} +BuildRequires: libqt5-qtbase-devel +Requires: libqt5-qtbase +%endif +%if 0%{?fedora} +BuildRequires: qt5-qtbase-devel +Requires: qt5-qtbase +%endif + +%description -n libsdr-devel +Provides the runtime library header files for libsdr. + +%prep +%setup -q + + +%build +cmake -DCMAKE_BUILD_TYPE=RELEASE \ + -DCMAKE_INSTALL_PREFIX=$RPM_BUILD_ROOT/usr +make + + +%install +make install + +%clean +rm -rf $RPM_BUILD_ROOT + +%post +/sbin/ldconfig + +%postun +/sbin/ldconfig + + +%files +%{_libdir}/libsdr.so.* +%{_libdir}/libsdr-gui.so.* + +%files -n libsdr-devel +%defattr(-, root, root, -) +%{_libdir}/libsdr.so +%{_libdir}/libsdr-gui.so +%{_includedir}/libsdr/ diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3fb9eae..bb81d90 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -13,10 +13,12 @@ if(SDR_WITH_PORTAUDIO) set(LIBSDR_SOURCES ${LIBSDR_SOURCES} portaudio.cc) set(LIBSDR_HEADERS ${LIBSDR_HEADERS} portaudio.hh) endif(SDR_WITH_PORTAUDIO) + if(SDR_WITH_FFTW) set(LIBSDR_SOURCES ${LIBSDR_SOURCES}) set(LIBSDR_HEADERS ${LIBSDR_HEADERS} fftplan_fftw3.hh) endif(SDR_WITH_FFTW) + if(SDR_WITH_RTLSDR) set(LIBSDR_SOURCES ${LIBSDR_SOURCES} rtlsource.cc) set(LIBSDR_HEADERS ${LIBSDR_HEADERS} rtlsource.hh) @@ -27,8 +29,16 @@ add_custom_target(libsdr_hdrs SOURCES ${LIBSDR_HEADERS}) add_library(libsdr SHARED ${LIBSDR_SOURCES}) set_target_properties(libsdr PROPERTIES OUTPUT_NAME sdr) set_target_properties(libsdr PROPERTIES DEPENDS libsdr_hdrs) +set_target_properties(libsdr PROPERTIES VERSION + "${libsdr_VERSION_MAJOR}.${libsdr_VERSION_MINOR}.${libsdr_VERSION_PATCH}") +set_target_properties(libsdr PROPERTIES SOVERION "${libsdr_VERSION_MAJOR}") target_link_libraries(libsdr ${LIBS}) +install(TARGETS libsdr DESTINATION ${CMAKE_INSTALL_LIBDIR}) +INSTALL_HEADERS_WITH_DIRECTORY("${LIBSDR_HEADERS}" "${CMAKE_INSTALL_INCLUDEDIR}/libsdr") +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/config.hh" + DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/libsdr") + if(SDR_WITH_FFTW AND SDR_WITH_QT5) set(libsdr_gui_SOURCES gui/spectrum.cc gui/spectrumview.cc gui/waterfallview.cc) set(libsdr_gui_MOC_HEADERS gui/spectrum.hh gui/spectrumview.hh gui/waterfallview.hh) @@ -37,6 +47,12 @@ if(SDR_WITH_FFTW AND SDR_WITH_QT5) add_library(libsdr-gui SHARED ${libsdr_gui_SOURCES} ${libsdr_gui_MOC_SOURCES}) set_target_properties(libsdr-gui PROPERTIES OUTPUT_NAME sdr-gui) + set_target_properties(libsdr-gui PROPERTIES VERSION + "${libsdr_VERSION_MAJOR}.${libsdr_VERSION_MINOR}.${libsdr_VERSION_PATCH}") + set_target_properties(libsdr-gui PROPERTIES SOVERION "${libsdr_VERSION_MAJOR}") target_link_libraries(libsdr-gui libsdr ${Qt5Core_LIBRARIES} ${Qt5Widgets_LIBRARIES}) + + install(TARGETS libsdr-gui DESTINATION ${CMAKE_INSTALL_LIBDIR}) + INSTALL_HEADERS_WITH_DIRECTORY("${libsdr_gui_HEADERS}" "${CMAKE_INSTALL_INCLUDEDIR}/libsdr") endif(SDR_WITH_FFTW AND SDR_WITH_QT5)