-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
176 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sources: | ||
"cci.20230529": | ||
url: "https://github.com/mackron/dr_libs/archive/dbbd08d81fd2b084c5ae931531871d0c5fd83b87.tar.gz" | ||
sha256: "9e8d488092c9a0a6b08d9aafc631b1c8d75e707bc10a56a5f4bb1709213702c1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
from conan import ConanFile | ||
from conan.tools.files import get, copy | ||
from conan.tools.build import check_min_cppstd | ||
from conan.tools.layout import basic_layout | ||
from conan.tools.microsoft import is_msvc, check_min_vs | ||
from conan.tools.scm import Version | ||
from conan.errors import ConanInvalidConfiguration | ||
|
||
import os | ||
|
||
required_conan_version = ">=1.52.0" | ||
|
||
|
||
class DrLibsConan(ConanFile): | ||
name = "dr_libs" | ||
description = "Public domain, single file audio decoding libraries for C and C++." | ||
license = ("Unlicense", "MIT-0") | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/mackron/dr_libs" | ||
topics = ("audio", "encoding", "header-only") | ||
no_copy_source = True | ||
settings = "os", "arch", "compiler", "build_type" | ||
package_type = "header-library" | ||
|
||
@property | ||
def _min_cppstd(self): | ||
return 11 | ||
|
||
@property | ||
def _compilers_minimum_version(self): | ||
return { | ||
"gcc": "4.7", | ||
"clang": "3.4", | ||
"apple-clang": "6", | ||
} | ||
|
||
def validate(self): | ||
if self.settings.get_safe("compiler.cppstd"): | ||
check_min_cppstd(self, self._min_cppstd) | ||
check_min_vs(self, 180) | ||
if not is_msvc(self): | ||
minimum_version = self._compilers_minimum_version.get( | ||
str(self.settings.compiler), False) | ||
if minimum_version and Version(self.settings.compiler.version) < minimum_version: | ||
raise ConanInvalidConfiguration( | ||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." | ||
) | ||
|
||
def layout(self): | ||
basic_layout(self, src_folder="src") | ||
|
||
def package_id(self): | ||
self.info.clear() | ||
|
||
def source(self): | ||
get(self, **self.conan_data["sources"][self.version], strip_root=True) | ||
|
||
def package(self): | ||
copy(self, pattern="LICENSE", dst=os.path.join( | ||
self.package_folder, "licenses"), src=self.source_folder) | ||
copy( | ||
self, | ||
pattern="*.h", | ||
dst=os.path.join(self.package_folder, "include"), | ||
src=self.source_folder, | ||
excludes=("old/*", "wip/*", "tests/*") | ||
) | ||
|
||
def package_info(self): | ||
self.cpp_info.bindirs = [] | ||
self.cpp_info.libdirs = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
project(test_DrLibs LANGUAGES CXX) | ||
find_package(dr_libs REQUIRED CONFIG) | ||
|
||
add_executable(${PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE dr_libs::dr_libs) | ||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from conan import ConanFile | ||
from conan.tools.build import can_run | ||
from conan.tools.cmake import cmake_layout, CMake | ||
import os | ||
|
||
|
||
# It will become the standard on Conan 2.x | ||
class TestDrLibsConan(ConanFile): | ||
settings = "os", "arch", "compiler", "build_type" | ||
generators = "CMakeDeps", "CMakeToolchain", "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.bindir, "test_DrLibs") | ||
self.run(bin_path, env="conanrun") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#define DR_WAV_IMPLEMENTATION | ||
#include "dr_wav.h" | ||
#include <vector> | ||
#include <iostream> | ||
#include <random> | ||
|
||
#define BUFFER_SIZE 255 | ||
|
||
int main() { | ||
srand(time(NULL)); | ||
|
||
// Create fake PCM data | ||
std::vector<drwav_int16> buffer(BUFFER_SIZE); | ||
for (size_t i = 0; i < BUFFER_SIZE; i++) | ||
buffer[i] = rand() % std::numeric_limits<drwav_int16>::max(); | ||
|
||
// Convert it to 32-bit floating point | ||
std::vector<float> asFloat(buffer.size()); | ||
drwav_s16_to_f32(asFloat.data(), buffer.data(), buffer.size()); | ||
|
||
// If we get here with no issues, then it's a success | ||
std::cout << "Test success!" << std::endl; | ||
return DRWAV_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"cci.20230529": | ||
folder: all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
versions: | ||
"3.91": | ||
folder: all | ||
"3.89": | ||
folder: all | ||
"3.88.1": | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
versions: | ||
"1.0.6": | ||
folder: all | ||
"1.0.1": | ||
folder: all | ||
"1.0.0": | ||
|