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

Add recipe for the bmx library provided by the BBC #23955

Merged
merged 21 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
20d814a
Add recipe for the bmx library provided by the BBC
irieger May 10, 2024
212bf98
Add libcurl flag to conanfile
irieger May 10, 2024
2b286d3
Add version ranges for expat & libcurl and remove fixed target C++ ve…
irieger May 10, 2024
93784ed
Switch linking of CURL to public as otherwise on Linux there is a ton…
irieger May 10, 2024
2bcf4ec
Add patch source for compatibility patch
irieger May 10, 2024
a89734a
Merge remote-tracking branch 'cci-origin/master' into bmx/add-recipe
irieger May 11, 2024
d27895d
Merge branch 'master' into bmx/add-recipe
AbrilRBS May 12, 2024
7c88047
Fix all the deps to not use their own CXX standard override
irieger May 13, 2024
6afb600
Bump the CCI tagged release build to the latest commit which integrat…
irieger May 13, 2024
70efc6f
Merge remote-tracking branch 'cci/master' into bmx/add-recipe
irieger May 13, 2024
3a93aad
Remove unused import
irieger May 13, 2024
8533171
Remove -O2 flag & bump cci-version to current master with upstream ch…
irieger May 17, 2024
4c130cc
Merge remote-tracking branch 'cci/master' into bmx/add-recipe
irieger May 17, 2024
b2a0db1
Merge branch 'master' into bmx/add-recipe
AbrilRBS May 22, 2024
f4e1354
Add the target_compile_features as applied by https://github.com/bbc/…
irieger May 22, 2024
2c10f67
Enforce minimum CXX11 for test package too
irieger May 22, 2024
181a3d4
Merge branch 'master' into bmx/add-recipe
AbrilRBS May 23, 2024
a0c5cfb
Merge branch 'master' into bmx/add-recipe
irieger May 30, 2024
31ce667
Merge remote-tracking branch 'cci/master' into bmx/add-recipe
irieger Jun 15, 2024
4535a55
Deactivate windows shared library building
irieger Jun 15, 2024
97e76c5
Add a descriptive comment for the restriction to disallow shared buil…
irieger Jun 16, 2024
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
16 changes: 16 additions & 0 deletions recipes/bmx/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sources:
"1.2":
url: "https://github.com/bbc/bmx/archive/refs/tags/v1.2.tar.gz"
sha256: "e64d91b2d27478d6b892d72183e1ecf79c99880b079ce04442432f3caed1e259"
"cci.20240510":
url: "https://github.com/bbc/bmx/archive/38204bbb2637da99c288b61d02c60f1d2d926a7d.tar.gz"
sha256: "c2c650461fe4c0bde83e1145a064d6ff4295350246d8c9ee0456b86013dfb79e"
patches:
"1.2":
- patch_file: "patches/1.2-cmake-fixes.patch"
patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)"
patch_type: "conan"
"cci.20240510":
- patch_file: "patches/1.2-cmake-fixes.patch"
patch_description: "Ensure project builds correctly with Conan (don't pick up disabled dependencies from the system, fix different spelling of libraries)"
patch_type: "conan"
131 changes: 131 additions & 0 deletions recipes/bmx/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
from conan import ConanFile
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rm, rmdir

Check warning on line 4 in recipes/bmx/all/conanfile.py

View workflow job for this annotation

GitHub Actions / Lint changed conanfile.py (v2 migration)

Unused rm imported from conan.tools.files
import os

required_conan_version = ">=1.53.0"


class BmxConan(ConanFile):
name = "bmx"
description = (
"Library for handling broadcast/production oriented media file formats. "
"Allows reading, modifying and writing media metadata and file essences."
)
topics = ("vfx", "image", "picture", "video", "multimedia", "mxf")
license = "BSD-3-Clause"
homepage = "https://github.com/bbc/bmx"
url = "https://github.com/conan-io/conan-center-index"

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

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")

def requirements(self):
# Required libraries
self.requires("uriparser/0.9.8")
self.requires("expat/2.6.2")

if not (self.settings.os == 'Windows' or self.settings.os == 'Macos'):
self.requires('libuuid/1.0.3')

# Configuration dependent requirements
if self.options.with_libcurl:
self.requires("libcurl/8.6.0")
irieger marked this conversation as resolved.
Show resolved Hide resolved

def validate(self):
if self.settings.compiler.cppstd:
check_min_cppstd(self, 11)
irieger marked this conversation as resolved.
Show resolved Hide resolved

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.variables["BMX_BUILD_WITH_LIBCURL"] = self.options.with_libcurl
tc.generate()

cd = CMakeDeps(self)
cd.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, "lib", "pkgconfig"))

@staticmethod
def _conan_comp(name):
return f"bmx_{name.lower()}"

def _add_component(self, name):
component = self.cpp_info.components[self._conan_comp(name)]
component.set_property("cmake_target_name", f"bmx::{name}")
component.names["cmake_find_package"] = name
component.names["cmake_find_package_multi"] = name
return component

def package_info(self):
self.cpp_info.set_property("cmake_file_name", "bmx")
self.cpp_info.set_property("pkg_config_name", "bmx")

self.cpp_info.names["cmake_find_package"] = "bmx"
self.cpp_info.names["cmake_find_package_multi"] = "bmx"

# bbc-bmx::MXF
libmxf = self._add_component("MXF")
libmxf.libs = ["MXF"]
libmxf.requires = []
if not (self.settings.os == 'Windows' or self.settings.os == 'Macos'):
libmxf.requires.append("libuuid::libuuid")

# bbc-bmx::MXF++
libmxfpp = self._add_component("MXF++")
libmxfpp.libs = ["MXF++"]
libmxfpp.requires = [
"bmx_mxf"
]

# bbc-bmx::bmx
libbmx = self._add_component("bmx")
libbmx.libs = ["bmx"]
libbmx.requires = [
"bmx_mxf",
"bmx_mxf++",
"expat::expat",
"uriparser::uriparser",
]
if not (self.settings.os == 'Windows' or self.settings.os == 'Macos'):
libbmx.requires.append("libuuid::libuuid")

if self.options.with_libcurl:
libbmx.requires.append("libcurl::libcurl")
55 changes: 55 additions & 0 deletions recipes/bmx/all/patches/1.2-cmake-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
diff --git CMakeLists.txt CMakeLists.txt
index 6fe9540e..4847ba3e 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -93,11 +93,25 @@ add_custom_target(bmx_test_data)

include("${PROJECT_SOURCE_DIR}/cmake/libmxf.cmake")
include("${PROJECT_SOURCE_DIR}/cmake/libmxfpp.cmake")
-include("${PROJECT_SOURCE_DIR}/cmake/ext_uuid.cmake")
-include("${PROJECT_SOURCE_DIR}/cmake/ext_expat.cmake")
-include("${PROJECT_SOURCE_DIR}/cmake/ext_uriparser.cmake")
+#include("${PROJECT_SOURCE_DIR}/cmake/ext_uuid.cmake")
+#include("${PROJECT_SOURCE_DIR}/cmake/ext_expat.cmake")
+#include("${PROJECT_SOURCE_DIR}/cmake/ext_uriparser.cmake")
+#if(BMX_BUILD_WITH_LIBCURL)
+# include("${PROJECT_SOURCE_DIR}/cmake/ext_libcurl.cmake")
+#endif()
+
+find_package(expat REQUIRED)
+find_package(uriparser REQUIRED)
+if(UNIX AND NOT APPLE)
+ find_package(libuuid REQUIRED)
+ set(uuid_link_lib libuuid::libuuid)
+else()
+ # MSVC: "ole" will already be linked in
+ # APPLE: doesn't require uuid library
+ set(uuid_link_lib)
+endif()
if(BMX_BUILD_WITH_LIBCURL)
- include("${PROJECT_SOURCE_DIR}/cmake/ext_libcurl.cmake")
+ find_package(CURL REQUIRED)
endif()

configure_file(config.h.in config.h)
diff --git src/CMakeLists.txt src/CMakeLists.txt
index 1c0824d8..ed95310a 100644
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -65,13 +65,13 @@ target_link_libraries(bmx
${MXFpp_link_lib}
PRIVATE
${uuid_link_lib}
- ${expat_link_lib}
- ${uriparser_link_lib}
+ expat::expat
+ uriparser::uriparser
)

if(BMX_BUILD_WITH_LIBCURL)
target_link_libraries(bmx PRIVATE
- ${libcurl_link_lib}
+ CURL::libcurl
)
endif()

7 changes: 7 additions & 0 deletions recipes/bmx/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)

find_package(bmx REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE bmx::bmx)
26 changes: 26 additions & 0 deletions recipes/bmx/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from conan import ConanFile
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)

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")
14 changes: 14 additions & 0 deletions recipes/bmx/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <bmx/Version.h>
#include <mxf/mxf_version.h>

#include <iostream>

int main() {
std::cout << bmx::get_bmx_library_name() << " library version " << bmx::get_bmx_version_string() << std::endl;

const auto mxf_version = mxf_get_version();
std::cout << "MXF library version "
<< mxf_version->major << '.' << mxf_version->minor << '.' << mxf_version->patch << std::endl;

return 0;
}
5 changes: 5 additions & 0 deletions recipes/bmx/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
versions:
"1.2":
folder: all
"cci.20240510":
folder: all
Loading