Statistics
| Branch: | Tag: | Revision:

root / gr-audio / lib / CMakeLists.txt @ 9b2855a4

History | View | Annotate | Download (5.5 kB)

1
# Copyright 2011 Free Software Foundation, Inc.
2
#
3
# This file is part of GNU Radio
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 the include and linker paths
22
########################################################################
23
include_directories(
24
    ${GNURADIO_CORE_INCLUDE_DIRS}
25
    ${GR_AUDIO_INCLUDE_DIRS}
26
    ${CMAKE_CURRENT_SOURCE_DIR}
27
)
28
29
include_directories(${Boost_INCLUDE_DIRS})
30
link_directories(${Boost_LIBRARY_DIRS})
31
32
list(APPEND gr_audio_libs gnuradio-core ${Boost_LIBRARIES})
33
list(APPEND gr_audio_sources gr_audio_registry.cc)
34
list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/gr-audio.conf)
35
36
########################################################################
37
## ALSA Support
38
########################################################################
39
find_package(ALSA)
40
41
if(ALSA_FOUND)
42
43
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/alsa ${ALSA_INCLUDE_DIRS})
44
    list(APPEND gr_audio_libs ${ALSA_LIBRARIES})
45
    list(APPEND gr_audio_sources
46
        ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gri_alsa.cc
47
        ${CMAKE_CURRENT_SOURCE_DIR}/alsa/audio_alsa_source.cc
48
        ${CMAKE_CURRENT_SOURCE_DIR}/alsa/audio_alsa_sink.cc
49
    )
50
    list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/alsa/gr-audio-alsa.conf)
51
52
endif(ALSA_FOUND)
53
54
########################################################################
55
## OSS Support
56
########################################################################
57
find_package(OSS)
58
59
if(OSS_FOUND)
60
61
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/oss ${OSS_INCLUDE_DIRS})
62
    list(APPEND gr_audio_sources
63
        ${CMAKE_CURRENT_SOURCE_DIR}/oss/audio_oss_source.cc
64
        ${CMAKE_CURRENT_SOURCE_DIR}/oss/audio_oss_sink.cc
65
    )
66
    list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/oss/gr-audio-oss.conf)
67
68
endif(OSS_FOUND)
69
70
71
########################################################################
72
## Jack Support
73
########################################################################
74
find_package(Jack)
75
76
if(JACK_FOUND)
77
78
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/jack ${JACK_INCLUDE_DIRS})
79
    list(APPEND gr_audio_libs ${JACK_LIBRARIES})
80
    add_definitions(${JACK_DEFINITIONS})
81
    list(APPEND gr_audio_sources
82
        ${CMAKE_CURRENT_SOURCE_DIR}/jack/gri_jack.cc
83
        ${CMAKE_CURRENT_SOURCE_DIR}/jack/audio_jack_source.cc
84
        ${CMAKE_CURRENT_SOURCE_DIR}/jack/audio_jack_sink.cc
85
    )
86
    list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/jack/gr-audio-jack.conf)
87
88
endif(JACK_FOUND)
89
90
########################################################################
91
## OSX Support
92
########################################################################
93
include(CheckIncludeFileCXX)
94
CHECK_INCLUDE_FILE_CXX(AudioUnit/AudioUnit.h AUDIO_UNIT_H)
95
CHECK_INCLUDE_FILE_CXX(AudioToolbox/AudioToolbox.h AUDIO_TOOLBOX_H)
96
97
if(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H)
98
99
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/osx)
100
    list(APPEND gr_audio_libs
101
        "-framework AudioUnit"
102
        "-framework CoreAudio"
103
        "-framework AudioToolbox"
104
        "-framework Carbon"
105
    )
106
    list(APPEND gr_audio_sources
107
        ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_source.cc
108
        ${CMAKE_CURRENT_SOURCE_DIR}/osx/audio_osx_sink.cc
109
    )
110
111
endif(AUDIO_UNIT_H AND AUDIO_TOOLBOX_H)
112
113
########################################################################
114
## PortAudio Support
115
########################################################################
116
find_package(Portaudio)
117
118
if(PORTAUDIO_FOUND)
119
120
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/portaudio ${PORTAUDIO_INCLUDE_DIRS})
121
    list(APPEND gr_audio_libs ${PORTAUDIO_LIBRARIES})
122
    add_definitions(${PORTAUDIO_DEFINITIONS})
123
    list(APPEND gr_audio_sources
124
        ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gri_portaudio.cc
125
        ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/audio_portaudio_source.cc
126
        ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/audio_portaudio_sink.cc
127
    )
128
    list(APPEND gr_audio_confs ${CMAKE_CURRENT_SOURCE_DIR}/portaudio/gr-audio-portaudio.conf)
129
130
endif(PORTAUDIO_FOUND)
131
132
########################################################################
133
## Windows Support
134
########################################################################
135
if(WIN32)
136
137
    include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows)
138
    list(APPEND gr_audio_libs winmm.lib)
139
    list(APPEND gr_audio_sources
140
        ${CMAKE_CURRENT_SOURCE_DIR}/windows/audio_windows_source.cc
141
        ${CMAKE_CURRENT_SOURCE_DIR}/windows/audio_windows_sink.cc
142
    )
143
144
endif(WIN32)
145
146
########################################################################
147
# Setup library
148
########################################################################
149
add_library(gnuradio-audio SHARED ${gr_audio_sources})
150
target_link_libraries(gnuradio-audio ${gr_audio_libs})
151
GR_LIBRARY_FOO(gnuradio-audio RUNTIME_COMPONENT "audio_runtime" DEVEL_COMPONENT "audio_devel")
152
153
install(FILES ${gr_audio_confs} DESTINATION ${GR_PREFSDIR} COMPONENT "audio_runtime")