Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 1 | cmake_minimum_required(VERSION 3.0.2) |
| 2 | |
| 3 | project("TinyALSA" C) |
| 4 | |
Bhalchandra Gajare | 986b8e3 | 2019-09-04 15:32:35 -0700 | [diff] [blame^] | 5 | option(TINYALSA_USES_PLUGINS "Whether or not to build with plugin support" OFF) |
| 6 | |
| 7 | if (TINYALSA_USES_PLUGINS) |
| 8 | set (plugin_opt -DTINYALSA_USES_PLUGINS=1) |
| 9 | endif (TINYALSA_USES_PLUGINS) |
| 10 | |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 11 | set (HDRS |
Taylor Holberton | bc86b6b | 2019-01-13 13:10:47 -0500 | [diff] [blame] | 12 | "include/tinyalsa/attributes.h" |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 13 | "include/tinyalsa/version.h" |
| 14 | "include/tinyalsa/asoundlib.h" |
| 15 | "include/tinyalsa/pcm.h" |
Bhalchandra Gajare | 986b8e3 | 2019-09-04 15:32:35 -0700 | [diff] [blame^] | 16 | "include/tinyalsa/plugin.h" |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 17 | "include/tinyalsa/mixer.h") |
| 18 | |
| 19 | set (SRCS |
| 20 | "src/pcm.c" |
Bhalchandra Gajare | 986b8e3 | 2019-09-04 15:32:35 -0700 | [diff] [blame^] | 21 | "src/pcm_hw.c" |
| 22 | "src/pcm_plugin.c" |
| 23 | "src/snd_card_plugin.c" |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 24 | "src/mixer.c") |
| 25 | |
| 26 | add_library("tinyalsa" ${HDRS} ${SRCS}) |
Bhalchandra Gajare | 986b8e3 | 2019-09-04 15:32:35 -0700 | [diff] [blame^] | 27 | target_compile_options("tinyalsa" PRIVATE -Wall -Wextra -Werror -Wfatal-errors ${plugin_opt}) |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 28 | target_include_directories("tinyalsa" PRIVATE "include") |
| 29 | |
| 30 | macro(ADD_EXAMPLE EXAMPLE) |
| 31 | add_executable(${EXAMPLE} ${ARGN}) |
| 32 | target_link_libraries(${EXAMPLE} "tinyalsa") |
Bhalchandra Gajare | 986b8e3 | 2019-09-04 15:32:35 -0700 | [diff] [blame^] | 33 | target_link_libraries(${EXAMPLE} "dl") |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 34 | target_include_directories(${EXAMPLE} PRIVATE "include") |
| 35 | endmacro(ADD_EXAMPLE EXAMPLE) |
| 36 | |
| 37 | add_example("pcm-readi" "examples/pcm-readi.c") |
| 38 | add_example("pcm-writei" "examples/pcm-writei.c") |
| 39 | |
| 40 | macro(ADD_UTIL UTIL) |
| 41 | add_executable(${UTIL} ${ARGN}) |
| 42 | target_link_libraries(${UTIL} "tinyalsa") |
Bhalchandra Gajare | 986b8e3 | 2019-09-04 15:32:35 -0700 | [diff] [blame^] | 43 | target_link_libraries(${UTIL} "dl") |
Taylor Holberton | 1893950 | 2017-10-12 20:09:05 -0400 | [diff] [blame] | 44 | target_compile_options(${UTIL} PRIVATE -Wall -Wextra -Werror -Wfatal-errors) |
| 45 | target_include_directories(${UTIL} PRIVATE "include") |
| 46 | endmacro(ADD_UTIL UTIL) |
| 47 | |
| 48 | add_util("tinyplay" "utils/tinyplay.c") |
| 49 | add_util("tinycap" "utils/tinycap.c") |
| 50 | add_util("tinypcminfo" "utils/tinypcminfo.c") |
| 51 | add_util("tinymix" "utils/tinymix.c") |
| 52 | |
| 53 | install(FILES ${HDRS} |
| 54 | DESTINATION "include/tinyalsa") |
| 55 | |
| 56 | install(TARGETS "tinyalsa" |
| 57 | "tinyplay" |
| 58 | "tinycap" |
| 59 | "tinymix" |
| 60 | "tinypcminfo" |
| 61 | RUNTIME DESTINATION "bin" |
| 62 | ARCHIVE DESTINATION "lib" |
| 63 | LIBRARY DESTINATION "lib") |
| 64 | |