mirror of https://github.com/axmolengine/axmol.git
Merge pull request #124 from halx99/alsoft
Add CMAKE option CC_USE_ALSOFT_ON_APPLE to use kcat openal-soft
This commit is contained in:
commit
908ad3ff04
|
@ -26,18 +26,24 @@ macro(cocos2dx_depend)
|
|||
include_directories(/System/Library/Frameworks)
|
||||
find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
|
||||
find_library(FOUNDATION_LIBRARY Foundation)
|
||||
find_library(OPENAL_LIBRARY OpenAL)
|
||||
find_library(QUARTZCORE_LIBRARY QuartzCore)
|
||||
find_library(GAMECONTROLLER_LIBRARY GameController)
|
||||
find_library(METAL_LIBRARY Metal)
|
||||
set(COCOS_APPLE_LIBS
|
||||
${OPENAL_LIBRARY}
|
||||
${AUDIOTOOLBOX_LIBRARY}
|
||||
${QUARTZCORE_LIBRARY}
|
||||
${FOUNDATION_LIBRARY}
|
||||
${GAMECONTROLLER_LIBRARY}
|
||||
${METAL_LIBRARY}
|
||||
)
|
||||
|
||||
if(NOT CC_USE_ALSOFT_ON_APPLE)
|
||||
find_library(OPENAL_LIBRARY OpenAL)
|
||||
set(COCOS_APPLE_LIBS
|
||||
${OPENAL_LIBRARY}
|
||||
${COCOS_APPLE_LIBS}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(MACOSX)
|
||||
list(APPEND PREBUILT_SPECIFIC_LIBS GLFW3)
|
||||
|
|
|
@ -34,6 +34,18 @@ set(COCOS2D_X_VERSION 4.0)
|
|||
set(COCOS_CORE_LIB cocos2d)
|
||||
project(cocos2d_libs)
|
||||
|
||||
# default value for cocos2dx extensions modules build
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
|
||||
option(BUILD_EXTENSIONS "Build extension library" ON)
|
||||
option(CC_USE_ALSOFT_ON_APPLE "Use openal-soft on apple platform" OFF)
|
||||
|
||||
set(CC_USE_ALSOFT_ON_APPLE ${CC_USE_ALSOFT_ON_APPLE} CACHE BOOL "Use openal-soft on apple platform" FORCE)
|
||||
|
||||
if(CC_USE_ALSOFT_ON_APPLE)
|
||||
add_definitions(-DCC_USE_ALSOFT_ON_APPLE=1)
|
||||
endif()
|
||||
|
||||
include(2d/CMakeLists.txt)
|
||||
include(3d/CMakeLists.txt)
|
||||
include(platform/CMakeLists.txt)
|
||||
|
@ -47,11 +59,6 @@ include(ui/CMakeLists.txt)
|
|||
include(network/CMakeLists.txt)
|
||||
include(audio/CMakeLists.txt)
|
||||
|
||||
# default value for cocos2dx extensions modules build
|
||||
option(BUILD_EDITOR_COCOSTUDIO "Build editor support for cocostudio" ON)
|
||||
option(BUILD_EDITOR_SPINE "Build editor support for spine" ON)
|
||||
option(BUILD_EXTENSIONS "Build extension library" ON)
|
||||
|
||||
if(BUILD_EDITOR_COCOSTUDIO)
|
||||
include(editor-support/cocostudio/CMakeLists.txt)
|
||||
set(COCOS_EDITOR_SUPPORT_SRC ${COCOS_EDITOR_SUPPORT_SRC} ${COCOS_CS_SRC} ${COCOS_CS_HEADER})
|
||||
|
|
|
@ -62,21 +62,19 @@ AudioDecoder* AudioDecoderManager::createDecoder(const std::string& path)
|
|||
{
|
||||
return new (std::nothrow) AudioDecoderOgg();
|
||||
}
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_IOS
|
||||
else if (cxx20::ic::ends_with(svPath, ".mp3"))
|
||||
{
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_IOS
|
||||
return new (std::nothrow) AudioDecoderMp3();
|
||||
#else
|
||||
return new (std::nothrow) AudioDecoderEXT();
|
||||
#endif
|
||||
}
|
||||
else if (cxx20::ic::ends_with(svPath, ".wav")) {
|
||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_IOS
|
||||
return new (std::nothrow) AudioDecoderWav();
|
||||
#else
|
||||
return new (std::nothrow) AudioDecoderEXT();
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
else {
|
||||
return new (std::nothrow) AudioDecoderEXT();
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
#include "platform/CCFileUtils.h"
|
||||
#include "base/ccUtils.h"
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#include "audio/apple/AudioEngineImpl.h"
|
||||
#else
|
||||
#include "audio/include/AudioEngineImpl.h"
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
set(COCOS_AUDIO_SRC
|
||||
audio/AudioEngine.cpp
|
||||
)
|
||||
|
||||
message(STATUS "CC_USE_ALSOFT_ON_APPLE:${CC_USE_ALSOFT_ON_APPLE}")
|
||||
|
||||
if(WINDOWS)
|
||||
|
||||
|
@ -82,20 +84,38 @@ elseif(APPLE)
|
|||
audio/include/AudioDecoderOgg.h
|
||||
audio/include/AudioDecoderWav.h
|
||||
audio/include/AudioCache.h
|
||||
audio/apple/AudioPlayer.h
|
||||
audio/apple/AudioDecoderEXT.h
|
||||
audio/apple/AudioEngineImpl.h
|
||||
)
|
||||
|
||||
set(COCOS_AUDIO_PLATFORM_SRC
|
||||
audio/AudioDecoderManager.cpp
|
||||
audio/AudioDecoder.cpp
|
||||
audio/AudioDecoderOgg.cpp
|
||||
audio/AudioDecoderWav.cpp
|
||||
audio/apple/AudioDecoderEXT.mm
|
||||
audio/apple/AudioCache.mm
|
||||
audio/apple/AudioEngineImpl.mm
|
||||
audio/apple/AudioPlayer.mm
|
||||
)
|
||||
|
||||
if(CC_USE_ALSOFT_ON_APPLE)
|
||||
set(COCOS_AUDIO_PLATFORM_HEADER ${COCOS_AUDIO_PLATFORM_HEADER}
|
||||
audio/include/AudioPlayer.h
|
||||
audio/include/AudioEngineImpl.h
|
||||
)
|
||||
set(COCOS_AUDIO_PLATFORM_SRC ${COCOS_AUDIO_PLATFORM_SRC}
|
||||
audio/AudioCache.cpp
|
||||
audio/AudioPlayer.cpp
|
||||
audio/AudioEngineImpl.cpp
|
||||
)
|
||||
else()
|
||||
set(COCOS_AUDIO_PLATFORM_HEADER ${COCOS_AUDIO_PLATFORM_HEADER}
|
||||
audio/apple/AudioPlayer.h
|
||||
audio/apple/AudioEngineImpl.h
|
||||
)
|
||||
set(COCOS_AUDIO_PLATFORM_SRC ${COCOS_AUDIO_PLATFORM_SRC}
|
||||
audio/apple/AudioCache.mm
|
||||
audio/apple/AudioPlayer.mm
|
||||
audio/apple/AudioEngineImpl.mm
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(COCOS_AUDIO_HEADER
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
#if CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC
|
||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC) && !CC_USE_ALSOFT_ON_APPLE
|
||||
#import <OpenAL/al.h>
|
||||
#else
|
||||
#ifdef OPENAL_PLAIN_INCLUDES
|
||||
|
|
|
@ -117,7 +117,16 @@ THE SOFTWARE.
|
|||
#define CC_USE_GL
|
||||
#endif
|
||||
|
||||
// whether use google angleproject GLES on desktop
|
||||
// https://github.com/google/angle
|
||||
#ifndef CC_USE_GLES_ON_DESKTOP
|
||||
#define CC_USE_GLES_ON_DESKTOP 1
|
||||
#endif
|
||||
|
||||
// whether use https://github.com/kcat/openal-soft on apple platform
|
||||
#ifndef CC_USE_ALSOFT_ON_APPLE
|
||||
#define CC_USE_ALSOFT_ON_APPLE 0
|
||||
#endif
|
||||
|
||||
/// @endcond
|
||||
#endif // __BASE_CC_PLATFORM_CONFIG_H__
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"version": "v51",
|
||||
"version": "v52",
|
||||
"zip_file_size": "107642814",
|
||||
"repo_name": "engine-x-3rd",
|
||||
"repo_parent": "https://github.com/c4games/",
|
||||
|
|
Loading…
Reference in New Issue