X-Git-Url: https://git.rvb.name/rtl-433.git/blobdiff_plain/d608f7f08edef0577b9613f4ea36ffb7753287c3..refs/heads/master:/CMakeLists.txt?ds=sidebyside diff --git a/CMakeLists.txt b/CMakeLists.txt index 61ceb08..6376b88 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,4 @@ -# Copyright 2012 OSMOCOM Project -# -# This file is part of rtl-sdr -# -# GNU Radio is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# GNU Radio is distributed in the hope that it will be useful, +# rtl_433 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. @@ -22,7 +13,9 @@ # Project setup ######################################################################## cmake_minimum_required(VERSION 2.6) -project(rtlsdr C) +project(rtl433 C) +set (rtl433_VERSION_MAJOR 1) +set (rtl433_VERSION_MINOR 0) #select the release build type by default to get optimization flags if(NOT CMAKE_BUILD_TYPE) @@ -42,6 +35,7 @@ if(CMAKE_COMPILER_IS_GNUCC AND NOT WIN32) ADD_DEFINITIONS(-Wno-unused) ADD_DEFINITIONS(-Wsign-compare) ADD_DEFINITIONS(-g3 -O0) + ADD_DEFINITIONS(-std=gnu99) #http://gcc.gnu.org/wiki/Visibility add_definitions(-fvisibility=hidden) endif() @@ -50,32 +44,16 @@ endif() # Find build dependencies ######################################################################## find_package(PkgConfig) -find_package(LibUSB) -set(THREADS_USE_PTHREADS_WIN32 true) -find_package(Threads) +find_package(LibRTLSDR) -if(NOT LIBUSB_FOUND) - message(FATAL_ERROR "LibUSB 1.0 required to compile rtl-sdr") -endif() -if(NOT THREADS_FOUND) - message(FATAL_ERROR "pthreads(-win32) required to compile rtl-sdr") -endif() ######################################################################## # Setup the include and linker paths ######################################################################## include_directories( ${CMAKE_SOURCE_DIR}/include - ${LIBUSB_INCLUDE_DIR} - ${THREADS_PTHREADS_INCLUDE_DIR} + ${LIBRTLSDR_INCLUDE_DIRS} ) -#link_directories( -# ... -#) - -# Set component parameters -#set(INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include CACHE INTERNAL "" FORCE) - ######################################################################## # Create uninstall target ######################################################################## @@ -88,45 +66,21 @@ add_custom_target(uninstall ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake ) -######################################################################## -# Install udev rules -######################################################################## -option(INSTALL_UDEV_RULES "Install udev rules for RTL-SDR" OFF) -if (INSTALL_UDEV_RULES) - install ( - FILES rtl-sdr.rules - DESTINATION "/etc/udev/rules.d" - COMPONENT "udev" - ) -else (INSTALL_UDEV_RULES) - message (STATUS "Udev rules not being installed, install them with -DINSTALL_UDEV_RULES=ON") -endif (INSTALL_UDEV_RULES) - ######################################################################## # Add subdirectories ######################################################################## add_subdirectory(include) add_subdirectory(src) - -######################################################################## -# Create Pkg Config File -######################################################################## -FOREACH(inc ${LIBUSB_INCLUDE_DIR}) - LIST(APPEND RTLSDR_PC_CFLAGS "-I${inc}") -ENDFOREACH(inc) - -FOREACH(lib ${LIBUSB_LIBRARY_DIRS}) - LIST(APPEND RTLSDR_PC_LIBS "-L${lib}") -ENDFOREACH(lib) +add_subdirectory(tests) # use space-separation format for the pc file -STRING(REPLACE ";" " " RTLSDR_PC_CFLAGS "${RTLSDR_PC_CFLAGS}") -STRING(REPLACE ";" " " RTLSDR_PC_LIBS "${RTLSDR_PC_LIBS}") +STRING(REPLACE ";" " " RTL433_PC_CFLAGS "${RTL433_PC_CFLAGS}") +STRING(REPLACE ";" " " RTL433_PC_LIBS "${RTL433_PC_LIBS}") # unset these vars to avoid hard-coded paths to cross environment IF(CMAKE_CROSSCOMPILING) - UNSET(RTLSDR_PC_CFLAGS) - UNSET(RTLSDR_PC_LIBS) + UNSET(RTL433_PC_CFLAGS) + UNSET(RTL433_PC_LIBS) ENDIF(CMAKE_CROSSCOMPILING) set(prefix ${CMAKE_INSTALL_PREFIX}) @@ -134,12 +88,7 @@ set(exec_prefix \${prefix}) set(libdir \${exec_prefix}/lib) set(includedir \${prefix}/include) -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/librtlsdr.pc.in - ${CMAKE_CURRENT_BINARY_DIR}/librtlsdr.pc -@ONLY) - INSTALL( - FILES ${CMAKE_CURRENT_BINARY_DIR}/librtlsdr.pc + FILES DESTINATION lib/pkgconfig )