-
Notifications
You must be signed in to change notification settings - Fork 0
/
FindOggVorbis.cmake
162 lines (128 loc) · 4.65 KB
/
FindOggVorbis.cmake
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
# - Try to find the OggVorbis libraries
# Once done this will define
#
# OGGVORBIS_FOUND - system has OggVorbis
# OGGVORBIS_VERSION - set either to 1 or 2
# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
# OGG_LIBRARY - The Ogg library
# VORBIS_LIBRARY - The Vorbis library
# VORBISFILE_LIBRARY - The VorbisFile library
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include (CheckLibraryExists)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/include"
)
find_path(OGG_INCLUDE_DIR ogg/ogg.h
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Ogg/include"
)
message(STATUS "Looking in: ${OPIFEX_ENGINE_REPOSITORY}")
message(STATUS "Vorbis Include: ${VORBIS_INCLUDE_DIR}")
message(STATUS "Ogg Include: ${OGG_INCLUDE_DIR}")
if( "${OPIFEX_OS}" STREQUAL "OPIFEX_WIN32" )
find_library(OGG_LIBRARY_RELEASE
NAMES ogg libogg libogg_static
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Ogg/lib/release/win32"
)
find_library(VORBIS_LIBRARY_RELEASE
NAMES vorbis libvorbis libvorbis_static
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/release/win32"
)
find_library(VORBISFILE_LIBRARY_RELEASE
NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/release/win32"
)
find_library(OGG_LIBRARY
NAMES ogg libogg
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Ogg/lib/debug/win32"
)
find_library(VORBIS_LIBRARY
NAMES vorbis libvorbis
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/debug/win32"
)
find_library(VORBISFILE_LIBRARY
NAMES vorbisfile libvorbisfile
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/debug/win32"
)
elseif( "${OPIFEX_OS}" STREQUAL "OPIFEX_WIN64" )
find_library(OGG_LIBRARY_RELEASE
NAMES ogg libogg libogg_static
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Ogg/lib/release/win64"
)
find_library(VORBIS_LIBRARY_RELEASE
NAMES vorbis libvorbis libvorbis_static
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/release/win64"
)
find_library(VORBISFILE_LIBRARY_RELEASE
NAMES vorbisfile vorbisfile_static libvorbisfile libvorbisfile_static
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/release/win64"
)
find_library(OGG_LIBRARY
NAMES ogg libogg
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Ogg/lib/debug/win64"
)
find_library(VORBIS_LIBRARY
NAMES vorbis libvorbis
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/debug/win64"
)
find_library(VORBISFILE_LIBRARY
NAMES vorbisfile libvorbisfile
PATHS
"${OPIFEX_ENGINE_REPOSITORY}/External/Vorbis/lib/debug/win64"
)
else()
include (CheckLibraryExists)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
find_library(OGG_LIBRARY NAMES ogg)
find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
endif()
message(STATUS "Ogg: ${OGG_LIBRARY}")
mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY)
if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
set(OGGVORBIS_FOUND TRUE)
set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
if (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 2)
else (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 1)
endif (HAVE_LIBVORBISENC2)
else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
set (OGGVORBIS_VERSION)
set(OGGVORBIS_FOUND FALSE)
endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)
if (OGGVORBIS_FOUND)
if (NOT OggVorbis_FIND_QUIETLY)
message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
endif (NOT OggVorbis_FIND_QUIETLY)
else (OGGVORBIS_FOUND)
if (OggVorbis_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find OggVorbis libraries")
endif (OggVorbis_FIND_REQUIRED)
if (NOT OggVorbis_FIND_QUITELY)
message(STATUS "Could NOT find OggVorbis libraries")
endif (NOT OggVorbis_FIND_QUITELY)
endif (OGGVORBIS_FOUND)