mirror of
https://github.com/conan-io/conan-center-index.git
synced 2025-08-09 07:48:56 +00:00
(#15153) add oboe/1.7.0
This commit is contained in:
9
recipes/oboe/all/conandata.yml
Normal file
9
recipes/oboe/all/conandata.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
sources:
|
||||
"1.7.0":
|
||||
url: "https://github.com/google/oboe/archive/refs/tags/1.7.0.tar.gz"
|
||||
sha256: "b01896f9180f725a38806cfef73a29b36b2ea37f91389ed4e69d664ce83b79b6"
|
||||
patches:
|
||||
"1.7.0":
|
||||
- patch_file: "patches/1.7.0-0001-fix-cmake.patch"
|
||||
patch_description: "Fix CMakeLists"
|
||||
patch_type: "conan"
|
65
recipes/oboe/all/conanfile.py
Normal file
65
recipes/oboe/all/conanfile.py
Normal file
@@ -0,0 +1,65 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class OboeConan(ConanFile):
|
||||
name = "oboe"
|
||||
description = "Oboe is a C++ library which makes it easy to build high-performance audio apps on Android."
|
||||
license = "Apache-2.0"
|
||||
topics = ("android", "audio")
|
||||
homepage = "https://github.com/google/oboe"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
|
||||
settings = "os", "arch", "compiler", "build_type",
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.os != "Android":
|
||||
raise ConanInvalidConfiguration("oboe supports Android only")
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, 17)
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.libs = ["oboe"]
|
||||
self.cpp_info.system_libs.extend(["log", "OpenSLES"])
|
30
recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch
Normal file
30
recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch
Normal file
@@ -0,0 +1,30 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -79,13 +79,13 @@ target_include_directories(oboe
|
||||
# Enable -Ofast
|
||||
target_compile_options(oboe
|
||||
PRIVATE
|
||||
- -std=c++17
|
||||
-Wall
|
||||
-Wextra-semi
|
||||
-Wshadow
|
||||
-Wshadow-field
|
||||
-Ofast
|
||||
- "$<$<CONFIG:DEBUG>:-Werror>")
|
||||
+)
|
||||
+target_compile_features(oboe PUBLIC cxx_std_17)
|
||||
|
||||
# Enable logging of D,V for debug builds
|
||||
target_compile_definitions(oboe PUBLIC $<$<CONFIG:DEBUG>:OBOE_ENABLE_LOGGING=1>)
|
||||
@@ -94,8 +94,8 @@ target_link_libraries(oboe PRIVATE log OpenSLES)
|
||||
|
||||
# When installing oboe put the libraries in the lib/<ABI> folder e.g. lib/arm64-v8a
|
||||
install(TARGETS oboe
|
||||
- LIBRARY DESTINATION lib/${ANDROID_ABI}
|
||||
- ARCHIVE DESTINATION lib/${ANDROID_ABI})
|
||||
+ LIBRARY DESTINATION lib
|
||||
+ ARCHIVE DESTINATION lib)
|
||||
|
||||
# Also install the headers
|
||||
install(DIRECTORY include/oboe DESTINATION include)
|
||||
\ No newline at end of file
|
8
recipes/oboe/all/test_package/CMakeLists.txt
Normal file
8
recipes/oboe/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(oboe REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE oboe::oboe)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
|
26
recipes/oboe/all/test_package/conanfile.py
Normal file
26
recipes/oboe/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,26 @@
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, cmake_layout
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package")
|
||||
self.run(bin_path, env="conanrun")
|
11
recipes/oboe/all/test_package/test_package.cpp
Normal file
11
recipes/oboe/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <oboe/Oboe.h>
|
||||
|
||||
int main() {
|
||||
oboe::AudioStreamBuilder builder;
|
||||
builder.setDirection(oboe::Direction::Output);
|
||||
builder.setPerformanceMode(oboe::PerformanceMode::LowLatency);
|
||||
builder.setSharingMode(oboe::SharingMode::Exclusive);
|
||||
builder.setFormat(oboe::AudioFormat::Float);
|
||||
builder.setChannelCount(oboe::ChannelCount::Mono);
|
||||
return 0;
|
||||
}
|
8
recipes/oboe/all/test_v1_package/CMakeLists.txt
Normal file
8
recipes/oboe/all/test_v1_package/CMakeLists.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package)
|
17
recipes/oboe/all/test_v1_package/conanfile.py
Normal file
17
recipes/oboe/all/test_v1_package/conanfile.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from conans import ConanFile, CMake, tools
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not tools.cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
3
recipes/oboe/config.yml
Normal file
3
recipes/oboe/config.yml
Normal file
@@ -0,0 +1,3 @@
|
||||
versions:
|
||||
"1.7.0":
|
||||
folder: all
|
Reference in New Issue
Block a user