Skip to content

Commit 345abe7

Browse files
committed
add NANA_ENABLE_AUDIO option for CMakeLists
1 parent 61a09ca commit 345abe7

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

CMakeLists.txt

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# CMake configuration for Nana
1+
# CMake configuration for Nana
22
# Author: Andrew Kornilov(https://github.com/ierofant)
33
# Contributor:
44
# Robert Hauck - Enable support for PNG/Freetype
@@ -14,6 +14,7 @@ option(ENABLE_PNG "Enable the use of PNG" OFF)
1414
option(LIBPNG_FROM_OS "Use libpng from operating system." ON)
1515
option(ENABLE_JPEG "Enable the use of JPEG" OFF)
1616
option(LIBJPEG_FROM_OS "Use libjpeg from operating system." ON)
17+
option(ENABLE_AUDIO "Enable class audio::play for PCM playback." OFF)
1718
option(CMAKE_VERBOSE_PREPROCESSOR "Show annoying debug messages during compilation." OFF)
1819
option(CMAKE_STOP_VERBOSE_PREPROCESSOR "Stop compilation after showing the annoying debug messages." ON)
1920
option(BUILD_NANA_DEMOS "Build all the demos form the nana_demo repository." OFF)
@@ -98,7 +99,17 @@ if(ENABLE_JPEG)
9899
endif(LIBJPEG_FROM_OS)
99100
endif(ENABLE_JPEG)
100101

101-
102+
if(ENABLE_AUDIO)
103+
add_definitions(-DNANA_ENABLE_AUDIO)
104+
if(UNIX)
105+
find_package(asound)
106+
if (ASOUND_FOUND)
107+
include_directories( ${ASOUND_INCLUDE_DIRS})
108+
else(ASOUND_FOUND)
109+
message(FATAL_ERROR "libasound is not found")
110+
endif(ASOUND_FOUND)
111+
endif(UNIX)
112+
endif(ENABLE_AUDIO)
102113

103114
#Unicode
104115
if(CMAKE_VERBOSE_PREPROCESSOR)

0 commit comments

Comments
 (0)