-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
70 lines (61 loc) · 2.01 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
cmake_minimum_required(VERSION 3.7)
project(scream LANGUAGES C)
add_executable(${PROJECT_NAME} scream.c network.c shmem.c raw.c)
# find pulseaudio
option(PULSEAUDIO_ENABLE "Enable PulseAudio" ON)
if (PULSEAUDIO_ENABLE)
find_package(PkgConfig)
pkg_check_modules(PULSEAUDIO libpulse-simple)
if (PULSEAUDIO_FOUND)
include_directories(${PULSEAUDIO_INCLUDE_DIRS})
target_link_directories(${PROJECT_NAME} PUBLIC ${PULSEAUDIO_LIBRARY_DIRS})
target_link_libraries(${PROJECT_NAME} ${PULSEAUDIO_LIBRARIES})
target_sources(${PROJECT_NAME} PRIVATE pulseaudio.c)
else ()
set(PULSEAUDIO_ENABLE OFF)
endif ()
endif ()
# find ALSA
option(ALSA_ENABLE "Enable ALSA" ON)
if (ALSA_ENABLE)
find_package(PkgConfig)
pkg_check_modules(PC_ALSA alsa)
if (PC_ALSA_FOUND)
include_directories(${PC_ALSA_INCLUDEDIR})
target_link_libraries(${PROJECT_NAME} ${PC_ALSA_LIBRARIES})
target_sources(${PROJECT_NAME} PRIVATE alsa.c)
else ()
set(ALSA_ENABLE OFF)
endif ()
endif ()
# find JACK
option(JACK_ENABLE "Enable JACK" ON)
if (JACK_ENABLE)
find_package(PkgConfig)
pkg_check_modules(PC_JACK jack)
pkg_check_modules(PC_LIBSOXR soxr)
if(PC_JACK_FOUND AND PC_LIBSOXR_FOUND)
include_directories(${PC_JACK_INCLUDEDIR} ${PC_LIBSOXR_INCLUDEDIR})
target_link_libraries(${PROJECT_NAME} ${PC_JACK_LIBRARIES} ${PC_LIBSOXR_LIBRARIES})
target_sources(${PROJECT_NAME} PRIVATE jack.c)
else ()
set(JACK_ENABLE OFF)
endif ()
endif ()
# find libpcap
option(PCAP_ENABLE "Enable PCAP" ON)
if (PCAP_ENABLE)
find_package(PkgConfig)
pkg_check_modules(PC_PCAP libpcap)
if (PC_PCAP_FOUND)
include_directories(${PC_PCAP_INCLUDEDIR})
target_link_libraries(${PROJECT_NAME} ${PC_PCAP_LIBRARIES})
target_sources(${PROJECT_NAME} PRIVATE pcap.c)
else ()
set(PCAP_ENABLE OFF)
endif ()
endif ()
configure_file(config.h.in config.h)
target_include_directories(${PROJECT_NAME} PUBLIC "${PROJECT_BINARY_DIR}")
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")