aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore24
-rw-r--r--CMakeLists.txt51
2 files changed, 64 insertions, 11 deletions
diff --git a/.gitignore b/.gitignore
index ccdd3be..befe4ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,20 +1,22 @@
-doxygen/html
-doxygen/man
+/doxygen/html
+/doxygen/man
+
+/build
*.o
*.so
*.so.*
*.a
-libs
-obj
+/libs
+/obj
-examples/audio.raw
-examples/pcm-readi
-examples/pcm-writei
+/examples/audio.raw
+/examples/pcm-readi
+/examples/pcm-writei
-utils/tinyplay
-utils/tinycap
-utils/tinymix
-utils/tinypcminfo
+/utils/tinyplay
+/utils/tinycap
+/utils/tinymix
+/utils/tinypcminfo
diff --git a/CMakeLists.txt b/CMakeLists.txt
new file mode 100644
index 0000000..4c78dbf
--- /dev/null
+++ b/CMakeLists.txt
@@ -0,0 +1,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")
+