Skip to content

Commit

Permalink
(#13247) [flatbuffers] update to 2.0.8
Browse files Browse the repository at this point in the history
* Update flatbuffers to 2.0.8

* Fix version variables

* Change CMake file names to lowercase

* Add CMake build requirement

Co-authored-by: chausner <chausner@users.noreply.github.com>
  • Loading branch information
chausner and chausner committed Oct 5, 2022
1 parent a345c53 commit 78ae835
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 9 deletions.
3 changes: 3 additions & 0 deletions recipes/flatbuffers/all/conandata.yml
@@ -1,4 +1,7 @@
sources:
"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"
Expand Down
19 changes: 12 additions & 7 deletions recipes/flatbuffers/all/conanfile.py
Expand Up @@ -43,6 +43,10 @@ def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC

def build_requirements(self):
if Version(self.version) >= "2.0.7":
self.tool_requires("cmake/3.24.0")

def configure(self):
if self.options.shared or self.options.header_only:
del self.options.fPIC
Expand Down Expand Up @@ -77,9 +81,10 @@ def generate(self):
tc.variables["FLATBUFFERS_LIBCXX_WITH_CLANG"] = False
# Mimic upstream CMake/Version.cmake removed in _patch_sources()
version = Version(self.version)
tc.variables["VERSION_MAJOR"] = version.major
tc.variables["VERSION_MINOR"] = version.minor
tc.variables["VERSION_PATCH"] = version.patch
tc.cache_variables["VERSION_MAJOR"] = str(version.major)
tc.cache_variables["VERSION_MINOR"] = str(version.minor or "0")
tc.cache_variables["VERSION_PATCH"] = str(version.patch or "0")
tc.cache_variables["VERSION_COMMIT"] = str(version.pre or "0")
# For msvc shared
tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True
# Relocatable shared libs on Macos
Expand Down Expand Up @@ -131,8 +136,8 @@ def _module_path(self):

def package_info(self):
self.cpp_info.set_property("cmake_find_mode", "both")
self.cpp_info.set_property("cmake_module_file_name", "FlatBuffers")
self.cpp_info.set_property("cmake_file_name", "Flatbuffers")
self.cpp_info.set_property("cmake_module_file_name", "flatbuffers")
self.cpp_info.set_property("cmake_file_name", "flatbuffers")
cmake_target = "flatbuffers"
if not self.options.header_only and self.options.shared:
cmake_target += "_shared"
Expand All @@ -157,8 +162,8 @@ def package_info(self):
self.env_info.PATH.append(bindir)

# 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.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
Expand Down
2 changes: 1 addition & 1 deletion recipes/flatbuffers/all/test_package/CMakeLists.txt
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.8)
project(test_package LANGUAGES CXX)

find_package(Flatbuffers REQUIRED CONFIG)
find_package(FlatBuffers REQUIRED CONFIG)
if(TARGET flatbuffers::flatbuffers_shared)
set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared)
else()
Expand Down
2 changes: 1 addition & 1 deletion recipes/flatbuffers/all/test_v1_package/CMakeLists.txt
Expand Up @@ -4,7 +4,7 @@ project(test_package LANGUAGES CXX)
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

find_package(Flatbuffers REQUIRED CONFIG)
find_package(FlatBuffers REQUIRED CONFIG)
if(TARGET flatbuffers::flatbuffers_shared)
set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared)
else()
Expand Down
2 changes: 2 additions & 0 deletions recipes/flatbuffers/config.yml
@@ -1,4 +1,6 @@
versions:
"2.0.8":
folder: all
"2.0.6":
folder: all
"2.0.5":
Expand Down

0 comments on commit 78ae835

Please sign in to comment.