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 all 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
20 changes: 20 additions & 0 deletions recipes/bmx/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
sources:
"1.2":
url: "https://github.com/bbc/bmx/archive/refs/tags/v1.2.tar.gz"
sha256: "e64d91b2d27478d6b892d72183e1ecf79c99880b079ce04442432f3caed1e259"
"cci.20240517":
url: "https://github.com/bbc/bmx/archive/52c7517923dde6e4de881fe1e47fbae5e60df731.tar.gz"
sha256: "b4a0545e2fa33bd7c25adce3b61fd4b06a68a192d037dd0e5eb14defd0b2c936"
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"
- patch_file: "patches/1.2-fix-cpp20.patch"
patch_description: "Fix a compilation problem with C++20"
patch_type: "portability"
patch_source: "https://github.com/bbc/bmx/pull/69"
"cci.20240517":
- patch_file: "patches/cci.20240517-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"
140 changes: 140 additions & 0 deletions recipes/bmx/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
from conan import ConanFile
from conan.errors import ConanInvalidConfiguration
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, rmdir
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 <3]")

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/[>=7.78.0 <9]")

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

# Symbol export is currently not working properly on Windows so shared
# libraries are currently deactivated. This can later be revisited based
# on https://github.com/bbc/bmx/issues/80
if self.settings.os == "Windows" and self.options.shared:
raise ConanInvalidConfiguration(
"Building as a shared library currently not supported on Windows!"
)

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")
141 changes: 141 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,141 @@
diff --git CMakeLists.txt CMakeLists.txt
index 6fe9540e7..8b2578852 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -34,7 +34,7 @@ if(BUILD_SHARED_LIBS OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

-set(CMAKE_CXX_STANDARD 11)
+#set(CMAKE_CXX_STANDARD 11)

# Set the test samples output directory
if(BMX_TEST_SAMPLES_DIR STREQUAL "")
@@ -75,7 +75,7 @@ if(MSVC)
endforeach()
endif()
else()
- add_compile_options(-W -Wall -O2)
+ add_compile_options(-W -Wall)

# Enable large file support on 32-bit systems.
add_definitions(
@@ -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 deps/libMXF/CMakeLists.txt deps/libMXF/CMakeLists.txt
index d36fde6c0..6a1af100b 100644
--- deps/libMXF/CMakeLists.txt
+++ deps/libMXF/CMakeLists.txt
@@ -35,7 +35,7 @@ if(BUILD_SHARED_LIBS OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

-set(CMAKE_CXX_STANDARD 11)
+#set(CMAKE_CXX_STANDARD 11)

# Set the test samples output directory
if(LIBMXF_TEST_SAMPLES_DIR STREQUAL "")
@@ -76,7 +76,7 @@ if(MSVC)
endforeach()
endif()
else()
- add_compile_options(-W -Wall -O2)
+ add_compile_options(-W -Wall)

# Enable large file support on 32-bit systems.
add_definitions(
diff --git deps/libMXFpp/CMakeLists.txt deps/libMXFpp/CMakeLists.txt
index 2272a2709..924fdf770 100644
--- deps/libMXFpp/CMakeLists.txt
+++ deps/libMXFpp/CMakeLists.txt
@@ -35,7 +35,7 @@ if(BUILD_SHARED_LIBS OR NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
endif()

-set(CMAKE_CXX_STANDARD 11)
+#set(CMAKE_CXX_STANDARD 11)

if(MSVC)
add_compile_options(/W3 /EHsc)
@@ -61,7 +61,7 @@ if(MSVC)
endforeach()
endif()
else()
- add_compile_options(-W -Wall -O2)
+ add_compile_options(-W -Wall)

# Enable large file support on 32-bit systems.
add_definitions(
diff --git deps/libMXFpp/libMXF++/CMakeLists.txt deps/libMXFpp/libMXF++/CMakeLists.txt
index 94d48c905..e6c6a63f9 100644
--- deps/libMXFpp/libMXF++/CMakeLists.txt
+++ deps/libMXFpp/libMXF++/CMakeLists.txt
@@ -32,6 +32,8 @@ add_library(MXFpp
${MXFpp_sources}
)

+target_compile_features(MXFpp PUBLIC cxx_std_11)
+
target_include_directories(MXFpp PUBLIC
${PROJECT_SOURCE_DIR}
)
diff --git src/CMakeLists.txt src/CMakeLists.txt
index 1c0824d8a..94f9c00d6 100644
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -26,6 +26,8 @@ target_include_directories(bmx PUBLIC
${PROJECT_SOURCE_DIR}/include
)

+target_compile_features(bmx PUBLIC cxx_std_11)
+
# Add path to header files if not included in MSVC distribution
if(MSVC)
include(CheckIncludeFile)
@@ -65,13 +67,14 @@ 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}
+ # Linking public to see if the shared library for curls dependencies correctly link
+ target_link_libraries(bmx PUBLIC
+ CURL::libcurl
)
endif()

26 changes: 26 additions & 0 deletions recipes/bmx/all/patches/1.2-fix-cpp20.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
diff --git deps/libMXFpp/libMXF++/MXFVersion.cpp deps/libMXFpp/libMXF++/MXFVersion.cpp
index 333d5871..bb247a32 100644
--- deps/libMXFpp/libMXF++/MXFVersion.cpp
+++ deps/libMXFpp/libMXF++/MXFVersion.cpp
@@ -33,6 +33,8 @@
#include "config.h"
#endif

+#include <string>
+
#include "git.h"
#include "fallback_git_version.h"

diff --git src/common/Version.cpp src/common/Version.cpp
index a4f00e14..d51da64a 100644
--- src/common/Version.cpp
+++ src/common/Version.cpp
@@ -219,7 +219,7 @@ mxfProductVersion bmx::get_bmx_mxf_product_version()
// Set the patch version value to the commit offset from the release tag.
// The commit offset is part of the git describe tag string which has the
// format "<tag>-<offset>-g<commit id>"
- string describe = bmx_git::DescribeTag();
+ string describe = std::string(bmx_git::DescribeTag());
#ifdef PACKAGE_GIT_VERSION_STRING
if (describe.empty() || describe == "unknown")
describe = PACKAGE_GIT_VERSION_STRING;
57 changes: 57 additions & 0 deletions recipes/bmx/all/patches/cci.20240517-cmake-fixes.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
diff --git CMakeLists.txt CMakeLists.txt
index 3139ef78e..a08fbb589 100644
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -91,11 +91,26 @@ 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 59c94b8b9..94f9c00d6 100644
--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -67,13 +67,14 @@ 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}
+ # Linking public to see if the shared library for curls dependencies correctly link
+ target_link_libraries(bmx PUBLIC
+ CURL::libcurl
)
endif()

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

find_package(bmx REQUIRED)

add_executable(${PROJECT_NAME} test_package.cpp)
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11)
target_link_libraries(${PROJECT_NAME} PRIVATE bmx::bmx)
Loading
Loading