2012-04-01 16:52:41 +02:00
|
|
|
# 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,
|
|
|
|
# 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.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with GNU Radio; see the file COPYING. If not, write to
|
|
|
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
|
|
|
# Boston, MA 02110-1301, USA.
|
|
|
|
|
2014-08-26 21:26:26 +02:00
|
|
|
MACRO(RTLSDR_APPEND_SRCS)
|
|
|
|
LIST(APPEND rtlsdr_srcs ${ARGV})
|
|
|
|
ENDMACRO(RTLSDR_APPEND_SRCS)
|
|
|
|
|
|
|
|
RTLSDR_APPEND_SRCS(
|
2012-05-17 21:33:53 +02:00
|
|
|
librtlsdr.c
|
2012-05-04 23:02:29 +02:00
|
|
|
tuner_e4k.c
|
2012-04-01 16:52:41 +02:00
|
|
|
tuner_fc0012.c
|
|
|
|
tuner_fc0013.c
|
2012-04-01 20:06:33 +02:00
|
|
|
tuner_fc2580.c
|
2013-11-04 21:50:02 +01:00
|
|
|
tuner_r82xx.c
|
2012-04-01 16:52:41 +02:00
|
|
|
)
|
|
|
|
|
2014-08-26 21:26:26 +02:00
|
|
|
########################################################################
|
|
|
|
# Set up Windows DLL resource files
|
|
|
|
########################################################################
|
|
|
|
IF(MSVC)
|
|
|
|
include(${CMAKE_SOURCE_DIR}/cmake/Modules/Version.cmake)
|
|
|
|
|
|
|
|
configure_file(
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/rtlsdr.rc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc
|
|
|
|
@ONLY)
|
2012-04-01 16:52:41 +02:00
|
|
|
|
2014-08-26 21:26:26 +02:00
|
|
|
RTLSDR_APPEND_SRCS(${CMAKE_CURRENT_BINARY_DIR}/rtlsdr.rc)
|
|
|
|
ENDIF(MSVC)
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Setup shared library variant
|
|
|
|
########################################################################
|
|
|
|
add_library(rtlsdr_shared SHARED ${rtlsdr_srcs})
|
|
|
|
target_link_libraries(rtlsdr_shared ${LIBUSB_LIBRARIES})
|
2012-04-03 00:51:15 +02:00
|
|
|
set_target_properties(rtlsdr_shared PROPERTIES DEFINE_SYMBOL "rtlsdr_EXPORTS")
|
|
|
|
set_target_properties(rtlsdr_shared PROPERTIES OUTPUT_NAME rtlsdr)
|
2013-06-02 14:32:45 +02:00
|
|
|
set_target_properties(rtlsdr_shared PROPERTIES SOVERSION ${MAJOR_VERSION})
|
|
|
|
set_target_properties(rtlsdr_shared PROPERTIES VERSION ${LIBVER})
|
2012-04-01 16:52:41 +02:00
|
|
|
|
2014-08-26 21:26:26 +02:00
|
|
|
########################################################################
|
|
|
|
# Setup static library variant
|
|
|
|
########################################################################
|
|
|
|
add_library(rtlsdr_static STATIC ${rtlsdr_srcs})
|
|
|
|
target_link_libraries(rtlsdr_static ${LIBUSB_LIBRARIES})
|
|
|
|
set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
|
|
|
if(NOT WIN32)
|
|
|
|
# Force same library filename for static and shared variants of the library
|
|
|
|
set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
|
|
|
|
endif()
|
2012-04-02 21:42:24 +02:00
|
|
|
|
2014-08-26 21:26:26 +02:00
|
|
|
########################################################################
|
|
|
|
# Setup libraries used in executables
|
|
|
|
########################################################################
|
2014-01-21 06:49:05 +01:00
|
|
|
add_library(convenience_static STATIC
|
|
|
|
convenience/convenience.c
|
|
|
|
)
|
|
|
|
|
2012-05-29 01:47:44 +02:00
|
|
|
if(WIN32)
|
|
|
|
add_library(libgetopt_static STATIC
|
|
|
|
getopt/getopt.c
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(convenience_static
|
|
|
|
rtlsdr_shared
|
|
|
|
)
|
2012-05-29 01:47:44 +02:00
|
|
|
endif()
|
|
|
|
|
2012-04-01 16:52:41 +02:00
|
|
|
########################################################################
|
|
|
|
# Build utility
|
|
|
|
########################################################################
|
2012-05-06 00:34:13 +02:00
|
|
|
add_executable(rtl_sdr rtl_sdr.c)
|
2012-04-19 17:46:52 +02:00
|
|
|
add_executable(rtl_tcp rtl_tcp.c)
|
2012-05-17 23:51:59 +02:00
|
|
|
add_executable(rtl_test rtl_test.c)
|
2012-07-17 20:41:27 +02:00
|
|
|
add_executable(rtl_fm rtl_fm.c)
|
2012-11-02 21:47:14 +01:00
|
|
|
add_executable(rtl_eeprom rtl_eeprom.c)
|
2012-12-09 23:41:20 +01:00
|
|
|
add_executable(rtl_adsb rtl_adsb.c)
|
2013-08-20 03:25:56 +02:00
|
|
|
add_executable(rtl_power rtl_power.c)
|
2019-10-17 14:18:24 +02:00
|
|
|
add_executable(rtl_biast rtl_biast.c)
|
|
|
|
|
|
|
|
set(INSTALL_TARGETS rtlsdr_shared rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power rtl_biast)
|
2012-07-17 20:41:27 +02:00
|
|
|
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_sdr rtlsdr_shared convenience_static
|
2012-04-02 21:42:24 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_tcp rtlsdr_shared convenience_static
|
2012-04-19 17:46:52 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_test rtlsdr_shared convenience_static
|
2012-05-17 23:51:59 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_fm rtlsdr_shared convenience_static
|
2012-07-17 20:41:27 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_eeprom rtlsdr_shared convenience_static
|
2012-11-02 21:47:14 +01:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_adsb rtlsdr_shared convenience_static
|
2012-12-09 23:41:20 +01:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2014-01-21 06:49:05 +01:00
|
|
|
target_link_libraries(rtl_power rtlsdr_shared convenience_static
|
2013-08-20 03:25:56 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2019-10-17 14:18:24 +02:00
|
|
|
target_link_libraries(rtl_biast rtlsdr_shared convenience_static
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2012-10-26 23:20:29 +02:00
|
|
|
if(UNIX)
|
|
|
|
target_link_libraries(rtl_fm m)
|
2012-12-27 23:14:14 +01:00
|
|
|
target_link_libraries(rtl_adsb m)
|
2013-08-20 03:25:56 +02:00
|
|
|
target_link_libraries(rtl_power m)
|
2012-10-24 17:31:22 +02:00
|
|
|
if(APPLE)
|
|
|
|
target_link_libraries(rtl_test m)
|
|
|
|
else()
|
|
|
|
target_link_libraries(rtl_test m rt)
|
|
|
|
endif()
|
2012-07-17 21:38:52 +02:00
|
|
|
endif()
|
2012-04-03 20:11:53 +02:00
|
|
|
|
2012-04-10 01:23:48 +02:00
|
|
|
if(WIN32)
|
2012-05-29 01:47:44 +02:00
|
|
|
target_link_libraries(rtl_sdr libgetopt_static)
|
2013-10-25 01:11:44 +02:00
|
|
|
target_link_libraries(rtl_tcp ws2_32 libgetopt_static)
|
2012-05-29 01:47:44 +02:00
|
|
|
target_link_libraries(rtl_test libgetopt_static)
|
2012-10-26 23:20:29 +02:00
|
|
|
target_link_libraries(rtl_fm libgetopt_static)
|
2012-11-02 21:47:14 +01:00
|
|
|
target_link_libraries(rtl_eeprom libgetopt_static)
|
2012-12-09 23:41:20 +01:00
|
|
|
target_link_libraries(rtl_adsb libgetopt_static)
|
2013-08-20 03:25:56 +02:00
|
|
|
target_link_libraries(rtl_power libgetopt_static)
|
2019-10-17 14:18:24 +02:00
|
|
|
target_link_libraries(rtl_biast libgetopt_static)
|
2012-04-10 01:23:48 +02:00
|
|
|
set_property(TARGET rtl_sdr APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-04-19 17:46:52 +02:00
|
|
|
set_property(TARGET rtl_tcp APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-05-21 22:33:35 +02:00
|
|
|
set_property(TARGET rtl_test APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-10-26 23:20:29 +02:00
|
|
|
set_property(TARGET rtl_fm APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-11-02 21:47:14 +01:00
|
|
|
set_property(TARGET rtl_eeprom APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-12-09 23:41:20 +01:00
|
|
|
set_property(TARGET rtl_adsb APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2013-08-20 03:25:56 +02:00
|
|
|
set_property(TARGET rtl_power APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2019-10-17 14:18:24 +02:00
|
|
|
set_property(TARGET rtl_biast APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-04-10 01:23:48 +02:00
|
|
|
endif()
|
2012-04-03 20:11:53 +02:00
|
|
|
########################################################################
|
|
|
|
# Install built library files & utilities
|
|
|
|
########################################################################
|
2012-07-17 22:46:43 +02:00
|
|
|
install(TARGETS ${INSTALL_TARGETS}
|
2013-04-14 17:05:08 +02:00
|
|
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR} # .so/.dylib file
|
|
|
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR} # .lib file
|
2012-04-03 20:11:53 +02:00
|
|
|
RUNTIME DESTINATION bin # .dll file
|
|
|
|
)
|