forked from r4stl1n/cAudio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
141 lines (116 loc) · 4.88 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
133
134
135
136
137
138
139
140
141
#/**********************************************************\
#Original Author: Murat Sari (wolfmanfx)
#
#Created: Feb 20, 2011
#License: ZLib
#
#\**********************************************************/
cmake_minimum_required(VERSION 2.8)
project(cAudio)
# Include necessary submodules
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/CMake"
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Utils"
"${CMAKE_CURRENT_SOURCE_DIR}/CMake/Packages"
)
include(CMakeDependentOption)
include(PreprocessorUtils)
include(MacroLogFeature)
#####################################################################
# Set up the basic build environment
#####################################################################
if (CMAKE_BUILD_TYPE STREQUAL "")
# CMake defaults to leaving CMAKE_BUILD_TYPE empty. This screws up
# differentiation between debug and release builds.
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of build, options are: None (CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif ()
if (WIN32)
# Create debug libraries with _d postfix
set(CMAKE_DEBUG_POSTFIX "_d")
endif()
set(CAUDIO_RELEASE_PATH "/Release")
set(CAUDIO_RELWDBG_PATH "/RelWithDebInfo")
set(CAUDIO_MINSIZE_PATH "/MinSizeRel")
set(CAUDIO_DEBUG_PATH "/Debug")
set(CAUDIO_LIB_DIRECTORY "/lib")
######################################################################
# Provide user options to customise the build process
######################################################################
# Customise what to build
option(CAUDIO_STATIC "Static build" FALSE)
option(CAUDIO_BUILD_SAMPLES "Build Samples" TRUE)
option(CAUDIO_BUILD_CSHARP_WRAPPER "Build CSharpWrapper - this wrapper is used with the provided *.cs files" FALSE)
#Custom settings
option(CAUDIO_BUILD_EAX_PLUGIN "Build EAXLegacyPreset Plugin" FALSE)
option(CAUDIO_BUILD_MP3DECODER_PLUGIN "Build mp3Decoder Plugin" FALSE)
option(CAUDIO_ENABLE_OGG "Enable OGG decoder" TRUE)
option(CAUDIO_SYSTEM_OGG "Link against system OGG" FALSE)
option(CAUDIO_ENABLE_WAV "Enable RIFF/Wav decoder" TRUE)
option(CAUDIO_ENABLE_DEFAULT_FILESYSTEM "Enable default filesystem data source" TRUE)
option(CAUDIO_ENABLE_DEFAULT_FILE_LOGGER "Enable default file logger (html)" TRUE)
option(CAUDIO_ENABLE_DEFAULT_CONSOLE_LOGGER "Enable default console logger" TRUE)
option(CAUDIO_ENABLE_THREAD_SAFETY "Enable thread safety" TRUE)
option(CAUDIO_ENABLE_STD_MEMORY_ALLOCATOR "Enable Std Memory allocations (memalloc and free)" TRUE)
option(CAUDIO_ENABLE_REROUTE_STL_ALLOCATIONS "Reroute STL memory allocations" TRUE)
option(CAUDIO_ENABLE_MEMORYTRACKER "Enable memory leak tracker" FALSE)
option(CAUDIO_ENABLE_MEMORY_LOG_ALL_ALLOCATIONS "Enable log all memory allocations" FALSE)
option(CAUDIO_ENABLE_MEMORY_STATISTICS "Enable memory statistics generator" FALSE)
if(APPLE)
option(CAUDIO_IOS_BUILD "Build for ios" FALSE)
endif()
include(ConfigureBuild)
if (CAUDIO_IOS_BUILD)
# Set build variables
set(CMAKE_OSX_SYSROOT iphoneos)
set(CMAKE_OSX_DEPLOYMENT_TARGET "")
set(CMAKE_EXE_LINKER_FLAGS "-framework Foundation -framework CoreGraphics -framework QuartzCore -framework UIKit -framework OpenGLES")
set(XCODE_ATTRIBUTE_SDKROOT iphoneos)
set(MACOSX_BUNDLE_GUI_IDENTIFIER "com.YOUR_COMPANY.\${PRODUCT_NAME:rfc1034identifier}")
set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_BIT))
add_definitions(-fno-regmove)
add_definitions(-falign-loops=16)
remove_definitions(-msse)
elseif (APPLE AND NOT CAUDIO_IOS_BUILD)
# Set 10.5 as the base SDK by default
set(XCODE_ATTRIBUTE_SDKROOT macosx)
set(CMAKE_OSX_SYSROOT macosx)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.5)
if (NOT CMAKE_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES $(ARCHS_STANDARD_32_64_BIT))
endif()
endif()
include(Dependencies)
include(InstallDependencies)
if(CAUDIO_ENABLE_OGG)
if(CAUDIO_SYSTEM_OGG)
find_package(Ogg)
find_package(Vorbis)
else()
add_subdirectory(DependenciesSource/libogg-1.2.2)
add_subdirectory(DependenciesSource/libvorbis-1.3.2)
# Set OGG_LIBRARIES, VORBIS_LIBRARIES as appropriate.
set(OGG_LIBRARIES Ogg)
set(VORBIS_LIBRARIES Vorbis)
endif()
endif()
add_subdirectory(cAudio)
if(CAUDIO_BUILD_EAX_PLUGIN)
add_subdirectory(Plugins/EAXLegacyPreset)
endif()
if(CAUDIO_BUILD_MP3DECODER_PLUGIN)
add_subdirectory(Plugins/mp3Decoder)
endif()
if(CAUDIO_BUILD_CSHARP_WRAPPER)
add_subdirectory(cAudioCSharpWrapper)
endif()
if(CAUDIO_BUILD_SAMPLES)
ADD_DEFINITIONS(-DCAUDIO_MEDIA_ROOT="${CMAKE_SOURCE_DIR}/Examples/Media/")
add_subdirectory(Examples/Tutorial1_2DSound)
add_subdirectory(Examples/Tutorial2_3DSound)
add_subdirectory(Examples/Tutorial3_MemoryPlayback)
add_subdirectory(Examples/Tutorial4_AudioCapture)
add_subdirectory(Examples/Tutorial5_AudioEffects)
add_subdirectory(Examples/Tutorial6_CustomEventHandler)
add_subdirectory(Examples/Tutorial7_CustomLogReceiver)
add_subdirectory(Examples/Tutorial8_CustomManagerEventHandler)
endif()