1
|
# Copyright 2012 OSMOCOM Project
|
2
|
#
|
3
|
# This file is part of OsmoSDR
|
4
|
#
|
5
|
# GNU Radio is free software; you can redistribute it and/or modify
|
6
|
# it under the terms of the GNU General Public License as published by
|
7
|
# the Free Software Foundation; either version 3, or (at your option)
|
8
|
# any later version.
|
9
|
#
|
10
|
# GNU Radio is distributed in the hope that it will be useful,
|
11
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
# GNU General Public License for more details.
|
14
|
#
|
15
|
# You should have received a copy of the GNU General Public License
|
16
|
# along with GNU Radio; see the file COPYING. If not, write to
|
17
|
# the Free Software Foundation, Inc., 51 Franklin Street,
|
18
|
# Boston, MA 02110-1301, USA.
|
19
|
|
20
|
########################################################################
|
21
|
# Setup library
|
22
|
########################################################################
|
23
|
add_library(osmosdr_shared SHARED
|
24
|
libosmosdr.c
|
25
|
)
|
26
|
|
27
|
target_link_libraries(osmosdr_shared
|
28
|
${LIBUSB_LIBRARIES}
|
29
|
)
|
30
|
|
31
|
set_target_properties(osmosdr_shared PROPERTIES DEFINE_SYMBOL "osmosdr_EXPORTS")
|
32
|
set_target_properties(osmosdr_shared PROPERTIES OUTPUT_NAME osmosdr)
|
33
|
set_target_properties(osmosdr_shared PROPERTIES SOVERSION 0 VERSION 0.0.0)
|
34
|
|
35
|
add_library(osmosdr_static STATIC
|
36
|
libosmosdr.c
|
37
|
)
|
38
|
|
39
|
target_link_libraries(osmosdr_static
|
40
|
${LIBUSB_LIBRARIES}
|
41
|
)
|
42
|
|
43
|
set_property(TARGET osmosdr_static APPEND PROPERTY COMPILE_DEFINITIONS "osmosdr_STATIC" )
|
44
|
|
45
|
if(NOT WIN32)
|
46
|
# Force same library filename for static and shared variants of the library
|
47
|
set_target_properties(osmosdr_static PROPERTIES OUTPUT_NAME osmosdr)
|
48
|
endif()
|
49
|
|
50
|
########################################################################
|
51
|
# Build utility
|
52
|
########################################################################
|
53
|
add_executable(osmo_sdr osmo_sdr.c)
|
54
|
target_link_libraries(osmo_sdr osmosdr_static
|
55
|
${LIBUSB_LIBRARIES}
|
56
|
)
|
57
|
|
58
|
if(WIN32)
|
59
|
set_property(TARGET osmo_sdr APPEND PROPERTY COMPILE_DEFINITIONS "osmosdr_STATIC" )
|
60
|
endif()
|
61
|
|
62
|
########################################################################
|
63
|
# Install built library files & utilities
|
64
|
########################################################################
|
65
|
install(TARGETS osmosdr_shared osmosdr_static osmo_sdr
|
66
|
LIBRARY DESTINATION lib${LIB_SUFFIX} # .so/.dylib file
|
67
|
ARCHIVE DESTINATION lib${LIB_SUFFIX} # .lib file
|
68
|
RUNTIME DESTINATION bin # .dll file
|
69
|
)
|