[DO-981] qt package (!15)
Co-authored-by: aleksandr.vodyanov <aleksandr.vodyanov@avroid.tech> Reviewed-on: https://git.avroid.tech/Conan/conan_build/pulls/15
This commit is contained in:
12
recipes/openal-soft/all/conandata.yml
Normal file
12
recipes/openal-soft/all/conandata.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
sources:
|
||||
"1.23.1":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/kcat/openal-soft/releases/download/1.23.1/openal-soft-1.23.1.tar.bz2"
|
||||
sha256: "796f4b89134c4e57270b7f0d755f0fa3435b90da437b745160a49bd41c845b21"
|
||||
"1.22.2":
|
||||
url: "https://nexus.avroid.tech/repository/devops-raw-proxy-github/kcat/openal-soft/releases/download/1.22.2/openal-soft-1.22.2.tar.bz2"
|
||||
sha256: "ae94cc95cda76b7cc6e92e38c2531af82148e76d3d88ce996e2928a1ea7c3d20"
|
||||
patches:
|
||||
"1.22.2":
|
||||
- patch_file: "patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch"
|
||||
patch_source: "https://github.com/kcat/openal-soft/commit/650a6d49e9a511d005171940761f6dd6b440ee66"
|
||||
- patch_file: "patches/1.22.2-0002-fix-pulseaudio-find-package-vars.patch"
|
||||
158
recipes/openal-soft/all/conanfile.py
Normal file
158
recipes/openal-soft/all/conanfile.py
Normal file
@@ -0,0 +1,158 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.apple import is_apple_os
|
||||
from conan.tools.build import check_min_cppstd, stdcpp_library
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, collect_libs, export_conandata_patches, copy, get, rmdir, save
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
import textwrap
|
||||
|
||||
required_conan_version = ">=1.54.0"
|
||||
|
||||
|
||||
class OpenALSoftConan(ConanFile):
|
||||
name = "openal-soft"
|
||||
description = "OpenAL Soft is a software implementation of the OpenAL 3D audio API."
|
||||
topics = ("openal", "audio", "api")
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://openal-soft.org/"
|
||||
license = "LGPL-2.0-or-later"
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
}
|
||||
|
||||
@property
|
||||
def _min_cppstd(self):
|
||||
return 14
|
||||
|
||||
@property
|
||||
def _minimum_compilers_version(self):
|
||||
return {
|
||||
"Visual Studio": "15",
|
||||
"msvc": "191",
|
||||
"gcc": "6",
|
||||
"clang": "5",
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
|
||||
def configure(self):
|
||||
if self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
# OpenAL's API is pure C, thus the c++ standard does not matter
|
||||
# Because the backend is C++, the C++ STL matters
|
||||
self.settings.rm_safe("compiler.cppstd")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
if self.settings.os == "Linux":
|
||||
self.requires("libalsa/1.2.10")
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, self._min_cppstd)
|
||||
|
||||
compiler = self.settings.compiler
|
||||
|
||||
minimum_version = self._minimum_compilers_version.get(str(compiler), False)
|
||||
if minimum_version and Version(compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration(
|
||||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.",
|
||||
)
|
||||
|
||||
if compiler == "clang" and Version(compiler.version) < "9" and \
|
||||
compiler.get_safe("libcxx") in ("libstdc++", "libstdc++11"):
|
||||
raise ConanInvalidConfiguration(
|
||||
f"{self.ref} cannot be built with {compiler} {compiler.version} and stdlibc++(11) c++ runtime",
|
||||
)
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["LIBTYPE"] = "SHARED" if self.options.shared else "STATIC"
|
||||
tc.variables["ALSOFT_UTILS"] = False
|
||||
tc.variables["ALSOFT_EXAMPLES"] = False
|
||||
tc.variables["ALSOFT_TESTS"] = False
|
||||
tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SoundIO"] = True
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
self._create_cmake_module_variables(
|
||||
os.path.join(self.package_folder, self._module_file_rel_path)
|
||||
)
|
||||
|
||||
def _create_cmake_module_variables(self, module_file):
|
||||
content = textwrap.dedent(f"""\
|
||||
set(OPENAL_FOUND TRUE)
|
||||
if(DEFINED OpenAL_INCLUDE_DIR)
|
||||
set(OPENAL_INCLUDE_DIR ${{OpenAL_INCLUDE_DIR}})
|
||||
endif()
|
||||
if(DEFINED OpenAL_LIBRARIES)
|
||||
set(OPENAL_LIBRARY ${{OpenAL_LIBRARIES}})
|
||||
endif()
|
||||
set(OPENAL_VERSION_STRING {self.version})
|
||||
""")
|
||||
save(self, module_file, content)
|
||||
|
||||
@property
|
||||
def _module_file_rel_path(self):
|
||||
return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake")
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.set_property("cmake_find_mode", "both")
|
||||
self.cpp_info.set_property("cmake_file_name", "OpenAL")
|
||||
self.cpp_info.set_property("cmake_target_name", "OpenAL::OpenAL")
|
||||
self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path])
|
||||
self.cpp_info.set_property("pkg_config_name", "openal")
|
||||
|
||||
self.cpp_info.names["cmake_find_package"] = "OpenAL"
|
||||
self.cpp_info.names["cmake_find_package_multi"] = "OpenAL"
|
||||
self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path]
|
||||
|
||||
self.cpp_info.libs = collect_libs(self)
|
||||
self.cpp_info.includedirs.append(os.path.join("include", "AL"))
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.system_libs.extend(["dl", "m"])
|
||||
elif is_apple_os(self):
|
||||
self.cpp_info.frameworks.extend(["AudioToolbox", "AudioUnit", "CoreAudio", "CoreFoundation"])
|
||||
if self.settings.os == "Macos":
|
||||
self.cpp_info.frameworks.append("ApplicationServices")
|
||||
elif self.settings.os == "Windows":
|
||||
self.cpp_info.system_libs.extend(["winmm", "ole32", "shell32", "user32"])
|
||||
if not self.options.shared:
|
||||
libcxx = stdcpp_library(self)
|
||||
if libcxx:
|
||||
self.cpp_info.system_libs.append(libcxx)
|
||||
if not self.options.shared:
|
||||
self.cpp_info.defines.append("AL_LIBTYPE_STATIC")
|
||||
if self.settings.get_safe("compiler.libcxx") in ["libstdc++", "libstdc++11"]:
|
||||
self.cpp_info.system_libs.append("atomic")
|
||||
@@ -0,0 +1,47 @@
|
||||
From 650a6d49e9a511d005171940761f6dd6b440ee66 Mon Sep 17 00:00:00 2001
|
||||
From: Chris Robinson <chris.kcat@gmail.com>
|
||||
Date: Mon, 18 Jul 2022 11:10:27 -0700
|
||||
Subject: [PATCH] Declare variables closer to where they're used
|
||||
|
||||
---
|
||||
alc/backends/alsa.cpp | 6 ++----
|
||||
1 file changed, 2 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp
|
||||
index 9c78b6c6a..b6efeaba1 100644
|
||||
--- a/alc/backends/alsa.cpp
|
||||
+++ b/alc/backends/alsa.cpp
|
||||
@@ -623,7 +623,6 @@ int AlsaPlayback::mixerNoMMapProc()
|
||||
|
||||
void AlsaPlayback::open(const char *name)
|
||||
{
|
||||
- al::optional<std::string> driveropt;
|
||||
const char *driver{"default"};
|
||||
if(name)
|
||||
{
|
||||
@@ -640,7 +639,7 @@ void AlsaPlayback::open(const char *name)
|
||||
else
|
||||
{
|
||||
name = alsaDevice;
|
||||
- if(bool{driveropt = ConfigValueStr(nullptr, "alsa", "device")})
|
||||
+ if(auto driveropt = ConfigValueStr(nullptr, "alsa", "device"))
|
||||
driver = driveropt->c_str();
|
||||
}
|
||||
TRACE("Opening device \"%s\"\n", driver);
|
||||
@@ -896,7 +895,6 @@ AlsaCapture::~AlsaCapture()
|
||||
|
||||
void AlsaCapture::open(const char *name)
|
||||
{
|
||||
- al::optional<std::string> driveropt;
|
||||
const char *driver{"default"};
|
||||
if(name)
|
||||
{
|
||||
@@ -913,7 +911,7 @@ void AlsaCapture::open(const char *name)
|
||||
else
|
||||
{
|
||||
name = alsaDevice;
|
||||
- if(bool{driveropt = ConfigValueStr(nullptr, "alsa", "capture")})
|
||||
+ if(auto driveropt = ConfigValueStr(nullptr, "alsa", "capture"))
|
||||
driver = driveropt->c_str();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 1984ac9..75e904d 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -1051,8 +1051,8 @@ if(PULSEAUDIO_FOUND)
|
||||
set(HAVE_PULSEAUDIO 1)
|
||||
set(BACKENDS "${BACKENDS} PulseAudio${IS_LINKED},")
|
||||
set(ALC_OBJS ${ALC_OBJS} alc/backends/pulseaudio.cpp alc/backends/pulseaudio.h)
|
||||
- add_backend_libs(${PULSEAUDIO_LIBRARIES})
|
||||
- set(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIRS})
|
||||
+ add_backend_libs(${PULSEAUDIO_LIBRARY})
|
||||
+ set(INC_PATHS ${INC_PATHS} ${PULSEAUDIO_INCLUDE_DIR})
|
||||
endif()
|
||||
endif()
|
||||
if(ALSOFT_REQUIRE_PULSEAUDIO AND NOT HAVE_PULSEAUDIO)
|
||||
22
recipes/openal-soft/all/test_package/CMakeLists.txt
Normal file
22
recipes/openal-soft/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,22 @@
|
||||
cmake_minimum_required(VERSION 3.1)
|
||||
project(test_package LANGUAGES C)
|
||||
|
||||
find_package(OpenAL REQUIRED)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.c)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL::OpenAL)
|
||||
|
||||
# Test whether variables from https://cmake.org/cmake/help/latest/module/FindOpenAL.html are properly defined
|
||||
set(_custom_vars
|
||||
OPENAL_FOUND
|
||||
OPENAL_INCLUDE_DIR
|
||||
OPENAL_LIBRARY
|
||||
OPENAL_VERSION_STRING
|
||||
)
|
||||
foreach(_custom_var ${_custom_vars})
|
||||
if(DEFINED ${_custom_var})
|
||||
message(STATUS "${_custom_var}: ${${_custom_var}}")
|
||||
else()
|
||||
message(FATAL_ERROR "${_custom_var} not defined")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"version": 4,
|
||||
"vendor": {
|
||||
"conan": {}
|
||||
},
|
||||
"include": [
|
||||
"build/gcc-12-x86_64-gnu17-release/generators/CMakePresets.json"
|
||||
]
|
||||
}
|
||||
26
recipes/openal-soft/all/test_package/conanfile.py
Normal file
26
recipes/openal-soft/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")
|
||||
134
recipes/openal-soft/all/test_package/test_package.c
Normal file
134
recipes/openal-soft/all/test_package/test_package.c
Normal file
@@ -0,0 +1,134 @@
|
||||
#include "alc.h"
|
||||
#include "al.h"
|
||||
#include "alext.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static ALenum checkALErrors(int linenum)
|
||||
{
|
||||
ALenum err = alGetError();
|
||||
if(err != AL_NO_ERROR)
|
||||
printf("OpenAL Error: %s (0x%x), @ %d\n", alGetString(err), err, linenum);
|
||||
return err;
|
||||
}
|
||||
#define checkALErrors() checkALErrors(__LINE__)
|
||||
|
||||
static ALCenum checkALCErrors(ALCdevice *device, int linenum)
|
||||
{
|
||||
ALCenum err = alcGetError(device);
|
||||
if(err != ALC_NO_ERROR)
|
||||
printf("ALC Error: %s (0x%x), @ %d\n", alcGetString(device, err), err, linenum);
|
||||
return err;
|
||||
}
|
||||
#define checkALCErrors(x) checkALCErrors((x),__LINE__)
|
||||
|
||||
#define MAX_WIDTH 80
|
||||
|
||||
static void printList(const char *list, char separator)
|
||||
{
|
||||
size_t col = MAX_WIDTH, len;
|
||||
const char *indent = " ";
|
||||
const char *next;
|
||||
|
||||
if(!list || *list == '\0')
|
||||
{
|
||||
fprintf(stdout, "\n%s!!! none !!!\n", indent);
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
next = strchr(list, separator);
|
||||
if(next)
|
||||
{
|
||||
len = next-list;
|
||||
do {
|
||||
next++;
|
||||
} while(*next == separator);
|
||||
}
|
||||
else
|
||||
len = strlen(list);
|
||||
|
||||
if(len + col + 2 >= MAX_WIDTH)
|
||||
{
|
||||
fprintf(stdout, "\n%s", indent);
|
||||
col = strlen(indent);
|
||||
}
|
||||
else
|
||||
{
|
||||
fputc(' ', stdout);
|
||||
col++;
|
||||
}
|
||||
|
||||
len = fwrite(list, 1, len, stdout);
|
||||
col += len;
|
||||
|
||||
if(!next || *next == '\0')
|
||||
break;
|
||||
fputc(',', stdout);
|
||||
col++;
|
||||
|
||||
list = next;
|
||||
} while(1);
|
||||
fputc('\n', stdout);
|
||||
}
|
||||
|
||||
static void printALCInfo(ALCdevice *device)
|
||||
{
|
||||
ALCint major, minor;
|
||||
|
||||
if(device)
|
||||
{
|
||||
const ALCchar *devname = NULL;
|
||||
printf("\n");
|
||||
if(alcIsExtensionPresent(device, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||
devname = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER);
|
||||
if(checkALCErrors(device) != ALC_NO_ERROR || !devname)
|
||||
devname = alcGetString(device, ALC_DEVICE_SPECIFIER);
|
||||
printf("** Info for device \"%s\" **\n", devname);
|
||||
}
|
||||
alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major);
|
||||
alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor);
|
||||
if(checkALCErrors(device) == ALC_NO_ERROR)
|
||||
printf("ALC version: %d.%d\n", major, minor);
|
||||
if(device)
|
||||
{
|
||||
printf("ALC extensions:");
|
||||
printList(alcGetString(device, ALC_EXTENSIONS), ' ');
|
||||
checkALCErrors(device);
|
||||
}
|
||||
}
|
||||
|
||||
static void printDeviceList(const char *list)
|
||||
{
|
||||
if(!list || *list == '\0')
|
||||
printf(" !!! none !!!\n");
|
||||
else do {
|
||||
printf(" %s\n", list);
|
||||
list += strlen(list) + 1;
|
||||
} while(*list != '\0');
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
printf("Available playback devices:\n");
|
||||
if(alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||
printDeviceList(alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER));
|
||||
else
|
||||
printDeviceList(alcGetString(NULL, ALC_DEVICE_SPECIFIER));
|
||||
printf("Available capture devices:\n");
|
||||
printDeviceList(alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER));
|
||||
|
||||
if(alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE)
|
||||
printf("Default playback device: %s\n",
|
||||
alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER));
|
||||
else
|
||||
printf("Default playback device: %s\n",
|
||||
alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER));
|
||||
printf("Default capture device: %s\n",
|
||||
alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER));
|
||||
|
||||
printALCInfo(NULL);
|
||||
|
||||
return 0;
|
||||
}
|
||||
5
recipes/openal-soft/config.yml
Normal file
5
recipes/openal-soft/config.yml
Normal file
@@ -0,0 +1,5 @@
|
||||
versions:
|
||||
"1.23.1":
|
||||
folder: all
|
||||
"1.22.2":
|
||||
folder: all
|
||||
Reference in New Issue
Block a user