aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTaylor Holberton <taylorcholberton@gmail.com>2017-10-12 20:09:05 -0400
committerTaylor Holberton <taylorcholberton@gmail.com>2017-10-12 20:09:05 -0400
commit1893950251319724fae9d5b090bccfbc2fbb38d4 (patch)
tree2d0e5968c70e9bd0424677f1d72a6750a4caec97
parent34ffa583936aeb6938636c9c0a26a322b69b0d26 (diff)
added CMake build
-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")
+