aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
blob: 4c78dbfe37018ee763ab20f5e91ff4571425c697 (plain)
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
cmake_minimum_required(VERSION 3.0.2)

project("TinyALSA" C)

set (HDRS
    "include/tinyalsa/version.h"
    "include/tinyalsa/asoundlib.h"
    "include/tinyalsa/pcm.h"
    "include/tinyalsa/mixer.h")

set (SRCS
    "src/pcm.c"
    "src/mixer.c")

add_library("tinyalsa" ${HDRS} ${SRCS})
target_compile_options("tinyalsa" PRIVATE -Wall -Wextra -Werror -Wfatal-errors)
target_include_directories("tinyalsa" PRIVATE "include")

macro(ADD_EXAMPLE EXAMPLE)
    add_executable(${EXAMPLE} ${ARGN})
    target_link_libraries(${EXAMPLE} "tinyalsa")
    target_include_directories(${EXAMPLE} PRIVATE "include")
endmacro(ADD_EXAMPLE EXAMPLE)

add_example("pcm-readi" "examples/pcm-readi.c")
add_example("pcm-writei" "examples/pcm-writei.c")

macro(ADD_UTIL UTIL)
    add_executable(${UTIL} ${ARGN})
    target_link_libraries(${UTIL} "tinyalsa")
    target_compile_options(${UTIL} PRIVATE -Wall -Wextra -Werror -Wfatal-errors)
    target_include_directories(${UTIL} PRIVATE "include")
endmacro(ADD_UTIL UTIL)

add_util("tinyplay" "utils/tinyplay.c")
add_util("tinycap" "utils/tinycap.c")
add_util("tinypcminfo" "utils/tinypcminfo.c")
add_util("tinymix" "utils/tinymix.c")

install(FILES ${HDRS}
    DESTINATION "include/tinyalsa")

install(TARGETS "tinyalsa"
                "tinyplay"
                "tinycap"
                "tinymix"
                "tinypcminfo"
    RUNTIME DESTINATION "bin"
    ARCHIVE DESTINATION "lib"
    LIBRARY DESTINATION "lib")