Skip to content

Commit

Permalink
flatbuffers: version 1.12.0: build bugfix (conan-io#25607)
Browse files Browse the repository at this point in the history
Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com>
Co-authored-by: Abril Rincón Blanco <git@rinconblanco.es>
  • Loading branch information
3 people authored and OMGtechy committed Dec 31, 2024
1 parent f8a8e2b commit 6311851
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 68 deletions.
18 changes: 5 additions & 13 deletions recipes/flatbuffers/all/conandata.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ sources:
"23.1.21":
url: "https://github.com/google/flatbuffers/archive/v23.1.21.tar.gz"
sha256: "d84cb25686514348e615163b458ae0767001b24b42325f426fd56406fd384238"
"23.1.4":
url: "https://github.com/google/flatbuffers/archive/v23.1.4.tar.gz"
sha256: "801871ff3747838c0dd9730fc44ca9cc453ff42f9c8a0a2f1b33776d2ca5e4b9"
"22.12.06":
url: "https://github.com/google/flatbuffers/archive/v22.12.06.tar.gz"
sha256: "209823306f2cbedab6ff70997e0d236fcfd1864ca9ad082cbfdb196e7386daed"
Expand All @@ -29,30 +26,25 @@ sources:
"22.9.29":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.29.tar.gz"
sha256: "372df01795c670f6538055a7932fc7eb3e81b3653be4a216c081e9c3c26b1b6d"
"22.9.24":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.24.tar.gz"
sha256: "40e0788873012def4d66a2fdbac15fbe012784473c01a703ccb5be33383556bf"
"2.0.8":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.8.tar.gz"
sha256: "f97965a727d26386afaefff950badef2db3ab6af9afe23ed6d94bfb65f95f37e"
"2.0.6":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.6.tar.gz"
sha256: "e2dc24985a85b278dd06313481a9ca051d048f9474e0f199e372fea3ea4248c9"
"2.0.5":
url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.5.tar.gz"
sha256: "b01e97c988c429e164c5c7df9e87c80007ca87f593c0d73733ba536ddcbc8f98"
"1.12.0":
url: "https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz"
sha256: "62f2223fb9181d1d6338451375628975775f7522185266cd5296571ac152bc45"
patches:
"2.0.6":
- patch_file: "patches/0004-no-flatc-execution-build-time.patch"
patch_description: "No flatc execution during build time"
patch_type: "conan"
"2.0.5":
- patch_file: "patches/0002-apple-no-universal-build.patch"
patch_description: "Don't use universal2 architecture"
patch_type: "bugfix"
- patch_file: "patches/0003-no-flatc-execution-build-time.patch"
patch_description: "No flatc execution during build time"
patch_type: "conan"
"1.12.0":
- patch_file: "patches/0005-arm-cxx-compiler-build.patch"
patch_description: "IAR ARM C++ Compiler build bugfix"
patch_type: "backport"
patch_source: "https://github.com/google/flatbuffers/commit/82fac326c5981a85233b8ae7e0d7ec8fda432963"
24 changes: 5 additions & 19 deletions recipes/flatbuffers/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from conan.tools.scm import Version
import os

required_conan_version = ">=1.53.0"
required_conan_version = ">=2.1"


class FlatbuffersConan(ConanFile):
Expand All @@ -18,6 +18,7 @@ class FlatbuffersConan(ConanFile):
description = "Memory Efficient Serialization Library"

settings = "os", "arch", "compiler", "build_type"
package_type = "library"
options = {
"shared": [True, False],
"fPIC": [True, False],
Expand Down Expand Up @@ -56,17 +57,17 @@ def package_id(self):
self.info.clear()

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 11)
check_min_cppstd(self, 11)

def build_requirements(self):
# since 23.3.3 version, flatbuffers cmake scripts were refactored to use cmake 3.8 version
# see https://github.com/google/flatbuffers/pull/7801
if Version(self.version) >= "2.0.7" and Version(self.version) < "23.3.3":
if Version(self.version) >= "2.0.8" and Version(self.version) < "23.3.3":
self.tool_requires("cmake/[>=3.16 <4]")

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)
self._patch_sources()

def generate(self):
tc = CMakeToolchain(self)
Expand All @@ -92,9 +93,6 @@ def generate(self):
# Fix iOS/tvOS/watchOS
if is_apple_os(self):
tc.variables["CMAKE_MACOSX_BUNDLE"] = False
# Inject at least C++11 standard (would be more elegant to rely on cxx_std_11 compile feature upstream)
if not valid_min_cppstd(self, 11):
tc.variables["CMAKE_CXX_STANDARD"] = 11
tc.generate()

def _patch_sources(self):
Expand All @@ -112,7 +110,6 @@ def _patch_sources(self):
"RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}")

def build(self):
self._patch_sources()
cmake = CMake(self)
cmake.configure()
cmake.build()
Expand Down Expand Up @@ -157,16 +154,5 @@ def package_info(self):
]
self.cpp_info.set_property("cmake_build_modules", build_modules)

# TODO: to remove in conan v2 once cmake_find_package* generators removed
self.cpp_info.filenames["cmake_find_package"] = "flatbuffers"
self.cpp_info.filenames["cmake_find_package_multi"] = "flatbuffers"
self.cpp_info.names["cmake_find_package"] = "flatbuffers"
self.cpp_info.names["cmake_find_package_multi"] = "flatbuffers"
self.cpp_info.components["libflatbuffers"].names["cmake_find_package"] = cmake_target
self.cpp_info.components["libflatbuffers"].names["cmake_find_package_multi"] = cmake_target
self.cpp_info.components["libflatbuffers"].build_modules["cmake_find_package"] = build_modules
self.cpp_info.components["libflatbuffers"].build_modules["cmake_find_package_multi"] = build_modules
self.cpp_info.components["libflatbuffers"].set_property("cmake_file_name", f"flatbuffers::{cmake_target}")
self.cpp_info.components["libflatbuffers"].set_property("pkg_config_name", "flatbuffers")
if self._has_flatc():
self.env_info.PATH.append(os.path.join(self.package_folder, "bin"))
16 changes: 16 additions & 0 deletions recipes/flatbuffers/all/patches/0005-arm-cxx-compiler-build.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h
index c4dc5bcd..0f3a7dfd 100644
--- a/include/flatbuffers/flatbuffers.h
+++ b/include/flatbuffers/flatbuffers.h
@@ -1871,10 +1871,7 @@ class FlatBufferBuilder {
vector_downward &buf_;

private:
- TableKeyComparator &operator=(const TableKeyComparator &other) {
- buf_ = other.buf_;
- return *this;
- }
+ FLATBUFFERS_DELETE_FUNC(TableKeyComparator &operator=(const TableKeyComparator &other))
};
/// @endcond

8 changes: 0 additions & 8 deletions recipes/flatbuffers/all/test_v1_package/CMakeLists.txt

This file was deleted.

22 changes: 0 additions & 22 deletions recipes/flatbuffers/all/test_v1_package/conanfile.py

This file was deleted.

6 changes: 0 additions & 6 deletions recipes/flatbuffers/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ versions:
folder: all
"23.1.21":
folder: all
"23.1.4":
folder: all
"22.12.06":
folder: all
"22.11.23":
Expand All @@ -19,12 +17,8 @@ versions:
folder: all
"22.9.29":
folder: all
"22.9.24":
folder: all
"2.0.8":
folder: all
"2.0.6":
folder: all
"2.0.5":
folder: all
"1.12.0":
Expand Down

0 comments on commit 6311851

Please sign in to comment.