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.
|
|
|
|
|
|
|
|
########################################################################
|
|
|
|
# Setup library
|
|
|
|
########################################################################
|
2012-04-03 00:51:15 +02:00
|
|
|
add_library(rtlsdr_shared SHARED
|
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
|
2012-09-08 02:37:30 +02:00
|
|
|
tuner_r820t.c
|
2012-04-01 16:52:41 +02:00
|
|
|
)
|
|
|
|
|
2012-04-03 00:51:15 +02:00
|
|
|
target_link_libraries(rtlsdr_shared
|
2012-04-01 16:52:41 +02:00
|
|
|
${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
|
|
|
|
2012-04-02 21:42:24 +02:00
|
|
|
add_library(rtlsdr_static STATIC
|
2012-05-17 21:33:53 +02:00
|
|
|
librtlsdr.c
|
2012-05-04 23:02:29 +02:00
|
|
|
tuner_e4k.c
|
2012-04-02 20:56:24 +02:00
|
|
|
tuner_fc0012.c
|
|
|
|
tuner_fc0013.c
|
2012-04-02 21:42:24 +02:00
|
|
|
tuner_fc2580.c
|
2012-09-08 02:37:30 +02:00
|
|
|
tuner_r820t.c
|
2012-04-02 20:56:24 +02:00
|
|
|
)
|
2012-04-02 21:42:24 +02:00
|
|
|
|
2012-05-29 01:47:44 +02:00
|
|
|
if(WIN32)
|
|
|
|
add_library(libgetopt_static STATIC
|
|
|
|
getopt/getopt.c
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2012-04-02 21:42:24 +02:00
|
|
|
target_link_libraries(rtlsdr_static
|
2012-04-02 20:56:24 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
)
|
2012-04-02 21:42:24 +02:00
|
|
|
|
2012-04-10 01:23:48 +02:00
|
|
|
set_property(TARGET rtlsdr_static APPEND PROPERTY COMPILE_DEFINITIONS "rtlsdr_STATIC" )
|
2012-04-03 00:51:15 +02:00
|
|
|
|
|
|
|
if(NOT WIN32)
|
2012-04-02 23:23:51 +02:00
|
|
|
# Force same library filename for static and shared variants of the library
|
2012-04-03 00:51:15 +02:00
|
|
|
set_target_properties(rtlsdr_static PROPERTIES OUTPUT_NAME rtlsdr)
|
|
|
|
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)
|
|
|
|
set(INSTALL_TARGETS rtlsdr_shared rtlsdr_static rtl_sdr rtl_tcp rtl_test rtl_fm rtl_eeprom rtl_adsb rtl_power)
|
2012-07-17 20:41:27 +02:00
|
|
|
|
2012-05-29 22:00:54 +02:00
|
|
|
target_link_libraries(rtl_sdr rtlsdr_shared
|
2012-04-02 21:42:24 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2012-05-29 22:00:54 +02:00
|
|
|
target_link_libraries(rtl_tcp rtlsdr_shared
|
2012-04-19 17:46:52 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2012-05-29 22:00:54 +02:00
|
|
|
target_link_libraries(rtl_test rtlsdr_shared
|
2012-05-17 23:51:59 +02:00
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2012-07-17 20:41:27 +02:00
|
|
|
target_link_libraries(rtl_fm rtlsdr_shared
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2012-11-02 21:47:14 +01:00
|
|
|
target_link_libraries(rtl_eeprom rtlsdr_shared
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2012-12-09 23:41:20 +01:00
|
|
|
target_link_libraries(rtl_adsb rtlsdr_shared
|
|
|
|
${LIBUSB_LIBRARIES}
|
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
2013-08-20 03:25:56 +02:00
|
|
|
target_link_libraries(rtl_power rtlsdr_shared
|
|
|
|
${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)
|
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" )
|
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
|
|
|
|
)
|