| 1 |
set(EXAMPLES |
| 2 |
live |
| 3 |
simple |
| 4 |
) |
| 5 |
|
| 6 |
foreach(EXAMPLE ${EXAMPLES}) |
| 7 |
add_executable(${EXAMPLE} EXCLUDE_FROM_ALL ${EXAMPLE}.c) |
| 8 |
target_link_libraries(${EXAMPLE} pocketsphinx) |
| 9 |
target_include_directories( |
| 10 |
${EXAMPLE} PRIVATE ${CMAKE_BINARY_DIR} |
| 11 |
) |
| 12 |
endforeach() |
| 13 |
|
| 14 |
add_custom_target(examples DEPENDS ${EXAMPLES}) |
| 15 |
|
| 16 |
# Try to find portaudio and pulseaudio with pkg-config |
| 17 |
find_package(PkgConfig QUIET) |
| 18 |
if(PKG_CONFIG_FOUND) |
| 19 |
pkg_check_modules(PULSEAUDIO libpulse-simple) |
| 20 |
if(PULSEAUDIO_FOUND) |
| 21 |
add_executable(live_pulseaudio EXCLUDE_FROM_ALL live_pulseaudio.c) |
| 22 |
target_link_libraries(live_pulseaudio pocketsphinx ${PULSEAUDIO_LIBRARIES}) |
| 23 |
target_include_directories(live_pulseaudio PRIVATE ${CMAKE_BINARY_DIR} |
| 24 |
live_pulseaudio PUBLIC ${PULSEAUDIO_INCLUDE_DIRS}) |
| 25 |
endif() |
| 26 |
|
| 27 |
pkg_check_modules(PORTAUDIO portaudio-2.0) |
| 28 |
if(PORTAUDIO_FOUND) |
| 29 |
add_executable(live_portaudio EXCLUDE_FROM_ALL live_portaudio.c) |
| 30 |
target_link_libraries(live_portaudio pocketsphinx ${PORTAUDIO_LIBRARIES}) |
| 31 |
target_include_directories(live_portaudio PRIVATE ${CMAKE_BINARY_DIR} |
| 32 |
live_portaudio PUBLIC ${PORTAUDIO_INCLUDE_DIRS}) |
| 33 |
endif() |
| 34 |
endif() |
| 35 |
|
| 36 |
# Try to find portaudio with its old package finder thing |
| 37 |
if(NOT PORTAUDIO_FOUND) |
| 38 |
find_package(portaudio QUIET) |
| 39 |
if(TARGET portaudio_static) |
| 40 |
add_executable(live_portaudio EXCLUDE_FROM_ALL live_portaudio.c) |
| 41 |
target_link_libraries(live_portaudio pocketsphinx portaudio_static) |
| 42 |
set(PORTAUDIO_FOUND 1) |
| 43 |
endif() |
| 44 |
endif() |
| 45 |
|
| 46 |
# Try to find portaudio with its new package finder thing |
| 47 |
if(NOT PORTAUDIO_FOUND) |
| 48 |
find_package(PortAudio QUIET) |
| 49 |
if(TARGET PortAudio::PortAudio) |
| 50 |
add_executable(live_portaudio EXCLUDE_FROM_ALL live_portaudio.c) |
| 51 |
target_link_libraries(live_portaudio pocketsphinx PortAudio::PortAudio) |
| 52 |
set(PORTAUDIO_FOUND 1) |
| 53 |
endif() |
| 54 |
endif() |
| 55 |
|
| 56 |
if(WIN32) |
| 57 |
add_executable(live_win32 EXCLUDE_FROM_ALL live_win32.c) |
| 58 |
target_link_libraries(live_win32 pocketsphinx winmm) |
| 59 |
endif() |