Skip to content

Commit

Permalink
(conan-io#15661) fruit: add fruit 3.7.1 and recipe improvements
Browse files Browse the repository at this point in the history
* add fruit 3.7.1 and recipe improvements

* Update recipes/fruit/all/conanfile.py

Co-authored-by: Stella Smith <[email protected]>

---------

Co-authored-by: Chris Mc <[email protected]>
Co-authored-by: Stella Smith <[email protected]>
  • Loading branch information
3 people authored and sabelka committed Feb 12, 2023
1 parent 64b147f commit f96e4a5
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 25 deletions.
53 changes: 33 additions & 20 deletions recipes/fruit/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,35 @@
sources:
"3.4.0":
url: "https://github.com/google/fruit/archive/v3.4.0.tar.gz"
sha256: "0f3793ee5e437437c3d6360a037866429a7f1975451fd60d740f9d2023e92034"
"3.5.0":
url: "https://github.com/google/fruit/archive/v3.5.0.tar.gz"
sha256: "1e1f26fb2ec100550e0e29ee0f4ad0df9f7a8144a65c0b9cb9954cd2e4d6a529"
"3.6.0":
url: "https://github.com/google/fruit/archive/v3.6.0.tar.gz"
sha256: "b35b9380f3affe0b3326f387505fa80f3584b0d0a270362df1f4ca9c39094eb5"
"3.7.1":
url: "https://github.com/google/fruit/archive/v3.7.1.tar.gz"
sha256: "ed4c6b7ebfbf75e14a74e21eb74ce2703b8485bfc9e660b1c36fb7fe363172d0"
"3.7.0":
url: "https://github.com/google/fruit/archive/v3.7.0.tar.gz"
sha256: "134d65c8e6dff204aeb771058c219dcd9a353853e30a3961a5d17a6cff434a09"
patches:
"3.6.0":
url: "https://github.com/google/fruit/archive/v3.6.0.tar.gz"
sha256: "b35b9380f3affe0b3326f387505fa80f3584b0d0a270362df1f4ca9c39094eb5"
"3.5.0":
url: "https://github.com/google/fruit/archive/v3.5.0.tar.gz"
sha256: "1e1f26fb2ec100550e0e29ee0f4ad0df9f7a8144a65c0b9cb9954cd2e4d6a529"
"3.4.0":
- patch_file: "patches/0001-fruit-3.4.0-cmake.patch"
patch_description: "Adapt CMake for Conan"
url: "https://github.com/google/fruit/archive/v3.4.0.tar.gz"
sha256: "0f3793ee5e437437c3d6360a037866429a7f1975451fd60d740f9d2023e92034"
patches:
"3.7.1":
- patch_file: "patches/0002-remove-cmake-extra-target-3.7.1.patch"
patch_description: "remove CMake extra target"
patch_type: "conan"
- patch_file: "patches/0004-3.4.0-set-options-for-cmake-target.patch"
patch_description: "Set Boost cmake target"
- patch_file: "patches/0003-supports-cmake-multi-configuration-generator-3.7.patch"
patch_description: "support CMake multi configuration generator"
patch_type: "conan"
"3.5.0":
- patch_file: "patches/0002-remove-cmake-extra-target-3.5.0.patch"
- patch_file: "patches/0004-set-options-for-cmake-target.patch"
patch_description: "Set options for CMake target"
patch_type: "conan"
"3.7.0":
- patch_file: "patches/0002-remove-cmake-extra-target-3.7.0.patch"
patch_description: "remove CMake extra target"
patch_type: "conan"
- patch_file: "patches/0003-supports-cmake-multi-configuration-generator.patch"
- patch_file: "patches/0003-supports-cmake-multi-configuration-generator-3.7.patch"
patch_description: "support CMake multi configuration generator"
patch_type: "conan"
- patch_file: "patches/0004-set-options-for-cmake-target.patch"
Expand All @@ -39,13 +45,20 @@ patches:
- patch_file: "patches/0004-set-options-for-cmake-target.patch"
patch_description: "Set options for CMake target"
patch_type: "conan"
"3.7.0":
- patch_file: "patches/0002-remove-cmake-extra-target-3.7.0.patch"
"3.5.0":
- patch_file: "patches/0002-remove-cmake-extra-target-3.5.0.patch"
patch_description: "remove CMake extra target"
patch_type: "conan"
- patch_file: "patches/0003-supports-cmake-multi-configuration-generator-3.7.0.patch"
- patch_file: "patches/0003-supports-cmake-multi-configuration-generator.patch"
patch_description: "support CMake multi configuration generator"
patch_type: "conan"
- patch_file: "patches/0004-set-options-for-cmake-target.patch"
patch_description: "Set options for CMake target"
patch_type: "conan"
"3.4.0":
- patch_file: "patches/0001-fruit-3.4.0-cmake.patch"
patch_description: "Adapt CMake for Conan"
patch_type: "conan"
- patch_file: "patches/0004-3.4.0-set-options-for-cmake-target.patch"
patch_description: "Set Boost cmake target"
patch_type: "conan"
21 changes: 16 additions & 5 deletions recipes/fruit/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,37 @@ class FruitConan(ConanFile):
topics = ("injection", "framework")
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False],
"use_boost": [True, False],
"use_boost": [True, False, "deprecated"],
"with_boost": [True, False],
"fPIC": [True, False]}
default_options = {"shared": False, "use_boost": True, "fPIC": True}
default_options = {
"shared": False,
"use_boost": "deprecated",
"with_boost": True,
"fPIC": True}

def export_sources(self):
export_conandata_patches(self)

def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
self.options.rm_safe("fPIC")

def package_id(self):
del self.info.options.use_boost

def configure(self):
if self.options.shared:
self.options.rm_safe("fPIC")
if self.options.use_boost != "deprecated":
self.output.warn("use_boost option is deprecated, use the option with_boost instead.")
self.options.with_boost = self.options.use_boost

def layout(self):
cmake_layout(self, src_folder="src")

def requirements(self):
if self.options.use_boost:
if self.options.with_boost:
self.requires("boost/1.80.0")

def validate(self):
Expand Down Expand Up @@ -86,7 +97,7 @@ def source(self):

def generate(self):
tc = CMakeToolchain(self)
tc.cache_variables["FRUIT_USES_BOOST"] = self.options.use_boost
tc.cache_variables["FRUIT_USES_BOOST"] = self.options.with_boost
tc.variables["FRUIT_ENABLE_COVERAGE"] = False
tc.variables["RUN_TESTS_UNDER_VALGRIND"] = False
tc.variables["CMAKE_CXX_STANDARD"] = 11
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 74c62a5..03444f5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.2)

project(Fruit VERSION 3.7.1 LANGUAGES CXX)

-set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.")
-if("${FRUIT_IS_BEING_BUILT_BY_CONAN}")
- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
- conan_basic_setup()
-endif()
-
if (POLICY CMP0054)
cmake_policy(SET CMP0054 NEW)
endif()
@@ -130,19 +124,6 @@ include(GNUInstallDirs)
add_subdirectory(configuration)
add_subdirectory(src)

-if(NOT "${FRUIT_IS_BEING_BUILT_BY_CONAN}")
- if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
- # Do not exclude these from "make all" in debug mode, they must build.
- add_subdirectory(examples)
- add_subdirectory(tests)
- else()
- add_subdirectory(examples EXCLUDE_FROM_ALL)
- add_subdirectory(tests)
- endif()
-
- add_subdirectory(extras EXCLUDE_FROM_ALL)
-endif()
-
install(DIRECTORY include/fruit/
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit
FILES_MATCHING PATTERN "*.h")
2 changes: 2 additions & 0 deletions recipes/fruit/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ versions:
folder: all
"3.7.0":
folder: all
"3.7.1":
folder: all

0 comments on commit f96e4a5

Please sign in to comment.