This repository has been archived by the owner on Jun 5, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
CMakeLists.txt
132 lines (109 loc) · 4.33 KB
/
CMakeLists.txt
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
PROJECT(OgreOggSound)
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
INCLUDE (CheckIncludeFileCXX)
# define header and source files for the library
SET (HEADER_FILES
include/LocklessQueue.h
include/OgreOggISound.h
include/OgreOggListener.h
include/OgreOggSoundCallback.h
include/OgreOggSoundFactory.h
include/OgreOggSound.h
include/OgreOggSoundManager.h
include/OgreOggSoundPlugin.h
include/OgreOggSoundPrereqs.h
include/OgreOggSoundRecord.h
include/OgreOggStaticSound.h
include/OgreOggStaticWavSound.h
include/OgreOggStreamBufferSound.h
include/OgreOggStreamSound.h
include/OgreOggStreamWavSound.h
)
SET (SOURCE_FILES
src/OgreOggISound.cpp
src/OgreOggListener.cpp
src/OgreOggSoundFactory.cpp
src/OgreOggSoundManager.cpp
src/OgreOggSoundPlugin.cpp
src/OgreOggSoundPluginDllStart.cpp
src/OgreOggSoundRecord.cpp
src/OgreOggStaticSound.cpp
src/OgreOggStaticWavSound.cpp
src/OgreOggStreamBufferSound.cpp
src/OgreOggStreamSound.cpp
src/OgreOggStreamWavSound.cpp
)
# Option.
SET(OGGSOUND_THREADED NO CACHE BOOL "Enable multi-threaded streamed sounds")
SET(USE_POCO NO CACHE BOOL "Use POCO Threads?")
IF(CMAKE_BUILD_TYPE STREQUAL Debug)
# Enable all compiler warnings and debug support.
ADD_DEFINITIONS(-D_DEBUG -g -Wall)
SET(CMAKE_DEBUG_POSTFIX "_d")
ENDIF(CMAKE_BUILD_TYPE STREQUAL Debug)
IF(OGGSOUND_THREADED)
IF(USE_POCO)
CHECK_INCLUDE_FILE_CXX(Poco/ScopedLock.h HAVE_POCO_H)
IF(HAVE_POCO_H)
ADD_DEFINITIONS(-DOGGSOUND_THREADED=1)
ADD_DEFINITIONS(-DPOCO_THREAD=1)
ENDIF()
ELSE()
SET(Boost_ADDITIONAL_VERSIONS "1.47" "1.44" "1.43" "1.42")
FIND_PACKAGE(Boost 1.42.0 COMPONENTS thread)
IF (Boost_FOUND)
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
LINK_LIBRARIES(${Boost_LIBRARIES})
ADD_DEFINITIONS(-DOGGSOUND_THREADED=1)
ENDIF()
ENDIF()
ELSE()
ADD_DEFINITIONS(-DOGGSOUND_THREADED=0)
ENDIF()
FIND_PACKAGE(OGRE 1.10 REQUIRED)
FIND_PACKAGE(PkgConfig QUIET)
PKG_CHECK_MODULES(PC_OPENAL QUIET openal)
FIND_PATH(OPENAL_INCLUDE_DIRS NAMES al.h HINTS ${PC_OPENAL_INCLUDE_DIRS} PATH_SUFFIXES openal)
FIND_LIBRARY(OPENAL_LIBRARIES NAMES openal HINTS ${PC_OPENAL_LIBRARY_DIRS})
PKG_CHECK_MODULES(PC_OGG QUIET ogg)
FIND_PATH(OGG_INCLUDE_DIRS NAMES ogg/ogg.h HINTS ${PC_OGG_INCLUDE_DIRS} PATH_SUFFIXES ogg)
FIND_LIBRARY(OGG_LIBRARIES NAMES ogg HINTS ${PC_OGG_LIBRARY_DIRS})
PKG_CHECK_MODULES(PC_VORBISFILE QUIET vorbisfile)
FIND_PATH(VORBIS_INCLUDE_DIRS NAMES vorbis/vorbisfile.h HINTS ${PC_VORBISFILE_INCLUDE_DIRS} PATH_SUFFIXES vorbisfile)
FIND_LIBRARY(VORBISFILE_LIBRARIES NAMES vorbisfile HINTS ${PC_VORBISFILE_LIBRARY_DIRS})
CHECK_INCLUDE_FILE_CXX(efx.h HAVE_EFX)
INCLUDE_DIRECTORIES(include
${OGRE_INCLUDE_DIRS}
${OPENAL_INCLUDE_DIRS}
${OGG_INCLUDE_DIRS}
${VORBIS_INCLUDE_DIRS})
LINK_DIRECTORIES(${OGRE_LIBRARY_DIRS}
${OPENAL_LIBRARY_DIRS}
${OGG_INCLUDE_DIRS}
${VORBISFILE_LIBRARIES})
LINK_LIBRARIES(${OGRE_LIBRARIES}
${OPENAL_LIBRARIES}
${OGG_LIBRARIES}
${VORBISFILE_LIBRARIES})
ADD_LIBRARY(Plugin_OggSound SHARED ${SOURCE_FILES} ${HEADER_FILES})
# disable "lib" prefix
set_target_properties(Plugin_OggSound PROPERTIES PREFIX "")
set(CMAKE_INSTALL_PREFIX ${OGRE_PREFIX_DIR} CACHE PATH "plugin must end up in OGRE plugin path" FORCE)
INSTALL(FILES ${HEADER_FILES} DESTINATION include/OGRE/Plugins/OggSound)
INSTALL(TARGETS Plugin_OggSound LIBRARY DESTINATION lib/OGRE/ ARCHIVE DESTINATION lib/OGRE/)
set_property(TARGET Plugin_OggSound PROPERTY INSTALL_RPATH ${OGRE_LIBRARY_DIRS})
# doxygen stuff
find_package(Doxygen)
if (DOXYGEN_FOUND)
# prepare doxygen configuration file
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/docs/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
add_custom_target( docs
COMMAND ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with Doxygen."
VERBATIM
)
# cleanup $build/api-doc on "make clean"
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES docs)
endif (DOXYGEN_FOUND)