Add some recipes
This commit is contained in:
55
recipes/fmt/all/conandata.yml
Normal file
55
recipes/fmt/all/conandata.yml
Normal file
@@ -0,0 +1,55 @@
|
||||
sources:
|
||||
"11.1.3":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/11.1.3/fmt-11.1.3.zip"
|
||||
sha256: "7df2fd3426b18d552840c071c977dc891efe274051d2e7c47e2c83c3918ba6df"
|
||||
"11.1.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/11.1.1/fmt-11.1.1.zip"
|
||||
sha256: "a25124e41c15c290b214c4dec588385153c91b47198dbacda6babce27edc4b45"
|
||||
"11.0.2":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/11.0.2/fmt-11.0.2.zip"
|
||||
sha256: "40fc58bebcf38c759e11a7bd8fdc163507d2423ef5058bba7f26280c5b9c5465"
|
||||
"11.0.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/11.0.1/fmt-11.0.1.zip"
|
||||
sha256: "62ca45531814109b5d6cef0cf2fd17db92c32a30dd23012976e768c685534814"
|
||||
"11.0.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/11.0.0/fmt-11.0.0.zip"
|
||||
sha256: "583ce480ef07fad76ef86e1e2a639fc231c3daa86c4aa6bcba524ce908f30699"
|
||||
"10.2.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/10.2.1/fmt-10.2.1.zip"
|
||||
sha256: "312151a2d13c8327f5c9c586ac6cf7cddc1658e8f53edae0ec56509c8fa516c9"
|
||||
"10.2.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/10.2.0/fmt-10.2.0.zip"
|
||||
sha256: "8a942861a94f8461a280f823041cde8f620a6d8b0e0aacc98c15bb5a9dd92399"
|
||||
"10.1.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/10.1.1/fmt-10.1.1.zip"
|
||||
sha256: "b84e58a310c9b50196cda48d5678d5fa0849bca19e5fdba6b684f0ee93ed9d1b"
|
||||
"10.1.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/10.1.0/fmt-10.1.0.zip"
|
||||
sha256: "d725fa83a8b57a3cedf238828fa6b167f963041e8f9f7327649bddc68ae316f4"
|
||||
"10.0.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/10.0.0/fmt-10.0.0.zip"
|
||||
sha256: "4943cb165f3f587f26da834d3056ee8733c397e024145ca7d2a8a96bb71ac281"
|
||||
"9.1.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/9.1.0/fmt-9.1.0.zip"
|
||||
sha256: "cceb4cb9366e18a5742128cb3524ce5f50e88b476f1e54737a47ffdf4df4c996"
|
||||
"9.0.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/9.0.0/fmt-9.0.0.zip"
|
||||
sha256: "fc96dd2d2fdf2bded630787adba892c23cb9e35c6fd3273c136b0c57d4651ad6"
|
||||
"8.1.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/8.1.1/fmt-8.1.1.zip"
|
||||
sha256: "23778bad8edba12d76e4075da06db591f3b0e3c6c04928ced4a7282ca3400e5d"
|
||||
"8.0.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip"
|
||||
sha256: "a627a56eab9554fc1e5dd9a623d0768583b3a383ff70a4312ba68f94c9d415bf"
|
||||
"7.1.3":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip"
|
||||
sha256: "5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e720084c9f"
|
||||
"6.2.1":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/6.2.1/fmt-6.2.1.zip"
|
||||
sha256: "94fea742ddcccab6607b517f6e608b1e5d63d712ddbc5982e44bafec5279881a"
|
||||
"5.3.0":
|
||||
url: "https://github.com/fmtlib/fmt/releases/download/5.3.0/fmt-5.3.0.zip"
|
||||
sha256: "4c0741e10183f75d7d6f730b8708a99b329b2f942dad5a9da3385ab92bb4a15c"
|
||||
patches:
|
||||
"5.3.0":
|
||||
- patch_file: "patches/fix-install-5.3.0.patch"
|
||||
158
recipes/fmt/all/conanfile.py
Normal file
158
recipes/fmt/all/conanfile.py
Normal file
@@ -0,0 +1,158 @@
|
||||
import os
|
||||
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.scm import Version
|
||||
from conan.tools.microsoft import is_msvc
|
||||
|
||||
required_conan_version = ">=2.1"
|
||||
|
||||
|
||||
class FmtConan(ConanFile):
|
||||
name = "fmt"
|
||||
description = "A safe and fast alternative to printf and IOStreams."
|
||||
license = "MIT"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/fmtlib/fmt"
|
||||
topics = ("format", "iostream", "printf")
|
||||
package_type = "library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"header_only": [True, False],
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"with_fmt_alias": [True, False],
|
||||
"with_os_api": [True, False],
|
||||
"with_unicode": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"header_only": False,
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"with_fmt_alias": False,
|
||||
"with_os_api": True,
|
||||
"with_unicode": True,
|
||||
}
|
||||
|
||||
@property
|
||||
def _has_with_os_api_option(self):
|
||||
return Version(self.version) >= "7.0.0"
|
||||
|
||||
@property
|
||||
def _has_with_unicode_option(self):
|
||||
return Version(self.version) >= "11.0.0"
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
if not self._has_with_os_api_option:
|
||||
del self.options.with_os_api
|
||||
elif str(self.settings.os) == "baremetal":
|
||||
self.options.with_os_api = False
|
||||
if not self._has_with_unicode_option:
|
||||
del self.options.with_unicode
|
||||
|
||||
def configure(self):
|
||||
if self.options.header_only:
|
||||
self.options.rm_safe("fPIC")
|
||||
self.options.rm_safe("shared")
|
||||
self.options.rm_safe("with_os_api")
|
||||
elif self.options.shared:
|
||||
self.options.rm_safe("fPIC")
|
||||
|
||||
def layout(self):
|
||||
if self.options.header_only:
|
||||
basic_layout(self, src_folder="src")
|
||||
else:
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def package_id(self):
|
||||
if self.info.options.header_only:
|
||||
self.info.clear()
|
||||
else:
|
||||
del self.info.options.with_fmt_alias
|
||||
|
||||
def validate(self):
|
||||
if self.settings.get_safe("compiler.cppstd"):
|
||||
check_min_cppstd(self, 11)
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
if not self.options.header_only:
|
||||
tc = CMakeToolchain(self)
|
||||
tc.cache_variables["FMT_DOC"] = False
|
||||
tc.cache_variables["FMT_TEST"] = False
|
||||
tc.cache_variables["FMT_INSTALL"] = True
|
||||
tc.cache_variables["FMT_LIB_DIR"] = "lib"
|
||||
if self._has_with_os_api_option:
|
||||
tc.cache_variables["FMT_OS"] = bool(self.options.with_os_api)
|
||||
if self._has_with_unicode_option:
|
||||
tc.cache_variables["FMT_UNICODE"] = bool(self.options.with_unicode)
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
apply_conandata_patches(self)
|
||||
if not self.options.header_only:
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
if Version(self.version) < "10.2.0":
|
||||
copy(self, pattern="*LICENSE.rst", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
else:
|
||||
copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"))
|
||||
if self.options.header_only:
|
||||
copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include"))
|
||||
else:
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
rmdir(self, os.path.join(self.package_folder, "res"))
|
||||
rmdir(self, os.path.join(self.package_folder, "share"))
|
||||
|
||||
def package_info(self):
|
||||
target = "fmt-header-only" if self.options.header_only else "fmt"
|
||||
self.cpp_info.set_property("cmake_file_name", "fmt")
|
||||
self.cpp_info.set_property("cmake_target_name", f"fmt::{target}")
|
||||
|
||||
# Mirror upstream find package version policy:
|
||||
# https://github.com/fmtlib/fmt/blob/11.1.1/CMakeLists.txt#L403-L407
|
||||
self.cpp_info.set_property("cmake_config_version_compat", "AnyNewerVersion")
|
||||
self.cpp_info.set_property("pkg_config_name", "fmt")
|
||||
|
||||
if is_msvc(self):
|
||||
if self.options.get_safe("with_unicode"):
|
||||
self.cpp_info.components["_fmt"].cxxflags.append("/utf-8")
|
||||
else:
|
||||
# Set the FMT_UNICODE=0, as defined publicly upstream
|
||||
# https://github.com/fmtlib/fmt/blob/11.1.1/CMakeLists.txt#L371
|
||||
self.cpp_info.components["_fmt"].defines.append("FMT_UNICODE=0")
|
||||
|
||||
# TODO: back to global scope in conan v2 once cmake_find_package* generators removed
|
||||
if self.options.with_fmt_alias:
|
||||
self.cpp_info.components["_fmt"].defines.append("FMT_STRING_ALIAS=1")
|
||||
|
||||
if self.options.header_only:
|
||||
self.cpp_info.components["_fmt"].defines.append("FMT_HEADER_ONLY=1")
|
||||
self.cpp_info.components["_fmt"].libdirs = []
|
||||
self.cpp_info.components["_fmt"].bindirs = []
|
||||
else:
|
||||
postfix = "d" if self.settings.build_type == "Debug" else ""
|
||||
libname = "fmt" + postfix
|
||||
self.cpp_info.components["_fmt"].libs = [libname]
|
||||
if self.settings.os == "Linux":
|
||||
self.cpp_info.components["_fmt"].system_libs.extend(["m"])
|
||||
if self.options.shared:
|
||||
self.cpp_info.components["_fmt"].defines.append("FMT_SHARED")
|
||||
|
||||
self.cpp_info.components["_fmt"].set_property("cmake_target_name", f"fmt::{target}")
|
||||
13
recipes/fmt/all/patches/fix-install-5.3.0.patch
Normal file
13
recipes/fmt/all/patches/fix-install-5.3.0.patch
Normal file
@@ -0,0 +1,13 @@
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -235,7 +235,9 @@ if (FMT_INSTALL)
|
||||
|
||||
# Install the library and headers.
|
||||
install(TARGETS ${INSTALL_TARGETS} EXPORT ${targets_export_name}
|
||||
- DESTINATION ${FMT_LIB_DIR})
|
||||
+ LIBRARY DESTINATION ${FMT_LIB_DIR}
|
||||
+ ARCHIVE DESTINATION ${FMT_LIB_DIR}
|
||||
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||
|
||||
install(FILES $<TARGET_PDB_FILE:${INSTALL_TARGETS}> DESTINATION ${FMT_LIB_DIR} OPTIONAL)
|
||||
install(FILES ${FMT_HEADERS} DESTINATION ${FMT_INC_DIR})
|
||||
20
recipes/fmt/all/test_package/CMakeLists.txt
Normal file
20
recipes/fmt/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(fmt REQUIRED CONFIG)
|
||||
|
||||
add_executable(test_package test_package.cpp)
|
||||
target_compile_features(test_package PRIVATE cxx_std_14)
|
||||
if(FMT_HEADER_ONLY)
|
||||
target_link_libraries(test_package PRIVATE fmt::fmt-header-only)
|
||||
else()
|
||||
target_link_libraries(test_package PRIVATE fmt::fmt)
|
||||
endif()
|
||||
|
||||
add_executable(test_ranges test_ranges.cpp)
|
||||
target_compile_features(test_ranges PRIVATE cxx_std_14)
|
||||
if(FMT_HEADER_ONLY)
|
||||
target_link_libraries(test_ranges PRIVATE fmt::fmt-header-only)
|
||||
else()
|
||||
target_link_libraries(test_ranges PRIVATE fmt::fmt)
|
||||
endif()
|
||||
31
recipes/fmt/all/test_package/conanfile.py
Normal file
31
recipes/fmt/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,31 @@
|
||||
import os
|
||||
from conan import ConanFile
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["FMT_HEADER_ONLY"] = self.dependencies[self.tested_reference_str].options.header_only
|
||||
tc.generate()
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if can_run(self):
|
||||
self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun")
|
||||
self.run(os.path.join(self.cpp.build.bindirs[0], "test_ranges"), env="conanrun")
|
||||
60
recipes/fmt/all/test_package/test_package.cpp
Normal file
60
recipes/fmt/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
#include <cstdlib>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <limits>
|
||||
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/printf.h>
|
||||
#include <fmt/ostream.h>
|
||||
#include <fmt/color.h>
|
||||
|
||||
|
||||
void vreport(const char *format, fmt::format_args args) {
|
||||
fmt::vprint(format, args);
|
||||
}
|
||||
|
||||
template <typename... Args>
|
||||
void report(const char *format, const Args & ... args) {
|
||||
vreport(format, fmt::make_format_args(args...));
|
||||
}
|
||||
|
||||
class Date {
|
||||
int year_, month_, day_;
|
||||
public:
|
||||
Date(int year, int month, int day) : year_(year), month_(month), day_(day) {}
|
||||
|
||||
friend std::ostream &operator<<(std::ostream &os, const Date &d) {
|
||||
return os << d.year_ << '-' << d.month_ << '-' << d.day_;
|
||||
}
|
||||
};
|
||||
|
||||
#if FMT_VERSION >= 90000
|
||||
namespace fmt {
|
||||
template <> struct formatter<Date> : ostream_formatter {};
|
||||
}
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
const std::string thing("World");
|
||||
fmt::print("PRINT: Hello {}!\n", thing);
|
||||
|
||||
const std::string formatted = fmt::format("{0}{1}{0}", "abra", "cad");
|
||||
fmt::print("{}\n", formatted);
|
||||
|
||||
fmt::memory_buffer buf;
|
||||
fmt::format_to(std::back_inserter(buf), "{}", 2.7182818);
|
||||
fmt::print("Euler number: {}\n", fmt::to_string(buf));
|
||||
|
||||
fmt::print("The date is {}\n", Date(2012, 12, 9));
|
||||
|
||||
report("{} {} {}\n", "Conan", 42, 3.14159);
|
||||
|
||||
fmt::print(std::cout, "{} {}\n", "Magic number", 42);
|
||||
|
||||
fmt::print(fg(fmt::color::aqua), "Bincrafters\n");
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
11
recipes/fmt/all/test_package/test_ranges.cpp
Normal file
11
recipes/fmt/all/test_package/test_ranges.cpp
Normal file
@@ -0,0 +1,11 @@
|
||||
#include <cstdlib>
|
||||
#include <vector>
|
||||
#include "fmt/ranges.h"
|
||||
|
||||
int main() {
|
||||
std::vector<char> numbers;
|
||||
fmt::format_to(std::back_inserter(numbers), "{}{}{}", 1, 2, 3);
|
||||
const std::string str_numbers = fmt::format("{}", numbers);
|
||||
fmt::print("numbers: {}\n", str_numbers);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
35
recipes/fmt/config.yml
Normal file
35
recipes/fmt/config.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
versions:
|
||||
"11.1.3":
|
||||
folder: all
|
||||
"11.1.1":
|
||||
folder: all
|
||||
"11.0.2":
|
||||
folder: all
|
||||
"11.0.1":
|
||||
folder: all
|
||||
"11.0.0":
|
||||
folder: all
|
||||
"10.2.1":
|
||||
folder: all
|
||||
"10.2.0":
|
||||
folder: all
|
||||
"10.1.1":
|
||||
folder: all
|
||||
"10.1.0":
|
||||
folder: all
|
||||
"10.0.0":
|
||||
folder: all
|
||||
"9.1.0":
|
||||
folder: all
|
||||
"9.0.0":
|
||||
folder: all
|
||||
"8.1.1":
|
||||
folder: all
|
||||
"8.0.1":
|
||||
folder: all
|
||||
"7.1.3":
|
||||
folder: all
|
||||
"6.2.1":
|
||||
folder: all
|
||||
"5.3.0":
|
||||
folder: all
|
||||
46
recipes/glaze/all/conandata.yml
Normal file
46
recipes/glaze/all/conandata.yml
Normal file
@@ -0,0 +1,46 @@
|
||||
sources:
|
||||
"4.4.3":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v4.4.3.tar.gz"
|
||||
sha256: "d0dd03f156f95860bf9c2957da0704ee0f7651e21089ff34e3d26fa0190e8684"
|
||||
"4.3.1":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v4.3.1.tar.gz"
|
||||
sha256: "934b16d0a00dfc2b06bc2920a6444b8a6a34edb4f0fe872f8ad7a044518a37e3"
|
||||
"4.0.1":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v4.0.1.tar.gz"
|
||||
sha256: "0026aca33201ee6d3a820fb5926f36ba8c838bfd3120e2e179b0eee62b5bd231"
|
||||
"3.6.2":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.6.2.tar.gz"
|
||||
sha256: "74b14656b7a47c0a03d0a857adf5059e8c2351a7a84623593be0dd16b293216c"
|
||||
"3.6.1":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.6.1.tar.gz"
|
||||
sha256: "70324ad952adee32d6bbf95a0983f0c1623ce61bd237aa28c8337af2d8bb9ed5"
|
||||
# keep 3.4.3 for breaking change: API(naming) change
|
||||
"3.4.3":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.4.3.tar.gz"
|
||||
sha256: "2af1ecc9fbdcb8182d5633979a12b950f6728dd0d76f02affa1e11b1a3369314"
|
||||
"3.4.1":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.4.1.tar.gz"
|
||||
sha256: "73a38c4d7731714581061a918b33ad57cf38404abc68d9a58dbe57d56fe26a79"
|
||||
"3.3.4":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.3.4.tar.gz"
|
||||
sha256: "7fe31c14e7ede69d937aa8f126894fef11ebf3156f25cb95446d3d6d38e9da9c"
|
||||
"3.3.2":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.3.2.tar.gz"
|
||||
sha256: "e492d3f662c3c096ce7abac86780af6c84f74c4f19b29223ad92fccc054aafad"
|
||||
"3.3.1":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.3.1.tar.gz"
|
||||
sha256: "edb16f7b75bf9a7c86a704c006a9859474e1d49467f8ddeabdc8c3a3d5a982a2"
|
||||
"3.1.9":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.1.9.tar.gz"
|
||||
sha256: "adfce5acc9d3d88525c006a525e8f21d2a4bb628b5f7022720625f052d88a73d"
|
||||
"3.1.7":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v3.1.7.tar.gz"
|
||||
sha256: "388483bb3dfa1fe25c1dfec24f0afd1651e0303833cfa1b7f51020a2569e992a"
|
||||
# keep 2.9.5 for c++20 compilers
|
||||
"2.9.5":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v2.9.5.tar.gz"
|
||||
sha256: "67fda0fb0cc701451c261bb1e0c94d63bafaaba13390527521e02a034eff085e"
|
||||
# keep 2.8.4 for breaking change: pure reflection support for C style arrays
|
||||
"2.8.4":
|
||||
url: "https://github.com/stephenberry/glaze/archive/v2.8.4.tar.gz"
|
||||
sha256: "6ca8e63783f0a1dbe69f50c0bc289134301ecf930ada83489b9715cdd2a49252"
|
||||
77
recipes/glaze/all/conanfile.py
Normal file
77
recipes/glaze/all/conanfile.py
Normal file
@@ -0,0 +1,77 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.files import get, copy
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.scm import Version
|
||||
from conan.tools.layout import basic_layout
|
||||
from conan.tools.microsoft import is_msvc
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.51.1"
|
||||
|
||||
class GlazeConan(ConanFile):
|
||||
name = "glaze"
|
||||
description = "Extremely fast, in memory, JSON and interface library for modern C++"
|
||||
license = "MIT"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/stephenberry/glaze"
|
||||
topics = ("json", "memory", "header-only")
|
||||
package_type = "header-library"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
no_copy_source = True
|
||||
|
||||
@property
|
||||
def _min_cppstd(self):
|
||||
return "20" if Version(self.version) < "3.0.0" else "23"
|
||||
|
||||
@property
|
||||
def _compilers_minimum_version(self):
|
||||
return {
|
||||
"20": {
|
||||
"Visual Studio": "17",
|
||||
"msvc": "193",
|
||||
"gcc": "11" if Version(self.version) < "2.6.3" else "12",
|
||||
"clang": "14",
|
||||
"apple-clang": "13.1",
|
||||
},
|
||||
"23": {
|
||||
"Visual Studio": "17",
|
||||
"msvc": "193",
|
||||
"gcc": "12",
|
||||
"clang": "15",
|
||||
"apple-clang": "14",
|
||||
},
|
||||
}.get(self._min_cppstd, {})
|
||||
|
||||
def layout(self):
|
||||
basic_layout(self, src_folder="src")
|
||||
|
||||
def package_id(self):
|
||||
self.info.clear()
|
||||
|
||||
def validate(self):
|
||||
if self.settings.compiler.get_safe("cppstd"):
|
||||
check_min_cppstd(self, self._min_cppstd)
|
||||
minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
|
||||
if minimum_version and Version(self.settings.compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration(
|
||||
f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
|
||||
)
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def package(self):
|
||||
copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
||||
copy(
|
||||
self,
|
||||
pattern="*.hpp",
|
||||
dst=os.path.join(self.package_folder, "include"),
|
||||
src=os.path.join(self.source_folder, "include"),
|
||||
)
|
||||
|
||||
def package_info(self):
|
||||
self.cpp_info.bindirs = []
|
||||
self.cpp_info.libdirs = []
|
||||
if is_msvc(self):
|
||||
self.cpp_info.cxxflags.append("/Zc:preprocessor")
|
||||
12
recipes/glaze/all/test_package/CMakeLists.txt
Normal file
12
recipes/glaze/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(glaze REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE glaze::glaze)
|
||||
if(glaze_VERSION VERSION_GREATER_EQUAL "3.0.0")
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_23)
|
||||
else()
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
endif()
|
||||
29
recipes/glaze/all/test_package/conanfile.py
Normal file
29
recipes/glaze/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,29 @@
|
||||
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_requirements(self):
|
||||
self.tool_requires("cmake/[>=3.20 <4]")
|
||||
|
||||
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")
|
||||
43
recipes/glaze/all/test_package/test_package.cpp
Normal file
43
recipes/glaze/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
#include "glaze/glaze.hpp"
|
||||
#include "glaze/json/json_ptr.hpp"
|
||||
#include "glaze/api/impl.hpp"
|
||||
|
||||
struct my_struct
|
||||
{
|
||||
int i = 287;
|
||||
double d = 3.14;
|
||||
std::string hello = "Hello World";
|
||||
std::array<uint64_t, 3> arr = { 1, 2, 3 };
|
||||
};
|
||||
|
||||
template <>
|
||||
struct glz::meta<my_struct> {
|
||||
using T = my_struct;
|
||||
static constexpr auto value = object(
|
||||
"i", &T::i,
|
||||
"d", &T::d,
|
||||
"hello", &T::hello,
|
||||
"arr", &T::arr
|
||||
);
|
||||
};
|
||||
|
||||
int main(void) {
|
||||
std::string buffer = R"({"i":287,"d":3.14,"hello":"Hello World","arr":[1,2,3]})";
|
||||
#ifdef GLAZE_USE_EXCEPTION
|
||||
auto s = glz::read_json<my_struct>(buffer);
|
||||
|
||||
(void)s.d;
|
||||
(void)s.hello;
|
||||
(void)s.arr;
|
||||
#else
|
||||
auto s = glz::read_json<my_struct>(buffer);
|
||||
|
||||
if (s) {
|
||||
(void)s.value().d;
|
||||
(void)s.value().hello;
|
||||
(void)s.value().arr;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
9
recipes/glaze/all/test_v1_package/CMakeLists.txt
Normal file
9
recipes/glaze/all/test_v1_package/CMakeLists.txt
Normal file
@@ -0,0 +1,9 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
project(test_package)
|
||||
|
||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
||||
conan_basic_setup(TARGETS)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/
|
||||
${CMAKE_CURRENT_BINARY_DIR}/test_package/)
|
||||
18
recipes/glaze/all/test_v1_package/conanfile.py
Normal file
18
recipes/glaze/all/test_v1_package/conanfile.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from conans import ConanFile, CMake
|
||||
from conan.tools.build import cross_building
|
||||
import os
|
||||
|
||||
|
||||
class TestPackageV1Conan(ConanFile):
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
generators = "cmake", "cmake_find_package_multi"
|
||||
|
||||
def build(self):
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def test(self):
|
||||
if not cross_building(self):
|
||||
bin_path = os.path.join("bin", "test_package")
|
||||
self.run(bin_path, run_environment=True)
|
||||
29
recipes/glaze/config.yml
Normal file
29
recipes/glaze/config.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
versions:
|
||||
"4.4.3":
|
||||
folder: all
|
||||
"4.3.1":
|
||||
folder: all
|
||||
"4.0.1":
|
||||
folder: all
|
||||
"3.6.2":
|
||||
folder: all
|
||||
"3.6.1":
|
||||
folder: all
|
||||
"3.4.3":
|
||||
folder: all
|
||||
"3.4.1":
|
||||
folder: all
|
||||
"3.3.4":
|
||||
folder: all
|
||||
"3.3.2":
|
||||
folder: all
|
||||
"3.3.1":
|
||||
folder: all
|
||||
"3.1.9":
|
||||
folder: all
|
||||
"3.1.7":
|
||||
folder: all
|
||||
"2.9.5":
|
||||
folder: all
|
||||
"2.8.4":
|
||||
folder: all
|
||||
53
recipes/spdlog/all/conandata.yml
Normal file
53
recipes/spdlog/all/conandata.yml
Normal file
@@ -0,0 +1,53 @@
|
||||
sources:
|
||||
"1.15.1":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.15.1.tar.gz"
|
||||
sha256: "25c843860f039a1600f232c6eb9e01e6627f7d030a2ae5e232bdd3c9205d26cc"
|
||||
"1.15.0":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.15.0.tar.gz"
|
||||
sha256: "9962648c9b4f1a7bbc76fd8d9172555bad1871fdb14ff4f842ef87949682caa5"
|
||||
"1.14.1":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.14.1.tar.gz"
|
||||
sha256: "1586508029a7d0670dfcb2d97575dcdc242d3868a259742b69f100801ab4e16b"
|
||||
"1.14.0":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.14.0.tar.gz"
|
||||
sha256: "429a6b73ade8285cb21f83bacf89e2821dd1720ea7faa3cb518ffe04b4e00efc"
|
||||
"1.13.0":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.13.0.tar.gz"
|
||||
sha256: "534f2ee1a4dcbeb22249856edfb2be76a1cf4f708a20b0ac2ed090ee24cfdbc9"
|
||||
"1.12.0":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.12.0.tar.gz"
|
||||
sha256: "4dccf2d10f410c1e2feaff89966bfc49a1abb29ef6f08246335b110e001e09a9"
|
||||
"1.11.0":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.11.0.tar.gz"
|
||||
sha256: "ca5cae8d6cac15dae0ec63b21d6ad3530070650f68076f3a4a862ca293a858bb"
|
||||
"1.10.0":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.10.0.tar.gz"
|
||||
sha256: "697f91700237dbae2326b90469be32b876b2b44888302afbc7aceb68bcfe8224"
|
||||
"1.9.2":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.9.2.tar.gz"
|
||||
sha256: "6fff9215f5cb81760be4cc16d033526d1080427d236e86d70bb02994f85e3d38"
|
||||
"1.9.1":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.9.1.tar.gz"
|
||||
sha256: "9a452cfa24408baccc9b2bc2d421d68172a7630c99e9504a14754be840d31a62"
|
||||
"1.8.5":
|
||||
url: "https://github.com/gabime/spdlog/archive/v1.8.5.tar.gz"
|
||||
sha256: "944d0bd7c763ac721398dca2bb0f3b5ed16f67cef36810ede5061f35a543b4b8"
|
||||
patches:
|
||||
"1.11.0":
|
||||
- patch_file: "patches/1.11.0-0001-fix-fmt10-build.patch"
|
||||
patch_description: "Fix fmt 10.0.0 build"
|
||||
patch_type: "conan"
|
||||
patch_source: "https://github.com/gabime/spdlog/pull/2694"
|
||||
# Each release is intended to work with some specific versions
|
||||
fmt_version_mapping:
|
||||
"1.15.1": "11.1.3"
|
||||
"1.15.0": "11.0.2"
|
||||
"1.14.1": "10.2.1"
|
||||
"1.14.0": "10.2.1"
|
||||
"1.13.0": "10.2.1"
|
||||
"1.12.0": "10.2.1"
|
||||
"1.11.0": "10.0.0"
|
||||
"1.10.0": "8.1.1"
|
||||
"1.9.2": "8.0.1"
|
||||
"1.9.1": "8.0.1"
|
||||
"1.8.5": "7.1.3"
|
||||
196
recipes/spdlog/all/conanfile.py
Normal file
196
recipes/spdlog/all/conanfile.py
Normal file
@@ -0,0 +1,196 @@
|
||||
from conan import ConanFile
|
||||
from conan.errors import ConanInvalidConfiguration
|
||||
from conan.tools.build import check_min_cppstd
|
||||
from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout
|
||||
from conan.tools.files import get, copy, rmdir, replace_in_file, apply_conandata_patches, export_conandata_patches
|
||||
from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime
|
||||
from conan.tools.scm import Version
|
||||
import os
|
||||
|
||||
required_conan_version = ">=1.53.0"
|
||||
|
||||
|
||||
class SpdlogConan(ConanFile):
|
||||
name = "spdlog"
|
||||
package_type = "library"
|
||||
description = "Fast C++ logging library"
|
||||
url = "https://github.com/conan-io/conan-center-index"
|
||||
homepage = "https://github.com/gabime/spdlog"
|
||||
topics = ("logger", "logging", "log-filtering", "file sink", "header-only")
|
||||
license = "MIT"
|
||||
settings = "os", "arch", "compiler", "build_type"
|
||||
options = {
|
||||
"shared": [True, False],
|
||||
"fPIC": [True, False],
|
||||
"header_only": [True, False],
|
||||
"wchar_support": [True, False],
|
||||
"wchar_filenames": [True, False],
|
||||
"wchar_console": [True, False],
|
||||
"no_exceptions": [True, False],
|
||||
"use_std_fmt": [True, False],
|
||||
}
|
||||
default_options = {
|
||||
"shared": False,
|
||||
"fPIC": True,
|
||||
"header_only": False,
|
||||
"wchar_support": False,
|
||||
"wchar_filenames": False,
|
||||
"wchar_console": False,
|
||||
"no_exceptions": False,
|
||||
"use_std_fmt": False,
|
||||
}
|
||||
|
||||
def export_sources(self):
|
||||
export_conandata_patches(self)
|
||||
|
||||
def config_options(self):
|
||||
if self.settings.os == "Windows":
|
||||
del self.options.fPIC
|
||||
else:
|
||||
del self.options.wchar_support
|
||||
del self.options.wchar_filenames
|
||||
del self.options.wchar_console
|
||||
if Version(self.version) < "1.10.0":
|
||||
del self.options.use_std_fmt
|
||||
if Version(self.version) < "1.15.0":
|
||||
self.options.rm_safe("wchar_console")
|
||||
|
||||
def configure(self):
|
||||
if self.options.get_safe("shared") or self.options.header_only:
|
||||
self.options.rm_safe("fPIC")
|
||||
if self.options.header_only:
|
||||
self.options.rm_safe("shared")
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self, src_folder="src")
|
||||
|
||||
def requirements(self):
|
||||
if not self.options.get_safe("use_std_fmt"):
|
||||
fmt_version = self.conan_data["fmt_version_mapping"][self.version]
|
||||
self.requires(f"fmt/{fmt_version}", transitive_headers=True, transitive_libs=True)
|
||||
|
||||
def package_id(self):
|
||||
if self.info.options.header_only:
|
||||
self.info.clear()
|
||||
|
||||
@property
|
||||
def _std_fmt_compilers_minimum_version(self):
|
||||
return {
|
||||
"gcc": "13",
|
||||
"clang": "14",
|
||||
"apple-clang": "15",
|
||||
"Visual Studio": "16",
|
||||
"msvc": "192",
|
||||
}
|
||||
|
||||
def validate(self):
|
||||
if self.options.get_safe("use_std_fmt"):
|
||||
check_min_cppstd(self, 20)
|
||||
else:
|
||||
check_min_cppstd(self, 11)
|
||||
if self.options.get_safe("shared") and is_msvc_static_runtime(self):
|
||||
raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported")
|
||||
|
||||
if self.options.get_safe("use_std_fmt"):
|
||||
compiler_name = str(self.settings.compiler)
|
||||
minimum_version = self._std_fmt_compilers_minimum_version.get(compiler_name, False)
|
||||
if not minimum_version:
|
||||
self.output.warning(f"{self.name} recipe lacks information about the {compiler_name} compiler support.")
|
||||
elif Version(self.settings.compiler.version) < minimum_version:
|
||||
raise ConanInvalidConfiguration(
|
||||
f"{self.ref} using std::fmt requires std::fmt, which your compiler does not support."
|
||||
)
|
||||
|
||||
def source(self):
|
||||
get(self, **self.conan_data["sources"][self.version], strip_root=True)
|
||||
|
||||
def generate(self):
|
||||
if not self.options.header_only:
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["SPDLOG_BUILD_EXAMPLE"] = False
|
||||
tc.variables["SPDLOG_BUILD_EXAMPLE_HO"] = False
|
||||
tc.variables["SPDLOG_BUILD_TESTS"] = False
|
||||
tc.variables["SPDLOG_BUILD_TESTS_HO"] = False
|
||||
tc.variables["SPDLOG_BUILD_BENCH"] = False
|
||||
if not self.options.get_safe("use_std_fmt"):
|
||||
fmt = self.dependencies["fmt"]
|
||||
tc.variables["SPDLOG_FMT_EXTERNAL"] = not fmt.options.header_only
|
||||
tc.variables["SPDLOG_FMT_EXTERNAL_HO"] = fmt.options.header_only
|
||||
tc.variables["SPDLOG_BUILD_SHARED"] = not self.options.header_only and self.options.shared
|
||||
tc.variables["SPDLOG_WCHAR_SUPPORT"] = self.options.get_safe("wchar_support", False)
|
||||
tc.variables["SPDLOG_WCHAR_FILENAMES"] = self.options.get_safe("wchar_filenames", False)
|
||||
if Version(self.version) >= "1.15.0":
|
||||
tc.variables["SDPLOG_WCHAR_CONSOLE"] = self.options.get_safe("wchar_console", False)
|
||||
tc.variables["SPDLOG_INSTALL"] = True
|
||||
tc.variables["SPDLOG_NO_EXCEPTIONS"] = self.options.no_exceptions
|
||||
tc.variables["SPDLOG_USE_STD_FORMAT"] = self.options.get_safe("use_std_fmt")
|
||||
if self.settings.os in ("iOS", "tvOS", "watchOS"):
|
||||
tc.variables["SPDLOG_NO_TLS"] = True
|
||||
tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "NEW"
|
||||
tc.generate()
|
||||
cmake_deps = CMakeDeps(self)
|
||||
cmake_deps.generate()
|
||||
|
||||
|
||||
def _patch_sources(self):
|
||||
apply_conandata_patches(self)
|
||||
replace_in_file(self, os.path.join(self.source_folder, "cmake", "utils.cmake"), "/WX", "")
|
||||
# This is properly set in later versions
|
||||
if self.options.get_safe("use_std_fmt") and Version(self.version) < "1.12":
|
||||
replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"),
|
||||
"CMAKE_CXX_STANDARD 11", "CMAKE_CXX_STANDARD 20")
|
||||
|
||||
def build(self):
|
||||
self._patch_sources()
|
||||
if not self.options.header_only:
|
||||
cmake = CMake(self)
|
||||
cmake.configure()
|
||||
cmake.build()
|
||||
|
||||
def package(self):
|
||||
copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder)
|
||||
if self.options.header_only:
|
||||
copy(self,
|
||||
src=os.path.join(self.source_folder, "include"),
|
||||
pattern="*.h", dst=os.path.join(self.package_folder, "include"),
|
||||
# Unvendor bundled dependencies https://github.com/gabime/spdlog/commit/18495bf25dad3a4e8c2fe3777a5f79acecde27e3
|
||||
excludes=("spdlog/fmt/bundled/*"))
|
||||
else:
|
||||
cmake = CMake(self)
|
||||
cmake.install()
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
|
||||
rmdir(self, os.path.join(self.package_folder, "lib", "spdlog", "cmake"))
|
||||
|
||||
def package_info(self):
|
||||
target = "spdlog_header_only" if self.options.header_only else "spdlog"
|
||||
self.cpp_info.set_property("cmake_file_name", "spdlog")
|
||||
self.cpp_info.set_property("cmake_target_name", f"spdlog::{target}")
|
||||
self.cpp_info.set_property("pkg_config_name", "spdlog")
|
||||
|
||||
# TODO: back to global scope in conan v2 once legacy generators removed
|
||||
self.cpp_info.components["libspdlog"].set_property("cmake_target_name", f"spdlog::{target}")
|
||||
if self.options.get_safe("use_std_fmt"):
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_USE_STD_FORMAT")
|
||||
else:
|
||||
self.cpp_info.components["libspdlog"].requires = ["fmt::fmt"]
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_FMT_EXTERNAL")
|
||||
|
||||
if self.options.header_only:
|
||||
self.cpp_info.components["libspdlog"].libdirs = []
|
||||
else:
|
||||
suffix = "d" if self.settings.build_type == "Debug" else ""
|
||||
self.cpp_info.components["libspdlog"].libs = [f"spdlog{suffix}"]
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_COMPILED_LIB")
|
||||
if self.options.get_safe("wchar_support"):
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_WCHAR_TO_UTF8_SUPPORT")
|
||||
if self.options.get_safe("wchar_filenames"):
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_WCHAR_FILENAMES")
|
||||
if self.options.get_safe("wchar_console"):
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_UTF8_TO_WCHAR_CONSOLE")
|
||||
if self.options.no_exceptions:
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_NO_EXCEPTIONS")
|
||||
if self.settings.os in ["Linux", "FreeBSD"]:
|
||||
self.cpp_info.components["libspdlog"].system_libs = ["pthread"]
|
||||
if self.options.header_only and self.settings.os in ("iOS", "tvOS", "watchOS"):
|
||||
self.cpp_info.components["libspdlog"].defines.append("SPDLOG_NO_TLS")
|
||||
34
recipes/spdlog/all/patches/1.11.0-0001-fix-fmt10-build.patch
Normal file
34
recipes/spdlog/all/patches/1.11.0-0001-fix-fmt10-build.patch
Normal file
@@ -0,0 +1,34 @@
|
||||
From 576210a1363822a132657090b9f37e305bd0e2c2 Mon Sep 17 00:00:00 2001
|
||||
From: pwqbot <ding00000804@gmail.com>
|
||||
Date: Tue, 20 Jun 2023 10:41:48 +0800
|
||||
Subject: [PATCH] fix fmt build
|
||||
|
||||
---
|
||||
include/spdlog/common.h | 9 ++++++++-
|
||||
1 file changed, 8 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/include/spdlog/common.h b/include/spdlog/common.h
|
||||
index f97fd48c..00f4d728 100644
|
||||
--- a/include/spdlog/common.h
|
||||
+++ b/include/spdlog/common.h
|
||||
@@ -160,12 +160,19 @@ using format_string_t = fmt::format_string<Args...>;
|
||||
template<class T>
|
||||
using remove_cvref_t = typename std::remove_cv<typename std::remove_reference<T>::type>::type;
|
||||
|
||||
+template<typename Char>
|
||||
+# if FMT_VERSION >= 90101
|
||||
+using fmt_runtime_string = fmt::runtime_format_string<Char>;
|
||||
+# else
|
||||
+using fmt_runtime_string = fmt::basic_runtime<Char>;
|
||||
+# endif
|
||||
+
|
||||
// clang doesn't like SFINAE disabled constructor in std::is_convertible<> so have to repeat the condition from basic_format_string here,
|
||||
// in addition, fmt::basic_runtime<Char> is only convertible to basic_format_string<Char> but not basic_string_view<Char>
|
||||
template<class T, class Char = char>
|
||||
struct is_convertible_to_basic_format_string
|
||||
: std::integral_constant<bool,
|
||||
- std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt::basic_runtime<Char>>::value>
|
||||
+ std::is_convertible<T, fmt::basic_string_view<Char>>::value || std::is_same<remove_cvref_t<T>, fmt_runtime_string<Char>>::value>
|
||||
{};
|
||||
|
||||
# if defined(SPDLOG_WCHAR_FILENAMES) || defined(SPDLOG_WCHAR_TO_UTF8_SUPPORT)
|
||||
17
recipes/spdlog/all/test_package/CMakeLists.txt
Normal file
17
recipes/spdlog/all/test_package/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
cmake_minimum_required(VERSION 3.8)
|
||||
project(test_package LANGUAGES CXX)
|
||||
|
||||
find_package(spdlog REQUIRED CONFIG)
|
||||
|
||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||
if(SPDLOG_HEADER_ONLY)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog_header_only)
|
||||
else()
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog)
|
||||
endif()
|
||||
|
||||
if(SPDLOG_USE_STD_FORMAT)
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
|
||||
else()
|
||||
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
|
||||
endif()
|
||||
33
recipes/spdlog/all/test_package/conanfile.py
Normal file
33
recipes/spdlog/all/test_package/conanfile.py
Normal file
@@ -0,0 +1,33 @@
|
||||
import os
|
||||
from conan import ConanFile
|
||||
from conan.tools.cmake import CMake, CMakeToolchain
|
||||
from conan.tools.build import can_run
|
||||
from conan.tools.cmake import cmake_layout
|
||||
|
||||
|
||||
class TestPackageConan(ConanFile):
|
||||
settings = "os", "compiler", "build_type", "arch"
|
||||
generators = "CMakeDeps", "VirtualRunEnv"
|
||||
test_type = "explicit"
|
||||
|
||||
def layout(self):
|
||||
cmake_layout(self)
|
||||
|
||||
def requirements(self):
|
||||
self.requires(self.tested_reference_str)
|
||||
|
||||
def generate(self):
|
||||
tc = CMakeToolchain(self)
|
||||
tc.variables["SPDLOG_HEADER_ONLY"] = self.dependencies["spdlog"].options.header_only
|
||||
tc.variables["SPDLOG_USE_STD_FORMAT"] = self.dependencies["spdlog"].options.get_safe("use_std_fmt", False)
|
||||
tc.generate()
|
||||
|
||||
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")
|
||||
13
recipes/spdlog/all/test_package/test_package.cpp
Normal file
13
recipes/spdlog/all/test_package/test_package.cpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#include <cstdlib>
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
#if defined __has_include
|
||||
# if __has_include ("spdlog/fmt/bundled/core.h")
|
||||
# error "bundled fmt within spdlog should not be present"
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int main(void) {
|
||||
spdlog::info("Welcome to spdlog version {}.{}.{} !", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
23
recipes/spdlog/config.yml
Normal file
23
recipes/spdlog/config.yml
Normal file
@@ -0,0 +1,23 @@
|
||||
versions:
|
||||
"1.15.1":
|
||||
folder: "all"
|
||||
"1.15.0":
|
||||
folder: "all"
|
||||
"1.14.1":
|
||||
folder: "all"
|
||||
"1.14.0":
|
||||
folder: "all"
|
||||
"1.13.0":
|
||||
folder: "all"
|
||||
"1.12.0":
|
||||
folder: "all"
|
||||
"1.11.0":
|
||||
folder: "all"
|
||||
"1.10.0":
|
||||
folder: "all"
|
||||
"1.9.2":
|
||||
folder: "all"
|
||||
"1.9.1":
|
||||
folder: "all"
|
||||
"1.8.5":
|
||||
folder: "all"
|
||||
Reference in New Issue
Block a user