Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ogg: add 1.3.5 + modernize #9021

Merged
merged 3 commits into from
Feb 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions recipes/ogg/all/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.1)
project(cmake_wrapper)

if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake")
else()
include(conanbuildinfo.cmake)
endif()
conan_basic_setup()
include(conanbuildinfo.cmake)
conan_basic_setup(KEEP_RPATHS)

add_subdirectory("source_subfolder")
3 changes: 3 additions & 0 deletions recipes/ogg/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"1.3.5":
url: "https://github.com/xiph/ogg/archive/refs/tags/v1.3.5.tar.gz"
sha256: "f6f1b04cfa4e98b70ffe775d5e302d9c6b98541f05159af6de2d6617817ed7d6"
"1.3.4":
url: "https://github.com/xiph/ogg/archive/v1.3.4.tar.gz"
sha256: "3da31a4eb31534b6f878914b7379b873c280e610649fe5c07935b3d137a828bc"
Expand Down
40 changes: 31 additions & 9 deletions recipes/ogg/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
from conans import ConanFile, CMake, tools
import os

required_conan_version = ">=1.43.0"


class OggConan(ConanFile):
name = "ogg"
description = "The OGG library"
topics = ("conan", "ogg", "codec", "audio", "lossless")
topics = ("ogg", "codec", "audio", "lossless")
url = "https://github.com/conan-io/conan-center-index"
homepage = "https://github.com/xiph/ogg"
license = "BSD-2-Clause"
exports_sources = ["CMakeLists.txt", "patches/*"]
generators = "cmake"

settings = "os", "arch", "build_type", "compiler"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
options = {
"shared": [True, False],
"fPIC": [True, False],
}
default_options = {
"shared": False,
"fPIC": True,
}

generators = "cmake"
_cmake = None

@property
Expand All @@ -25,6 +33,11 @@ def _source_subfolder(self):
def _build_subfolder(self):
return "build_subfolder"

def export_sources(self):
self.copy("CMakeLists.txt")
for patch in self.conan_data.get("patches", {}).get(self.version, []):
self.copy(patch["patch_file"])

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Expand All @@ -36,14 +49,15 @@ def configure(self):
del self.settings.compiler.cppstd

def source(self):
tools.get(**self.conan_data["sources"][self.version])
extracted_dir = self.name + "-" + self.version
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def _configure_cmake(self):
if self._cmake:
return self._cmake
self._cmake = CMake(self)
# Generate a relocatable shared lib on Macos
self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW"
self._cmake.configure(build_folder=self._build_subfolder)
return self._cmake

Expand All @@ -62,8 +76,16 @@ def package(self):
tools.rmdir(os.path.join(self.package_folder, "share"))

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "Ogg")
self.cpp_info.set_property("cmake_target_name", "Ogg::ogg")
self.cpp_info.set_property("pkg_config_name", "ogg")
# TODO: back to global scope in conan v2 once cmake_find_package_* generators removed
self.cpp_info.components["ogglib"].libs = ["ogg"]

# TODO: to remove in conan v2 once cmake_find_package_* generators removed
self.cpp_info.names["cmake_find_package"] = "Ogg"
self.cpp_info.names["cmake_find_package_multi"] = "Ogg"
self.cpp_info.components["ogglib"].names["cmake_find_package"] = "ogg"
self.cpp_info.components["ogglib"].names["cmake_find_package_multi"] = "ogg"
self.cpp_info.components["ogglib"].libs = ["ogg"]
self.cpp_info.components["ogglib"].set_property("cmake_target_name", "Ogg::ogg")
self.cpp_info.components["ogglib"].set_property("pkg_config_name", "ogg")
2 changes: 1 addition & 1 deletion recipes/ogg/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1)
project(test_package C)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)

find_package(Ogg REQUIRED CONFIG)

Expand Down
4 changes: 2 additions & 2 deletions recipes/ogg/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@


class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
settings = "os", "arch", "compiler", "build_type"
generators = "cmake", "cmake_find_package_multi"

def build(self):
Expand All @@ -12,6 +12,6 @@ def build(self):
cmake.build()

def test(self):
if not tools.cross_building(self.settings):
if not tools.cross_building(self):
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
2 changes: 2 additions & 0 deletions recipes/ogg/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
versions:
"1.3.5":
folder: all
"1.3.4":
folder: all