Add an Oboe backend stub
This commit is contained in:
parent
a1e5f4eb83
commit
67e54a2669
@ -988,6 +988,35 @@ IF(ALSOFT_REQUIRE_OPENSL AND NOT HAVE_OPENSL)
|
||||
MESSAGE(FATAL_ERROR "Failed to enabled required OpenSL backend")
|
||||
ENDIF()
|
||||
|
||||
# Check for Oboe (Android) backend
|
||||
set(OBOE_TARGET )
|
||||
if(ANDROID)
|
||||
set(OBOE_SOURCE "" CACHE STRING "Source directory for Oboe.")
|
||||
if(OBOE_SOURCE)
|
||||
add_subdirectory(${OBOE_SOURCE} ./oboe)
|
||||
set(OBOE_TARGET oboe)
|
||||
else()
|
||||
find_package(Oboe)
|
||||
if(OBOE_FOUND)
|
||||
set(OBOE_TARGET "oboe::oboe")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
option(ALSOFT_REQUIRE_OBOE "Require Oboe backend" OFF)
|
||||
if(OBOE_TARGET)
|
||||
option(ALSOFT_BACKEND_OBOE "Enable Oboe backend" ON)
|
||||
if(ALSOFT_BACKEND_OBOE)
|
||||
set(HAVE_OBOE 1)
|
||||
set(ALC_OBJS ${ALC_OBJS} alc/backends/oboe.cpp alc/backends/oboe.h)
|
||||
set(BACKENDS "${BACKENDS} Oboe,")
|
||||
set(EXTRA_LIBS ${OBOE_TARGET} ${EXTRA_LIBS})
|
||||
endif()
|
||||
endif()
|
||||
if(ALSOFT_REQUIRE_OBOE AND NOT HAVE_OBOE)
|
||||
message(FATAL_ERROR "Failed to enabled required Oboe backend")
|
||||
endif()
|
||||
|
||||
# Check for SDL2 backend
|
||||
OPTION(ALSOFT_REQUIRE_SDL2 "Require SDL2 backend" OFF)
|
||||
FIND_PACKAGE(SDL2)
|
||||
|
@ -116,6 +116,9 @@
|
||||
#ifdef HAVE_OPENSL
|
||||
#include "backends/opensl.h"
|
||||
#endif
|
||||
#ifdef HAVE_OBOE
|
||||
#include "backends/oboe.h"
|
||||
#endif
|
||||
#ifdef HAVE_SOLARIS
|
||||
#include "backends/solaris.h"
|
||||
#endif
|
||||
@ -173,6 +176,9 @@ BackendInfo BackendList[] = {
|
||||
#ifdef HAVE_COREAUDIO
|
||||
{ "core", CoreAudioBackendFactory::getFactory },
|
||||
#endif
|
||||
#ifdef HAVE_OBOE
|
||||
{ "oboe", OboeBackendFactory::getFactory },
|
||||
#endif
|
||||
#ifdef HAVE_OPENSL
|
||||
{ "opensl", OSLBackendFactory::getFactory },
|
||||
#endif
|
||||
|
28
alc/backends/oboe.cpp
Normal file
28
alc/backends/oboe.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "oboe.h"
|
||||
|
||||
#include "oboe/Oboe.h"
|
||||
|
||||
|
||||
bool OboeBackendFactory::init() { return true; }
|
||||
|
||||
bool OboeBackendFactory::querySupport(BackendType /*type*/)
|
||||
{ return false; }
|
||||
|
||||
std::string OboeBackendFactory::probe(BackendType /*type*/)
|
||||
{
|
||||
return std::string{};
|
||||
}
|
||||
|
||||
BackendPtr OboeBackendFactory::createBackend(ALCdevice* /*device*/, BackendType /*type*/)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
BackendFactory &OboeBackendFactory::getFactory()
|
||||
{
|
||||
static OboeBackendFactory factory{};
|
||||
return factory;
|
||||
}
|
19
alc/backends/oboe.h
Normal file
19
alc/backends/oboe.h
Normal file
@ -0,0 +1,19 @@
|
||||
#ifndef BACKENDS_OBOE_H
|
||||
#define BACKENDS_OBOE_H
|
||||
|
||||
#include "backends/base.h"
|
||||
|
||||
struct OboeBackendFactory final : public BackendFactory {
|
||||
public:
|
||||
bool init() override;
|
||||
|
||||
bool querySupport(BackendType type) override;
|
||||
|
||||
std::string probe(BackendType type) override;
|
||||
|
||||
BackendPtr createBackend(ALCdevice *device, BackendType type) override;
|
||||
|
||||
static BackendFactory &getFactory();
|
||||
};
|
||||
|
||||
#endif /* BACKENDS_OBOE_H */
|
31
cmake/FindOboe.cmake
Normal file
31
cmake/FindOboe.cmake
Normal file
@ -0,0 +1,31 @@
|
||||
# - Find Oboe
|
||||
# Find the Oboe library
|
||||
#
|
||||
# This module defines the following variable:
|
||||
# OBOE_FOUND - True if Oboe was found
|
||||
#
|
||||
# This module defines the following target:
|
||||
# oboe::oboe - Import target for linking Oboe to a project
|
||||
#
|
||||
|
||||
find_path(OBOE_INCLUDE_DIR NAMES oboe/Oboe.h
|
||||
DOC "The Oboe include directory"
|
||||
)
|
||||
|
||||
find_library(OBOE_LIBRARY NAMES oboe
|
||||
DOC "The Oboe library"
|
||||
)
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set OBOE_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(Oboe REQUIRED_VARS OBOE_LIBRARY OBOE_INCLUDE_DIR)
|
||||
|
||||
if(OBOE_FOUND)
|
||||
add_library(oboe::oboe UNKNOWN IMPORTED)
|
||||
set_target_properties(oboe::oboe PROPERTIES
|
||||
IMPORTED_LOCATION ${OBOE_LIBRARY}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${OBOE_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
mark_as_advanced(OBOE_INCLUDE_DIR OBOE_LIBRARY)
|
@ -65,6 +65,9 @@
|
||||
/* Define if we have the OpenSL backend */
|
||||
#cmakedefine HAVE_OPENSL
|
||||
|
||||
/* Define if we have the Oboe backend */
|
||||
#cmakedefine HAVE_OBOE
|
||||
|
||||
/* Define if we have the Wave Writer backend */
|
||||
#cmakedefine HAVE_WAVE
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user