diff --git a/docs/how_to_add_packages.md b/docs/how_to_add_packages.md index 436b9f6251684..1013f71c9e7d1 100644 --- a/docs/how_to_add_packages.md +++ b/docs/how_to_add_packages.md @@ -156,7 +156,7 @@ Then in your `conanfile.py` method, it has to be used to download the sources: ### How to provide a good recipe -The [recipes](https://github.com/conan-io/conan-center-index/tree/master/recipes) available in CCI can be used as good examples, you can use them as the base for your recipe. +The [recipes](https://github.com/conan-io/conan-center-index/tree/master/recipes) available in CCI can be used as good examples, you can use them as the base for your recipe. However it is important to note Conan features change over time and our best practices evolve so some minor details may be out of date due to the vast number of recipes. If you are looking for header-only projects, you can take a look on [rapidjson](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/all/conanfile.py), [rapidxml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidxml/all/conanfile.py), and [nuklear](https://github.com/conan-io/conan-center-index/blob/master/recipes/nuklear/all/conanfile.py). Also, Conan Docs has a section about [how to package header-only libraries](https://docs.conan.io/en/latest/howtos/header_only.html). diff --git a/recipes/apr-util/all/CMakeLists.txt b/recipes/apr-util/all/CMakeLists.txt index a69305eb3971f..2a122ebfa3606 100644 --- a/recipes/apr-util/all/CMakeLists.txt +++ b/recipes/apr-util/all/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) +project(cmake_wrapper C) include(conanbuildinfo.cmake) conan_basic_setup() diff --git a/recipes/apr-util/all/conanfile.py b/recipes/apr-util/all/conanfile.py index d676c66675672..832a6fae3770c 100644 --- a/recipes/apr-util/all/conanfile.py +++ b/recipes/apr-util/all/conanfile.py @@ -1,10 +1,9 @@ from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration -import glob import os -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.33.0" class AprUtilConan(ConanFile): @@ -72,8 +71,11 @@ def _build_subfolder(self): def requirements(self): self.requires("apr/1.7.0") + if self.settings.os != "Windows": + #cmake build doesn't allow injection of iconv yet + self.requires("libiconv/1.16") if self.options.with_openssl: - self.requires("openssl/1.1.1j") + self.requires("openssl/1.1.1k") if self.options.with_nss: # self.requires("nss/x.y.z") raise ConanInvalidConfiguration("CCI has no nss recipe (yet)") @@ -96,17 +98,17 @@ def requirements(self): # self.requires("ldap/x.y.z") raise ConanInvalidConfiguration("CCI has no ldap recipe (yet)") if self.options.with_mysql: - self.requires("libmysqlclient/8.0.17") + self.requires("libmysqlclient/8.0.25") if self.options.with_sqlite3: - self.requires("sqlite3/3.35.1") + self.requires("sqlite3/3.35.5") if self.options.with_expat: - self.requires("expat/2.2.10") + self.requires("expat/2.4.1") if self.options.with_postgresql: self.requires("libpq/13.2") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format(self.name, self.version), self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def validate(self): if self.options.shared != self.options["apr"].shared: @@ -139,6 +141,7 @@ def _configure_autotools(self): conf_args = [ "--with-apr={}".format(tools.unix_path(self.deps_cpp_info["apr"].rootpath)), "--with-crypto" if self._with_crypto else "--without-crypto", + "--with-iconv={}".format(tools.unix_path(self.deps_cpp_info["libiconv"].rootpath)), "--with-openssl={}".format(tools.unix_path(self.deps_cpp_info["openssl"].rootpath)) if self.options.with_openssl else "--without-openssl", "--with-expat={}".format(tools.unix_path(self.deps_cpp_info["expat"].rootpath)) if self.options.with_expat else "--without-expat", "--with-mysql={}".format(tools.unix_path(self.deps_cpp_info["libmysqlclient"].rootpath)) if self.options.with_mysql else "--without-mysql", @@ -176,8 +179,7 @@ def package(self): autotools = self._configure_autotools() autotools.install() - for file in glob.glob(os.path.join(self.package_folder, "lib", "apr-util-1", "*.la")): - os.unlink(file) + tools.remove_files_by_mask(os.path.join(self.package_folder, "lib", "apr-util-1"), "*.la") os.unlink(os.path.join(self.package_folder, "lib", "libaprutil-1.la")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -191,8 +193,6 @@ def package_info(self): self.cpp_info.system_libs = ["dl", "pthread", "rt"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["mswsock", "rpcrt4", "ws2_32"] - elif self.settings.os == "Macos": - self.cpp_info.system_libs = ["iconv"] binpath = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH env var : {}".format(binpath)) diff --git a/recipes/arcus/all/CMakeLists.txt b/recipes/arcus/all/CMakeLists.txt new file mode 100644 index 0000000000000..361b35d4c17d9 --- /dev/null +++ b/recipes/arcus/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/arcus/all/conandata.yml b/recipes/arcus/all/conandata.yml new file mode 100644 index 0000000000000..9e659afa43d49 --- /dev/null +++ b/recipes/arcus/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.9.1": + url: "https://github.com/Ultimaker/libArcus/archive/refs/tags/4.9.1.tar.gz" + sha256: "18d939fd2428c72fdce35a286c196438327cfc3c8476e463e5ca46570168c9ce" diff --git a/recipes/arcus/all/conanfile.py b/recipes/arcus/all/conanfile.py new file mode 100644 index 0000000000000..b16f0d29cbc89 --- /dev/null +++ b/recipes/arcus/all/conanfile.py @@ -0,0 +1,127 @@ +from conans import ConanFile, CMake, tools +import os +import textwrap + +required_conan_version = ">=1.33.0" + + +class ArcusConan(ConanFile): + name = "arcus" + description = "This library contains C++ code and Python3 bindings for " \ + "creating a socket in a thread and using this socket to send " \ + "and receive messages based on the Protocol Buffers library." + license = "LGPL-3.0-or-later" + topics = ("arcus", "protobuf", "socket", "cura") + homepage = "https://github.com/Ultimaker/libArcus" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + generators = "cmake", "cmake_find_package" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("protobuf/3.17.1") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + # Do not force PIC + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", + "") + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC)", + "") + # TODO: this patch could be removed when CMake variables fixed in protobuf recipe + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES})", + "target_link_libraries(Arcus PUBLIC protobuf::libprotobuf)") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["BUILD_PYTHON"] = False + self._cmake.definitions["BUILD_EXAMPLES"] = False + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + if self.settings.compiler == "Visual Studio": + self._cmake.definitions["MSVC_STATIC_RUNTIME"] = str(self.settings.compiler.runtime).startswith("MT") + self._cmake.configure() + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"Arcus": "Arcus::Arcus"} + ) + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake") + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, + "conan-official-{}-targets.cmake".format(self.name)) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "Arcus" + self.cpp_info.names["cmake_find_package_multi"] = "Arcus" + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.libs = ["Arcus"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + elif self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/arcus/all/test_package/CMakeLists.txt b/recipes/arcus/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ef27cd84029d8 --- /dev/null +++ b/recipes/arcus/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Arcus REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} Arcus) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/arcus/all/test_package/conanfile.py b/recipes/arcus/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/arcus/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/arcus/all/test_package/test_package.cpp b/recipes/arcus/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f213963f9dbec --- /dev/null +++ b/recipes/arcus/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + Arcus::Socket socket; + return 0; +} diff --git a/recipes/arcus/config.yml b/recipes/arcus/config.yml new file mode 100644 index 0000000000000..4831b25407aa2 --- /dev/null +++ b/recipes/arcus/config.yml @@ -0,0 +1,3 @@ +versions: + "4.9.1": + folder: all diff --git a/recipes/argtable2/all/conandata.yml b/recipes/argtable2/all/conandata.yml index 258eee8df3aac..9f0629c6216d9 100644 --- a/recipes/argtable2/all/conandata.yml +++ b/recipes/argtable2/all/conandata.yml @@ -8,3 +8,5 @@ patches: base_path: "source_subfolder" - patch_file: "patches/2.13-0002-msvc-nmake-accept-conan-flags.patch" base_path: "source_subfolder" + - patch_file: "patches/2.13-0003-armv8-build.patch" + base_path: "source_subfolder" diff --git a/recipes/argtable2/all/conanfile.py b/recipes/argtable2/all/conanfile.py index cb8edd88462f6..319ff6bcc27a2 100644 --- a/recipes/argtable2/all/conanfile.py +++ b/recipes/argtable2/all/conanfile.py @@ -1,5 +1,6 @@ from conans import AutoToolsBuildEnvironment, ConanFile, tools import os +import shutil class Argtable2Conan(ConanFile): @@ -45,10 +46,21 @@ def build_requirements(self): if tools.os_info.is_windows and self.settings.compiler != "Visual Studio": self.build_requires("msys2/20200517") + if self.settings.os != "Windows": + self.build_requires("gnu-config/cci.20201022") + def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("argtable{}".format(self.version.replace(".", "-")), self._source_subfolder) + @property + def _user_info_build(self): + # If using the experimental feature with different context for host and + # build, the 'user_info' attributes of the 'build_requires' packages + # will be located into the 'user_info_build' object. In other cases they + # will be located into the 'deps_user_info' object. + return getattr(self, "user_info_build", None) or self.deps_user_info + def _configure_autotools(self): if self._autotools: return self._autotools @@ -58,6 +70,14 @@ def _configure_autotools(self): "--enable-shared={}".format(yes_no(self.options.shared)), "--enable-static={}".format(yes_no(not self.options.shared)), ] + + # it contains outdated 'config.sub' and + # 'config.guess' files. It not allows to build libelf for armv8 arch. + shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, + os.path.join(self._source_subfolder, "config.sub")) + shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, + os.path.join(self._source_subfolder, "config.guess")) + self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) return self._autotools diff --git a/recipes/argtable2/all/patches/2.13-0003-armv8-build.patch b/recipes/argtable2/all/patches/2.13-0003-armv8-build.patch new file mode 100644 index 0000000000000..84bce24b2273d --- /dev/null +++ b/recipes/argtable2/all/patches/2.13-0003-armv8-build.patch @@ -0,0 +1,12 @@ +diff --git a/src/arg_int.c b/src/arg_int.c +index 29c20e5..bc10012 100644 +--- a/src/arg_int.c ++++ b/src/arg_int.c +@@ -30,6 +30,7 @@ USA. + + #include "argtable2.h" + #include ++#include + + /* local error codes */ + enum {EMINCOUNT=1,EMAXCOUNT,EBADINT,EOVERFLOW}; diff --git a/recipes/b2/standard/conanfile.py b/recipes/b2/standard/conanfile.py index 605daa796c58a..17703bad0de81 100644 --- a/recipes/b2/standard/conanfile.py +++ b/recipes/b2/standard/conanfile.py @@ -77,9 +77,12 @@ def build(self): os.chdir(build_dir) command = os.path.join( engine_dir, "b2.exe" if use_windows_commands else "b2") - full_command = \ - "{0} --ignore-site-config --prefix=../output --abbreviate-paths install".format( - command) + if self.options.toolset != 'auto': + full_command = "{0} --ignore-site-config --prefix=../output --abbreviate-paths" \ + " toolset={1} install".format(command, self.options.toolset) + else: + full_command = "{0} --ignore-site-config --prefix=../output --abbreviate-paths" \ + " install".format(command) self.run(full_command) def package(self): diff --git a/recipes/confu_json/all/conandata.yml b/recipes/confu_json/all/conandata.yml new file mode 100644 index 0000000000000..fc37ce631ce5d --- /dev/null +++ b/recipes/confu_json/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.0.5: + url: https://github.com/werto87/confu_json/archive/refs/tags/v0.0.5.tar.gz + sha256: bc506d4b7836a7689b1c6a2d89bb0c3441f774c8f845fef79d85c71099df5bf9 diff --git a/recipes/confu_json/all/conanfile.py b/recipes/confu_json/all/conanfile.py new file mode 100644 index 0000000000000..d9a0751549bb5 --- /dev/null +++ b/recipes/confu_json/all/conanfile.py @@ -0,0 +1,71 @@ +from conans import ConanFile, tools +from conans.tools import check_min_cppstd +from conans.errors import ConanInvalidConfiguration, ConanException +import os +from conans.tools import Version + +required_conan_version = ">=1.33.0" + + +class ConfuJson(ConanFile): + name = "confu_json" + homepage = "https://github.com/werto87/confu_json" + description = "uses boost::fusion to help with serialization; json <-> user defined type" + topics = ("json parse", "serialization", "user defined type") + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + settings = "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "15", + "gcc": "10", + "clang": "10", + } + + def validate(self): + if self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration( + "apple-clang is not supported because of missing concept support") + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get( + str(self.settings.compiler)) + if not min_version: + self.output.warn("{} recipe lacks information about the {} " + "compiler support.".format( + self.name, self.settings.compiler)) + else: + if tools.Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + "{} requires C++{} support. " + "The current compiler {} {} does not support it.".format( + self.name, self._minimum_cpp_standard, + self.settings.compiler, + self.settings.compiler.version)) + + def requirements(self): + self.requires("boost/1.76.0") + self.requires("magic_enum/0.7.2") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("*.h*", dst="include/confu_json", + src="source_subfolder/confu_json") + self.copy("*LICENSE.md", dst="licenses", keep_path=False) + + def package_id(self): + self.info.header_only() diff --git a/recipes/confu_json/all/test_package/CMakeLists.txt b/recipes/confu_json/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..43c029827180c --- /dev/null +++ b/recipes/confu_json/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(${PROJECT_NAME} example.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::confu_json) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) diff --git a/recipes/confu_json/all/test_package/conanfile.py b/recipes/confu_json/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b63178709d69f --- /dev/null +++ b/recipes/confu_json/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/confu_json/all/test_package/example.cpp b/recipes/confu_json/all/test_package/example.cpp new file mode 100644 index 0000000000000..e1edc3931571a --- /dev/null +++ b/recipes/confu_json/all/test_package/example.cpp @@ -0,0 +1,16 @@ +#include "confu_json/confu_json.hxx" +#include // this file should be included only in one translation unit + +BOOST_FUSION_DEFINE_STRUCT((shared_class), Nested, + (long, answer)) // used to define a struct + +int main() { + using namespace confu_json; + auto nested = shared_class::Nested{}; + nested.answer = 42; + std::cout << to_json(nested) + << std::endl; // converts the struct into json and prints it + auto nestedTest = to_object( + to_json(nested)); // converts the struct into json and back into an object + assert(nested.answer == nestedTest.answer); +} diff --git a/recipes/confu_json/config.yml b/recipes/confu_json/config.yml new file mode 100644 index 0000000000000..a82f94dfae8e8 --- /dev/null +++ b/recipes/confu_json/config.yml @@ -0,0 +1,4 @@ +versions: + 0.0.5: + folder: all + diff --git a/recipes/cpu_features/all/conanfile.py b/recipes/cpu_features/all/conanfile.py index 6abca552051fe..251d4a11453cf 100644 --- a/recipes/cpu_features/all/conanfile.py +++ b/recipes/cpu_features/all/conanfile.py @@ -1,5 +1,6 @@ import os from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration class CpuFeaturesConan(ConanFile): @@ -35,6 +36,10 @@ def configure(self): del self.settings.compiler.libcxx del self.settings.compiler.cppstd + def validate(self): + if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): + raise ConanInvalidConfiguration("Cross-building not implemented") + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC diff --git a/recipes/crowcpp-crow/all/conandata.yml b/recipes/crowcpp-crow/all/conandata.yml index d8eced9828909..09dda86e9c7d8 100644 --- a/recipes/crowcpp-crow/all/conandata.yml +++ b/recipes/crowcpp-crow/all/conandata.yml @@ -1,8 +1,14 @@ sources: + "0.3": + url: "https://github.com/CrowCpp/crow/archive/v0.3.tar.gz" + sha256: "75c4a9cf18bddd15320570a643bc3bdffba8eafaea7b383cf46df7219c80052e" "0.2": sha256: f52445e0b236ecf0fda50ac5a1b7a2da511401c885071fb97a74b6b9844a9e64 url: https://github.com/CrowCpp/crow/archive/0.2.tar.gz patches: + "0.3": + - patch_file: "patches/001-disable-examples.patch" + base_path: "source_subfolder" "0.2": - patch_file: "patches/001-disable-examples.patch" base_path: "source_subfolder" diff --git a/recipes/crowcpp-crow/config.yml b/recipes/crowcpp-crow/config.yml index 7e65100e62b2c..f3bf2c14ea034 100644 --- a/recipes/crowcpp-crow/config.yml +++ b/recipes/crowcpp-crow/config.yml @@ -1,3 +1,5 @@ versions: + "0.3": + folder: all "0.2": folder: all diff --git a/recipes/cryptopp/all/conanfile.py b/recipes/cryptopp/all/conanfile.py index 6b4d904deac1b..aaeb1665eb4c1 100644 --- a/recipes/cryptopp/all/conanfile.py +++ b/recipes/cryptopp/all/conanfile.py @@ -82,6 +82,8 @@ def _configure_cmake(self): self._cmake.definitions["USE_INTERMEDIATE_OBJECTS_TARGET"] = False if self.settings.os == "Android": self._cmake.definitions["CRYPTOPP_NATIVE_ARCH"] = True + if self.settings.os == "Macos" and self.settings.arch == "armv8" and tools.Version(self.version) <= "8.4.0": + self._cmake.definitions["CMAKE_CXX_FLAGS"] = "-march=armv8-a" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake diff --git a/recipes/djinni-generator/all/conandata.yml b/recipes/djinni-generator/all/conandata.yml index 65bba71a817f5..b7081bc87d34d 100644 --- a/recipes/djinni-generator/all/conandata.yml +++ b/recipes/djinni-generator/all/conandata.yml @@ -14,3 +14,6 @@ sources: "1.0.0": url: https://github.com/cross-language-cpp/djinni-generator/releases/download/v1.0.0/djinni sha256: "a5dc94cd5175f228eb17e93e0f4cec93c18615758b139707a05f20dc7001f55f" + "1.1.0": + url: https://github.com/cross-language-cpp/djinni-generator/releases/download/v1.1.0/djinni + sha256: "4efd4f68cf913af7c9dd7dd975a8aa2d2a90e8efd9d3b556979ff577923e0d44" diff --git a/recipes/djinni-generator/config.yml b/recipes/djinni-generator/config.yml index 58b468609fdaf..8af4fbf3c504e 100644 --- a/recipes/djinni-generator/config.yml +++ b/recipes/djinni-generator/config.yml @@ -9,3 +9,5 @@ versions: folder: "all" "1.0.0": folder: "all" + "1.1.0": + folder: "all" diff --git a/recipes/doctest/2.x.x/conandata.yml b/recipes/doctest/2.x.x/conandata.yml index 731888fee3d6d..926a11a7e8d1d 100644 --- a/recipes/doctest/2.x.x/conandata.yml +++ b/recipes/doctest/2.x.x/conandata.yml @@ -26,3 +26,6 @@ sources: "2.4.5": url: "https://github.com/onqtam/doctest/archive/2.4.5.tar.gz" sha256: "b76ece19f0e473e3afa5c545dbdce2dd70bfef98ed0f383443b2f9fd9f86d5b4" + "2.4.6": + url: "https://github.com/onqtam/doctest/archive/2.4.6.tar.gz" + sha256: "39110778e6baf373ef04342d7cb3fe35da104cb40769103e8a2f0035f5a5f1cb" diff --git a/recipes/doctest/2.x.x/test_package/CMakeLists.txt b/recipes/doctest/2.x.x/test_package/CMakeLists.txt index ad9b6b6c4895f..175cbf2c31983 100644 --- a/recipes/doctest/2.x.x/test_package/CMakeLists.txt +++ b/recipes/doctest/2.x.x/test_package/CMakeLists.txt @@ -12,4 +12,4 @@ target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) enable_testing() -doctest_discover_tests(${PROJECT_NAME}) +doctest_discover_tests(${PROJECT_NAME} ADD_LABELS 1) diff --git a/recipes/doctest/config.yml b/recipes/doctest/config.yml index 792adaed5ebb7..004c85c8d9d65 100644 --- a/recipes/doctest/config.yml +++ b/recipes/doctest/config.yml @@ -17,3 +17,5 @@ versions: folder: 2.x.x 2.4.5: folder: 2.x.x + 2.4.6: + folder: 2.x.x diff --git a/recipes/fast-cdr/all/CMakeLists.txt b/recipes/fast-cdr/all/CMakeLists.txt new file mode 100644 index 0000000000000..d17aaff199b4a --- /dev/null +++ b/recipes/fast-cdr/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/fast-cdr/all/conandata.yml b/recipes/fast-cdr/all/conandata.yml new file mode 100644 index 0000000000000..234636418ba1e --- /dev/null +++ b/recipes/fast-cdr/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.21": + url: "https://github.com/eProsima/Fast-CDR/archive/refs/tags/v1.0.21.tar.gz" + sha256: "C1F32BDD76910ADA00D551EB8828DE7561AD2B2846D063CB4316F9262C03C77D" diff --git a/recipes/fast-cdr/all/conanfile.py b/recipes/fast-cdr/all/conanfile.py new file mode 100644 index 0000000000000..606732768e531 --- /dev/null +++ b/recipes/fast-cdr/all/conanfile.py @@ -0,0 +1,133 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os +import textwrap + +class FastCDRConan(ConanFile): + + name = "fast-cdr" + license = "Apache-2.0" + homepage = "https://github.com/eProsima/Fast-CDR" + url = "https://github.com/conan-io/conan-center-index" + description = "eProsima FastCDR library for serialization" + topics = ("conan", "DDS", "Middleware", "Serialization") + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + generators = "cmake" + exports_sources = ["CMakeLists.txt"] + _cmake = None + + @property + def _pkg_cmake(self): + return os.path.join( + self.package_folder, + "lib", + "cmake" + ) + + @property + def _module_subfolder(self): + return os.path.join( + "lib", + "cmake" + ) + + @property + def _module_file_rel_path(self): + return os.path.join( + self._module_subfolder, + "conan-target-properties.cmake" + ) + + @property + def _pkg_share(self): + return os.path.join( + self.package_folder, + "share" + ) + + @property + def _source_subfolder(self): + return "source_subfolder" + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + def _configure_cmake(self): + if not self._cmake: + self._cmake = CMake(self) + self._cmake.definitions["BUILD_STATIC"] = not self.options.shared + self._cmake.configure() + return self._cmake + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True, + destination=self._source_subfolder) + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + if self.settings.os == "Windows": + if ("MT" in self.settings.compiler.runtime and self.options.shared): + # This combination leads to an fast-cdr error when linking + # linking dynamic '*.dll' and static MT runtime + # see https://github.com/eProsima/Fast-CDR/blob/v1.0.21/include/fastcdr/eProsima_auto_link.h#L37 + # (2021-05-31) + raise ConanInvalidConfiguration("Mixing a dll eprosima library with a static runtime is a bad idea") + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + cmake = self._configure_cmake() + cmake.install() + self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + tools.rmdir(self._pkg_cmake) + tools.rmdir(self._pkg_share) + tools.remove_files_by_mask( + directory=os.path.join(self.package_folder, "lib"), + pattern="*.pdb" + ) + tools.remove_files_by_mask( + directory=os.path.join(self.package_folder, "bin"), + pattern="*.pdb" + ) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"fastcdr": "fastcdr::fastcdr"} + ) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "fastcdr" + self.cpp_info.names["cmake_find_package_multi"] = "fastcdr" + self.cpp_info.libs = tools.collect_libs(self) + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines.append("FASTCDR_DYN_LINK") + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/fast-cdr/all/test_package/CMakeLists.txt b/recipes/fast-cdr/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..82b4f6152e8ee --- /dev/null +++ b/recipes/fast-cdr/all/test_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(fastcdr REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +# check if the alias target fastcdr works +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} + fastcdr +) diff --git a/recipes/fast-cdr/all/test_package/conanfile.py b/recipes/fast-cdr/all/test_package/conanfile.py new file mode 100644 index 0000000000000..23ba95e79f465 --- /dev/null +++ b/recipes/fast-cdr/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fast-cdr/all/test_package/test_package.cpp b/recipes/fast-cdr/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3a437b366c3c4 --- /dev/null +++ b/recipes/fast-cdr/all/test_package/test_package.cpp @@ -0,0 +1,74 @@ +// Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima). +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include +#include + +#include +#include +#include + +#define N_ARR_ELEMENTS 5 + +static const char char_seq_t[N_ARR_ELEMENTS] = {'E', 'D', 'C', 'B', 'A'}; +static const std::wstring wstring_t = L"Hola a todos, esto es un test con widestring"; + +using namespace eprosima::fastcdr; + +#define BUFFER_LENGTH 2000 + + +void check_good_case() +{ + char buffer[BUFFER_LENGTH]; + const std::wstring& input_value = wstring_t; + + // Serialization. + { + FastBuffer cdrbuffer(buffer, BUFFER_LENGTH); + Cdr cdr_ser(cdrbuffer); + cdr_ser << input_value; + } + + // Deserialization. + { + FastBuffer cdrbuffer(buffer, BUFFER_LENGTH); + Cdr cdr_des(cdrbuffer); + std::wstring output_value{}; + + cdr_des >> output_value; + } +} + + +int main() +{ + check_good_case(); + + char buffer[BUFFER_LENGTH]; + + // Serialization. + FastBuffer cdrbuffer(buffer, BUFFER_LENGTH); + Cdr cdr_ser(cdrbuffer); + cdr_ser.serializeSequence(char_seq_t, 5); + + // Deserialization. + Cdr cdr_des(cdrbuffer); + + char* char_seq_value = NULL; size_t char_seq_len = 0; + + cdr_des.deserializeSequence(char_seq_value, char_seq_len); + + return 0; +} diff --git a/recipes/fast-cdr/config.yml b/recipes/fast-cdr/config.yml new file mode 100644 index 0000000000000..79180689c4d4f --- /dev/null +++ b/recipes/fast-cdr/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.21": + folder: all diff --git a/recipes/fftw/all/conandata.yml b/recipes/fftw/all/conandata.yml index 43968663d69ad..d4d2ad7dd2008 100644 --- a/recipes/fftw/all/conandata.yml +++ b/recipes/fftw/all/conandata.yml @@ -1,6 +1,10 @@ sources: "3.3.9": - url: "http://www.fftw.org/fftw-3.3.9.tar.gz" + url: + [ + "https://www.fftw.org/fftw-3.3.9.tar.gz", + "https://fftw.org/fftw-3.3.9.tar.gz", + ] sha256: "bf2c7ce40b04ae811af714deb512510cc2c17b9ab9d6ddcf49fe4487eea7af3d" "3.3.8": url: "http://www.fftw.org/fftw-3.3.8.tar.gz" diff --git a/recipes/foonathan-memory/all/CMakeLists.txt b/recipes/foonathan-memory/all/CMakeLists.txt new file mode 100644 index 0000000000000..d17aaff199b4a --- /dev/null +++ b/recipes/foonathan-memory/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/foonathan-memory/all/conandata.yml b/recipes/foonathan-memory/all/conandata.yml new file mode 100644 index 0000000000000..351f74f8b44bd --- /dev/null +++ b/recipes/foonathan-memory/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "0.7.0": + url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7.tar.gz" + sha256: "01A7CC5A5EBDDBD71BEC69C89562A4A2ECD7C29334C0A29D38D83E7F7F66EB53" +patches: + "0.7.0": + - base_path: "source_subfolder" + patch_file: "patches/0.7.0-0001-fix-virtualAllocFromApp.patch" diff --git a/recipes/foonathan-memory/all/conanfile.py b/recipes/foonathan-memory/all/conanfile.py new file mode 100644 index 0000000000000..106bf69a94c91 --- /dev/null +++ b/recipes/foonathan-memory/all/conanfile.py @@ -0,0 +1,135 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os +import textwrap + +class FoonathanMemory(ConanFile): + + name = "foonathan-memory" + license = "Zlib" + homepage = "https://github.com/foonathan/memory" + url = "https://github.com/conan-io/conan-center-index" + description = "STL compatible C++ memory allocator library" + topics = ("conan", "memory", "STL", "RawAllocator") + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_tools": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "with_tools": False + } + generators = "cmake" + exports_sources = ["patches/**","CMakeLists.txt"] + _cmake = None + + @property + def _pkg_cmake(self): + return os.path.join( + self.package_folder, + "lib", + "foonathan_memory", + "cmake" + ) + + @property + def _pkg_share(self): + return os.path.join( + self.package_folder, + "share" + ) + + @property + def _module_subfolder(self): + return os.path.join( + "lib", + "cmake" + ) + + @property + def _module_file_rel_path(self): + return os.path.join( + self._module_subfolder, + "conan-target-properties.cmake" + ) + + @property + def _source_subfolder(self): + return "source_subfolder" + + def _patch_sources(self): + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + + def _configure_cmake(self): + if not self._cmake: + self._cmake = CMake(self) + self._cmake.definitions["FOONATHAN_MEMORY_BUILD_EXAMPLES"] = False + self._cmake.definitions["FOONATHAN_MEMORY_BUILD_TESTS"] = False + self._cmake.definitions["FOONATHAN_MEMORY_BUILD_TOOLS"] = self.options.with_tools + self._cmake.configure() + return self._cmake + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True, + destination=self._source_subfolder) + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + cmake = self._configure_cmake() + cmake.install() + self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + tools.rmdir(self._pkg_cmake) + tools.rmdir(self._pkg_share) + tools.remove_files_by_mask( + directory=os.path.join(self.package_folder, "lib"), + pattern="*.pdb" + ) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"foonathan_memory": "foonathan_memory::foonathan_memory"} + ) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "foonathan_memory" + self.cpp_info.names["cmake_find_package_multi"] = "foonathan_memory" + self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.includedirs = [ + os.path.join("include", "foonathan_memory"), + os.path.join("include", "foonathan_memory", "comp") + ] + if self.options.with_tools: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH env var with : {}".format(bin_path)), + self.env_info.PATH.append(bin_path) + diff --git a/recipes/foonathan-memory/all/patches/0.7.0-0001-fix-virtualAllocFromApp.patch b/recipes/foonathan-memory/all/patches/0.7.0-0001-fix-virtualAllocFromApp.patch new file mode 100755 index 0000000000000..7961ecb88013c --- /dev/null +++ b/recipes/foonathan-memory/all/patches/0.7.0-0001-fix-virtualAllocFromApp.patch @@ -0,0 +1,22 @@ +diff --git a/src/virtual_memory.cpp b/src/virtual_memory.cpp +index 74d1c4e..d0e5fd5 100644 +--- a/src/virtual_memory.cpp ++++ b/src/virtual_memory.cpp +@@ -37,7 +37,7 @@ const std::size_t foonathan::memory::virtual_memory_page_size = get_page_size(); + void* foonathan::memory::virtual_memory_reserve(std::size_t no_pages) noexcept + { + auto pages = +-#if (_MSC_VER <= 1900) ++#if (_MSC_VER <= 1900) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + VirtualAlloc(nullptr, no_pages * virtual_memory_page_size, MEM_RESERVE, PAGE_READWRITE); + #else + VirtualAllocFromApp(nullptr, no_pages * virtual_memory_page_size, MEM_RESERVE, +@@ -55,7 +55,7 @@ void foonathan::memory::virtual_memory_release(void* pages, std::size_t) noexcep + void* foonathan::memory::virtual_memory_commit(void* memory, std::size_t no_pages) noexcept + { + auto region = +-#if (_MSC_VER <= 1900) ++#if (_MSC_VER <= 1900) || WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) + VirtualAlloc(memory, no_pages * virtual_memory_page_size, MEM_COMMIT, PAGE_READWRITE); + #else + VirtualAllocFromApp(memory, no_pages * virtual_memory_page_size, MEM_COMMIT, diff --git a/recipes/foonathan-memory/all/test_package/CMakeLists.txt b/recipes/foonathan-memory/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..83cd20076bb9f --- /dev/null +++ b/recipes/foonathan-memory/all/test_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(foonathan_memory REQUIRED) + +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +#check if the alias target foonathan_memory works +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} + foonathan_memory +) diff --git a/recipes/foonathan-memory/all/test_package/conanfile.py b/recipes/foonathan-memory/all/test_package/conanfile.py new file mode 100644 index 0000000000000..23ba95e79f465 --- /dev/null +++ b/recipes/foonathan-memory/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/foonathan-memory/all/test_package/test_package.cpp b/recipes/foonathan-memory/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..20153e0cbe2dc --- /dev/null +++ b/recipes/foonathan-memory/all/test_package/test_package.cpp @@ -0,0 +1,69 @@ + +// Copyright (C) 2015-2021 Müller +// This file is subject to the license terms in the LICENSE file +// found in the top-level directory of this distribution. + +// this example shows how to store allocators by reference and type-erased +// see https://memory.foonathan.net/md_doc_adapters_storage.html for further details + +#include +#include + +#include // allocator_reference, any_allocator_reference +#include // heap_allocator +#include // memory_stack + +// alias namespace foonathan::memory as memory for easier access +#include + +template +void do_sth(memory::allocator_reference ref); + +int main() +{ + using namespace memory::literals; + + // storing stateless allocator by reference + // heap_allocator is stateless so it does not need to be actually referenced + // the reference can take it as a temporary and construct it on the fly + memory::allocator_reference ref_stateless(memory::heap_allocator{}); + do_sth(ref_stateless); + + // create a memory_stack + // allocates a memory block - initially 4KiB big - and allocates from it in a stack-like manner + // deallocation is only done via unwinding to a previously queried marker + memory::memory_stack<> stack(4_KiB); + + // storing stateful allocator by reference + // memory_stack is stateful and thus the reference actually takes the address of the object + // the user has to ensure that the referenced object lives long enough + memory::allocator_reference> ref_stateful(stack); + do_sth(ref_stateful); + + // storing a reference type-erased + // any_allocator_reference is an alias for allocator_reference + // it triggers a specialization that uses type-erasure + // the tag type can be passed to any class that uses an allocator_reference internally, + // like std_allocator or the deep_copy_ptr from the other example + memory::any_allocator_reference any1( + ref_stateful); // initialize with another allocator reference, will "unwrap" + do_sth(any1); + + memory::any_allocator_reference any2(stack); // initialize with a "normal" RawAllocator + do_sth(any2); + + memory::any_allocator_reference any3( + std::allocator{}); // normal Allocators are RawAllocators, too, so this works + do_sth(any3); +} + +template +void do_sth(memory::allocator_reference ref) +{ + // ref is a full-blown RawAllocator that provides all member functions, + // so there is no need to use the allocator_traits + + auto node = ref.allocate_node(sizeof(int), alignof(int)); + std::cout << "Got memory for an int " << node << '\n'; + ref.deallocate_node(node, sizeof(int), alignof(int)); +} diff --git a/recipes/foonathan-memory/config.yml b/recipes/foonathan-memory/config.yml new file mode 100644 index 0000000000000..55c94c09eb61d --- /dev/null +++ b/recipes/foonathan-memory/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.0": + folder: all diff --git a/recipes/gdcm/all/CMakeLists.txt b/recipes/gdcm/all/CMakeLists.txt new file mode 100644 index 0000000000000..c2b070dd78a43 --- /dev/null +++ b/recipes/gdcm/all/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.9.2) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +add_subdirectory(source_subfolder) diff --git a/recipes/gdcm/all/conandata.yml b/recipes/gdcm/all/conandata.yml new file mode 100644 index 0000000000000..e5909be85a6c1 --- /dev/null +++ b/recipes/gdcm/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "3.0.9": + url: "https://github.com/malaterre/GDCM/archive/refs/tags/v3.0.9.tar.gz" + sha256: "fcfc50ea8809bd4a173550c7d7bb4f8722ae0781fbf17240ce84a04e90af0e9b" +patches: + "3.0.9": + - patch_file: "patches/0001-charls-linking.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-openjpeg-integration.patch" + base_path: "source_subfolder" diff --git a/recipes/gdcm/all/conanfile.py b/recipes/gdcm/all/conanfile.py new file mode 100644 index 0000000000000..60c798adb8547 --- /dev/null +++ b/recipes/gdcm/all/conanfile.py @@ -0,0 +1,220 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os +import textwrap + +required_conan_version = ">=1.33.0" + +class GDCMConan(ConanFile): + name = "gdcm" + topics = ("dicom", "images") + homepage = "http://gdcm.sourceforge.net/" + url = "https://github.com/conan-io/conan-center-index" + license = "BSD-3-Clause" + description = "C++ library for DICOM medical files" + exports_sources = "CMakeLists.txt", "patches/**" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + generators = "cmake", "cmake_find_package" + + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def validate(self): + if (self.settings.compiler == "Visual Studio" + and self.options.shared + and str(self.settings.compiler.runtime).startswith("MT")): + raise ConanInvalidConfiguration("shared gdcm can't be built with MT or MTd") + if self.settings.compiler.cppstd: + tools.check_min_cppstd(self, "11") + + def requirements(self): + self.requires("expat/2.4.1") + self.requires("openjpeg/2.4.0") + self.requires("zlib/1.2.11") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + + self._cmake = CMake(self) + self._cmake.definitions["GDCM_BUILD_DOCBOOK_MANPAGES"] = False + self._cmake.definitions["GDCM_BUILD_SHARED_LIBS"] = self.options.shared + # FIXME: unvendor deps https://github.com/conan-io/conan-center-index/pull/5705#discussion_r647224146 + self._cmake.definitions["GDCM_USE_SYSTEM_EXPAT"] = True + self._cmake.definitions["GDCM_USE_SYSTEM_OPENJPEG"] = True + self._cmake.definitions["GDCM_USE_SYSTEM_ZLIB"] = True + + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("Copyright.txt", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + if self.settings.os == "Windows": + bin_dir = os.path.join(self.package_folder, "bin") + tools.remove_files_by_mask(bin_dir, "[!gs]*.dll") + tools.remove_files_by_mask(bin_dir, "*.pdb") + lib_dir = os.path.join(self.package_folder, "lib") + tools.rmdir(os.path.join(self.package_folder, "share")) + tools.remove_files_by_mask(os.path.join(lib_dir, self._gdcm_subdir), "[!U]*.cmake") #leave UseGDCM.cmake untouched + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._gdcm_cmake_module_aliases_path), + self._gdcm_libraries + ) + self._create_cmake_variables(os.path.join(self.package_folder, self._gdcm_cmake_variables_path)) + + def _create_cmake_variables(self, variables_file): + v = tools.Version(self.version) + content = textwrap.dedent("""\ + # The GDCM version number. + set(GDCM_MAJOR_VERSION "{v_major}") + set(GDCM_MINOR_VERSION "{v_minor}") + set(GDCM_BUILD_VERSION "{v_patch}") + + get_filename_component(SELF_DIR "${{CMAKE_CURRENT_LIST_FILE}}" PATH) + + # The libraries. + set(GDCM_LIBRARIES "") + + # The CMake macros dir. + set(GDCM_CMAKE_DIR "") + + # The configuration options. + set(GDCM_BUILD_SHARED_LIBS "{build_shared_libs}") + + set(GDCM_USE_VTK "OFF") + + # The "use" file. + set(GDCM_USE_FILE ${{SELF_DIR}}/UseGDCM.cmake) + + # The VTK options. + set(GDCM_VTK_DIR "") + + get_filename_component(GDCM_INCLUDE_ROOT "${{SELF_DIR}}/../../include/{gdcm_subdir}" ABSOLUTE) + set(GDCM_INCLUDE_DIRS ${{GDCM_INCLUDE_ROOT}}) + get_filename_component(GDCM_LIB_ROOT "${{SELF_DIR}}/../../lib" ABSOLUTE) + set(GDCM_LIBRARY_DIRS ${{GDCM_LIB_ROOT}}) + """.format(v_major=v.major, + v_minor=v.minor, + v_patch=v.patch, + build_shared_libs="ON" if self.options.shared else "OFF", + gdcm_subdir=self._gdcm_subdir)) + tools.save(variables_file, content) + + @staticmethod + def _create_cmake_module_alias_targets(targets_file, libraries): + content = "\n".join([textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=library, aliased="GDCM::"+library)) for library in libraries]) + tools.save(targets_file, content) + + @property + def _gdcm_subdir(self): + v = tools.Version(self.version) + return "gdcm-{}.{}".format(v.major, v.minor) + + @property + def _gdcm_builddir(self): + return os.path.join("lib", self._gdcm_subdir) + + @property + def _gdcm_cmake_module_aliases_path(self): + return os.path.join("lib", self._gdcm_subdir, "conan-official-gdcm-targets.cmake") + + @property + def _gdcm_cmake_variables_path(self): + return os.path.join("lib", self._gdcm_subdir, "conan-official-gdcm-variables.cmake") + + @property + def _gdcm_build_modules(self): + return [self._gdcm_cmake_module_aliases_path, self._gdcm_cmake_variables_path] + + @property + def _gdcm_libraries(self): + gdcm_libs = ["gdcmcharls", + "gdcmCommon", + "gdcmDICT", + "gdcmDSED", + "gdcmIOD", + "gdcmjpeg12", + "gdcmjpeg16", + "gdcmjpeg8", + "gdcmMEXD", + "gdcmMSFF", + "socketxx"] + if self.settings.os == "Windows": + gdcm_libs.append("gdcmgetopt") + else: + gdcm_libs.append("gdcmuuid") + return gdcm_libs + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "GDCM" + self.cpp_info.names["cmake_find_multi_package"] = "GDCM" + gdcm_libs = self._gdcm_libraries + for lib in gdcm_libs: + self.cpp_info.components[lib].libs = [lib] + self.cpp_info.components[lib].includedirs = [os.path.join("include", self._gdcm_subdir)] + self.cpp_info.components[lib].builddirs = [self._gdcm_builddir] + self.cpp_info.components[lib].build_modules["cmake"] = self._gdcm_build_modules + self.cpp_info.components[lib].build_modules["cmake_find_package"] = self._gdcm_build_modules + self.cpp_info.components[lib].build_modules["cmake_find_multi_package"] = self._gdcm_build_modules + + self.cpp_info.components["gdcmDSED"].requires.extend(["gdcmCommon", "zlib::zlib"]) + self.cpp_info.components["gdcmIOD"].requires.extend(["gdcmDSED", "gdcmCommon", "expat::expat"]) + self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmIOD", "gdcmDSED", "gdcmDICT", "openjpeg::openjpeg"]) + if not self.options.shared: + self.cpp_info.components["gdcmDICT"].requires.extend(["gdcmDSED", "gdcmIOD"]) + self.cpp_info.components["gdcmMEXD"].requires.extend(["gdcmMSFF", "gdcmDICT", "gdcmDSED", "gdcmIOD", "socketxx"]) + self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmjpeg8", "gdcmjpeg12", "gdcmjpeg16", "gdcmcharls"]) + + if self.settings.os == "Windows": + self.cpp_info.components["gdcmCommon"].system_libs = ["ws2_32", "crypt32"] + self.cpp_info.components["gdcmMSFF"].system_libs = ["rpcrt4"] + self.cpp_info.components["socketxx"].system_libs = ["ws2_32"] + else: + self.cpp_info.components["gdcmMSFF"].requires.append("gdcmuuid") + + self.cpp_info.components["gdcmCommon"].system_libs = ["dl"] + if tools.is_apple_os(self.settings.os): + self.cpp_info.components["gdcmCommon"].frameworks = ["CoreFoundation"] diff --git a/recipes/gdcm/all/patches/0001-charls-linking.patch b/recipes/gdcm/all/patches/0001-charls-linking.patch new file mode 100644 index 0000000000000..57df8966f04ba --- /dev/null +++ b/recipes/gdcm/all/patches/0001-charls-linking.patch @@ -0,0 +1,38 @@ +--- a/Utilities/gdcmcharls/CMakeLists.txt ++++ b/Utilities/gdcmcharls/CMakeLists.txt +@@ -61,12 +61,10 @@ endif() + #option(charls_BUILD_SHARED_LIBS "Build CharLS with shared libraries." OFF) + #set(BUILD_SHARED_LIBS ${charls_BUILD_SHARED_LIBS}) + +-if(WIN32) +- if(BUILD_SHARED_LIBS) +- add_definitions(-DCHARLS_DLL_BUILD) +- else() +- add_definitions(-DCHARLS_STATIC) +- endif() ++if(BUILD_SHARED_LIBS) ++ add_definitions(-DCHARLS_DLL_BUILD) ++else() ++ add_definitions(-DCHARLS_STATIC) + endif() + + add_library(${CHARLS_LIBRARY_NAME} +--- a/Utilities/gdcmcharls/charls.h ++++ b/Utilities/gdcmcharls/charls.h +@@ -13,12 +13,12 @@ + #define CHARLS_IMEXPORT(returntype) __declspec(dllexport) returntype __stdcall + #endif + +-// Non-windows (static linking) +-#if !defined(CHARLS_IMEXPORT) && !defined(_WIN32) +-# define CHARLS_IMEXPORT(returntype) returntype ++// Non-windows (dynamic linking) ++#if !defined(WIN32) && (defined(CHARLS_DLL) || defined(CHARLS_DLL_BUILD)) ++#define CHARLS_IMEXPORT(returntype) __attribute__((visibility("default"))) returntype + #endif + +-// Windows static linking ++// Static linking + #if !defined(CHARLS_IMEXPORT) && defined(CHARLS_STATIC) + # define CHARLS_IMEXPORT(returntype) returntype + #endif diff --git a/recipes/gdcm/all/patches/0002-openjpeg-integration.patch b/recipes/gdcm/all/patches/0002-openjpeg-integration.patch new file mode 100644 index 0000000000000..a85da145a8462 --- /dev/null +++ b/recipes/gdcm/all/patches/0002-openjpeg-integration.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -364,7 +364,7 @@ endif() + + if(GDCM_USE_SYSTEM_OPENJPEG) + find_package(OpenJPEG 2.0.0 REQUIRED) +- set(GDCM_OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARIES}) ++ set(GDCM_OPENJPEG_LIBRARIES ${OpenJPEG_LIBRARIES}) + else() + set(GDCM_OPENJPEG_LIBRARIES gdcmopenjp2) + endif() +--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt ++++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt +@@ -149,7 +149,7 @@ else() + ) + endif() + if(GDCM_USE_SYSTEM_OPENJPEG) +- include_directories(${OPENJPEG_INCLUDE_DIRS} ) ++ include_directories(${OpenJPEG_INCLUDE_DIRS} ) + else() + include_directories( + "${GDCM_BINARY_DIR}/Utilities/gdcmopenjpeg" diff --git a/recipes/gdcm/all/test_package/CMakeLists.txt b/recipes/gdcm/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..52e5115892396 --- /dev/null +++ b/recipes/gdcm/all/test_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.9.2) +project(test_package) + +if(NOT DEFINED CMAKE_CXX_STANDARD) + set(CMAKE_CXX_STANDARD 11) +endif() +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(GDCM REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +include(${GDCM_USE_FILE}) +target_link_libraries(${PROJECT_NAME} gdcmMSFF) diff --git a/recipes/gdcm/all/test_package/DCMTK_JPEGExt_12Bits.dcm b/recipes/gdcm/all/test_package/DCMTK_JPEGExt_12Bits.dcm new file mode 100644 index 0000000000000..a38d4be8214fc Binary files /dev/null and b/recipes/gdcm/all/test_package/DCMTK_JPEGExt_12Bits.dcm differ diff --git a/recipes/gdcm/all/test_package/conanfile.py b/recipes/gdcm/all/test_package/conanfile.py new file mode 100644 index 0000000000000..62048238ee169 --- /dev/null +++ b/recipes/gdcm/all/test_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + +class GDCMTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + input_file = os.path.join(self.source_folder, "DCMTK_JPEGExt_12Bits.dcm") + test_dir = "test_dir" + tools.mkdir(test_dir) + output_file = os.path.join(test_dir, "output.dcm") + self.run([bin_path, input_file, output_file], run_environment=True) diff --git a/recipes/gdcm/all/test_package/test_package.cpp b/recipes/gdcm/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bce75e82a246e --- /dev/null +++ b/recipes/gdcm/all/test_package/test_package.cpp @@ -0,0 +1,78 @@ +/*========================================================================= + + Program: GDCM (Grassroots DICOM). A DICOM library + + Copyright (c) 2006-2011 Mathieu Malaterre + All rights reserved. + See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notice for more information. + +=========================================================================*/ +/* + * This example is ... guess what this is for :) + */ + +#include "gdcmReader.h" +#include "gdcmWriter.h" +#include "gdcmAttribute.h" + +#include + +int main(int argc, char* argv[]) +{ + if (argc < 3) + { + std::cerr << argv[0] << " input.dcm output.dcm" << std::endl; + return 1; + } + const char* filename = argv[1]; + const char* outfilename = argv[2]; + + // Instanciate the reader: + gdcm::Reader reader; + reader.SetFileName(filename); + if (!reader.Read()) + { + std::cerr << "Could not read: " << filename << std::endl; + return 1; + } + + // If we reach here, we know for sure only 1 thing: + // It is a valid DICOM file (potentially an old ACR-NEMA 1.0/2.0 file) + // (Maybe, it's NOT a Dicom image -could be a DICOMDIR, a RTSTRUCT, etc-) + + // The output of gdcm::Reader is a gdcm::File + gdcm::File& file = reader.GetFile(); + + // the dataset is the the set of element we are interested in: + gdcm::DataSet& ds = file.GetDataSet(); + + // Contruct a static(*) type for Image Comments : + gdcm::Attribute<0x0020, 0x4000> imagecomments; + imagecomments.SetValue("Hello, World !"); + + // Now replace the Image Comments from the dataset with our: + ds.Replace(imagecomments.GetAsDataElement()); + + // Write the modified DataSet back to disk + gdcm::Writer writer; + writer.CheckFileMetaInformationOff(); // Do not attempt to reconstruct the file meta to preserve the file + // as close to the original as possible. + writer.SetFileName(outfilename); + writer.SetFile(file); + if (!writer.Write()) + { + std::cerr << "Could not write: " << outfilename << std::endl; + return 1; + } + + return 0; +} + +/* + * (*) static type, means that extra DICOM information VR & VM are computed at compilation time. + * The compiler is deducing those values from the template arguments of the class. + */ diff --git a/recipes/gdcm/config.yml b/recipes/gdcm/config.yml new file mode 100644 index 0000000000000..638e4d986a94c --- /dev/null +++ b/recipes/gdcm/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.9": + folder: "all" diff --git a/recipes/geos/all/conanfile.py b/recipes/geos/all/conanfile.py index a1919660cd641..9d0f6ce7e56f3 100644 --- a/recipes/geos/all/conanfile.py +++ b/recipes/geos/all/conanfile.py @@ -51,6 +51,12 @@ def source(self): def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, {}): tools.patch(**patch) + + if self.settings.os == "Macos" and self.settings.arch == "armv8" and tools.Version(self.version) <= "3.9.0": + # Issue reported https://trac.osgeo.org/geos/ticket/1090, and + # fixed upstream for following versions https://trac.osgeo.org/geos/changeset/6318f224552c27a4b87ecf8817173cb7e6a2f4f1/git + os.unlink(os.path.join(self.build_folder, self._source_subfolder, 'src', 'inlines.cpp')) + cmake = self._configure_cmake() cmake.build() diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index e5ca5430f1b8e..7d645d8cf8dd5 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,28 +1,28 @@ sources: "2.65.0": - url: "https://download.gnome.org/sources/glib/2.65/glib-2.65.0.tar.xz" - sha256: "b041e63cd0ac1fccb486374022ade040d907aad29b278e27d9e43e9294a6e7a3" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.65.0/glib-2.65.0.tar.gz" + sha256: "60c82c8f3e45dff15815df08375f01638df9ee12271982d431295f0ab0e7779a" "2.65.1": - url: "https://download.gnome.org/sources/glib/2.65/glib-2.65.1.tar.xz" - sha256: "bc63bf6c32713e0ee1dddc28e03f23b4a20c78bcb9a2c5b0f4eea41e46fb9cee" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.65.1/glib-2.65.1.tar.gz" + sha256: "9a391abc24b90305588b022770bf44e0ab7f87af2fd260a015438a124e8fc7be" "2.65.2": - url: "https://download.gnome.org/sources/glib/2.65/glib-2.65.2.tar.xz" - sha256: "445b1951eaa82d7a8af46bdff5dcc8030406db1ceeb0f0c3a88983f70152c555" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.65.2/glib-2.65.2.tar.gz" + sha256: "346d4b29bf05e7b129a829b52ff917a9eb0e769d7c88ca775102256f9cf109ee" "2.65.3": - url: "https://download.gnome.org/sources/glib/2.65/glib-2.65.3.tar.xz" - sha256: "efd894e4693068bca945cb20d168b088510fa24d48a577f5edaf3d55912c60c2" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.65.3/glib-2.65.3.tar.gz" + sha256: "0fa5004fafe377b3d299c8f1d3ed03778fc1091a3f02ef9e837df977e50f2904" "2.66.0": - url: "https://download.gnome.org/sources/glib/2.66/glib-2.66.0.tar.xz" - sha256: "c5a66bf143065648c135da4c943d2ac23cce15690fc91c358013b2889111156c" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.66.0/glib-2.66.0.tar.gz" + sha256: "dd720b29bea359e74c93333e4a322cee20f94d499402aa83d187989fabcf04b0" "2.66.1": - url: "https://download.gnome.org/sources/glib/2.66/glib-2.66.1.tar.xz" - sha256: "a269ffe69fbcc3a21ff1acb1b6146b2a5723499d6e2de33ae16ccb6d2438ef60" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.66.1/glib-2.66.1.tar.gz" + sha256: "40e127273e464b82c2bec310a77c22f5a881a7af1ad6e27b287eee5442d6dfa8" "2.66.2": - url: "https://download.gnome.org/sources/glib/2.66/glib-2.66.2.tar.xz" - sha256: "ec390bed4e8dd0f89e918f385e8d4cfd7470b1ef7c1ce93ec5c4fc6e3c6a17c4" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.66.2/glib-2.66.2.tar.gz" + sha256: "2a02d8f9c7403ec577b08c16145fa70b683b562a2277b53f108209dc656058b6" "2.67.0": - url: "https://download.gnome.org/sources/glib/2.67/glib-2.67.0.tar.xz" - sha256: "0b15e57ab6c2bb90ced4e24a1b0d8d6e9a13af8a70266751aa3a45baffeed7c1" + url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.67.0/glib-2.67.0.tar.gz" + sha256: "a6df47c78dc8793dac80edecd9602c53a517ec2d30e9f7832a25eb554fa5ddb6" "2.67.1": url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.67.1/glib-2.67.1.tar.gz" sha256: "99861fb444a2801c1885c63504efb4cbff4d1acc0cf276c21f2c96f6b95020ad" diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index a71e4349f2b7b..33aa0eb2fa944 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -38,6 +38,10 @@ class GLibConan(ConanFile): def _is_msvc(self): return self.settings.compiler == "Visual Studio" + def validate(self): + if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): + raise ConanInvalidConfiguration("Cross-building not implemented") + def configure(self): if self.options.shared: del self.options.fPIC diff --git a/recipes/gtest/all/CMakeLists.txt b/recipes/gtest/all/CMakeLists.txt index 85997b1584ee4..936997bc005be 100644 --- a/recipes/gtest/all/CMakeLists.txt +++ b/recipes/gtest/all/CMakeLists.txt @@ -1,15 +1,13 @@ cmake_minimum_required(VERSION 2.8.11) project(cmake_wrapper) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include("conanbuildinfo.cmake") conan_basic_setup() -option(GTEST_NO_MAIN "Generate google main libraries" OFF) - if(MSVC) - if(MSVC_VERSION AND MSVC_VERSION GREATER_EQUAL 1910) + if(MSVC_VERSION AND (MSVC_VERSION EQUAL 1910 OR MSVC_VERSION GREATER 1910)) add_definitions(-DGTEST_LANG_CXX11=1 -DGTEST_HAS_TR1_TUPLE=0) - endif(MSVC_VERSION AND MSVC_VERSION GREATER_EQUAL 1910) + endif(MSVC_VERSION AND (MSVC_VERSION EQUAL 1910 OR MSVC_VERSION GREATER 1910)) endif(MSVC) add_subdirectory("source_subfolder") diff --git a/recipes/gtest/all/conandata.yml b/recipes/gtest/all/conandata.yml index eed122e278a00..97666235ea8ce 100644 --- a/recipes/gtest/all/conandata.yml +++ b/recipes/gtest/all/conandata.yml @@ -8,6 +8,9 @@ sources: "cci.20210126": url: "https://github.com/google/googletest/archive/273f8cb059a4e7b089731036392422b5ef489791.tar.gz" sha256: "2937e96827aa44b291d42c4f0ffaa6a7637445822cf873d0fa6a889df84b8628" + "1.11.0": + url: "https://github.com/google/googletest/archive/release-1.11.0.tar.gz" + sha256: "b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5" patches: "1.8.1": - patch_file: "patches/gtest-1.8.1.patch" diff --git a/recipes/gtest/all/conanfile.py b/recipes/gtest/all/conanfile.py index 625e7532cbae5..b53533d3bd5bb 100644 --- a/recipes/gtest/all/conanfile.py +++ b/recipes/gtest/all/conanfile.py @@ -1,7 +1,8 @@ -import glob -import os from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" class GTestConan(ConanFile): @@ -10,13 +11,35 @@ class GTestConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/googletest" license = "BSD-3-Clause" - topics = ("conan", "gtest", "testing", "google-testing", "unit-test") + topics = ("gtest", "testing", "google-testing", "unit-test") exports_sources = ["CMakeLists.txt", "patches/*"] generators = "cmake" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "build_gmock": [True, False], "fPIC": [True, False], "no_main": [True, False], "debug_postfix": "ANY", "hide_symbols": [True, False]} - default_options = {"shared": False, "build_gmock": True, "fPIC": True, "no_main": False, "debug_postfix": 'd', "hide_symbols": False} - _source_subfolder = "source_subfolder" + options = { + "shared": [True, False], + "build_gmock": [True, False], + "fPIC": [True, False], + "no_main": [True, False], + "debug_postfix": "ANY", + "hide_symbols": [True, False], + } + default_options = { + "shared": False, + "build_gmock": True, + "fPIC": True, + "no_main": False, + "debug_postfix": "d", + "hide_symbols": False, + } + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" @property def _minimum_cpp_standard(self): @@ -45,7 +68,7 @@ def _minimum_compilers_version(self): "clang": "5", "apple-clang": "9.1" } - + @property def _postfix(self): return self.options.debug_postfix if self.settings.build_type == "Debug" else "" @@ -57,6 +80,10 @@ def config_options(self): del self.options.debug_postfix def configure(self): + if self.options.shared: + del self.options.fPIC + + def validate(self): if self.settings.get_safe("compiler.cppstd"): tools.check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compilers_version.get( @@ -77,26 +104,26 @@ def lazy_lt_semver(v1, v2): self.name, self.settings.compiler, min_version, self.settings.compiler.version)) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("googletest-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): - cmake = CMake(self) + if self._cmake: + return self._cmake + self._cmake = CMake(self) if self.settings.build_type == "Debug": - cmake.definitions["CUSTOM_DEBUG_POSTFIX"] = self.options.debug_postfix + self._cmake.definitions["CUSTOM_DEBUG_POSTFIX"] = self.options.debug_postfix if self.settings.os == "Windows" and self.settings.get_safe("compiler.runtime"): - cmake.definitions["gtest_force_shared_crt"] = "MD" in str(self.settings.compiler.runtime) - cmake.definitions["BUILD_GMOCK"] = self.options.build_gmock - cmake.definitions["GTEST_NO_MAIN"] = self.options.no_main + self._cmake.definitions["gtest_force_shared_crt"] = "MD" in str(self.settings.compiler.runtime) + self._cmake.definitions["BUILD_GMOCK"] = self.options.build_gmock if self.settings.os == "Windows" and self.settings.compiler == "gcc": - cmake.definitions["gtest_disable_pthreads"] = True - cmake.definitions["gtest_hide_internal_symbols"] = self.options.hide_symbols - cmake.configure() - return cmake + self._cmake.definitions["gtest_disable_pthreads"] = True + self._cmake.definitions["gtest_hide_internal_symbols"] = self.options.hide_symbols + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake def build(self): - for patch in self.conan_data["patches"][self.version]: + for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) cmake = self._configure_cmake() cmake.build() @@ -107,8 +134,7 @@ def package(self): cmake.install() tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - for pdb_file in glob.glob(os.path.join(self.package_folder, "lib", "*.pdb")): - os.unlink(pdb_file) + tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") def package_id(self): del self.info.options.no_main @@ -121,17 +147,18 @@ def package_info(self): self.cpp_info.components["libgtest"].libs = ["gtest{}".format(self._postfix)] if self.settings.os == "Linux": self.cpp_info.components["libgtest"].system_libs.append("pthread") - + if self.settings.os == "Neutrino" and self.settings.os.version == "7.1": self.cpp_info.components["libgtest"].system_libs.append("regex") if self.options.shared: self.cpp_info.components["libgtest"].defines.append("GTEST_LINKED_AS_SHARED_LIBRARY=1") - if self.settings.compiler == "Visual Studio": - if tools.Version(self.settings.compiler.version.value) >= "15": - self.cpp_info.components["libgtest"].defines.append("GTEST_LANG_CXX11=1") - self.cpp_info.components["libgtest"].defines.append("GTEST_HAS_TR1_TUPLE=0") + if self.version == "1.8.1": + if self.settings.compiler == "Visual Studio": + if tools.Version(self.settings.compiler.version) >= "15": + self.cpp_info.components["libgtest"].defines.append("GTEST_LANG_CXX11=1") + self.cpp_info.components["libgtest"].defines.append("GTEST_HAS_TR1_TUPLE=0") if not self.options.no_main: self.cpp_info.components["gtest_main"].libs = ["gtest_main{}".format(self._postfix)] diff --git a/recipes/gtest/config.yml b/recipes/gtest/config.yml index ef88df4e76413..4499b986340b9 100644 --- a/recipes/gtest/config.yml +++ b/recipes/gtest/config.yml @@ -5,3 +5,5 @@ versions: folder: all "cci.20210126": folder: all + "1.11.0": + folder: all diff --git a/recipes/h5pp/all/conandata.yml b/recipes/h5pp/all/conandata.yml index 85a8aa509b37e..b1daaba22cbac 100644 --- a/recipes/h5pp/all/conandata.yml +++ b/recipes/h5pp/all/conandata.yml @@ -8,3 +8,10 @@ sources: "1.8.5": sha256: 1e1a42159fccd10b1022445ea0f0690c5314e94b0fc3d5c9fa0f02b165148c18 url: https://github.com/DavidAce/h5pp/archive/v1.8.5.tar.gz + "1.8.6": + sha256: 39d413c9383b00a87153b9480ab6a91ba356d3f30b3598de0c0c8f7f3bd802c7 + url: https://github.com/DavidAce/h5pp/archive/v1.8.6.tar.gz + "1.9.0": + sha256: f633b6f76ab20e1767f55068154cf8bf553e39d526ae80947388640c57ea2056 + url: https://github.com/DavidAce/h5pp/archive/v1.9.0.tar.gz + diff --git a/recipes/h5pp/all/conanfile.py b/recipes/h5pp/all/conanfile.py index 7b6f6d07e2372..baa4c93426eef 100644 --- a/recipes/h5pp/all/conanfile.py +++ b/recipes/h5pp/all/conanfile.py @@ -1,7 +1,7 @@ import os from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration - +from conans.tools import Version class h5ppConan(ConanFile): name = "h5pp" @@ -11,8 +11,8 @@ class h5ppConan(ConanFile): topics = ("conan","h5pp","hdf5", "binary", "storage") license = "MIT" settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - requires = "eigen/3.3.9", "spdlog/1.8.2", "hdf5/1.12.0" + generators = "cmake", "cmake_find_package","cmake_find_package_multi" + requires = "eigen/3.3.9", "spdlog/1.8.5", "hdf5/1.12.0" _cmake = None @@ -40,7 +40,8 @@ def _configure_cmake(self): self._cmake.definitions["H5PP_ENABLE_TESTS"] = False self._cmake.definitions["H5PP_BUILD_EXAMPLES"] = False self._cmake.definitions["H5PP_PRINT_INFO"] = False - self._cmake.definitions["H5PP_DOWNLOAD_METHOD"] = "conan" + if Version(self.version) >= "1.9.0": + self._cmake.definitions["H5PP_PACKAGE_MANAGER"] = "none" self._cmake.configure(source_folder=self._source_subfolder) return self._cmake @@ -62,7 +63,10 @@ def package(self): cmake = self._configure_cmake() cmake.install() self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "share")) + if Version(self.version) <= "1.8.6": + tools.rmdir(os.path.join(self.package_folder, "share")) + else: + tools.rmdir(os.path.join(self.package_folder, "lib/cmake")) def package_info(self): self.cpp_info.names["cmake_find_package"] = "h5pp" diff --git a/recipes/h5pp/all/test_package/test_package.cpp b/recipes/h5pp/all/test_package/test_package.cpp index b1a1c883369f1..197623963fa97 100644 --- a/recipes/h5pp/all/test_package/test_package.cpp +++ b/recipes/h5pp/all/test_package/test_package.cpp @@ -84,7 +84,7 @@ void test_h5pp(h5pp::File & file, const WriteType & writeData, std::string_view file.writeDataset(writeData,dsetpath); h5pp::logger::log->debug("Reading {}",tag); auto readData = file.readDataset(dsetpath); - if constexpr(h5pp::type::sfinae::is_ScalarN()) { + if constexpr(h5pp::type::sfinae::is_Scalar2_v or h5pp::type::sfinae::is_Scalar3_v) { compareScalar(writeData,readData); } else if constexpr (has_scalarN_v){ diff --git a/recipes/h5pp/config.yml b/recipes/h5pp/config.yml index f664419a614dc..5df3f36059025 100644 --- a/recipes/h5pp/config.yml +++ b/recipes/h5pp/config.yml @@ -5,3 +5,7 @@ versions: folder: "all" "1.8.5": folder: "all" + "1.8.6": + folder: "all" + "1.9.0": + folder: "all" diff --git a/recipes/hazelcast-cpp-client/all/conandata.yml b/recipes/hazelcast-cpp-client/all/conandata.yml index 468eebcc772d7..99207f191f98a 100644 --- a/recipes/hazelcast-cpp-client/all/conandata.yml +++ b/recipes/hazelcast-cpp-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.1": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.1.1.zip" + sha256: "ca425c97eb871400de4bd2307ddaf3c557c9c1bae50d6a0db6507d72f435830c" "4.1.0": url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.1.0.zip" sha256: "8356bc76077fea354e83ffcd506096797137af10b292809c6b7843a8fbd084e3" diff --git a/recipes/hazelcast-cpp-client/config.yml b/recipes/hazelcast-cpp-client/config.yml index c841ba5aa8831..7785de64b6179 100644 --- a/recipes/hazelcast-cpp-client/config.yml +++ b/recipes/hazelcast-cpp-client/config.yml @@ -1,4 +1,6 @@ versions: + "4.1.1": + folder: all "4.1.0": folder: all "4.0.1": diff --git a/recipes/hipony-enumerate/all/CMakeLists.txt b/recipes/hipony-enumerate/all/CMakeLists.txt new file mode 100644 index 0000000000000..4beb13671fe5e --- /dev/null +++ b/recipes/hipony-enumerate/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8) +project(cmake_wrapper) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory("source_subfolder") diff --git a/recipes/hipony-enumerate/all/conandata.yml b/recipes/hipony-enumerate/all/conandata.yml new file mode 100644 index 0000000000000..1a6399d227d06 --- /dev/null +++ b/recipes/hipony-enumerate/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.2.1": + url: "https://github.com/hipony/enumerate/archive/refs/tags/v2.2.1.zip" + sha256: "0b6e208007fc0cdffe7f23686faddf5c2bc06f6794bacf2e612197e1e54140e7" diff --git a/recipes/hipony-enumerate/all/conanfile.py b/recipes/hipony-enumerate/all/conanfile.py new file mode 100644 index 0000000000000..30fab9e3aea84 --- /dev/null +++ b/recipes/hipony-enumerate/all/conanfile.py @@ -0,0 +1,113 @@ +import os +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.33.0" + + +class HiponyEnumerateConan(ConanFile): + name = "hipony-enumerate" + license = "BSL-1.0" + + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hipony/enumerate" + description = "C++11 compatible version of enumerate" + topics = ("enumerate", "header-only", "cpp", + "constexpr", "cpp17", "cpp11", "tuples") + + settings = "os", "arch", "compiler", "build_type" + options = { + "aggregates": [True, False], + } + default_options = { + "aggregates": False + } + + generators = "cmake", "cmake_find_package_multi" + no_copy_source = True + exports_sources = ["CMakeLists.txt"] + _cmake = None + + def requirements(self): + if self.options.aggregates: + self.requires("pfr/2.0.2") + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8" if self.options.aggregates else "6", + "Visual Studio": "16" if self.options.aggregates else "14", + "clang": "5.0" if self.options.aggregates else "3.9", + "apple-clang": "10", + } + + @property + def _minimum_standard(self): + return "17" if self.options.aggregates else "11" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd( + self, self._minimum_standard) + + def lazy_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False) + if not minimum_version: + self.output.warn( + "{0} {1} requires C++{2}. Your compiler is unknown. Assuming it supports C++{2}." + .format(self.name, self.version, self._minimum_standard)) + elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + "{} {} requires C++{}, which your compiler does not support." + .format(self.name, self.version, self._minimum_standard)) + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + cmake = CMake(self) + cmake.definitions["BUILD_TESTING"] = "OFF" + cmake.definitions["HIPONY_ENUMERATE_AGGREGATES_ENABLED"] = self.options.aggregates + cmake.configure() + self._cmake = cmake + return self._cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_id(self): + self.info.header_only() + + def package_info(self): + self.cpp_info.filenames["cmake_find_package"] = "hipony-enumerate" + self.cpp_info.filenames["cmake_find_package_multi"] = "hipony-enumerate" + self.cpp_info.names["cmake_find_package"] = "hipony" + self.cpp_info.names["cmake_find_package_multi"] = "hipony" + self.cpp_info.components["enumerate"].names["cmake_find_package"] = "enumerate" + self.cpp_info.components["enumerate"].names["cmake_find_package_multi"] = "enumerate" + + if self.options.aggregates: + self.cpp_info.components["enumerate"].requires.append( + "pfr::pfr") + self.cpp_info.components["enumerate"].defines.append( + "HIPONY_ENUMERATE_AGGREGATES_ENABLED") diff --git a/recipes/hipony-enumerate/all/test_package/CMakeLists.txt b/recipes/hipony-enumerate/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5f8b27c181317 --- /dev/null +++ b/recipes/hipony-enumerate/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(hipony-enumerate REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE hipony::enumerate) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/hipony-enumerate/all/test_package/conanfile.py b/recipes/hipony-enumerate/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4004acdc63518 --- /dev/null +++ b/recipes/hipony-enumerate/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hipony-enumerate/all/test_package/test_package.cpp b/recipes/hipony-enumerate/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f4232aad68348 --- /dev/null +++ b/recipes/hipony-enumerate/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +#include +#include + +int main() { + std::array array{0, 1, 2, 3, 4, 5}; + for (auto &&item : hipony::enumerate(array)) { + std::cout << item.index << ' ' << item.value << '\n'; + } +} diff --git a/recipes/hipony-enumerate/config.yml b/recipes/hipony-enumerate/config.yml new file mode 100644 index 0000000000000..73a2f2e547b16 --- /dev/null +++ b/recipes/hipony-enumerate/config.yml @@ -0,0 +1,3 @@ +versions: + "2.2.1": + folder: "all" diff --git a/recipes/icu/all/conanfile.py b/recipes/icu/all/conanfile.py index ec15ea6c1f5ed..3f7ad43f30e71 100644 --- a/recipes/icu/all/conanfile.py +++ b/recipes/icu/all/conanfile.py @@ -69,6 +69,9 @@ def build_requirements(self): if tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/20200517") + if tools.cross_building(self.settings, skip_x64_x86=True) and hasattr(self, 'settings_build'): + self.build_requires("icu/{}".format(self.version)) + def source(self): tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) @@ -148,7 +151,6 @@ def _build_config_cmd(self): bits = "64" if self.settings.arch in arch64 else "32" args = [platform, "--prefix={0}".format(prefix), - "--with-library-bits={0}".format(bits), "--disable-samples", "--disable-layout", "--disable-layoutex", @@ -159,12 +161,13 @@ def _build_config_cmd(self): env_build = self._configure_autotools() if tools.cross_building(self.settings, skip_x64_x86=True): - if env_build.build: - args.append("--build=%s" % env_build.build) if env_build.host: args.append("--host=%s" % env_build.host) - if env_build.target: - args.append("--target=%s" % env_build.target) + bin_path = self.deps_env_info["icu"].PATH[0] + base_path, _ = bin_path.rsplit('/', 1) + args.append("--with-cross-build={}".format(base_path)) + else: + args.append("--with-library-bits={0}".format(bits),) if self.settings.os != "Windows": # http://userguide.icu-project.org/icudata @@ -220,6 +223,10 @@ def package(self): tools.mkdir(os.path.join(self.package_folder, "res")) shutil.move(self._data_path, os.path.join(self.package_folder, "res")) + # Copy some files required for cross-compiling + self.copy("icucross.mk", src=os.path.join(build_dir, "config"), dst="config") + self.copy("icucross.inc", src=os.path.join(build_dir, "config"), dst="config") + tools.rmdir(os.path.join(self.package_folder, "lib", "icu")) tools.rmdir(os.path.join(self.package_folder, "lib", "man")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) diff --git a/recipes/itk/all/CMakeLists.txt b/recipes/itk/all/CMakeLists.txt index ad57fcb040811..15f275836fa64 100644 --- a/recipes/itk/all/CMakeLists.txt +++ b/recipes/itk/all/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.10.2) project(cmake_wrapper) include(conanbuildinfo.cmake) diff --git a/recipes/itk/all/conandata.yml b/recipes/itk/all/conandata.yml index f81a07fcbb119..00d92878235fd 100644 --- a/recipes/itk/all/conandata.yml +++ b/recipes/itk/all/conandata.yml @@ -2,9 +2,13 @@ sources: "5.1.0": url: "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.0/InsightToolkit-5.1.0.tar.gz" sha256: "121020a1611508cec8123eb5226215598cec07be627d843a2e6b6da891e61d13" + "5.1.2": + url: "https://github.com/InsightSoftwareConsortium/ITK/releases/download/v5.1.2/InsightToolkit-5.1.2.tar.gz" + sha256: "f1e5a78e11125348f68f655c6b89b617c3a8b2c09f710081f621054811a70c98" patches: "5.1.0": - patch_file: "patches/0001-find-conan-packages.patch" base_path: "source_subfolder" - - patch_file: "patches/0002-gdcm-dependencies.patch" #FIXME: should be removed when gdcm is added as a cci recipe + "5.1.2": + - patch_file: "patches/0001-find-conan-packages.patch" base_path: "source_subfolder" diff --git a/recipes/itk/all/conanfile.py b/recipes/itk/all/conanfile.py index be49e838d4bbf..8453129858290 100644 --- a/recipes/itk/all/conanfile.py +++ b/recipes/itk/all/conanfile.py @@ -3,7 +3,7 @@ import glob import os -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.33.0" class ITKConan(ConanFile): @@ -48,34 +48,55 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - if self.settings.compiler == "apple-clang": - raise ConanInvalidConfiguration("itk does not support this compiler") def requirements(self): self.requires("libjpeg/9d") - self.requires("dcmtk/3.6.5") + self.requires("dcmtk/3.6.6") self.requires("double-conversion/3.1.5") self.requires("eigen/3.3.9") - self.requires("expat/2.2.10") + self.requires("expat/2.4.1") self.requires("fftw/3.3.9") + self.requires("gdcm/3.0.9") self.requires("hdf5/1.12.0") - self.requires("icu/68.2") + self.requires("icu/69.1") self.requires("libtiff/4.2.0") self.requires("libpng/1.6.37") self.requires("openjpeg/2.4.0") + self.requires("tbb/2020.3") self.requires("zlib/1.2.11") + @property + def _minimum_cpp_standard(self): + return 11 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "14", + "gcc": "4.8.1", + "clang": "3.3", + "apple-clang": "9", + } + def validate(self): if self.options.shared and not self.options["hdf5"].shared: raise ConanInvalidConfiguration("When building a shared itk, hdf5 needs to be shared too (or not linked to by the consumer).\n" "This is because H5::DataSpace::ALL might get initialized twice, which will cause a H5::DataSpaceIException to be thrown).") + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if not min_version: + self.output.warn("{} recipe lacks information about the {} compiler support.".format( + self.name, self.settings.compiler)) + else: + if tools.Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( + self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("InsightToolkit-{}".format(self.version), self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): @@ -96,6 +117,7 @@ def _configure_cmake(self): self._cmake.definitions["ITK_USE_SYSTEM_DOUBLECONVERSION"] = True self._cmake.definitions["ITK_USE_SYSTEM_EIGEN"] = True self._cmake.definitions["ITK_USE_SYSTEM_FFTW"] = True + self._cmake.definitions["ITK_USE_SYSTEM_GDCM"] = True self._cmake.definitions["ITK_USE_SYSTEM_HDF5"] = True self._cmake.definitions["ITK_USE_SYSTEM_ICU"] = True self._cmake.definitions["ITK_USE_SYSTEM_JPEG"] = True @@ -107,15 +129,12 @@ def _configure_cmake(self): self._cmake.definitions["ITK_USE_SYSTEM_KWIML"] = False # FIXME: Missing VXL recipe self._cmake.definitions["ITK_USE_SYSTEM_VXL"] = False - # FIXME: Missing gdcm recipe - self._cmake.definitions["ITK_USE_SYSTEM_GDCM"] = False self._cmake.definitions["GDCM_USE_SYSTEM_OPENJPEG"] = True self._cmake.definitions["ITK_BUILD_DEFAULT_MODULES"] = False self._cmake.definitions["Module_ITKDeprecated"] = False self._cmake.definitions["Module_ITKMINC"] = False self._cmake.definitions["Module_ITKIOMINC"] = False - self._cmake.definitions["Module_ITKV3Compatibility"] = False self._cmake.definitions["Module_ITKVideoBridgeOpenCV"] = False @@ -197,6 +216,7 @@ def _configure_cmake(self): self._cmake.definitions["Module_ITKSignedDistanceFunction"] = True self._cmake.definitions["Module_ITKSmoothing"] = True self._cmake.definitions["Module_ITKSpatialFunction"] = True + self._cmake.definitions["Module_ITKTBB"] = True self._cmake.definitions["Module_ITKThresholding"] = True self._cmake.definitions["Module_ITKVideoCore"] = True self._cmake.definitions["Module_ITKVideoFiltering"] = True diff --git a/recipes/itk/all/patches/0001-find-conan-packages.patch b/recipes/itk/all/patches/0001-find-conan-packages.patch index 4808d6e7e1951..76c32aaab2c63 100644 --- a/recipes/itk/all/patches/0001-find-conan-packages.patch +++ b/recipes/itk/all/patches/0001-find-conan-packages.patch @@ -143,3 +143,30 @@ +set_property(TARGET itkopenjpeg PROPERTY INTERFACE_LINK_LIBRARIES OpenJPEG::OpenJPEG) +#target_compile_definitions(itkopenjpeg INTERFACE) +install(TARGETS itkopenjpeg EXPORT ${ITK3P_INSTALL_EXPORT_NAME}) +--- Modules/ThirdParty/TBB/CMakeLists.txt ++++ Modules/ThirdParty/TBB/CMakeLists.txt +@@ -8,14 +8,14 @@ set(ITKTBB_NO_SRC 1) + # When this module is loaded by an app, load TBB too. + set(ITKTBB_EXPORT_CODE_INSTALL " + set(TBB_DIR \"${TBB_DIR}\") +-find_package(TBB REQUIRED CONFIG) ++find_package(TBB REQUIRED) + ") + + # When this module is configured by an app, configure TBB too. + set(ITKTBB_EXPORT_CODE_BUILD " + if(NOT ITK_BINARY_DIR) + set(TBB_DIR \"${TBB_DIR}\") +- find_package(TBB REQUIRED CONFIG) ++ find_package(TBB REQUIRED) + endif() + ") + +diff --git a/Modules/ThirdParty/TBB/itk-module-init.cmake b/Modules/ThirdParty/TBB/itk-module-init.cmake +index 1b7ee20a..0859ef33 100644 +--- a/Modules/ThirdParty/TBB/itk-module-init.cmake ++++ b/Modules/ThirdParty/TBB/itk-module-init.cmake +@@ -1,2 +1,2 @@ +-find_package(TBB REQUIRED CONFIG) # must have TBBConfig.cmake, provided since version tbb2017_20170604oss ++find_package(TBB REQUIRED) + get_target_property(TBB_INCLUDE_DIRS TBB::tbb INTERFACE_INCLUDE_DIRECTORIES) diff --git a/recipes/itk/all/patches/0002-gdcm-dependencies.patch b/recipes/itk/all/patches/0002-gdcm-dependencies.patch deleted file mode 100644 index a3d41ab944121..0000000000000 --- a/recipes/itk/all/patches/0002-gdcm-dependencies.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeLists.txt -+++ Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat/CMakeLists.txt -@@ -149,7 +149,8 @@ - ) - endif() - if(GDCM_USE_SYSTEM_OPENJPEG) -- include_directories(${OPENJPEG_INCLUDE_DIRS} ) -+ include_directories(${OpenJPEG_INCLUDE_DIRS} ) -+ link_libraries(OpenJPEG::OpenJPEG) - else() - include_directories( - "${GDCM_BINARY_DIR}/Utilities/gdcmopenjpeg" ---- Modules/ThirdParty/GDCM/src/gdcm/Utilities/CMakeLists.txt -+++ Modules/ThirdParty/GDCM/src/gdcm/Utilities/CMakeLists.txt -@@ -30,6 +30,6 @@ - set(OPENJPEG_INSTALL_INCLUDE_DIR ${GDCM_INSTALL_INCLUDE_DIR}/gdcmopenjpeg) - add_subdirectory(gdcmopenjpeg) - mark_as_advanced(BUILD_JPIP BUILD_JPWL BUILD_CODEC BUILD_DOC BUILD_MJ2 BUILD_PKGCONFIG_FILES BUILD_SHARED_LIBS BUILD_THIRDPARTY OPJ_DATA_ROOT OPJ_DISABLE_TPSOT_FIX OPJ_USE_THREAD) -+else() -+ find_package(OpenJPEG REQUIRED) - endif() -- --# Do jpegls (JPEG-LS aka near lossless implementation) diff --git a/recipes/itk/config.yml b/recipes/itk/config.yml index 591c7a897b8cd..b1d89f5048227 100644 --- a/recipes/itk/config.yml +++ b/recipes/itk/config.yml @@ -1,3 +1,5 @@ versions: "5.1.0": folder: "all" + "5.1.2": + folder: "all" diff --git a/recipes/jemalloc/all/conanfile.py b/recipes/jemalloc/all/conanfile.py index 4f8b512291013..d6c93cdb9d688 100644 --- a/recipes/jemalloc/all/conanfile.py +++ b/recipes/jemalloc/all/conanfile.py @@ -26,6 +26,7 @@ class JemallocConan(ConanFile): "enable_debug_logging": [True, False], "enable_initial_exec_tls": [True, False], "enable_libdl": [True, False], + "enable_prof": [True, False], } default_options = { "shared": False, @@ -40,6 +41,7 @@ class JemallocConan(ConanFile): "enable_debug_logging": False, "enable_initial_exec_tls": True, "enable_libdl": True, + "enable_prof": False, } exports_sources = ["patches/**"] @@ -99,6 +101,8 @@ def _autotools_args(self): "--enable-initial-exec-tls" if self.options.enable_initial_exec_tls else "--disable-initial-exec-tls", "--enable-libdl" if self.options.enable_libdl else "--disable-libdl", ] + if self.options.enable_prof: + conf_args.append("--enable-prof") if self.options.shared: conf_args.extend(["--enable-shared", "--disable-static"]) else: diff --git a/recipes/libaom-av1/all/conandata.yml b/recipes/libaom-av1/all/conandata.yml index ac1cc09e0026c..c4ee812e89c1f 100644 --- a/recipes/libaom-av1/all/conandata.yml +++ b/recipes/libaom-av1/all/conandata.yml @@ -1,7 +1,12 @@ sources: "2.0.1": url: "https://aomedia.googlesource.com/aom/+archive/b52ee6d44adaef8a08f6984390de050d64df9faa.tar.gz" + "3.1.1": + url: "https://aomedia.googlesource.com/aom/+archive/7fadc0e77130efb05f52979b0deaba9b6a1bba6d.tar.gz" patches: "2.0.1": - base_path: "source_subfolder" patch_file: "patches/0001-msvc-install.patch" + "3.1.1": + - base_path: "source_subfolder" + patch_file: "patches/0001-msvc-install-3.1.1.patch" diff --git a/recipes/libaom-av1/all/patches/0001-msvc-install-3.1.1.patch b/recipes/libaom-av1/all/patches/0001-msvc-install-3.1.1.patch new file mode 100644 index 0000000000000..62ad4ae1cbb06 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-msvc-install-3.1.1.patch @@ -0,0 +1,25 @@ +diff --git a/build/cmake/aom_install.cmake b/build/cmake/aom_install.cmake +index 2c0e7a5bf..e42b11203 100644 +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -96,4 +96,20 @@ macro(setup_aom_install_targets) + "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") + endif() + endif() ++ ++ if (MSVC) ++ if(BUILD_SHARED_LIBS) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) ++ endif() ++ set(AOM_INSTALL_LIBS aom) ++ install( ++ FILES ${AOM_INSTALL_INCS} ++ DESTINATION "include/aom") ++ install( ++ TARGETS ${AOM_INSTALL_LIBS} ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ endif() ++ + endmacro() diff --git a/recipes/libaom-av1/all/patches/0001-msvc-install.patch b/recipes/libaom-av1/all/patches/0001-msvc-install.patch index d5d7ef2945387..264983fceefee 100644 --- a/recipes/libaom-av1/all/patches/0001-msvc-install.patch +++ b/recipes/libaom-av1/all/patches/0001-msvc-install.patch @@ -1,26 +1,25 @@ diff --git a/build/cmake/aom_install.cmake b/build/cmake/aom_install.cmake -index cd40fe424..31f0224af 100644 +index cd40fe424..72b7fff07 100644 --- a/build/cmake/aom_install.cmake +++ b/build/cmake/aom_install.cmake -@@ -93,4 +93,21 @@ macro(setup_aom_install_targets) +@@ -93,4 +93,20 @@ macro(setup_aom_install_targets) "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") endif() endif() + + if (MSVC) + if(BUILD_SHARED_LIBS) -+ set(AOM_INSTALL_LIBS aom aom_static) -+ else() -+ set(AOM_INSTALL_LIBS aom) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) + endif() ++ set(AOM_INSTALL_LIBS aom) + install( + FILES ${AOM_INSTALL_INCS} -+ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom") ++ DESTINATION "include/aom") + install( + TARGETS ${AOM_INSTALL_LIBS} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + endif() + endmacro() diff --git a/recipes/libaom-av1/config.yml b/recipes/libaom-av1/config.yml index bb7eb85dfac49..538d3b2f2327b 100644 --- a/recipes/libaom-av1/config.yml +++ b/recipes/libaom-av1/config.yml @@ -1,3 +1,5 @@ versions: "2.0.1": folder: all + "3.1.1": + folder: all diff --git a/recipes/libcurl/all/test_package/conanfile.py b/recipes/libcurl/all/test_package/conanfile.py index 2ba91fa8c5901..1fbb087ff230b 100644 --- a/recipes/libcurl/all/test_package/conanfile.py +++ b/recipes/libcurl/all/test_package/conanfile.py @@ -15,32 +15,34 @@ def build(self): cmake.configure() cmake.build() + @property + def _test_executable(self): + if self.settings.os == "Windows": + return os.path.join("bin", "test_package.exe") + else: + return os.path.join("bin", "test_package") + def test(self): - if tools.cross_building(self.settings) and self.settings.os in ["Android", "iOS"]: - return - - if "arm" in self.settings.arch: - self.test_arm() - elif tools.cross_building(self.settings) and self.settings.os == "Windows": - self.test_mingw_cross() - elif not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - - def test_mingw_cross(self): - bin_path = os.path.join("bin", "test_package.exe") - output = subprocess.check_output(["file", bin_path]).decode() - assert re.search(r"PE32.*executable.*Windows", output) - - def test_arm(self): - file_ext = "so" if self.options["libcurl"].shared else "a" - lib_path = os.path.join(self.deps_cpp_info["libcurl"].libdirs[0], "libcurl.%s" % file_ext) - output = subprocess.check_output(["readelf", "-h", lib_path]).decode() - - if "armv8" in self.settings.arch: - if self.settings.arch == "armv8_32": - assert re.search(r"Machine:\s+ARM", output) - else: - assert re.search(r"Machine:\s+AArch64", output) + if not tools.cross_building(self): + self.run(self._test_executable, run_environment=True) else: - assert re.search(r"Machine:\s+ARM", output) + # We will dump information for the generated executable + if self.settings.os in ["Android", "iOS"]: + # FIXME: Check output for these hosts + return + + output = subprocess.check_output(["file", self._test_executable]).decode() + + if self.settings.os == "Macos" and self.settings.arch == "armv8": + assert "Mach-O 64-bit executable arm64" in output, "Not found in output: {}".format(output) + + elif self.settings.os == "Linux": + if self.settings.arch == "armv8_32": + assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output) + elif "armv8" in self.settings.arch: + assert re.search(r"Machine:\s+AArch64", output), "Not found in output: {}".format(output) + elif "arm" in self.settings.arch: + assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output) + + elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW + assert re.search(r"PE32.*executable.*Windows", output), "Not found in output: {}".format(output) diff --git a/recipes/libgd/all/conandata.yml b/recipes/libgd/all/conandata.yml index 836bbc8ce8fe6..5f256cbcd7962 100644 --- a/recipes/libgd/all/conandata.yml +++ b/recipes/libgd/all/conandata.yml @@ -5,6 +5,12 @@ sources: "2.3.0": url: "https://github.com/libgd/libgd/archive/gd-2.3.0.tar.gz" sha256: "a77dfbbf8bfa7f19c935c11f3b939321f8c1059953a91203158cb2dbf27a0f9e" + "2.3.1": + url: "https://github.com/libgd/libgd/archive/gd-2.3.1.tar.gz" + sha256: "795978dcec1bf931148ebcdca9ed1e9cdfa9e71acff8bf035a8867dd1f7af6cd" + "2.3.2": + url: "https://github.com/libgd/libgd/archive/gd-2.3.2.tar.gz" + sha256: "dcc22244d775f469bee21dce1ea42552adbb72ba0cc423f9fa6a64601b3a1893" patches: "2.2.5": - patch_file: "patches/2.2.5-msvc-static-lib.patch" @@ -16,3 +22,13 @@ patches: base_path: "source_subfolder" - patch_file: "patches/qualify-nondll.patch" base_path: "source_subfolder" + "2.3.1": + - patch_file: "patches/remove-unistd-h.patch" + base_path: "source_subfolder" + - patch_file: "patches/qualify-nondll.patch" + base_path: "source_subfolder" + "2.3.2": + - patch_file: "patches/remove-unistd-h.patch" + base_path: "source_subfolder" + - patch_file: "patches/2.3.2-qualify-nondll.patch" + base_path: "source_subfolder" diff --git a/recipes/libgd/all/patches/2.3.2-qualify-nondll.patch b/recipes/libgd/all/patches/2.3.2-qualify-nondll.patch new file mode 100644 index 0000000000000..0eccaf9b59f38 --- /dev/null +++ b/recipes/libgd/all/patches/2.3.2-qualify-nondll.patch @@ -0,0 +1,34 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 509c422..1d1be42 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -106,7 +106,7 @@ if (WIN32 AND NOT MINGW AND NOT MSYS) + # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib") + + if (BUILD_STATIC_LIBS) +- SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1) ++ SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS BGD_NONDLL=1) + endif() + + ENDIF(WIN32 AND NOT MINGW AND NOT MSYS) +diff --git a/src/gd.h b/src/gd.h +index 4302812..e4a1c0b 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -40,14 +40,14 @@ extern "C" { + and other languages. This breaks ABI compatibility + with previous DLL revs, but it's necessary. */ + +-/* 2.0.29: WIN32 programmers can declare the NONDLL macro if they ++/* 2.0.29: WIN32 programmers can declare the BGD_NONDLL macro if they + wish to build gd as a static library or by directly including + the gd sources in a project. */ + + /* http://gcc.gnu.org/wiki/Visibility */ + #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE) + # ifdef BGDWIN32 +-# ifdef NONDLL ++# ifdef BGD_NONDLL + # define BGD_EXPORT_DATA_PROT + # else + # ifdef __GNUC__ diff --git a/recipes/libgd/config.yml b/recipes/libgd/config.yml index 667deaf128e00..f329b6a418166 100644 --- a/recipes/libgd/config.yml +++ b/recipes/libgd/config.yml @@ -3,3 +3,7 @@ versions: folder: all "2.3.0": folder: all + "2.3.1": + folder: all + "2.3.2": + folder: all diff --git a/recipes/libltc/all/conandata.yml b/recipes/libltc/all/conandata.yml new file mode 100644 index 0000000000000..aac3e2964fcab --- /dev/null +++ b/recipes/libltc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.1": + url: "https://github.com/x42/libltc/releases/download/v1.3.1/libltc-1.3.1.tar.gz" + sha256: "50e63eb3b767151bc0159a3cc5d426d03a42fd69029bc9b3b7c346555f4b709c" diff --git a/recipes/libltc/all/conanfile.py b/recipes/libltc/all/conanfile.py new file mode 100644 index 0000000000000..6f92c3dd9d654 --- /dev/null +++ b/recipes/libltc/all/conanfile.py @@ -0,0 +1,100 @@ +from conans import ConanFile, AutoToolsBuildEnvironment, tools +from contextlib import contextmanager +import os + + +class LibltcConan(ConanFile): + name = "libltc" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://x42.github.io/libltc/" + description = "Linear/Logitudinal Time Code (LTC) Library" + topics = ("timecode", "smpte", "ltc") + license = "LGPL-3.0" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _source_subfolder(self): + return "source_subfolder" + + _autotools = None + + def config_options(self): + if self.settings.os == 'Windows': + del self.options.fPIC + + def configure(self): + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + if self.options.shared: + del self.options.fPIC + + def build_requirements(self): + if tools.os_info.is_windows and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/20200517") + if self.settings.compiler == "Visual Studio": + self.build_requires("automake/1.16.2") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + @contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self.settings): + env = { + "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), + "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), + "LD": "{} link -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), + "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), + } + with tools.environment_append(env): + yield + else: + yield + + def _configure_autotools(self): + if self._autotools: + return self._autotools + self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + args = [] + if self.options.shared: + args.extend(["--disable-static", "--enable-shared"]) + else: + args.extend(["--disable-shared", "--enable-static"]) + if self.settings.compiler == "Visual Studio": + self._autotools.cxx_flags.append("-EHsc") + self._autotools.flags.append("-FS") + self._autotools.configure(args=args, configure_dir=self._source_subfolder) + return self._autotools + + def build(self): + with self._build_context(): + autotools = self._configure_autotools() + autotools.make() + + def package(self): + self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) + with self._build_context(): + autotools = self._configure_autotools() + autotools.install() + tools.rmdir(os.path.join(self.package_folder, "share")) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + os.unlink(os.path.join(self.package_folder, "lib", "libltc.la")) + if self.settings.compiler == "Visual Studio" and self.options.shared: + tools.rename(os.path.join(self.package_folder, "lib", "ltc.dll.lib"), + os.path.join(self.package_folder, "lib", "ltc.lib")) + + def package_info(self): + self.cpp_info.names["pkg_config"] = "ltc" + self.cpp_info.libs = ["ltc"] + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m"] diff --git a/recipes/libltc/all/test_package/CMakeLists.txt b/recipes/libltc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..196188113685c --- /dev/null +++ b/recipes/libltc/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/libltc/all/test_package/conanfile.py b/recipes/libltc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/libltc/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libltc/all/test_package/test_package.cpp b/recipes/libltc/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..16385cc339a1a --- /dev/null +++ b/recipes/libltc/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +/* example was taken from https://www.gnu.org/ghm/2011/paris/slides/andreas-enge-mpc.pdf */ + +#include + +int main (void) { + LTCDecoder *decoder = ltc_decoder_create(1920, 1920 * 2); + ltc_decoder_free(decoder); +} diff --git a/recipes/libltc/config.yml b/recipes/libltc/config.yml new file mode 100644 index 0000000000000..71bf3f0e1bada --- /dev/null +++ b/recipes/libltc/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.1": + folder: "all" diff --git a/recipes/libnl/all/conanfile.py b/recipes/libnl/all/conanfile.py index 1754166600184..32529e9a7f67d 100644 --- a/recipes/libnl/all/conanfile.py +++ b/recipes/libnl/all/conanfile.py @@ -1,6 +1,9 @@ -import os, glob from conans import ConanFile, tools, AutoToolsBuildEnvironment from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + class LibNlConan(ConanFile): name = "libnl" @@ -21,13 +24,12 @@ def _source_subfolder(self): return "source_subfolder" def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def configure(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("Libnl is only supported on Linux") + if self.options.shared: del self.options.fPIC del self.settings.compiler.libcxx @@ -56,12 +58,7 @@ def package(self): autotools = self._configure_autotools() autotools.install() self.copy("COPYING", dst="licenses", src=self._source_subfolder) - #tools.remove_files_by_mask causes AttributeError: module 'conans.tools' has no attribute 'remove_files_by_mask' - #tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - la_pattern = os.path.join(self.package_folder, "lib", "**", "*.la") - la_files = glob.glob(la_pattern, recursive=True) - for next_file in la_files: - os.remove(next_file) + tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") tools.rmdir(os.path.join(self.package_folder, "share")) tools.rmdir(os.path.join(self.package_folder, "etc")) tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) diff --git a/recipes/libpq/all/conandata.yml b/recipes/libpq/all/conandata.yml index 1a889bc28908c..06a6b152761af 100644 --- a/recipes/libpq/all/conandata.yml +++ b/recipes/libpq/all/conandata.yml @@ -38,3 +38,10 @@ sources: "9.6.19": url: "https://ftp.postgresql.org/pub/source/v9.6.19/postgresql-9.6.19.tar.gz" sha256: "1840c1f84560ed169079c93610c46c42c4c590181352244e0d8966633a88f358" +patches: + "9.6.19": + - patch_file: "patches/9.6.19/001-Use-return-instead-of-exit-in-configure.patch" + base_path: "source_subfolder" + # url: https://www.postgresql.org/message-id/09A4B554-82B1-4536-B191-2461342EE0BB%40icloud.com + # patch_source: https://www.postgresql.org/message-id/attachment/45881/0002-Use-return-instead-of-exit-in-configure.patch + # patch_type: portability diff --git a/recipes/libpq/all/conanfile.py b/recipes/libpq/all/conanfile.py index 0aae92c197c1a..9ed39376229c7 100644 --- a/recipes/libpq/all/conanfile.py +++ b/recipes/libpq/all/conanfile.py @@ -11,6 +11,7 @@ class LibpqConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.postgresql.org/docs/current/static/libpq.html" license = "PostgreSQL" + exports_sources = ["patches/*"] settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -53,6 +54,10 @@ def config_options(self): def configure(self): del self.settings.compiler.libcxx del self.settings.compiler.cppstd + + if self.options.shared: + del self.options.fPIC + if self.settings.compiler != "Visual Studio" and self.settings.os == "Windows": if self.options.shared: raise ConanInvalidConfiguration("static mingw build is not possible") @@ -76,6 +81,8 @@ def _configure_autotools(self): args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') if tools.cross_building(self.settings) and not self.options.with_openssl: args.append("--disable-strong-random") + if tools.cross_building(self.settings, skip_x64_x86=True): + args.append("USE_DEV_URANDOM=1") if self.settings.os != "Windows" and self.options.disable_rpath: args.append('--disable-rpath') if self._is_clang8_x86: @@ -92,6 +99,9 @@ def _make_args(self): return args def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + if self.settings.compiler == "Visual Studio": # https://www.postgresql.org/docs/8.3/install-win32-libpq.html # https://github.com/postgres/postgres/blob/master/src/tools/msvc/README diff --git a/recipes/libpq/all/patches/9.6.19/001-Use-return-instead-of-exit-in-configure.patch b/recipes/libpq/all/patches/9.6.19/001-Use-return-instead-of-exit-in-configure.patch new file mode 100644 index 0000000000000..f22f976abd1c0 --- /dev/null +++ b/recipes/libpq/all/patches/9.6.19/001-Use-return-instead-of-exit-in-configure.patch @@ -0,0 +1,85 @@ +From d3c7c1fbb346fd5c040a7a379d971db7b5129581 Mon Sep 17 00:00:00 2001 +From: Peter Eisentraut +Date: Tue, 30 Aug 2016 12:00:00 -0400 +Subject: [PATCH 02/27] Use return instead of exit() in configure + +Using exit() requires stdlib.h, which is not included. Use return +instead. Also add return type for main(). +--- + config/c-compiler.m4 | 4 +++- + config/c-library.m4 | 4 +++- + configure | 12 +++++++++--- + 3 files changed, 15 insertions(+), 5 deletions(-) + +diff --git a/config/c-compiler.m4 b/config/c-compiler.m4 +index f87beb0..8bc6d32 100644 +--- a/config/c-compiler.m4 ++++ b/config/c-compiler.m4 +@@ -71,8 +71,10 @@ int does_int64_work() + return 0; + return 1; + } ++ ++int + main() { +- exit(! does_int64_work()); ++ return (! does_int64_work()); + }])], + [Ac_cachevar=yes], + [Ac_cachevar=no], +diff --git a/config/c-library.m4 b/config/c-library.m4 +index 82b1614..a893d68 100644 +--- a/config/c-library.m4 ++++ b/config/c-library.m4 +@@ -204,8 +204,10 @@ int does_int64_snprintf_work() + return 0; /* either multiply or snprintf is busted */ + return 1; + } ++ ++int + main() { +- exit(! does_int64_snprintf_work()); ++ return (! does_int64_snprintf_work()); + }]])], + [pgac_cv_snprintf_long_long_int_modifier=$pgac_modifier; break], + [], +diff --git a/configure b/configure +index d4442f3..394f658 100755 +--- a/configure ++++ b/configure +@@ -13853,8 +13853,10 @@ int does_int64_work() + return 0; + return 1; + } ++ ++int + main() { +- exit(! does_int64_work()); ++ return (! does_int64_work()); + } + _ACEOF + if ac_fn_c_try_run "$LINENO"; then : +@@ -13935,8 +13937,10 @@ int does_int64_work() + return 0; + return 1; + } ++ ++int + main() { +- exit(! does_int64_work()); ++ return (! does_int64_work()); + } + _ACEOF + if ac_fn_c_try_run "$LINENO"; then : +@@ -14011,8 +14015,10 @@ int does_int64_snprintf_work() + return 0; /* either multiply or snprintf is busted */ + return 1; + } ++ ++int + main() { +- exit(! does_int64_snprintf_work()); ++ return (! does_int64_snprintf_work()); + } + _ACEOF + if ac_fn_c_try_run "$LINENO"; then : diff --git a/recipes/libusb/all/conanfile.py b/recipes/libusb/all/conanfile.py index 3e0800d9ee87f..e91efcc714c0a 100644 --- a/recipes/libusb/all/conanfile.py +++ b/recipes/libusb/all/conanfile.py @@ -35,9 +35,11 @@ def configure(self): del self.options.fPIC del self.settings.compiler.libcxx del self.settings.compiler.cppstd + if self.settings.os == "Android": + self.options.enable_udev = False def config_options(self): - if self.settings.os != "Linux": + if self.settings.os not in ["Linux", "Android"]: del self.options.enable_udev if self.settings.os == "Windows": del self.options.fPIC @@ -90,7 +92,7 @@ def _configure_autotools(self): self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) configure_args = ["--enable-shared" if self.options.shared else "--disable-shared"] configure_args.append("--enable-static" if not self.options.shared else "--disable-static") - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "Android"]: configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") elif self._is_mingw: if self.settings.arch == "x86_64": @@ -144,6 +146,7 @@ def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "libusb-1.0")) if self.settings.os == "Linux": self.cpp_info.system_libs.append("pthread") + if self.settings.os in ["Linux", "Android"]: if self.options.enable_udev: self.cpp_info.system_libs.append("udev") elif self.settings.os == "Macos": diff --git a/recipes/llvm-core/all/conandata.yml b/recipes/llvm-core/all/conandata.yml index e827098115aa1..83e4048a65a91 100644 --- a/recipes/llvm-core/all/conandata.yml +++ b/recipes/llvm-core/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "12.0.0": + url: https://github.com/llvm/llvm-project/releases/download/llvmorg-12.0.0/llvm-12.0.0.src.tar.xz + sha256: 49dc47c8697a1a0abd4ee51629a696d7bfe803662f2a7252a3b16fc75f3a8b50 "11.1.0": url: https://github.com/llvm/llvm-project/releases/download/llvmorg-11.1.0/llvm-11.1.0.src.tar.xz sha256: ce8508e318a01a63d4e8b3090ab2ded3c598a50258cc49e2625b9120d4c03ea5 @@ -6,8 +9,11 @@ sources: patches: "11.1.0": - base_path: "source" - patch_file: "patches/11.1.0-vs2019.patch" + patch_file: "patches/11x/11.1.0-cmake.patch" - base_path: "source" - patch_file: "patches/11.1.0-cmake.patch" + patch_file: "patches/11x/11.1.0-native.patch" + "12.0.0": - base_path: "source" - patch_file: "patches/11.1.0-native.patch" + patch_file: "patches/12x/12.0.0-cmake.patch" + - base_path: "source" + patch_file: "patches/12x/12.0.0-native.patch" diff --git a/recipes/llvm-core/all/conanfile.py b/recipes/llvm-core/all/conanfile.py index bff27b412fc65..46710dc502121 100644 --- a/recipes/llvm-core/all/conanfile.py +++ b/recipes/llvm-core/all/conanfile.py @@ -66,6 +66,12 @@ class LLVMCoreConan(ConanFile): 'with_xml2': True } + # Older cmake versions may have issues generating the graphviz output used + # to model the components + build_requires = [ + 'cmake/3.20.3' + ] + exports_sources = ['CMakeLists.txt', 'patches/*'] generators = ['cmake', 'cmake_find_package'] no_copy_source = True @@ -116,6 +122,11 @@ def _configure_cmake(self): cmake.definitions['LLVM_ENABLE_PIC'] = \ self.options.get_safe('fPIC', default=False) + if self.settings.compiler == 'Visual Studio': + build_type = str(self.settings.build_type).upper() + cmake.definitions['LLVM_USE_CRT_{}'.format(build_type)] = \ + self.settings.compiler.runtime + cmake.definitions['LLVM_ABI_BREAKING_CHECKS'] = 'WITH_ASSERTS' cmake.definitions['LLVM_ENABLE_WARNINGS'] = True cmake.definitions['LLVM_ENABLE_PEDANTIC'] = True @@ -136,6 +147,7 @@ def _configure_cmake(self): cmake.definitions['LLVM_APPEND_VC_REV'] = False cmake.definitions['LLVM_BUILD_DOCS'] = False cmake.definitions['LLVM_ENABLE_IDE'] = False + cmake.definitions['LLVM_ENABLE_TERMINFO'] = False cmake.definitions['LLVM_ENABLE_EH'] = self.options.exceptions cmake.definitions['LLVM_ENABLE_RTTI'] = self.options.rtti @@ -183,7 +195,7 @@ def requirements(self): if self.options.get_safe('with_xml2', False): self.requires('libxml2/2.9.10') - def configure(self): + def validate(self): if self.options.shared: # Shared builds disabled just due to the CI message = 'Shared builds not currently supported' raise ConanInvalidConfiguration(message) @@ -195,6 +207,8 @@ def configure(self): message = 'Cannot enable exceptions without rtti support' raise ConanInvalidConfiguration(message) self._supports_compiler() + if tools.cross_building(self, skip_x64_x86=True): + raise ConanInvalidConfiguration('Cross-building not implemented') def source(self): tools.get(**self.conan_data['sources'][self.version]) @@ -216,6 +230,8 @@ def package(self): if not self.options.shared: for ext in ['.a', '.lib']: + lib = '**/lib/*LLVMTableGenGlobalISel{}'.format(ext) + self.copy(lib, dst='lib', keep_path=False) lib = '*LLVMTableGenGlobalISel{}'.format(ext) self.copy(lib, dst='lib', src='lib') @@ -268,6 +284,9 @@ def package(self): os.remove(os.path.join(lib_path, name)) if not self.options.shared: + if self.options.get_safe('with_zlib', False): + if not 'z' in components['LLVMSupport']: + components['LLVMSupport'].append('z') components_path = \ os.path.join(self.package_folder, 'lib', 'components.json') with open(components_path, 'w') as components_file: @@ -282,10 +301,9 @@ def package_info(self): if self.options.shared: self.cpp_info.libs = tools.collect_libs(self) if self.settings.os == 'Linux': - self.cpp_info.system_libs = ['tinfo', 'pthread'] - self.cpp_info.system_libs.extend(['rt', 'dl', 'm']) + self.cpp_info.system_libs = ['pthread', 'rt', 'dl', 'm'] elif self.settings.os == 'Macos': - self.cpp_info.system_libs = ['curses', 'm'] + self.cpp_info.system_libs = ['m'] return components_path = \ diff --git a/recipes/llvm-core/all/patches/11.1.0-vs2019.patch b/recipes/llvm-core/all/patches/11.1.0-vs2019.patch deleted file mode 100644 index 509261ff3794d..0000000000000 --- a/recipes/llvm-core/all/patches/11.1.0-vs2019.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- include/llvm/Support/type_traits.h -+++ include/llvm/Support/type_traits.h -@@ -176,7 +176,7 @@ - (has_deleted_copy_assign || has_trivial_copy_assign) && - (has_deleted_copy_constructor || has_trivial_copy_constructor); - --#ifdef HAVE_STD_IS_TRIVIALLY_COPYABLE -+#if 0 - static_assert(value == std::is_trivially_copyable::value, - "inconsistent behavior between llvm:: and std:: implementation of is_trivially_copyable"); - #endif diff --git a/recipes/llvm-core/all/patches/11.1.0-cmake.patch b/recipes/llvm-core/all/patches/11x/11.1.0-cmake.patch similarity index 100% rename from recipes/llvm-core/all/patches/11.1.0-cmake.patch rename to recipes/llvm-core/all/patches/11x/11.1.0-cmake.patch diff --git a/recipes/llvm-core/all/patches/11.1.0-native.patch b/recipes/llvm-core/all/patches/11x/11.1.0-native.patch similarity index 100% rename from recipes/llvm-core/all/patches/11.1.0-native.patch rename to recipes/llvm-core/all/patches/11x/11.1.0-native.patch diff --git a/recipes/llvm-core/all/patches/12x/12.0.0-cmake.patch b/recipes/llvm-core/all/patches/12x/12.0.0-cmake.patch new file mode 100644 index 0000000000000..8d3f7dbf7cf98 --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/12.0.0-cmake.patch @@ -0,0 +1,55 @@ +--- cmake/config-ix.cmake ++++ cmake/config-ix.cmake +@@ -143,6 +143,9 @@ + elseif(NOT LLVM_USE_SANITIZER MATCHES "Memory.*") + find_package(LibXml2) + endif() ++ set(LIBXML2_FOUND 1) ++ list(GET LibXml2_INCLUDE_DIRS -1 LIBXML2_INCLUDE_DIR) ++ set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) + if(LibXml2_FOUND) + # Check if libxml2 we found is usable; for example, we may have found a 32-bit + # library on a 64-bit system which would result in a link-time failure. +@@ -335,7 +335,7 @@ + message(FATAL_ERROR "libffi includes are not found.") + endif() + +- find_library(FFI_LIBRARY_PATH ffi PATHS ${FFI_LIBRARY_DIR}) ++ find_library(FFI_LIBRARY_PATH NAMES ffi libffi PATHS ${FFI_LIBRARY_DIR}) + if( NOT FFI_LIBRARY_PATH ) + message(FATAL_ERROR "libffi is not found.") + endif() +--- cmake/modules/TableGen.cmake ++++ cmake/modules/TableGen.cmake +@@ -132,12 +132,7 @@ + macro(add_tablegen target project) + set(${target}_OLD_LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS}) + set(LLVM_LINK_COMPONENTS ${LLVM_LINK_COMPONENTS} TableGen) +- +- # CMake doesn't let compilation units depend on their dependent libraries on some generators. +- if(NOT CMAKE_GENERATOR STREQUAL "Ninja" AND NOT XCODE) +- # FIXME: It leaks to user, callee of add_tablegen. +- set(LLVM_ENABLE_OBJLIB ON) +- endif() ++ set(LLVM_ENABLE_OBJLIB OFF) + + add_llvm_executable(${target} DISABLE_LLVM_LINK_LLVM_DYLIB ${ARGN}) + set(LLVM_LINK_COMPONENTS ${${target}_OLD_LLVM_LINK_COMPONENTS}) +--- lib/WindowsManifest/CMakeLists.txt ++++ lib/WindowsManifest/CMakeLists.txt +@@ -21,14 +21,5 @@ + # This block is only needed for llvm-config. When we deprecate llvm-config and + # move to using CMake export, this block can be removed. + if(LLVM_ENABLE_LIBXML2) +- # CMAKE_BUILD_TYPE is only meaningful to single-configuration generators. +- if(CMAKE_BUILD_TYPE) +- string(TOUPPER ${CMAKE_BUILD_TYPE} build_type) +- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION_${build_type}) +- endif() +- if(NOT zlib_library) +- get_property(libxml2_library TARGET LibXml2::LibXml2 PROPERTY LOCATION) +- endif() +- get_library_name(${libxml2_library} libxml2_library) +- set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${libxml2_library}) ++ set_property(TARGET LLVMWindowsManifest PROPERTY LLVM_SYSTEM_LIBS ${LIBXML2_LIBRARIES}) + endif() diff --git a/recipes/llvm-core/all/patches/12x/12.0.0-native.patch b/recipes/llvm-core/all/patches/12x/12.0.0-native.patch new file mode 100644 index 0000000000000..f5c6d542fab8f --- /dev/null +++ b/recipes/llvm-core/all/patches/12x/12.0.0-native.patch @@ -0,0 +1,81 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -891,10 +891,6 @@ + include_directories( ${LLVM_INCLUDE_DIR} ${LLVM_MAIN_INCLUDE_DIR}) + + # when crosscompiling import the executable targets from a file +-if(LLVM_USE_HOST_TOOLS) +- include(CrossCompile) +- llvm_create_cross_target(LLVM NATIVE "" Release) +-endif(LLVM_USE_HOST_TOOLS) + if(LLVM_TARGET_IS_CROSSCOMPILE_HOST) + # Dummy use to avoid CMake Warning: Manually-specified variables were not used + # (this is a variable that CrossCompile sets on recursive invocations) +--- cmake/modules/TableGen.cmake ++++ cmake/modules/TableGen.cmake +@@ -144,33 +144,6 @@ + set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN} PARENT_SCOPE) + set(${project}_TABLEGEN_TARGET ${${project}_TABLEGEN} PARENT_SCOPE) + +- if(LLVM_USE_HOST_TOOLS) +- if( ${${project}_TABLEGEN} STREQUAL "${target}" ) +- # The NATIVE tablegen executable *must* depend on the current target one +- # otherwise the native one won't get rebuilt when the tablgen sources +- # change, and we end up with incorrect builds. +- build_native_tool(${target} ${project}_TABLEGEN_EXE DEPENDS ${target}) +- set(${project}_TABLEGEN_EXE ${${project}_TABLEGEN_EXE} PARENT_SCOPE) +- +- add_custom_target(${project}-tablegen-host DEPENDS ${${project}_TABLEGEN_EXE}) +- set(${project}_TABLEGEN_TARGET ${project}-tablegen-host PARENT_SCOPE) +- +- # Create an artificial dependency between tablegen projects, because they +- # compile the same dependencies, thus using the same build folders. +- # FIXME: A proper fix requires sequentially chaining tablegens. +- if (NOT ${project} STREQUAL LLVM AND TARGET ${project}-tablegen-host AND +- TARGET LLVM-tablegen-host) +- add_dependencies(${project}-tablegen-host LLVM-tablegen-host) +- endif() +- +- # If we're using the host tablegen, and utils were not requested, we have no +- # need to build this tablegen. +- if ( NOT LLVM_BUILD_UTILS ) +- set_target_properties(${target} PROPERTIES EXCLUDE_FROM_ALL ON) +- endif() +- endif() +- endif() +- + if ((${project} STREQUAL LLVM OR ${project} STREQUAL MLIR) AND NOT LLVM_INSTALL_TOOLCHAIN_ONLY AND LLVM_BUILD_UTILS) + set(export_to_llvmexports) + if(${target} IN_LIST LLVM_DISTRIBUTION_COMPONENTS OR +--- tools/llvm-config/CMakeLists.txt ++++ tools/llvm-config/CMakeLists.txt +@@ -75,11 +75,3 @@ + + # Add the dependency on the generation step. + add_file_dependencies(${CMAKE_CURRENT_SOURCE_DIR}/llvm-config.cpp ${BUILDVARIABLES_OBJPATH}) +- +-if(CMAKE_CROSSCOMPILING AND NOT LLVM_CONFIG_PATH) +- build_native_tool(llvm-config LLVM_CONFIG_PATH) +- set(LLVM_CONFIG_PATH "${LLVM_CONFIG_PATH}" CACHE STRING "") +- +- add_custom_target(NativeLLVMConfig DEPENDS ${LLVM_CONFIG_PATH}) +- add_dependencies(llvm-config NativeLLVMConfig) +-endif() +--- tools/llvm-shlib/CMakeLists.txt ++++ tools/llvm-shlib/CMakeLists.txt +@@ -155,13 +155,8 @@ + + set(LLVM_EXPORTED_SYMBOL_FILE ${CMAKE_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libllvm-c.exports) + if(NOT LLVM_NM) +- if(CMAKE_CROSSCOMPILING) +- build_native_tool(llvm-nm llvm_nm) +- set(llvm_nm_target "${llvm_nm}") +- else() +- set(llvm_nm $) +- set(llvm_nm_target llvm-nm) +- endif() ++ set(llvm_nm $) ++ set(llvm_nm_target llvm-nm) + else() + set(llvm_nm ${LLVM_NM}) + set(llvm_nm_target "") diff --git a/recipes/llvm-core/all/restore_shared.patch b/recipes/llvm-core/all/restore_shared.patch new file mode 100644 index 0000000000000..c817a9a95e02b --- /dev/null +++ b/recipes/llvm-core/all/restore_shared.patch @@ -0,0 +1,22 @@ +diff --git a/recipes/llvm-core/all/conanfile.py b/recipes/llvm-core/all/conanfile.py +index bff27b41..f70578d8 100644 +--- a/recipes/llvm-core/all/conanfile.py ++++ b/recipes/llvm-core/all/conanfile.py +@@ -184,13 +184,11 @@ + self.requires('libxml2/2.9.10') + + def validate(self): +- if self.options.shared: # Shared builds disabled just due to the CI +- message = 'Shared builds not currently supported' ++ if self.options.shared: ++ del self.options.fPIC ++ if self.settings.os == 'Windows' and self.options.shared: ++ message = 'Shared builds not supported on Windows' + raise ConanInvalidConfiguration(message) +- # del self.options.fPIC +- # if self.settings.os == 'Windows' and self.options.shared: +- # message = 'Shared builds not supported on Windows' +- # raise ConanInvalidConfiguration(message) + if self.options.exceptions and not self.options.rtti: + message = 'Cannot enable exceptions without rtti support' + raise ConanInvalidConfiguration(message) diff --git a/recipes/llvm-core/config.yml b/recipes/llvm-core/config.yml index 051c4cad1e3eb..83e036ded6577 100644 --- a/recipes/llvm-core/config.yml +++ b/recipes/llvm-core/config.yml @@ -1,3 +1,5 @@ versions: + "12.0.0": + folder: all "11.1.0": folder: all diff --git a/recipes/miniupnpc/all/CMakeLists.txt b/recipes/miniupnpc/all/CMakeLists.txt new file mode 100644 index 0000000000000..6bf06e870411a --- /dev/null +++ b/recipes/miniupnpc/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder/miniupnpc) diff --git a/recipes/miniupnpc/all/conandata.yml b/recipes/miniupnpc/all/conandata.yml new file mode 100644 index 0000000000000..ec95b2f526522 --- /dev/null +++ b/recipes/miniupnpc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.2.2": + url: "https://github.com/miniupnp/miniupnp/archive/refs/tags/miniupnpc_2_2_2.tar.gz" + sha256: "a598890cad635170dfce6281d71fc3052dee5c8220da0109281542156267c762" diff --git a/recipes/miniupnpc/all/conanfile.py b/recipes/miniupnpc/all/conanfile.py new file mode 100644 index 0000000000000..69d7e59c32b5f --- /dev/null +++ b/recipes/miniupnpc/all/conanfile.py @@ -0,0 +1,87 @@ +from conans import ConanFile, CMake, tools +import os + +required_conan_version = ">=1.33.0" + + +class MiniupnpcConan(ConanFile): + name = "miniupnpc" + description = "UPnP client library/tool to access Internet Gateway Devices." + license = "BSD-3-Clause" + topics = ("miniupnpc", "upnp", "networking", "internet-gateway") + homepage = "https://github.com/miniupnp/miniupnp" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + # Do not force PIC + tools.replace_in_file(os.path.join(self._source_subfolder, "miniupnpc", "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["UPNPC_BUILD_STATIC"] = not self.options.shared + self._cmake.definitions["UPNPC_BUILD_SHARED"] = self.options.shared + self._cmake.definitions["UPNPC_BUILD_TESTS"] = False + self._cmake.definitions["UPNPC_BUILD_SAMPLE"] = False + self._cmake.definitions["NO_GETADDRINFO"] = False + self._cmake.definitions["UPNPC_NO_INSTALL"] = False + self._cmake.configure() + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "miniupnpc")) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "miniupnpc" + self.cpp_info.names["cmake_find_package_multi"] = "miniupnpc" + self.cpp_info.names["pkg_config"] = "miniupnpc" + prefix = "lib" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = ["{}miniupnpc".format(prefix)] + if not self.options.shared: + self.cpp_info.defines.append("MINIUPNP_STATICLIB") + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["iphlpapi", "ws2_32"] + elif self.settings.os == "SunOS": + self.cpp_info.system_libs = ["socket", "nsl", "resolv"] diff --git a/recipes/miniupnpc/all/test_package/CMakeLists.txt b/recipes/miniupnpc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..547cd35c3e343 --- /dev/null +++ b/recipes/miniupnpc/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(miniupnpc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} miniupnpc::miniupnpc) diff --git a/recipes/miniupnpc/all/test_package/conanfile.py b/recipes/miniupnpc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/miniupnpc/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/miniupnpc/all/test_package/test_package.c b/recipes/miniupnpc/all/test_package/test_package.c new file mode 100644 index 0000000000000..b7ba38ffbf1f2 --- /dev/null +++ b/recipes/miniupnpc/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include + +int main(void) { + const char * multicastif = 0; + const char * minissdpdpath = 0; + int localport = UPNP_LOCAL_PORT_ANY; + int ipv6 = 0; + unsigned char ttl = 2; + int error = 0; + struct UPNPDev *devlist = upnpDiscover(2000, multicastif, minissdpdpath, localport, ipv6, ttl, &error); + return 0; +} diff --git a/recipes/miniupnpc/config.yml b/recipes/miniupnpc/config.yml new file mode 100644 index 0000000000000..6d6cfc66eae07 --- /dev/null +++ b/recipes/miniupnpc/config.yml @@ -0,0 +1,3 @@ +versions: + "2.2.2": + folder: all diff --git a/recipes/mio/all/conandata.yml b/recipes/mio/all/conandata.yml new file mode 100644 index 0000000000000..6c19f2b0e4da7 --- /dev/null +++ b/recipes/mio/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "cci.20201220": + url: "https://github.com/mandreyel/mio/archive/3f86a95c0784d73ce6815237ec33ed25f233b643.tar.gz" + sha256: "056ae59d63c5d7f34dd90510adf2996ef1c4c17ec2b26ba9c9cb9974025b2c2c" +patches: + "cci.20201220": + - patch_file: "patches/0001-fix-include-windows.patch" + base_path: "source_subfolder" diff --git a/recipes/mio/all/conanfile.py b/recipes/mio/all/conanfile.py new file mode 100644 index 0000000000000..fae3fe1eca892 --- /dev/null +++ b/recipes/mio/all/conanfile.py @@ -0,0 +1,53 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.33.0" + + +class MioConan(ConanFile): + name = "mio" + description = "Cross-platform C++11 header-only library for memory mapped file IO." + license = "MIT" + topics = ("mio", "mmap", "memory-mapping", "fileviewer") + homepage = "https://github.com/mandreyel/mio" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "compiler" + exports_sources = "patches/**" + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy("*pp", dst="include", src=os.path.join(self._source_subfolder, "include")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "mio" + self.cpp_info.names["cmake_find_package_multi"] = "mio" + + self.cpp_info.components["mio-headers"].names["cmake_find_package"] = "mio-headers" + self.cpp_info.components["mio-headers"].names["cmake_find_package_multi"] = "mio-headers" + + if self.settings.os == "Windows": + self.cpp_info.components["mio_full_winapi"].names["cmake_find_package"] = "mio_full_winapi" + self.cpp_info.components["mio_full_winapi"].names["cmake_find_package_multi"] = "mio_full_winapi" + + self.cpp_info.components["mio_min_winapi"].names["cmake_find_package"] = "mio_min_winapi" + self.cpp_info.components["mio_min_winapi"].names["cmake_find_package_multi"] = "mio_min_winapi" + self.cpp_info.components["mio_min_winapi"].defines = ["WIN32_LEAN_AND_MEAN", "NOMINMAX"] diff --git a/recipes/mio/all/patches/0001-fix-include-windows.patch b/recipes/mio/all/patches/0001-fix-include-windows.patch new file mode 100644 index 0000000000000..a2d1ea2ee71fd --- /dev/null +++ b/recipes/mio/all/patches/0001-fix-include-windows.patch @@ -0,0 +1,15 @@ +see https://github.com/mandreyel/mio/pull/73 + +--- a/include/mio/detail/mmap.ipp ++++ b/include/mio/detail/mmap.ipp +@@ -27,7 +27,9 @@ + + #include + +-#ifndef _WIN32 ++#ifdef _WIN32 ++# include ++#else + # include + # include + # include diff --git a/recipes/mio/all/test_package/CMakeLists.txt b/recipes/mio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2920b1925ee03 --- /dev/null +++ b/recipes/mio/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(mio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} mio::mio) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/mio/all/test_package/conanfile.py b/recipes/mio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/mio/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mio/all/test_package/test_package.cpp b/recipes/mio/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..aeb37b6519b6f --- /dev/null +++ b/recipes/mio/all/test_package/test_package.cpp @@ -0,0 +1,51 @@ +#include + +#include +#include +#include +#include +#include + +int handle_error(const std::error_code &error) { + const auto &errmsg = error.message(); + std::printf("error mapping file: %s, exiting...\n", errmsg.c_str()); + return error.value(); +} + +void allocate_file(const std::string &path, const int size) { + std::ofstream file(path); + std::string s(size, '0'); + file << s; +} + +int main() { + const auto path = "file.txt"; + allocate_file(path, 155); + + std::error_code error; + mio::mmap_sink rw_mmap = mio::make_mmap_sink(path, 0, mio::map_entire_file, error); + if (error) { return handle_error(error); } + + std::fill(rw_mmap.begin(), rw_mmap.end(), 'a'); + + for (auto &b : rw_mmap) { + b += 10; + } + + const int answer_index = rw_mmap.size() / 2; + rw_mmap[answer_index] = 42; + + rw_mmap.sync(error); + if (error) { return handle_error(error); } + + rw_mmap.unmap(); + + mio::mmap_source ro_mmap; + ro_mmap.map(path, error); + if (error) { return handle_error(error); } + + const int the_answer_to_everything = ro_mmap[answer_index]; + assert(the_answer_to_everything == 42); + + return 0; +} diff --git a/recipes/mio/config.yml b/recipes/mio/config.yml new file mode 100644 index 0000000000000..98dc4e2902c05 --- /dev/null +++ b/recipes/mio/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20201220": + folder: all diff --git a/recipes/mosquitto/2.x/conandata.yml b/recipes/mosquitto/2.x/conandata.yml index fa041dfeb78ac..1d2e94fbac499 100644 --- a/recipes/mosquitto/2.x/conandata.yml +++ b/recipes/mosquitto/2.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.11": + url: "https://github.com/eclipse/mosquitto/archive/v2.0.11.tar.gz" + sha256: "0d46f0cbfa98c353ea9562a9e1219f60b9530463ae98b68fbe9bc828fcf9dbbc" "2.0.10": url: "https://github.com/eclipse/mosquitto/archive/v2.0.10.tar.gz" sha256: "448e7cf4b422501c0ce7cb33caa8f31ac350118ce9fc5101db852c1f49a7d096" diff --git a/recipes/mosquitto/config.yml b/recipes/mosquitto/config.yml index 334573e047365..a1bbe5e740538 100644 --- a/recipes/mosquitto/config.yml +++ b/recipes/mosquitto/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.11": + folder: "2.x" "2.0.10": folder: "2.x" "2.0.7": diff --git a/recipes/mpc/all/conanfile.py b/recipes/mpc/all/conanfile.py index 02124a3798aa9..4798dfea691a7 100644 --- a/recipes/mpc/all/conanfile.py +++ b/recipes/mpc/all/conanfile.py @@ -2,6 +2,7 @@ from conans.errors import ConanInvalidConfiguration import os +required_conan_version = ">=1.33.0" class MpcConan(ConanFile): name = "mpc" @@ -15,30 +16,31 @@ class MpcConan(ConanFile): options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} exports_sources = "patches/**" + _autotools = None @property def _source_subfolder(self): return "source_subfolder" - _autotools = None - def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC - def requirements(self): - self.requires("mpfr/4.1.0") - def configure(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("The mpc package cannot be built on Visual Studio.") + if self.options.shared: + del self.options.fPIC del self.settings.compiler.libcxx del self.settings.compiler.cppstd + def validate(self): + if self.settings.compiler == "Visual Studio": + raise ConanInvalidConfiguration("The mpc package cannot be built on Visual Studio.") + + def requirements(self): + self.requires("mpfr/4.1.0") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_autotools(self): if self._autotools: @@ -63,7 +65,7 @@ def package(self): autotools = self._configure_autotools() autotools.install() tools.rmdir(os.path.join(self.package_folder, "share")) - os.unlink(os.path.join(self.package_folder, "lib", "libmpc.la")) + tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") def package_info(self): self.cpp_info.libs = ["mpc"] diff --git a/recipes/mpmcqueue/all/conandata.yml b/recipes/mpmcqueue/all/conandata.yml new file mode 100644 index 0000000000000..d3dfe57bc07e6 --- /dev/null +++ b/recipes/mpmcqueue/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/rigtorp/MPMCQueue/archive/refs/tags/v1.0.tar.gz" + sha256: "f009ef10b66f2b8bc6e3a4f50577efbdfea0c163464cd7de368378f173007b75" diff --git a/recipes/mpmcqueue/all/conanfile.py b/recipes/mpmcqueue/all/conanfile.py new file mode 100644 index 0000000000000..f1d170f7edd42 --- /dev/null +++ b/recipes/mpmcqueue/all/conanfile.py @@ -0,0 +1,41 @@ +from conans import ConanFile, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class MpmcqueueConan(ConanFile): + name = "mpmcqueue" + description = "A bounded multi-producer multi-consumer concurrent queue written in C++11." + license = "MIT" + topics = ("mpmcqueue", "queue", "concurrency") + homepage = "https://github.com/rigtorp/MPMCQueue" + url = "https://github.com/conan-io/conan-center-index" + settings = "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("gcc < 5 not supported") + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "MPMCQueue" + self.cpp_info.names["cmake_find_package_multi"] = "MPMCQueue" diff --git a/recipes/mpmcqueue/all/test_package/CMakeLists.txt b/recipes/mpmcqueue/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..46cfe5ee905ba --- /dev/null +++ b/recipes/mpmcqueue/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(MPMCQueue REQUIRED CONFIG) +find_package(Threads REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} MPMCQueue::MPMCQueue Threads::Threads) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/mpmcqueue/all/test_package/conanfile.py b/recipes/mpmcqueue/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/mpmcqueue/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mpmcqueue/all/test_package/test_package.cpp b/recipes/mpmcqueue/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e3c8d12a9996f --- /dev/null +++ b/recipes/mpmcqueue/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include + +#include +#include + +int main() { + rigtorp::MPMCQueue q(10); + auto t1 = std::thread([&] { + int v; + q.pop(v); + std::cout << "t1 " << v << "\n"; + }); + auto t2 = std::thread([&] { + int v; + q.pop(v); + std::cout << "t2 " << v << "\n"; + }); + q.push(1); + q.push(2); + t1.join(); + t2.join(); + + return 0; +} diff --git a/recipes/mpmcqueue/config.yml b/recipes/mpmcqueue/config.yml new file mode 100644 index 0000000000000..edab1ee152d36 --- /dev/null +++ b/recipes/mpmcqueue/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all diff --git a/recipes/msys2/all/conandata.yml b/recipes/msys2/all/conandata.yml index 202279f04e838..1c39a0bec18d2 100644 --- a/recipes/msys2/all/conandata.yml +++ b/recipes/msys2/all/conandata.yml @@ -1,7 +1,7 @@ sources: "cci.latest": url: [ - "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20210419.tar.xz", - "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20210419.tar.xz", + "http://repo.msys2.org/distrib/x86_64/msys2-base-x86_64-20210604.tar.xz", + "https://sourceforge.net/projects/msys2/files/Base/x86_64/msys2-base-x86_64-20210604.tar.xz", ] - sha256: "3d014d6f5ae519ea5de5b586bff505309c1f42fd8148996d63ba132b24146c85" + sha256: "ebbdb74d54f8ea1eeb1a744d50e47cc649785e9b4328435f290aca5a0a58bd4f" diff --git a/recipes/nasm/all/conanfile.py b/recipes/nasm/all/conanfile.py index 159796f0f5496..bf9d0b82a8feb 100644 --- a/recipes/nasm/all/conanfile.py +++ b/recipes/nasm/all/conanfile.py @@ -53,11 +53,19 @@ def _configure_autotools(self): self._autotools.configure(configure_dir=self._source_subfolder) # GCC9 - "pure" attribute on function returning "void" tools.replace_in_file("Makefile", "-Werror=attributes", "") + + # Need "-arch" flag for the linker when cross-compiling. + # FIXME: Revisit after https://github.com/conan-io/conan/issues/9069, using new Autotools integration + if str(self.version).startswith("2.13"): + tools.replace_in_file("Makefile", "$(CC) $(LDFLAGS) -o", "$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o") + return self._autotools def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) + + if self.settings.os == "Windows": self._build_vs() else: diff --git a/recipes/ninja/1.9.x/conanfile.py b/recipes/ninja/1.9.x/conanfile.py index 36b7841282f4c..ecb1c744a678e 100644 --- a/recipes/ninja/1.9.x/conanfile.py +++ b/recipes/ninja/1.9.x/conanfile.py @@ -1,6 +1,7 @@ import os import sys from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conans.errors import ConanInvalidConfiguration class NinjaConan(ConanFile): @@ -9,11 +10,18 @@ class NinjaConan(ConanFile): license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ninja-build/ninja" - settings = "os_build", "arch_build", "compiler" + settings = "os", "arch", "compiler", "build_type" topics = ("conan", "ninja", "build") _source_subfolder = "source_subfolder" + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): + raise ConanInvalidConfiguration("Cross-building not implemented") + def _build_vs(self): with tools.chdir(self._source_subfolder): with tools.vcvars(self.settings, filter_known_paths=False): @@ -22,10 +30,10 @@ def _build_vs(self): def _build_configure(self): with tools.chdir(self._source_subfolder): cxx = os.environ.get("CXX", "g++") - if self.settings.os_build == "Linux": - if self.settings.arch_build == "x86": + if self.settings.os == "Linux": + if self.settings.arch == "x86": cxx += " -m32" - elif self.settings.arch_build == "x86_64": + elif self.settings.arch == "x86_64": cxx += " -m64" env_build = AutoToolsBuildEnvironment(self) env_build_vars = env_build.vars @@ -38,7 +46,7 @@ def source(self): os.rename("ninja-%s" % self.version, self._source_subfolder) def build(self): - if self.settings.os_build == "Windows": + if self.settings.os == "Windows": self._build_vs() else: self._build_configure() @@ -53,11 +61,8 @@ def package(self): def package_info(self): # ensure ninja is executable - if self.settings.os_build in ["Linux", "Macos"]: + if self.settings.os in ["Linux", "Macos"]: name = os.path.join(self.package_folder, "bin", "ninja") os.chmod(name, os.stat(name).st_mode | 0o111) self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.CONAN_CMAKE_GENERATOR = "Ninja" - - def package_id(self): - del self.info.settings.compiler diff --git a/recipes/ninja/1.9.x/test_package/conanfile.py b/recipes/ninja/1.9.x/test_package/conanfile.py index f1e1d62d98619..379e60b03587f 100644 --- a/recipes/ninja/1.9.x/test_package/conanfile.py +++ b/recipes/ninja/1.9.x/test_package/conanfile.py @@ -1,8 +1,9 @@ -from conans import ConanFile +from conans import ConanFile, tools import os class TestPackage(ConanFile): def test(self): - self.run("ninja --version", run_environment=True) + if not tools.cross_building(self, skip_x64_x86=True): + self.run("ninja --version", run_environment=True) diff --git a/recipes/openblas/all/conandata.yml b/recipes/openblas/all/conandata.yml index b693191e81f1b..e38f0a3d69f5c 100644 --- a/recipes/openblas/all/conandata.yml +++ b/recipes/openblas/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.3.15": + url: "https://github.com/xianyi/OpenBLAS/archive/v0.3.15.tar.gz" + sha256: "30a99dec977594b387a17f49904523e6bc8dd88bd247266e83485803759e4bbe" "0.3.13": sha256: 79197543b17cc314b7e43f7a33148c308b0807cd6381ee77f77e15acf3e6459e url: https://github.com/xianyi/OpenBLAS/archive/v0.3.13.tar.gz diff --git a/recipes/openblas/all/conanfile.py b/recipes/openblas/all/conanfile.py index b5ff52f479223..471e7e0d73617 100644 --- a/recipes/openblas/all/conanfile.py +++ b/recipes/openblas/all/conanfile.py @@ -39,17 +39,20 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + del self.options.fPIC + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename('OpenBLAS-{}'.format(self.version), self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) + if self.options.build_lapack: self.output.warn("Building with lapack support requires a Fortran compiler.") - self._cmake.definitions["NOFORTRAN"] = not self.options.build_lapack self._cmake.definitions["BUILD_WITHOUT_LAPACK"] = not self.options.build_lapack self._cmake.definitions["DYNAMIC_ARCH"] = self.options.dynamic_arch diff --git a/recipes/openblas/config.yml b/recipes/openblas/config.yml index 5d81f164b8f01..8f7bcb146319b 100644 --- a/recipes/openblas/config.yml +++ b/recipes/openblas/config.yml @@ -1,4 +1,6 @@ versions: + "0.3.15": + folder: all "0.3.13": folder: all "0.3.12": diff --git a/recipes/openfbx/all/CMakeLists.txt b/recipes/openfbx/all/CMakeLists.txt new file mode 100644 index 0000000000000..7ecf50295356b --- /dev/null +++ b/recipes/openfbx/all/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.8) +project(openfbx) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_library(${PROJECT_NAME} source_subfolder/src/ofbx.cpp) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +target_link_libraries(${PROJECT_NAME} PRIVATE ${CONAN_LIBS}) + +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +install(FILES source_subfolder/src/ofbx.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/openfbx/all/conandata.yml b/recipes/openfbx/all/conandata.yml new file mode 100644 index 0000000000000..70dd76cfdbbd9 --- /dev/null +++ b/recipes/openfbx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20210426": + url: "https://github.com/nem0/OpenFBX/archive/d8076369cf8b8c52ef590fab0345f0ddb9a3b4c8.tar.gz" + sha256: "27cc1376a528af75dcd4ddcf3a189c8d0550f1258a075f6af5c50e6f03f821cc" diff --git a/recipes/openfbx/all/conanfile.py b/recipes/openfbx/all/conanfile.py new file mode 100644 index 0000000000000..ab7a5ea338b62 --- /dev/null +++ b/recipes/openfbx/all/conanfile.py @@ -0,0 +1,76 @@ +from conans import ConanFile, CMake, tools +import os + +required_conan_version = ">=1.33.0" + + +class OpenfbxConan(ConanFile): + name = "openfbx" + description = "Lightweight open source FBX importer." + license = "MIT" + topics = ("openfbx", "fbx", "importer") + homepage = "https://github.com/nem0/OpenFBX" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("miniz/2.1.0") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + # unvendor miniz + tools.remove_files_by_mask(os.path.join(self._source_subfolder, "src"), "miniz*") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["openfbx"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/openfbx/all/test_package/CMakeLists.txt b/recipes/openfbx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..33ae887aa6aea --- /dev/null +++ b/recipes/openfbx/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/openfbx/all/test_package/conanfile.py b/recipes/openfbx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0219e5fd61f67 --- /dev/null +++ b/recipes/openfbx/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + fbx_path = os.path.join(self.source_folder, "d.fbx") + self.run("{} {}".format(bin_path, fbx_path), run_environment=True) diff --git a/recipes/openfbx/all/test_package/d.fbx b/recipes/openfbx/all/test_package/d.fbx new file mode 100644 index 0000000000000..147ec354d2be2 Binary files /dev/null and b/recipes/openfbx/all/test_package/d.fbx differ diff --git a/recipes/openfbx/all/test_package/test_package.cpp b/recipes/openfbx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..be802370b1f87 --- /dev/null +++ b/recipes/openfbx/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include + +#include +#include +#include + +int main(int argc, char **argv) { + if (argc < 2) { + std::cerr << "Need at least one argument" << std::endl; + return -1; + } + + std::ifstream in_file(argv[1], std::ios::binary); + in_file.seekg(0, std::ios::end); + int file_size = static_cast(in_file.tellg()); + std::vector content(file_size); + + ofbx::IScene *g_scene = ofbx::load(&content[0], file_size, static_cast(ofbx::LoadFlags::TRIANGULATE)); + + return 0; +} diff --git a/recipes/openfbx/config.yml b/recipes/openfbx/config.yml new file mode 100644 index 0000000000000..b83c4168f469b --- /dev/null +++ b/recipes/openfbx/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210426": + folder: all diff --git a/recipes/pffft/all/conandata.yml b/recipes/pffft/all/conandata.yml index f9e43b590b49b..296826e651fa3 100644 --- a/recipes/pffft/all/conandata.yml +++ b/recipes/pffft/all/conandata.yml @@ -2,3 +2,6 @@ sources: "cci.20201015": sha256: "f21913b96eb0f87839dcb363992cd619e7a9c4333685ad9627bc3da205e36a89" url: "https://bitbucket.org/jpommier/pffft/get/2b2bd45bbf9b.zip" + "cci.20210511": + url: "https://bitbucket.org/jpommier/pffft/get/ed78751d751e.zip" + sha256: "af4ac1f9e148348b492686491f2235b5b4dd210148fac29ceca6fb629e563b53" diff --git a/recipes/pffft/config.yml b/recipes/pffft/config.yml index 2d280c547a633..75dd91071cd88 100644 --- a/recipes/pffft/config.yml +++ b/recipes/pffft/config.yml @@ -1,3 +1,5 @@ versions: "cci.20201015": folder: all + "cci.20210511": + folder: all diff --git a/recipes/pfr/all/conandata.yml b/recipes/pfr/all/conandata.yml index 5fdf55e5464f0..68a1f3f746292 100644 --- a/recipes/pfr/all/conandata.yml +++ b/recipes/pfr/all/conandata.yml @@ -1,7 +1,10 @@ sources: "1.0.4": - - url: "https://github.com/boostorg/pfr/archive/1.0.4.tar.gz" + - url: "https://github.com/boostorg/pfr/archive/refs/tags/1.0.4.tar.gz" sha256: "01ecb27c850f50c589bad9a741ec9af6b06fe07ed673946c4bbb1960eb0f126e" + "2.0.2": + - url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.2.tar.gz" + sha256: "1f03ebd3728d7df166d40d992ac071927d483474aa0f947e78a573c4ca288c04" patches: "1.0.4": - patch_file: "patches/50_add_license.patch" diff --git a/recipes/pfr/all/conanfile.py b/recipes/pfr/all/conanfile.py index 558d69587b679..b71135f138e2f 100644 --- a/recipes/pfr/all/conanfile.py +++ b/recipes/pfr/all/conanfile.py @@ -3,7 +3,7 @@ import os -class LibnameConan(ConanFile): +class PfrConan(ConanFile): name = "pfr" description = "std::tuple like methods for user defined types without any macro or boilerplate code" topics = ("conan", "boost", "pfr", "reflection", "magic_get") @@ -59,7 +59,8 @@ def build(self): def package(self): include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern=os.path.join(self._source_subfolder, "LICENSE_1_0.txt"), dst="licenses", src=self.source_folder) + self.copy(pattern=os.path.join(self._source_subfolder, + "LICENSE_1_0.txt"), dst="licenses", src=self.source_folder) self.copy(pattern="*", dst="include", src=include_folder) def package_id(self): diff --git a/recipes/pfr/all/test_package/CMakeLists.txt b/recipes/pfr/all/test_package/CMakeLists.txt index 04e93484921eb..c174dd4623429 100644 --- a/recipes/pfr/all/test_package/CMakeLists.txt +++ b/recipes/pfr/all/test_package/CMakeLists.txt @@ -4,5 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() -add_executable(${PROJECT_NAME} test_package.cpp) +add_executable(${PROJECT_NAME} test_package_${PfrMajorVersion}.cpp) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/pfr/all/test_package/conanfile.py b/recipes/pfr/all/test_package/conanfile.py index bd7165a553cf4..bb3251f0a954b 100644 --- a/recipes/pfr/all/test_package/conanfile.py +++ b/recipes/pfr/all/test_package/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, CMake, tools +from conans.tools import Version import os @@ -8,6 +9,8 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) + cmake.definitions["PfrMajorVersion"] = Version( + self.deps_cpp_info["pfr"].version).major cmake.configure() cmake.build() diff --git a/recipes/pfr/all/test_package/test_package.cpp b/recipes/pfr/all/test_package/test_package_1.cpp similarity index 100% rename from recipes/pfr/all/test_package/test_package.cpp rename to recipes/pfr/all/test_package/test_package_1.cpp diff --git a/recipes/pfr/all/test_package/test_package_2.cpp b/recipes/pfr/all/test_package/test_package_2.cpp new file mode 100644 index 0000000000000..41d16d9f0e64b --- /dev/null +++ b/recipes/pfr/all/test_package/test_package_2.cpp @@ -0,0 +1,184 @@ +// Copyright 2016-2021 Antony Polukhin + +// Distributed under the Boost Software License, Version 1.0. +// (See the accompanying file LICENSE_1_0.txt +// or a copy at .) + +#include +#include +#include +#include + +#include + +// boost-no-inspect +void test_examples() +{ + +#if BOOST_PFR_USE_CPP17 + { + //[pfr_quick_examples_ops + // Assert equality. + // Note that the equality operator for structure is not defined. + + struct test + { + std::string f1; + std::string_view f2; + }; + + assert( + boost::pfr::eq(test{"aaa", "zomg"}, test{"aaa", "zomg"})); + //] + } +#endif + + { + //[pfr_quick_examples_for_each + // Increment each field of the variable on 1 and + // output the content of the variable. + + struct test + { + int f1; + long f2; + }; + + test var{42, 43}; + + boost::pfr::for_each_field(var, [](auto &field) + { field += 1; }); + + // Outputs: {43, 44} + std::cout << boost::pfr::io(var); + //] + } + + { + //[pfr_quick_examples_tuple_size + // Getting fields count of some structure + + struct some + { + int a, b, c, d, e; + }; + + std::cout << "Fields count in structure: " + << boost::pfr::tuple_size::value // Outputs: 5 + << '\n'; + //] + } + + { + //[pfr_quick_examples_get + // Get field by index and assign new value to that field + + struct sample + { + char c; + float f; + }; + + sample var{}; + boost::pfr::get<1>(var) = 42.01f; + + std::cout << var.f; // Outputs: 42.01 + //] + } + +#if BOOST_PFR_USE_CPP17 || BOOST_PFR_USE_LOOPHOLE + { + //[pfr_quick_examples_structure_to_tuple + // Getting a std::tuple of values from structures fields + + struct foo + { + int a, b; + }; + struct other + { + char c; + foo nested; + }; + + other var{'A', {3, 4}}; + std::tuple t = boost::pfr::structure_to_tuple(var); + assert(std::get<0>(t) == 'A'); + assert( + boost::pfr::eq(std::get<1>(t), foo{3, 4})); + //] + } +#endif + +#if BOOST_PFR_USE_CPP17 || BOOST_PFR_USE_LOOPHOLE + { + //[pfr_quick_examples_structure_tie + // Getting a std::tuple of references to structure fields + + struct foo + { + int a, b; + }; + struct other + { + char c; + foo f; + }; + + other var{'A', {14, 15}}; + std::tuple t = boost::pfr::structure_tie(var); + std::get<1>(t) = foo{1, 2}; + + std::cout << boost::pfr::io(var.f); // Outputs: {1, 2} + //] + } +#endif + +} // void test_examples() + +//[pfr_quick_examples_functions_for +// Define all the comparison and IO operators for my_structure type along +// with hash_value function. + +#include + +namespace my_namespace +{ + struct my_structure + { + int a, b, c, d, e, f, g; + // ... + }; + BOOST_PFR_FUNCTIONS_FOR(my_structure) +} +//] + +//[pfr_quick_examples_eq_fields +// Define only the equality and inequality operators for my_eq_ne_structure. + +#include + +namespace my_namespace +{ + struct my_eq_ne_structure + { + float a, b, c, d, e, f, g; + // ... + }; + + inline bool operator==(const my_eq_ne_structure &x, const my_eq_ne_structure &y) + { + return boost::pfr::eq_fields(x, y); + } + + inline bool operator!=(const my_eq_ne_structure &x, const my_eq_ne_structure &y) + { + return boost::pfr::ne_fields(x, y); + } +} +//] + +int main() +{ + test_examples(); +} diff --git a/recipes/pfr/config.yml b/recipes/pfr/config.yml index cae8337488c8a..88205b70a6794 100644 --- a/recipes/pfr/config.yml +++ b/recipes/pfr/config.yml @@ -1,3 +1,5 @@ versions: "1.0.4": folder: "all" + "2.0.2": + folder: "all" diff --git a/recipes/plf_colony/all/conandata.yml b/recipes/plf_colony/all/conandata.yml new file mode 100644 index 0000000000000..2a9972e724260 --- /dev/null +++ b/recipes/plf_colony/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "6.25": + url: "https://github.com/mattreecebentley/plf_colony/archive/848305c2f83fbd5407e6e3fdb9c3e3e8dcfa2ea6.tar.gz" + sha256: "4d298dbd9266201be9733ef276046e9a55d7f35a8c16378fc1dcb687ca8ab4ad" diff --git a/recipes/plf_colony/all/conanfile.py b/recipes/plf_colony/all/conanfile.py new file mode 100644 index 0000000000000..758494f43db5e --- /dev/null +++ b/recipes/plf_colony/all/conanfile.py @@ -0,0 +1,29 @@ +from conans import ConanFile, tools + +required_conan_version = ">=1.33.0" + + +class PlfcolonyConan(ConanFile): + name = "plf_colony" + description = "An unordered data container providing fast iteration/insertion/erasure " \ + "while maintaining pointer/iterator/reference validity to non-erased elements." + license = "Zlib" + topics = ("plf_colony", "container", "bucket", "unordered") + homepage = "https://github.com/mattreecebentley/plf_colony" + url = "https://github.com/conan-io/conan-center-index" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) + self.copy("plf_colony.h", dst="include", src=self._source_subfolder) diff --git a/recipes/plf_colony/all/test_package/CMakeLists.txt b/recipes/plf_colony/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..196188113685c --- /dev/null +++ b/recipes/plf_colony/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/plf_colony/all/test_package/conanfile.py b/recipes/plf_colony/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/plf_colony/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/plf_colony/all/test_package/test_package.cpp b/recipes/plf_colony/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bde5b1111a533 --- /dev/null +++ b/recipes/plf_colony/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include + +int main() { + plf::colony i_colony; + + // Insert 100 ints: + for (int i = 0; i != 100; ++i) { + i_colony.insert(i); + } + + // Erase half of them: + for (plf::colony::iterator it = i_colony.begin(); it != i_colony.end(); ++it) { + it = i_colony.erase(it); + } + + // Total the remaining ints: + int total = 0; + + for (plf::colony::iterator it = i_colony.begin(); it != i_colony.end(); ++it) { + total += *it; + } + + std::cout << "Total: " << total << std::endl; + return 0; +} diff --git a/recipes/plf_colony/config.yml b/recipes/plf_colony/config.yml new file mode 100644 index 0000000000000..5fc314870b4af --- /dev/null +++ b/recipes/plf_colony/config.yml @@ -0,0 +1,3 @@ +versions: + "6.25": + folder: all diff --git a/recipes/pngpp/all/conandata.yml b/recipes/pngpp/all/conandata.yml new file mode 100644 index 0000000000000..8f572862e9a9d --- /dev/null +++ b/recipes/pngpp/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "0.2.10": + url: "https://download.savannah.nongnu.org/releases/pngpp/png++-0.2.10.tar.gz" + sha256: "998af216ab16ebb88543fbaa2dbb9175855e944775b66f2996fc945c8444eee1" +patches: + "0.2.10": + - patch_file: "patches/0001-fix-windows.patch" + base_path: "source_subfolder" diff --git a/recipes/pngpp/all/conanfile.py b/recipes/pngpp/all/conanfile.py new file mode 100644 index 0000000000000..bd480790a26cd --- /dev/null +++ b/recipes/pngpp/all/conanfile.py @@ -0,0 +1,36 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.33.0" + + +class PngppConan(ConanFile): + name = "pngpp" + description = "A C++ wrapper for libpng library." + license = "BSD-3-Clause" + topics = ("png++", "png") + homepage = "https://www.nongnu.org/pngpp" + url = "https://github.com/conan-io/conan-center-index" + exports_sources = "patches/**" + + @property + def _source_subfolder(self): + return "source_subfolder" + + def requirements(self): + self.requires("libpng/1.6.37") + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + def package(self): + self.copy("COPYING", dst="licenses", src=self._source_subfolder) + self.copy("*.hpp", dst=os.path.join("include", "png++"), src=self._source_subfolder) diff --git a/recipes/pngpp/all/patches/0001-fix-windows.patch b/recipes/pngpp/all/patches/0001-fix-windows.patch new file mode 100644 index 0000000000000..2e05f1e133a42 --- /dev/null +++ b/recipes/pngpp/all/patches/0001-fix-windows.patch @@ -0,0 +1,11 @@ +--- a/error.hpp ++++ b/error.hpp +@@ -32,7 +32,7 @@ + #define PNGPP_ERROR_HPP_INCLUDED + + /* check if we have strerror_s or strerror_r, prefer the former which is C11 std */ +-#ifdef __STDC_LIB_EXT1__ ++#if defined(__STDC_LIB_EXT1__) || defined(_WIN32) + #define __STDC_WANT_LIB_EXT1__ 1 + #include + diff --git a/recipes/pngpp/all/test_package/CMakeLists.txt b/recipes/pngpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..196188113685c --- /dev/null +++ b/recipes/pngpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/pngpp/all/test_package/conanfile.py b/recipes/pngpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/pngpp/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pngpp/all/test_package/test_package.cpp b/recipes/pngpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7c74c1d575226 --- /dev/null +++ b/recipes/pngpp/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include + +int main() { + png::image image(128, 128); + for (png::uint_32 y = 0; y < image.get_height(); ++y) { + for (png::uint_32 x = 0; x < image.get_width(); ++x) { + image[y][x] = png::rgb_pixel(x, y, x + y); + } + } + image.write("rgb.png"); + return 0; +} diff --git a/recipes/pngpp/config.yml b/recipes/pngpp/config.yml new file mode 100644 index 0000000000000..2b6204e74adb5 --- /dev/null +++ b/recipes/pngpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.10": + folder: all diff --git a/recipes/poco/all/conanfile.py b/recipes/poco/all/conanfile.py index dc7250b358768..a51b2c038eeb6 100644 --- a/recipes/poco/all/conanfile.py +++ b/recipes/poco/all/conanfile.py @@ -4,7 +4,7 @@ import os -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.33.0" class PocoConan(ConanFile): @@ -91,9 +91,8 @@ def _build_subfolder(self): return "build_subfolder" def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = "poco-poco-{}-release".format(self.version) - os.rename(extracted_folder, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def config_options(self): if self.settings.os == "Windows": @@ -111,6 +110,12 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC + if not self.options.enable_xml: + util_dependencies = self._poco_component_tree["PocoUtil"].dependencies + self._poco_component_tree["PocoUtil"] = self._poco_component_tree["PocoUtil"]._replace(dependencies = tuple(x for x in util_dependencies if x != "PocoXML")) + if not self.options.enable_json: + util_dependencies = self._poco_component_tree["PocoUtil"].dependencies + self._poco_component_tree["PocoUtil"] = self._poco_component_tree["PocoUtil"]._replace(dependencies = tuple(x for x in util_dependencies if x != "PocoJSON")) def validate(self): if self.options.enable_apacheconnector: @@ -135,9 +140,9 @@ def requirements(self): self.requires("pcre/8.44") self.requires("zlib/1.2.11") if self.options.enable_xml: - self.requires("expat/2.2.10") + self.requires("expat/2.4.1") if self.options.enable_data_sqlite: - self.requires("sqlite3/3.34.0") + self.requires("sqlite3/3.35.5") if self.options.enable_apacheconnector: self.requires("apr/1.7.0") self.requires("apr-util/1.6.1") @@ -146,15 +151,15 @@ def requirements(self): if self.options.get_safe("enable_netssl", False) or \ self.options.enable_crypto or \ self.options.get_safe("enable_jwt", False): - self.requires("openssl/1.1.1i") + self.requires("openssl/1.1.1k") if self.options.enable_data_odbc and self.settings.os != "Windows": - self.requires("odbc/2.3.7") + self.requires("odbc/2.3.9") if self.options.get_safe("enable_data_postgresql", False): - self.requires("libpq/13.1") + self.requires("libpq/13.2") if self.options.get_safe("enable_data_mysql", False): self.requires("apr/1.7.0") - self.requires('apr-util/1.6.1') - self.requires("libmysqlclient/8.0.17") + self.requires("apr-util/1.6.1") + self.requires("libmysqlclient/8.0.25") def _patch_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): @@ -164,6 +169,7 @@ def _configure_cmake(self): if self._cmake: return self._cmake self._cmake = CMake(self) + self._cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type if tools.Version(self.version) < "1.10.1": self._cmake.definitions["POCO_STATIC"] = not self.options.shared for comp in self._poco_component_tree.values(): @@ -238,5 +244,11 @@ def package_info(self): self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi", "crypt32"]) if self.options.enable_data_odbc: self.cpp_info.system_libs.extend(["odbc32", "odbccp32"]) + self.cpp_info.defines.append("POCO_UNBUNDLED") + if self.options.enable_util: + if not self.options.enable_json: + self.cpp_info.defines.append("POCO_UTIL_NO_JSONCONFIGURATION") + if not self.options.enable_xml: + self.cpp_info.defines.append("POCO_UTIL_NO_XMLCONFIGURATION") self.cpp_info.names["cmake_find_package"] = "Poco" self.cpp_info.names["cmake_find_package_multi"] = "Poco" diff --git a/recipes/premake/5.x/conanfile.py b/recipes/premake/5.x/conanfile.py index 8d95257cc861d..f0834e0449cd2 100644 --- a/recipes/premake/5.x/conanfile.py +++ b/recipes/premake/5.x/conanfile.py @@ -1,4 +1,5 @@ from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild +from conans.errors import ConanInvalidConfiguration import glob import os import re @@ -33,6 +34,10 @@ def config_options(self): if self.settings.os != "Windows" or self.settings.compiler == "Visual Studio": del self.options.lto + def validate(self): + if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): + raise ConanInvalidConfiguration("Cross-building not implemented") + @property def _msvc_version(self): return { diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index a37360194178a..9dafbfd849c33 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -14,3 +14,5 @@ patches: base_path: "qt5/qtwebengine" - patch_file: "patches/fix-macdeployqt.diff" base_path: "qt5/qttools" + - patch_file: "patches/QTBUG-88625.diff" + base_path: "qt5/qtwebengine" diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index ebc45603dcee2..34b397fb31065 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -81,7 +81,7 @@ class QtConan(ConanFile): "cross_compile": "ANY", "sysroot": "ANY", "config": "ANY", - "multiconfiguration": [True, False], + "multiconfiguration": [True, False] } options.update({module: [True, False] for module in _submodules}) @@ -117,7 +117,7 @@ class QtConan(ConanFile): "cross_compile": None, "sysroot": None, "config": None, - "multiconfiguration": False, + "multiconfiguration": False } default_options.update({module: False for module in _submodules}) @@ -148,10 +148,11 @@ def build_requirements(self): msg = ("Python2 must be available in PATH " "in order to build Qt WebEngine") raise ConanInvalidConfiguration(msg) + # In any case, check its actual version for compatibility from six import StringIO # Python 2 and 3 compatible mybuf = StringIO() - cmd_v = "{} --version".format(python_exe) + cmd_v = "\"{}\" --version".format(python_exe) self.run(cmd_v, output=mybuf) verstr = mybuf.getvalue().strip().split("Python ")[1] if verstr.endswith("+"): @@ -167,7 +168,8 @@ def build_requirements(self): else: msg = ("Found Python 2 in path, but with invalid version {}" " (QtWebEngine requires >= {} & < " - "{})".format(verstr, v_min, v_max)) + "{})\nIf you have both Python 2 and 3 installed, copy the python 2 executable to" + "python2(.exe)".format(verstr, v_min, v_max)) raise ConanInvalidConfiguration(msg) def config_options(self): @@ -191,9 +193,6 @@ def configure(self): #if self.settings.os != "Linux": # self.options.with_libiconv = False # QTBUG-84708 - if self.options.widgets and not self.options.gui: - raise ConanInvalidConfiguration("using option qt:widgets without option qt:gui is not possible. " - "You can either disable qt:widgets or enable qt:gui") if not self.options.gui: del self.options.opengl del self.options.with_vulkan @@ -207,38 +206,12 @@ def configure(self): del self.options.with_libalsa del self.options.with_openal - if self.options.qtwebengine: - if not self.options.shared: - raise ConanInvalidConfiguration("Static builds of Qt Webengine are not supported") - - if tools.cross_building(self.settings, skip_x64_x86=True): - raise ConanInvalidConfiguration("Cross compiling Qt WebEngine is not supported") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("Compiling Qt WebEngine with gcc < 5 is not supported") - - if self.settings.os == "Android" and self.options.get_safe("opengl", "no") == "desktop": - raise ConanInvalidConfiguration("OpenGL desktop is not supported on Android. Consider using OpenGL es2") - - if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") == "dynamic": - raise ConanInvalidConfiguration("Dynamic OpenGL is supported only on Windows.") - - if self.options.get_safe("with_fontconfig", False) and not self.options.get_safe("with_freetype", False): - raise ConanInvalidConfiguration("with_fontconfig cannot be enabled if with_freetype is disabled.") - - if self.options.multiconfiguration: - del self.settings.build_type - - if not self.options.with_doubleconversion and str(self.settings.compiler.libcxx) != "libc++": - raise ConanInvalidConfiguration("Qt without libc++ needs qt:with_doubleconversion. " - "Either enable qt:with_doubleconversion or switch to libc++") - if tools.os_info.is_linux: if self.options.qtwebengine: self.options.with_fontconfig = True - if "MT" in self.settings.get_safe("compiler.runtime", default="") and self.options.shared: - raise ConanInvalidConfiguration("Qt cannot be built as shared library with static runtime") + if self.options.multiconfiguration: + del self.settings.build_type config = configparser.ConfigParser() config.read(os.path.join(self.recipe_folder, "qtmodules%s.conf" % self.version)) @@ -272,15 +245,56 @@ def _enablemodule(mod): if self.options.get_safe(module): _enablemodule(module) + def validate(self): + if self.options.widgets and not self.options.gui: + raise ConanInvalidConfiguration("using option qt:widgets without option qt:gui is not possible. " + "You can either disable qt:widgets or enable qt:gui") + + if self.options.qtwebengine: + if not self.options.shared: + raise ConanInvalidConfiguration("Static builds of Qt WebEngine are not supported") + + if not (self.options.gui and self.options.qtdeclarative and self.options.qtlocation and self.options.qtwebchannel): + raise ConanInvalidConfiguration("option qt:qtwebengine requires also qt:gui, qt:qtdeclarative, qt:qtlocation and qt:qtwebchannel") + + if tools.cross_building(self.settings, skip_x64_x86=True): + raise ConanInvalidConfiguration("Cross compiling Qt WebEngine is not supported") + + if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("Compiling Qt WebEngine with gcc < 5 is not supported") + + if self.settings.os == "Android" and self.options.get_safe("opengl", "no") == "desktop": + raise ConanInvalidConfiguration("OpenGL desktop is not supported on Android. Consider using OpenGL es2") + + if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") == "dynamic": + raise ConanInvalidConfiguration("Dynamic OpenGL is supported only on Windows.") + + if self.options.get_safe("with_fontconfig", False) and not self.options.get_safe("with_freetype", False): + raise ConanInvalidConfiguration("with_fontconfig cannot be enabled if with_freetype is disabled.") + + if not self.options.with_doubleconversion and str(self.settings.compiler.libcxx) != "libc++": + raise ConanInvalidConfiguration("Qt without libc++ needs qt:with_doubleconversion. " + "Either enable qt:with_doubleconversion or switch to libc++") + + if "MT" in self.settings.get_safe("compiler.runtime", default="") and self.options.shared: + raise ConanInvalidConfiguration("Qt cannot be built as shared library with static runtime") + + if self.settings.compiler == "apple-clang": + if tools.Version(self.settings.compiler.version) < "10.0": + raise ConanInvalidConfiguration("Old versions of apple sdk are not supported by Qt (QTBUG-76777)") + if self.settings.compiler in ["gcc", "clang"]: + if tools.Version(self.settings.compiler.version) < "5.0": + raise ConanInvalidConfiguration("qt 5.15.X does not support GCC or clang before 5.0") + def requirements(self): self.requires("zlib/1.2.11") if self.options.openssl: self.requires("openssl/1.1.1k") if self.options.with_pcre2: - self.requires("pcre2/10.36") + self.requires("pcre2/10.37") if self.options.with_glib: - self.requires("glib/2.68.1") + self.requires("glib/2.68.3") # if self.options.with_libiconv: # QTBUG-84708 # self.requires("libiconv/1.16")# QTBUG-84708 if self.options.with_doubleconversion and not self.options.multiconfiguration: @@ -290,7 +304,7 @@ def requirements(self): if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.13.93") if self.options.get_safe("with_icu", False): - self.requires("icu/68.2") + self.requires("icu/69.1") if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: self.requires("harfbuzz/2.8.1") if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration: @@ -304,7 +318,7 @@ def requirements(self): self.requires("sqlite3/3.35.5") self.options["sqlite3"].enable_column_metadata = True if self.options.get_safe("with_mysql", False): - self.requires("libmysqlclient/8.0.17") + self.requires("libmysqlclient/8.0.25") if self.options.with_pq: self.requires("libpq/13.2") if self.options.with_odbc: @@ -317,13 +331,13 @@ def requirements(self): if self.options.gui and self.settings.os == "Linux": self.requires("xorg/system") if not tools.cross_building(self, skip_x64_x86=True): - self.requires("xkbcommon/1.2.1") + self.requires("xkbcommon/1.3.0") if self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: self.requires("zstd/1.5.0") if self.options.qtwebengine and self.settings.os == "Linux": - self.requires("expat/2.3.0") + self.requires("expat/2.4.1") self.requires("opus/1.3.1") def source(self): @@ -730,37 +744,300 @@ def package_id(self): self.info.settings.compiler.runtime = "MT/MTd" def package_info(self): - # FIXME add components - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.names["cmake_find_package"] = "Qt5" + self.cpp_info.names["cmake_find_package_multi"] = "Qt5" - # Add top level include directory, so code compile if someone uses - # includes with prefixes (e.g. "#include ") - self.cpp_info.includedirs = ["include"] + libsuffix = "" + if self.settings.build_type == "Debug": + if self.settings.os == "Windows": + libsuffix = "d" + elif tools.is_apple_os(self.settings.os): + libsuffix = "_debug" + + def _get_corrected_reqs(requires): + reqs = [] + for r in requires: + reqs.append(r if "::" in r else "qt%s" % r) + return reqs + + def _create_module(module, requires=[]): + componentname = "qt%s" % module + assert componentname not in self.cpp_info.components, "Module %s already present in self.cpp_info.components" % module + self.cpp_info.components[componentname].names["cmake_find_package"] = module + self.cpp_info.components[componentname].names["cmake_find_package_multi"] = module + self.cpp_info.components[componentname].libs = ["Qt5%s%s" % (module, libsuffix)] + self.cpp_info.components[componentname].includedirs = ["include", os.path.join("include", "Qt%s" % module)] + self.cpp_info.components[componentname].defines = ["QT_%s_LIB" % module.upper()] + if module != "Core" and "Core" not in requires: + requires.append("Core") + self.cpp_info.components[componentname].requires = _get_corrected_reqs(requires) + + def _create_plugin(pluginname, libname, type, requires): + componentname = "qt%s" % pluginname + assert componentname not in self.cpp_info.components, "Plugin %s already present in self.cpp_info.components" % pluginname + self.cpp_info.components[componentname].names["cmake_find_package"] = pluginname + self.cpp_info.components[componentname].names["cmake_find_package_multi"] = pluginname + if not self.options.shared: + self.cpp_info.components[componentname].libs = [libname + libsuffix] + self.cpp_info.components[componentname].libdirs = [os.path.join("bin", "archdatadir", "plugins", type)] + self.cpp_info.components[componentname].includedirs = [] + if "Core" not in requires: + requires.append("Core") + self.cpp_info.components[componentname].requires = _get_corrected_reqs(requires) + + core_reqs = ["zlib::zlib"] + if self.options.with_pcre2: + core_reqs.append("pcre2::pcre2") + if self.options.with_doubleconversion: + core_reqs.append("double-conversion::double-conversion") + if self.options.get_safe("with_icu", False): + core_reqs.append("icu::icu") + if self.options.with_zstd: + core_reqs.append("zstd::zstd") + + _create_module("Core", core_reqs) + if self.options.gui: + gui_reqs = ["DBus"] + if self.options.with_freetype: + gui_reqs.append("freetype::freetype") + if self.options.with_libpng: + gui_reqs.append("libpng::libpng") + if self.options.get_safe("with_fontconfig", False): + gui_reqs.append("fontconfig::fontconfig") + if self.settings.os in ["Linux", "FreeBSD"]: + gui_reqs.append("xorg::xorg") + if not tools.cross_building(self, skip_x64_x86=True): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("opengl", "no") != "no": + gui_reqs.append("opengl::opengl") + if self.options.with_harfbuzz: + gui_reqs.append("harfbuzz::harfbuzz") + if self.options.with_libjpeg == "libjpeg-turbo": + gui_reqs.append("libjpeg-turbo::libjpeg-turbo") + if self.options.with_libjpeg == "libjpeg": + gui_reqs.append("libjpeg::libjpeg") + _create_module("Gui", gui_reqs) + if self.options.with_sqlite3: + _create_plugin("QSQLiteDriverPlugin", "qsqlite", "sqldrivers", ["sqlite3::sqlite3"]) + if self.options.with_pq: + _create_plugin("QPSQLDriverPlugin", "qsqlpsql", "sqldrivers", ["libpq::libpq"]) + if self.options.get_safe("with_mysql", False): + _create_plugin("QMySQLDriverPlugin", "qsqlmysql", "sqldrivers", ["libmysqlclient::libmysqlclient"]) + if self.options.with_odbc: + if self.settings.os != "Windows": + _create_plugin("QODBCDriverPlugin", "qsqlodbc", "sqldrivers", ["odbc::odbc"]) + networkReqs = [] + if self.options.openssl: + networkReqs.append("openssl::openssl") + _create_module("Network", networkReqs) + _create_module("Sql") + _create_module("Test") + if self.options.widgets: + _create_module("Widgets", ["Gui"]) + if self.options.gui and self.options.widgets: + _create_module("PrintSupport", ["Gui", "Widgets"]) + if self.options.get_safe("opengl", "no") != "no" and self.options.gui: + _create_module("OpenGL", ["Gui"]) + if self.options.widgets and self.options.get_safe("opengl", "no") != "no": + _create_module("OpenGLExtensions", ["Gui"]) + _create_module("DBus") + _create_module("Concurrent") + _create_module("Xml") + + if self.options.qtdeclarative: + _create_module("Qml", ["Network"]) + _create_module("QmlModels", ["Qml"]) + self.cpp_info.components["qtQmlImportScanner"].names["cmake_find_package"] = "QmlImportScanner" # this is an alias for Qml and there to integrate with existing consumers + self.cpp_info.components["qtQmlImportScanner"].names["cmake_find_package_multi"] = "QmlImportScanner" + self.cpp_info.components["qtQmlImportScanner"].requires = _get_corrected_reqs(["Qml"]) + if self.options.gui: + _create_module("Quick", ["Gui", "Qml", "QmlModels"]) + if self.options.widgets: + _create_module("QuickWidgets", ["Gui", "Qml", "Quick", "Widgets"]) + _create_module("QuickShapes", ["Gui", "Qml", "Quick"]) + _create_module("QmlWorkerScript", ["Qml"]) + _create_module("QuickTest", ["Test"]) + + if self.options.qttools and self.options.gui and self.options.widgets: + _create_module("UiPlugin", ["Gui", "Widgets"]) + self.cpp_info.components["qtUiPlugin"].libs = [] # this is a collection of abstract classes, so this is header-only + self.cpp_info.components["qtUiPlugin"].libdirs = [] + _create_module("UiTools", ["UiPlugin", "Gui", "Widgets"]) + _create_module("Designer", ["Gui", "UiPlugin", "Widgets", "Xml"]) + _create_module("Help", ["Gui", "Sql", "Widgets"]) + + if self.options.qtquick3d and self.options.gui: + _create_module("Quick3DUtils", ["Gui"]) + _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DUtils"]) + _create_module("Quick3DRuntimeRender", ["Gui", "Quick", "Quick3DAssetImport", "Quick3DUtils", "ShaderTools"]) + _create_module("Quick3D", ["Gui", "Qml", "Quick", "Quick3DRuntimeRender"]) + + if self.options.qtquickcontrols2 and self.options.gui: + _create_module("QuickControls2", ["Gui", "Quick"]) + _create_module("QuickTemplates2", ["Gui", "Quick"]) + + if self.options.qtsvg and self.options.gui: + _create_module("Svg", ["Gui"]) + if self.options.widgets: + _create_module("SvgWidgets", ["Gui", "Svg", "Widgets"]) + + if self.options.qtwayland and self.options.gui: + _create_module("WaylandClient", ["Gui", "wayland::wayland-client"]) + _create_module("WaylandCompositor", ["Gui", "wayland::wayland-server"]) + + if self.options.qtlocation: + _create_module("Positioning") + _create_module("Location", ["Gui", "Quick"]) + _create_plugin("QGeoServiceProviderFactoryMapbox", "qtgeoservices_mapbox", "geoservices", []) + _create_plugin("QGeoServiceProviderFactoryMapboxGL", "qtgeoservices_mapboxgl", "geoservices", []) + _create_plugin("GeoServiceProviderFactoryEsri", "qtgeoservices_esri", "geoservices", []) + _create_plugin("QGeoServiceProviderFactoryItemsOverlay", "qtgeoservices_itemsoverlay", "geoservices", []) + _create_plugin("QGeoServiceProviderFactoryNokia", "qtgeoservices_nokia", "geoservices", []) + _create_plugin("QGeoServiceProviderFactoryOsm", "qtgeoservices_osm", "geoservices", []) + _create_plugin("QGeoPositionInfoSourceFactoryGeoclue", "qtposition_geoclue", "position", []) + _create_plugin("QGeoPositionInfoSourceFactoryGeoclue2", "qtposition_geoclue2", "position", []) + _create_plugin("QGeoPositionInfoSourceFactoryPoll", "qtposition_positionpoll", "position", []) + _create_plugin("QGeoPositionInfoSourceFactorySerialNmea", "qtposition_serialnmea", "position", []) + + if self.options.qtwebchannel: + _create_module("WebChannel", ["Qml"]) - # Add all Qt module directories (QtCore, QtGui, QtWidgets and so on), so prefix - # can be omited in includes (e.g. "#include " => "#include ") - fu = ["include/" + f.name for f in os.scandir("include") if f.is_dir()] - self.cpp_info.includedirs.extend(fu) + if self.options.qtwebengine: + _create_module("WebEngineCore", ["Gui", "Quick", "WebChannel", "Positioning", "expat::expat", "opus::libopus"]) + _create_module("WebEngine", ["WebEngineCore"]) + _create_module("WebEngineWidgets", ["WebEngineCore", "Quick", "PrintSupport", "Widgets", "Gui", "Network"]) + + if self.options.qtserialport: + _create_module("SerialPort") + + if self.options.qtserialbus: + _create_module("SerialBus", ["SerialPort"]) + _create_plugin("PassThruCanBusPlugin", "qtpassthrucanbus", "canbus", []) + _create_plugin("PeakCanBusPlugin", "qtpeakcanbus", "canbus", []) + _create_plugin("SocketCanBusPlugin", "qtsocketcanbus", "canbus", []) + _create_plugin("TinyCanBusPlugin", "qttinycanbus", "canbus", []) + _create_plugin("VirtualCanBusPlugin", "qtvirtualcanbus", "canbus", []) + + if self.options.qtsensors: + _create_module("Sensors") + _create_plugin("genericSensorPlugin", "qtsensors_generic", "sensors", []) + _create_plugin("IIOSensorProxySensorPlugin", "qtsensors_iio-sensor-proxy", "sensors", []) + if self.settings.os == "Linux": + _create_plugin("LinuxSensorPlugin", "qtsensors_linuxsys", "sensors", []) + _create_plugin("QtSensorGesturePlugin", "qtsensorgestures_plugin", "sensorgestures", []) + _create_plugin("QShakeSensorGesturePlugin", "qtsensorgestures_shakeplugin", "sensorgestures", []) + + if self.options.qtscxml: + _create_module("Scxml", ["Qml"]) + + if self.options.qtpurchasing: + _create_module("Purchasing") + + if self.options.qtcharts: + _create_module("Charts", ["Gui", "Widgets"]) + + if self.options.qt3d: + _create_module("3DCore", ["Gui", "Network"]) + + _create_module("3DRender", ["3DCore"]) + _create_plugin("DefaultGeometryLoaderPlugin", "defaultgeometryloader", "geometryloaders", []) + _create_plugin("GLTFGeometryLoaderPlugin", "gltfgeometryloader", "geometryloaders", []) + _create_plugin("GLTFSceneExportPlugin", "gltfsceneexport", "sceneparsers", []) + _create_plugin("GLTFSceneImportPlugin", "gltfsceneimport", "sceneparsers", []) + _create_plugin("OpenGLRendererPlugin", "openglrenderer", "renderers", []) + _create_plugin("Scene2DPlugin", "scene2d", "renderplugins", []) + + _create_module("3DAnimation", ["3DRender", "3DCore", "Gui"]) + _create_module("3DInput", ["3DCore", "GamePad", "Gui"]) + _create_module("3DLogic", ["3DCore", "Gui"]) + _create_module("3DExtras", ["3DRender", "3DInput", "3DLogic", "3DCore", "Gui"]) + _create_module("3DQuick", ["3DCore", "Quick", "Gui", "Qml"]) + _create_module("3DQuickAnimation", ["3DAnimation", "3DRender", "3DQuick", "3DCore", "Gui", "Qml"]) + _create_module("3DQuickExtras", ["3DExtras", "3DInput", "3DQuick", "3DRender", "3DLogic", "3DCore", "Gui", "Qml"]) + _create_module("3DQuickInput", ["3DInput", "3DQuick", "3DCore", "Gui", "Qml"]) + _create_module("3DQuickRender", ["3DRender", "3DQuick", "3DCore", "Gui", "Qml"]) + _create_module("3DQuickScene2D", ["3DRender", "3DQuick", "3DCore", "Gui", "Qml"]) + + if self.options.qtgamepad: + _create_module("Gamepad", ["Gui"]) + if self.settings.os == "Linux": + _create_plugin("QEvdevGamepadBackendPlugin", "evdevgamepad", "gamepads", []) + if self.settings.os == "Macos": + _create_plugin("QDarwinGamepadBackendPlugin", "darwingamepad", "gamepads", []) + if self.settings.os =="Windows": + _create_plugin("QXInputGamepadBackendPlugin", "xinputgamepad", "gamepads", []) + + if self.options.qtmultimedia: + _create_module("Multimedia", ["Network", "Gui", "openal::openal"]) + _create_module("MultimediaWidgets", ["Multimedia", "Widgets", "Gui"]) + if self.options.qtdeclarative and self.options.gui: + _create_module("MultimediaQuick", ["Multimedia", "Quick"]) + _create_plugin("QM3uPlaylistPlugin", "qtmultimedia_m3u", "playlistformats", []) + if self.settings.os == "Linux": + _create_module("MultimediaGstTools", ["Multimedia", "MultimediaWidgets", "Gui"]) + _create_plugin("CameraBinServicePlugin", "gstcamerabin", "mediaservice", []) + _create_plugin("QAlsaPlugin", "qtaudio_alsa", "audio", []) + _create_plugin("QGstreamerAudioDecoderServicePlugin", "gstaudiodecoder", "mediaservice", []) + _create_plugin("QGstreamerCaptureServicePlugin", "gstmediacapture", "mediaservice", []) + _create_plugin("QGstreamerPlayerServicePlugin", "gstmediaplayer", "mediaservice", []) + if self.settings.os == "Windows": + _create_plugin("AudioCaptureServicePlugin", "qtmedia_audioengine", "mediaservice", []) + _create_plugin("DSServicePlugin", "dsengine", "mediaservice", []) + _create_plugin("QWindowsAudioPlugin", "qtaudio_windows", "audio", []) + if self.settings.os == "Macos": + _create_plugin("AudioCaptureServicePlugin", "qtmedia_audioengine", "mediaservice", []) + _create_plugin("AVFMediaPlayerServicePlugin", "qavfmediaplayer", "mediaservice", []) + _create_plugin("AVFServicePlugin", "qavfcamera", "mediaservice", []) + _create_plugin("CoreAudioPlugin", "qtaudio_coreaudio", "audio", []) + + if self.options.qtwebsockets: + _create_module("WebSockets", ["Network"]) + + if self.options.qtconnectivity: + _create_module("Bluetooth", ["Network"]) + _create_module("Nfc", []) + + if self.options.qtdatavis3d: + _create_module("DataVisualization", ["Gui"]) + + if self.options.qtnetworkauth: + _create_module("NetworkAuth", ["Network"]) if not self.options.shared: if self.settings.os == "Windows": - self.cpp_info.system_libs.append("Version") # "Qt5Cored.lib" require "GetFileVersionInfoW" and "VerQueryValueW" which are in "Version.lib" library - self.cpp_info.system_libs.append("Winmm") # "Qt5Cored.lib" require "__imp_timeSetEvent" which is in "Winmm.lib" library - self.cpp_info.system_libs.append("Netapi32") # "Qt5Cored.lib" require "NetApiBufferFree" which is in "Netapi32.lib" library - self.cpp_info.system_libs.append("UserEnv") # "Qt5Cored.lib" require "__imp_GetUserProfileDirectoryW " which is in "UserEnv.Lib" library + self.cpp_info.components["qtCore"].system_libs.append("version") # qtcore requires "GetFileVersionInfoW" and "VerQueryValueW" which are in "Version.lib" library + self.cpp_info.components["qtCore"].system_libs.append("winmm") # qtcore requires "__imp_timeSetEvent" which is in "Winmm.lib" library + self.cpp_info.components["qtCore"].system_libs.append("netapi32") # qtcore requires "NetApiBufferFree" which is in "Netapi32.lib" library + self.cpp_info.components["qtCore"].system_libs.append("userenv") # qtcore requires "__imp_GetUserProfileDirectoryW " which is in "UserEnv.Lib" library + self.cpp_info.components["qtCore"].system_libs.append("ws2_32") # qtcore requires "WSAStartup " which is in "Ws2_32.Lib" library + self.cpp_info.components["qtNetwork"].system_libs.append("DnsApi") # qtnetwork from qtbase requires "DnsFree" which is in "Dnsapi.lib" library if self.settings.os == "Macos": - self.cpp_info.frameworks.extend(["IOKit"]) # "libQt5Core.a" require "_IORegistryEntryCreateCFProperty", "_IOServiceGetMatchingService" and much more which are in "IOKit" framework - self.cpp_info.frameworks.extend(["Cocoa"]) # "libQt5Core.a" require "_OBJC_CLASS_$_NSApplication" and more, which are in "Cocoa" framework - self.cpp_info.frameworks.extend(["Security"]) # "libQt5Core.a" require "_SecRequirementCreateWithString" and more, which are in "Security" framework + self.cpp_info.components["qtCore"].frameworks.append("IOKit") # qtcore requires "_IORegistryEntryCreateCFProperty", "_IOServiceGetMatchingService" and much more which are in "IOKit" framework + self.cpp_info.components["qtCore"].frameworks.append("Cocoa") # qtcore requires "_OBJC_CLASS_$_NSApplication" and more, which are in "Cocoa" framework + self.cpp_info.components["qtCore"].frameworks.append("Security") # qtcore requires "_SecRequirementCreateWithString" and more, which are in "Security" framework + + self.cpp_info.components["qtCore"].builddirs.append(os.path.join("bin","archdatadir","bin")) + self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_executables_file) + self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_executables_file) for m in os.listdir(os.path.join("lib", "cmake")): module = os.path.join("lib", "cmake", m, "%sMacros.cmake" % m) - self.cpp_info.build_modules["cmake_find_package"].append(module) - self.cpp_info.build_modules["cmake_find_package_multi"].append(module) - self.cpp_info.builddirs.append(os.path.join("lib", "cmake", m)) - self.cpp_info.build_modules["cmake_find_package"].append(self._cmake_executables_file) - self.cpp_info.build_modules["cmake_find_package_multi"].append(self._cmake_executables_file) + component_name = m.replace("Qt5", "qt") + self.cpp_info.components[component_name].build_modules["cmake_find_package"].append(module) + self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].append(module) + self.cpp_info.components[component_name].builddirs.append(os.path.join("lib", "cmake", m)) + + objects_dirs = glob.glob(os.path.join(self.package_folder, "lib", "objects-*/")) + for object_dir in objects_dirs: + for m in os.listdir(object_dir): + submodules_dir = os.path.join(object_dir, m) + component = "qt" + m[:m.find("_")] + for sub_dir in os.listdir(submodules_dir): + submodule_dir = os.path.join(submodules_dir, sub_dir) + obj_files = [os.path.join(submodule_dir, file) for file in os.listdir(submodule_dir)] + self.cpp_info.components[component].exelinkflags.extend(obj_files) + self.cpp_info.components[component].sharedlinkflags.extend(obj_files) @staticmethod diff --git a/recipes/qt/5.x.x/patches/QTBUG-88625.diff b/recipes/qt/5.x.x/patches/QTBUG-88625.diff new file mode 100644 index 0000000000000..ed0c1fd48d82c --- /dev/null +++ b/recipes/qt/5.x.x/patches/QTBUG-88625.diff @@ -0,0 +1,58 @@ +Fix compile errors in QtWebEngine when building with VS2019 >= 16.8.0 . +See https://bugreports.qt.io/browse/QTBUG-88625 and +https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/321741 . + +diff -u -r a/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp b/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp +--- a/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp 2021-05-20 13:38:32.243947800 +0200 ++++ b/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp 2021-05-20 12:25:30.392900700 +0200 +@@ -72,11 +72,11 @@ + const RGB9E5Data *inputData = reinterpret_cast(&input); + + *red = +- inputData->R * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); ++ inputData->R * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); + *green = +- inputData->G * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); ++ inputData->G * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); + *blue = +- inputData->B * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); ++ inputData->B * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); + } + + } // namespace gl +diff -u -r a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h +--- a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h 2020-11-07 02:22:36.000000000 +0100 ++++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h 2021-05-20 13:39:42.890109500 +0200 +@@ -130,7 +130,7 @@ + // https://en.wikipedia.org/wiki/CIELAB_color_space#Forward_transformation. + FloatPoint3D toXYZ(const FloatPoint3D& lab) const { + auto invf = [](float x) { +- return x > kSigma ? pow(x, 3) : 3 * kSigma2 * (x - 4.0f / 29.0f); ++ return x > kSigma ? (float)pow(x, 3) : 3 * kSigma2 * (x - 4.0f / 29.0f); + }; + + FloatPoint3D v = {clamp(lab.X(), 0.0f, 100.0f), +diff -u -r a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h +--- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h 2020-11-07 02:22:36.000000000 +0100 ++++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h 2021-05-20 13:41:08.983902900 +0200 +@@ -197,6 +197,20 @@ + } + return *this; + } ++ ++ #if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC) ++ TimestampedTracePiece& operator=(TimestampedTracePiece&& ttp) const ++ { ++ if (this != &ttp) { ++ // First invoke the destructor and then invoke the move constructor ++ // inline via placement-new to implement move-assignment. ++ this->~TimestampedTracePiece(); ++ new (const_cast(this)) TimestampedTracePiece(std::move(ttp)); ++ } ++ ++ return const_cast(*this); ++ } ++#endif // PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC) + + ~TimestampedTracePiece() { + switch (type) { diff --git a/recipes/qt/5.x.x/test_package/CMakeLists.txt b/recipes/qt/5.x.x/test_package/CMakeLists.txt index 5e57ff2921781..5f0647c685c50 100644 --- a/recipes/qt/5.x.x/test_package/CMakeLists.txt +++ b/recipes/qt/5.x.x/test_package/CMakeLists.txt @@ -9,7 +9,7 @@ conan_set_vs_runtime() conan_set_libcxx() conan_output_dirs_setup() -find_package(qt REQUIRED CONFIG) +find_package(Qt5 COMPONENTS Core REQUIRED CONFIG) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) @@ -20,4 +20,4 @@ add_executable(${PROJECT_NAME} ${SOURCES}) # Must compile with "-fPIC" since Qt was built with -reduce-relocations. target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) -target_link_libraries(${PROJECT_NAME} qt::qt) +target_link_libraries(${PROJECT_NAME} Qt5::Core) diff --git a/recipes/quantlib/all/CMakeLists.txt b/recipes/quantlib/all/CMakeLists.txt new file mode 100644 index 0000000000000..af7cd55f3e626 --- /dev/null +++ b/recipes/quantlib/all/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.4) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + +add_subdirectory(source_subfolder) diff --git a/recipes/quantlib/all/conandata.yml b/recipes/quantlib/all/conandata.yml new file mode 100644 index 0000000000000..47464581d2d33 --- /dev/null +++ b/recipes/quantlib/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "1.22": + url: "https://github.com/lballabio/QuantLib/releases/download/QuantLib-v1.22/QuantLib-1.22.tar.gz" + sha256: "85c81816f689f458596dd7073e4da8fd7f596c1e4c8ada81a6300389a39588af" +patches: + "1.22": + - patch_file: "patches/0001-fix-cmake.patch" + base_path: "source_subfolder" diff --git a/recipes/quantlib/all/conanfile.py b/recipes/quantlib/all/conanfile.py new file mode 100644 index 0000000000000..f290d96d45c23 --- /dev/null +++ b/recipes/quantlib/all/conanfile.py @@ -0,0 +1,77 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.33.0" + + +class QuantlibConan(ConanFile): + name = "quantlib" + description = "QuantLib is a free/open-source library for modeling, trading, and risk management in real-life." + license = "BSD-3-Clause" + topics = ("quantlib", "quantitative-finance") + homepage = "https://www.quantlib.org" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = "cmake", "cmake_find_package" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("boost/1.76.0") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("gcc < 5 not supported") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["USE_BOOST_DYNAMIC_LIBRARIES"] = False # even if boost shared, the underlying upstream logic doesn't matter for conan + if self.settings.compiler == "Visual Studio": + self._cmake.definitions["MSVC_RUNTIME"] = "dynamic" if "MD" in str(self.settings.compiler.runtime) else "static" + self._cmake.configure() + return self._cmake + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE.TXT", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.names["pkg_config"] = "quantlib" + self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/quantlib/all/patches/0001-fix-cmake.patch b/recipes/quantlib/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..2d779b9f09535 --- /dev/null +++ b/recipes/quantlib/all/patches/0001-fix-cmake.patch @@ -0,0 +1,48 @@ +* Don't build examples and tests +* Allow shared on windows +* enable at least C++11 standard + +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required() ++cmake_minimum_required(VERSION 3.8) + + project(QuantLib) + +@@ -45,8 +45,6 @@ if (Boost_FOUND) + endif (Boost_FOUND) + + add_subdirectory(ql) +-add_subdirectory(Examples) +-add_subdirectory(test-suite) + + # + # Copy across the ANSI config file into the build directory. Users +--- a/ql/CMakeLists.txt ++++ b/ql/CMakeLists.txt +@@ -2294,7 +2294,7 @@ set(QuantLib_HDR + get_quantlib_library_name(QL_OUTPUT_NAME) + + if(WIN32) +- if (${BUILD_SHARED_LIBS}) ++ if (0) + # Windows needs to link static library (nothing is declared to export in QuantLib) + message(FATAL_ERROR "You should build QuantLib in STATIC mode as nothing is exported from the library. Use BUILD_SHARED_LIBS=OFF") + endif() +@@ -2303,6 +2303,7 @@ if(WIN32) + else() + add_library(${QL_OUTPUT_NAME} ${QuantLib_SRC} ${QuantLib_HDR}) + endif() ++target_compile_features(${QL_OUTPUT_NAME} PUBLIC cxx_std_11) + set(QL_LINK_LIBRARY ${QL_OUTPUT_NAME} PARENT_SCOPE) + + foreach(file ${QuantLib_HDR}) +@@ -2311,6 +2312,7 @@ foreach(file ${QuantLib_HDR}) + endforeach() + + install(TARGETS ${QL_OUTPUT_NAME} ++ RUNTIME DESTINATION bin + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE diff --git a/recipes/quantlib/all/test_package/CMakeLists.txt b/recipes/quantlib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..33ae887aa6aea --- /dev/null +++ b/recipes/quantlib/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/quantlib/all/test_package/conanfile.py b/recipes/quantlib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/quantlib/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/quantlib/all/test_package/test_package.cpp b/recipes/quantlib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0df14de5ce8b6 --- /dev/null +++ b/recipes/quantlib/all/test_package/test_package.cpp @@ -0,0 +1,69 @@ +#include +#ifdef BOOST_MSVC +#include +#endif +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if defined(QL_ENABLE_SESSIONS) +namespace QuantLib { + ThreadKey sessionId() { return {}; } +} +#endif + +// Correct value is: (e^{-.25} \sqrt{\pi})^{dimension} +struct integrand { + QuantLib::Real operator()(const std::vector& arg) const { + QuantLib::Real sum = 1.; + for (double i : arg) + sum *= std::exp(-i * i) * std::cos(i); + return sum; + } +}; + +int main() { + try { + QuantLib::Size dimension = 3; + QuantLib::Real exactSol = std::pow(std::exp(-.25) * std::sqrt(M_PI), static_cast(dimension)); + + QuantLib::ext::function& arg)> f = integrand(); + + QuantLib::GaussianQuadMultidimIntegrator intg(dimension, 15); + QuantLib::Real valueQuad = intg(f); + + std::vector > integrals; + for (QuantLib::Size i = 0; i < dimension; ++i) { + integrals.push_back(QuantLib::ext::make_shared >(1.e-4, 20)); + } + std::vector a_limits(integrals.size(), -4.); + std::vector b_limits(integrals.size(), 4.); + QuantLib::MultidimIntegral testIntg(integrals); + + QuantLib::Real valueGrid = testIntg(f, a_limits, b_limits); + + std::cout << std::fixed << std::setprecision(4); + std::cout << std::endl << "-------------- " << std::endl + << "Exact: " << exactSol << std::endl + << "Quad: " << valueQuad << std::endl + << "Grid: " << valueGrid << std::endl + << std::endl; + + return 0; + + } catch (std::exception& e) { + std::cerr << e.what() << std::endl; + return 1; + } catch (...) { + std::cerr << "unknown error" << std::endl; + return 1; + } +} diff --git a/recipes/quantlib/config.yml b/recipes/quantlib/config.yml new file mode 100644 index 0000000000000..a04ddfaf17d5f --- /dev/null +++ b/recipes/quantlib/config.yml @@ -0,0 +1,3 @@ +versions: + "1.22": + folder: "all" diff --git a/recipes/qwt/all/conandata.yml b/recipes/qwt/all/conandata.yml new file mode 100644 index 0000000000000..5e6acd7ff338d --- /dev/null +++ b/recipes/qwt/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "6.1.6": + url: "https://sourceforge.net/projects/qwt/files/qwt/6.1.6/qwt-6.1.6.zip" + sha256: "4b2452662ae64656aca92f1bef44a281229f77056689100af62c4b9f24462873" diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py new file mode 100644 index 0000000000000..9c52d58b09eba --- /dev/null +++ b/recipes/qwt/all/conanfile.py @@ -0,0 +1,120 @@ +import os +from conans import ConanFile, tools + +required_conan_version = ">=1.33.0" + +class QwtConan(ConanFile): + name = "qwt" + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://qwt.sourceforge.io/" + topics = ("conan", "archive", "compression") + description = ( + "The Qwt library contains GUI Components and utility classes which are primarily useful for programs " + "with a technical background. Beside a framework for 2D plots it provides scales, sliders, dials, compasses, " + "thermometers, wheels and knobs to control or display values, arrays, or ranges of type double." + ) + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "plot": [True, False], + "widgets": [True, False], + "svg": [True, False], + "opengl": [True, False], + "mathml": [True, False], + "designer": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "plot": True, + "widgets": True, + "opengl": True, + "designer": True, + "mathml": False, + "svg": False + + } + generators = "qmake" + + @property + def _source_subfolder(self): + return "source_subfolder" + + def build_requirements(self): + if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": + self.build_requires("jom/1.1.3") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("qt/5.15.2") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + + def _patch_qwt_config_files(self): + # qwtconfig.pri + qwtconfig_path = os.path.join(self.source_folder, self._source_subfolder, "qwtconfig.pri") + qwtconfig = tools.load(qwtconfig_path) + + qwtconfig = "CONFIG += conan_basic_setup\ninclude(../conanbuildinfo.pri)\n" + qwtconfig + qwtconfig += "QWT_CONFIG {}= QwtDll\n".format("+" if self.options.shared else "-") + qwtconfig += "QWT_CONFIG {}= QwtPlot\n".format("+" if self.options.plot else "-") + qwtconfig += "QWT_CONFIG {}= QwtWidgets\n".format("+" if self.options.widgets else "-") + qwtconfig += "QWT_CONFIG {}= QwtSvg\n".format("+" if self.options.svg else "-") + qwtconfig += "QWT_CONFIG {}= QwtOpenGL\n".format("+" if self.options.opengl else "-") + qwtconfig += "QWT_CONFIG {}= QwtMathML\n".format("+" if self.options.mathml else "-") + qwtconfig += "QWT_CONFIG {}= QwtDesigner\n".format("+" if self.options.designer else "-") + tools.save(qwtconfig_path, qwtconfig) + + # qwtbuild.pri + qwtbuild_path = os.path.join(self.source_folder, self._source_subfolder, "qwtbuild.pri") + qwtbuild = tools.load(qwtbuild_path) + # set build type + qwtbuild += "CONFIG -= debug_and_release\n" + qwtbuild += "CONFIG -= build_all\n" + qwtbuild += "CONFIG -= release\n" + qwtbuild += "CONFIG += {}\n".format("debug" if self.settings.build_type == "Debug" else "release") + if self.settings.build_type == "RelWithDebInfo": + qwtbuild += "CONFIG += force_debug_info\n" + tools.save(qwtbuild_path, qwtbuild) + + def build(self): + self._patch_qwt_config_files() + + if self.settings.compiler == "Visual Studio": + vcvars = tools.vcvars_command(self.settings) + self.run("{} && qmake {}".format(vcvars, self._source_subfolder), run_environment=True) + self.run("{} && jom".format(vcvars)) + else: + self.run("qmake {}".format(self._source_subfolder), run_environment=True) + self.run("make -j {}".format(tools.cpu_count())) + + def package(self): + self.copy("COPYING", src=os.path.join(self._source_subfolder), dst="licenses") + self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "src")) + self.copy("*.dll", dst="bin", keep_path=False) + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.so*", dst="lib", keep_path=False, symlinks=True) + self.copy("*.dylib", dst="lib", keep_path=False) + self.copy("*.a", dst="lib", keep_path=False) + + def package_info(self): + postfix = "" + if self.settings.build_type == "Debug": + if self.settings.os == "Windows": + postfix += "d" + elif self.settings.os == "Macos": + postfix += "_debug" + self.cpp_info.libs = ["qwt" + postfix] + self.env_info.QT_PLUGIN_PATH.append(os.path.join(self.package_folder, 'bin')) + self.env_info.QT_PLUGIN_PATH.append(os.path.join(self.package_folder, 'lib')) + self.cpp_info.defines = ['HAVE_QWT', 'QWT_DLL'] if self.options.shared else ['HAVE_QWT'] diff --git a/recipes/qwt/all/test_package/CMakeLists.txt b/recipes/qwt/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..79d3544c480ff --- /dev/null +++ b/recipes/qwt/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.5) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_executable(example example.cpp) +# Must compile with "-fPIC" since Qt was built with -reduce-relocations. +target_compile_options(example PRIVATE -fPIC) +target_link_libraries(example CONAN_PKG::qt CONAN_PKG::qwt) +set_property(TARGET example PROPERTY CXX_STANDARD 11) + diff --git a/recipes/qwt/all/test_package/conanfile.py b/recipes/qwt/all/test_package/conanfile.py new file mode 100644 index 0000000000000..47c78f875835e --- /dev/null +++ b/recipes/qwt/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class QwtTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/qwt/all/test_package/example.cpp b/recipes/qwt/all/test_package/example.cpp new file mode 100644 index 0000000000000..194d042bbc781 --- /dev/null +++ b/recipes/qwt/all/test_package/example.cpp @@ -0,0 +1,10 @@ +#include +#include + +#include + +int main() +{ + qDebug() << QwtDate::toString(QwtDate::toDateTime(10), "MMM dd hh:mm ", QwtDate::FirstThursday); + return 0; +} diff --git a/recipes/qwt/config.yml b/recipes/qwt/config.yml new file mode 100644 index 0000000000000..25122d605fe76 --- /dev/null +++ b/recipes/qwt/config.yml @@ -0,0 +1,3 @@ +versions: + "6.1.6": + folder: "all" diff --git a/recipes/rapidjson/all/conanfile.py b/recipes/rapidjson/all/conanfile.py index d9e09298e2aea..828301cb40897 100644 --- a/recipes/rapidjson/all/conanfile.py +++ b/recipes/rapidjson/all/conanfile.py @@ -1,6 +1,7 @@ from conans import ConanFile, tools import os -import glob + +required_conan_version = ">=1.33.0" class RapidjsonConan(ConanFile): @@ -17,14 +18,11 @@ def _source_subfolder(self): return "source_subfolder" def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def package(self): - include_folder = os.path.join(self._source_subfolder, "include") self.copy(pattern="license.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=include_folder) + self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) def package_id(self): self.info.header_only() diff --git a/recipes/recastnavigation/all/conanfile.py b/recipes/recastnavigation/all/conanfile.py index 5f14207cbf2a9..8340de036cff1 100644 --- a/recipes/recastnavigation/all/conanfile.py +++ b/recipes/recastnavigation/all/conanfile.py @@ -1,7 +1,8 @@ import os -import glob from conans import ConanFile, CMake, tools +required_conan_version = ">=1.33.0" + class RecastNavigationConan(ConanFile): name = "recastnavigation" @@ -37,10 +38,12 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + del self.options.fPIC + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('recastnavigation-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_cmake(self): if self._cmake: @@ -64,6 +67,8 @@ def package(self): cmake.install() def package_info(self): + self.cpp_info.names["cmake_find_package"] = "recastnavigation" + self.cpp_info.names["cmake_find_package_multi"] = "recastnavigation" self.cpp_info.components["Recast"].names["cmake_find_package"] = "Recast" self.cpp_info.components["Recast"].names["cmake_find_package_multi"] = "Recast" self.cpp_info.components["Recast"].libs = ["Recast"] diff --git a/recipes/rocksdb/all/conanfile.py b/recipes/rocksdb/all/conanfile.py index 13a181c98b527..d312127b85dba 100644 --- a/recipes/rocksdb/all/conanfile.py +++ b/recipes/rocksdb/all/conanfile.py @@ -76,6 +76,9 @@ def configure(self): if self.settings.build_type == "Debug": self.options.use_rtti = True # Rtti are used in asserts for debug mode... + if self.options.shared: + del self.options.fPIC + def requirements(self): if self.options.with_gflags: self.requires("gflags/2.2.2") @@ -139,6 +142,9 @@ def _configure_cmake(self): self._cmake.definitions["WITH_NUMA"] = False + if self.settings.os == "Macos" and self.settings.arch == "armv8": + self._cmake.definitions["CMAKE_CXX_FLAGS"] = "-march=armv8-a" + self._cmake.configure(build_folder=self._build_subfolder) return self._cmake diff --git a/recipes/scnlib/all/CMakeLists.txt b/recipes/scnlib/all/CMakeLists.txt new file mode 100644 index 0000000000000..af7cd55f3e626 --- /dev/null +++ b/recipes/scnlib/all/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.4) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + +add_subdirectory(source_subfolder) diff --git a/recipes/scnlib/all/conandata.yml b/recipes/scnlib/all/conandata.yml new file mode 100644 index 0000000000000..4a7b3d9f55408 --- /dev/null +++ b/recipes/scnlib/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "0.4": + url: "https://github.com/eliaskosunen/scnlib/archive/refs/tags/v0.4.tar.gz" + sha256: "f23e66b00c9d38671b39b83c082a5b2db1cf05b3e3eff7b4a769487d9ed9d366" +patches: + "0.4": + - patch_file: "patches/0001-install-dll-windows.patch" + base_path: "source_subfolder" diff --git a/recipes/scnlib/all/conanfile.py b/recipes/scnlib/all/conanfile.py new file mode 100644 index 0000000000000..db0ab386b4916 --- /dev/null +++ b/recipes/scnlib/all/conanfile.py @@ -0,0 +1,105 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class ScnlibConan(ConanFile): + name = "scnlib" + description = "scanf for modern C++" + license = "Apache-2.0" + topics = ("scnlib", "parsing", "io", "scanf") + homepage = "https://github.com/eliaskosunen/scnlib" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "header_only": [True, False], + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "header_only": False, + "shared": False, + "fPIC": True, + } + + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.header_only or self.options.shared: + del self.options.fPIC + if self.options.header_only: + del self.options.shared + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "6.0", + "Visual Studio": "15", + } + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and tools.Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("{} {} requires several C++11 features, which your compiler does not support.".format(self.name, self.version)) + + def package_id(self): + if self.options.header_only: + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["SCN_INSTALL"] = True + self._cmake.configure() + return self._cmake + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + if not self.options.header_only: + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + if self.options.header_only: + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + self.copy("*", dst=os.path.join("include", "scn", "detail"), src=os.path.join(self._source_subfolder, "src")) + else: + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + tools.rmdir(os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "scn" + self.cpp_info.names["cmake_find_package_multi"] = "scn" + target = "scn-header-only" if self.options.header_only else "scn" + self.cpp_info.components["_scnlib"].names["cmake_find_package"] = target + self.cpp_info.components["_scnlib"].names["cmake_find_package_multi"] = target + if self.options.header_only: + self.cpp_info.components["_scnlib"].defines = ["SCN_HEADER_ONLY=1"] + else: + self.cpp_info.components["_scnlib"].defines = ["SCN_HEADER_ONLY=0"] + self.cpp_info.components["_scnlib"].libs = ["scn"] diff --git a/recipes/scnlib/all/patches/0001-install-dll-windows.patch b/recipes/scnlib/all/patches/0001-install-dll-windows.patch new file mode 100644 index 0000000000000..8928ce2f8c250 --- /dev/null +++ b/recipes/scnlib/all/patches/0001-install-dll-windows.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -145,6 +145,7 @@ if (SCN_INSTALL) + + install(TARGETS ${SCN_EXPORT_TARGETS_LIST} + EXPORT scnTargets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/scnlib/all/test_package/CMakeLists.txt b/recipes/scnlib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..162694934e5fb --- /dev/null +++ b/recipes/scnlib/all/test_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(scn REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +if(TARGET scn::scn-header-only) + target_link_libraries(${PROJECT_NAME} scn::scn-header-only) +else() + target_link_libraries(${PROJECT_NAME} scn::scn) +endif() diff --git a/recipes/scnlib/all/test_package/conanfile.py b/recipes/scnlib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/scnlib/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/scnlib/all/test_package/test_package.cpp b/recipes/scnlib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..148a9caff4852 --- /dev/null +++ b/recipes/scnlib/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +#include + +int main() { + std::string s{"conan-center-index"}; + auto span = scn::make_span(s); + return 0; +} diff --git a/recipes/scnlib/config.yml b/recipes/scnlib/config.yml new file mode 100644 index 0000000000000..5d8da8efb5763 --- /dev/null +++ b/recipes/scnlib/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4": + folder: all diff --git a/recipes/sdl/all/CMakeLists.txt b/recipes/sdl/all/CMakeLists.txt new file mode 100644 index 0000000000000..54ee569370cf9 --- /dev/null +++ b/recipes/sdl/all/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 2.8.12) +project(cmake_wrapper) + +include(${CONAN_INSTALL_FOLDER}/conanbuildinfo.cmake) +conan_basic_setup() + +if(UNIX AND NOT APPLE) + if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) + add_definitions("-DGBM_BO_USE_CURSOR=2") + endif() + endif() +endif() + +add_subdirectory(source_subfolder) diff --git a/recipes/sdl/all/conandata.yml b/recipes/sdl/all/conandata.yml new file mode 100644 index 0000000000000..225d21e84ef17 --- /dev/null +++ b/recipes/sdl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.0.14": + url: "https://www.libsdl.org/release/SDL2-2.0.14.tar.gz" + sha256: d8215b571a581be1332d2106f8036fcb03d12a70bae01e20f424976d275432bc diff --git a/recipes/sdl/all/conanfile.py b/recipes/sdl/all/conanfile.py new file mode 100644 index 0000000000000..0c3a921ac814a --- /dev/null +++ b/recipes/sdl/all/conanfile.py @@ -0,0 +1,318 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class SDLConan(ConanFile): + name = "sdl" + description = "Access to audio, keyboard, mouse, joystick, and graphics hardware via OpenGL, Direct3D and Vulkan" + topics = ("sdl2", "audio", "keyboard", "graphics", "opengl") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.libsdl.org" + license = "Zlib" + exports_sources = ["CMakeLists.txt", "patches/*"] + generators = ["cmake", "pkg_config"] + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "directx": [True, False], + "alsa": [True, False], + "jack": [True, False], + "pulse": [True, False], + "sndio": [True, False], + "nas": [True, False], + "esd": [True, False], + "arts": [True, False], + "x11": [True, False], + "xcursor": [True, False], + "xinerama": [True, False], + "xinput": [True, False], + "xrandr": [True, False], + "xscrnsaver": [True, False], + "xshape": [True, False], + "xvm": [True, False], + "wayland": [True, False], + "directfb": [True, False], + "iconv": [True, False], + "video_rpi": [True, False], + "sdl2main": [True, False], + "opengl": [True, False], + "opengles": [True, False], + "vulkan": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "directx": True, + "alsa": True, + "jack": True, + "pulse": True, + "sndio": False, + "nas": True, + "esd": False, + "arts": False, + "x11": True, + "xcursor": True, + "xinerama": True, + "xinput": True, + "xrandr": True, + "xscrnsaver": True, + "xshape": True, + "xvm": True, + "wayland": False, + "directfb": False, + "iconv": True, + "video_rpi": False, + "sdl2main": True, + "opengl": True, + "opengles": True, + "vulkan": True + } + + _source_subfolder = "source_subfolder" + _build_subfolder = "build_subfolder" + _cmake = None + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.compiler == "Visual Studio": + del self.options.iconv + if self.settings.os != "Linux": + del self.options.alsa + del self.options.jack + del self.options.pulse + del self.options.sndio + del self.options.nas + del self.options.esd + del self.options.arts + del self.options.x11 + del self.options.xcursor + del self.options.xinerama + del self.options.xinput + del self.options.xrandr + del self.options.xscrnsaver + del self.options.xshape + del self.options.xvm + del self.options.wayland + del self.options.directfb + del self.options.video_rpi + if self.settings.os != "Windows": + del self.options.directx + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + if self.settings.os == "Macos" and not self.options.iconv: + raise ConanInvalidConfiguration("On macOS iconv can't be disabled") + if self.settings.os == "Linux": + raise ConanInvalidConfiguration("Linux not supported yet") + + def requirements(self): + if self.options.get_safe("iconv", False): + self.requires("libiconv/1.16") + if self.settings.os == "Linux": + self.requires("xorg/system") + if self.options.alsa: + self.requires("libalsa/1.2.4") + if self.options.pulse: + self.requires("pulseaudio/13.0") + if self.options.opengl: + self.requires("opengl/system") + + def package_id(self): + del self.info.options.sdl2main + + def build_requirements(self): + if self.settings.os == "Linux": + self.build_requires("pkgconf/1.7.3") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + + # ensure sdl2-config is created for MinGW + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "if(NOT WINDOWS OR CYGWIN)", + "if(NOT WINDOWS OR CYGWIN OR MINGW)") + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "if(NOT (WINDOWS OR CYGWIN))", + "if(NOT (WINDOWS OR CYGWIN OR MINGW))") + if self.version >= "2.0.14": + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + 'check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)', + '# check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)') + self._build_cmake() + + def _check_pkg_config(self, option, package_name): + if option: + pkg_config = tools.PkgConfig(package_name) + if not pkg_config.provides: + raise ConanInvalidConfiguration("package %s is not available" % package_name) + + def _check_dependencies(self): + if self.settings.os == "Linux": + self._check_pkg_config(self.options.jack, "jack") + self._check_pkg_config(self.options.esd, "esound") + self._check_pkg_config(self.options.wayland, "wayland-client") + self._check_pkg_config(self.options.wayland, "wayland-protocols") + self._check_pkg_config(self.options.directfb, "directfb") + + def validate(self): + self._check_dependencies() + + def _configure_cmake(self): + if not self._cmake: + self._cmake = CMake(self) + # FIXME: self.install_folder not defined? Neccessary? + self._cmake.definitions["CONAN_INSTALL_FOLDER"] = self.install_folder + if self.settings.os != "Windows": + if not self.options.shared: + self._cmake.definitions["SDL_STATIC_PIC"] = self.options.fPIC + if self.settings.compiler == "Visual Studio" and not self.options.shared: + self._cmake.definitions["HAVE_LIBC"] = True + self._cmake.definitions["SDL_SHARED"] = self.options.shared + self._cmake.definitions["SDL_STATIC"] = not self.options.shared + self._cmake.definitions["VIDEO_OPENGL"] = self.options.opengl + self._cmake.definitions["VIDEO_OPENGLES"] = self.options.opengles + self._cmake.definitions["VIDEO_VULKAN"] = self.options.vulkan + if self.settings.os == "Linux": + # See https://github.com/bincrafters/community/issues/696 + self._cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + + self._cmake.definitions["ALSA"] = self.options.alsa + if self.options.alsa: + self._cmake.definitions["HAVE_ASOUNDLIB_H"] = True + self._cmake.definitions["HAVE_LIBASOUND"] = True + self._cmake.definitions["JACK"] = self.options.jack + self._cmake.definitions["PULSEAUDIO"] = self.options.pulse + self._cmake.definitions["SNDIO"] = self.options.sndio + self._cmake.definitions["NAS"] = self.options.nas + self._cmake.definitions["VIDEO_X11"] = self.options.x11 + if self.options.x11: + self._cmake.definitions["HAVE_XEXT_H"] = True + self._cmake.definitions["VIDEO_X11_XCURSOR"] = self.options.xcursor + if self.options.xcursor: + self._cmake.definitions["HAVE_XCURSOR_H"] = True + self._cmake.definitions["VIDEO_X11_XINERAMA"] = self.options.xinerama + if self.options.xinerama: + self._cmake.definitions["HAVE_XINERAMA_H"] = True + self._cmake.definitions["VIDEO_X11_XINPUT"] = self.options.xinput + if self.options.xinput: + self._cmake.definitions["HAVE_XINPUT_H"] = True + self._cmake.definitions["VIDEO_X11_XRANDR"] = self.options.xrandr + if self.options.xrandr: + self._cmake.definitions["HAVE_XRANDR_H"] = True + self._cmake.definitions["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver + if self.options.xscrnsaver: + self._cmake.definitions["HAVE_XSS_H"] = True + self._cmake.definitions["VIDEO_X11_XSHAPE"] = self.options.xshape + if self.options.xshape: + self._cmake.definitions["HAVE_XSHAPE_H"] = True + self._cmake.definitions["VIDEO_X11_XVM"] = self.options.xvm + if self.options.xvm: + self._cmake.definitions["HAVE_XF86VM_H"] = True + self._cmake.definitions["VIDEO_WAYLAND"] = self.options.wayland + self._cmake.definitions["VIDEO_DIRECTFB"] = self.options.directfb + self._cmake.definitions["VIDEO_RPI"] = self.options.video_rpi + elif self.settings.os == "Windows": + self._cmake.definitions["DIRECTX"] = self.options.directx + + self._cmake.configure(build_dir=self._build_subfolder) + return self._cmake + + def _build_cmake(self): + if self.settings.os == "Linux": + if self.options.pulse: + tools.rename("libpulse.pc", "libpulse-simple.pc") + lib_paths = [lib for dep in self.deps_cpp_info.deps for lib in self.deps_cpp_info[dep].lib_paths] + with tools.environment_append({"LIBRARY_PATH": os.pathsep.join(lib_paths)}): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy(pattern="COPYING.txt", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "sdl2-config") + tools.rmdir(os.path.join(self.package_folder, "cmake")) + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "libdata")) + tools.rmdir(os.path.join(self.package_folder, "share")) + + def _add_libraries_from_pc(self, library, static=None): + if static is None: + static = not self.options.shared + pkg_config = tools.PkgConfig(library, static=static) + libs = [lib[2:] for lib in pkg_config.libs_only_l] # cut -l prefix + lib_paths = [lib[2:] for lib in pkg_config.libs_only_L] # cut -L prefix + self.cpp_info.components["libsdl2"].libs.extend(libs) + self.cpp_info.components["libsdl2"].libdirs.extend(lib_paths) + self.cpp_info.components["libsdl2"].sharedlinkflags.extend(pkg_config.libs_only_other) + self.cpp_info.components["libsdl2"].exelinkflags.extend(pkg_config.libs_only_other) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "SDL2" + self.cpp_info.names["cmake_find_package_multi"] = "SDL2" + + postfix = "d" if self.settings.build_type == "Debug" else "" + # SDL2 + sdl2_cmake_target = "SDL2" if self.options.shared else "SDL2-static" + self.cpp_info.components["libsdl2"].names["cmake_find_package"] = sdl2_cmake_target + self.cpp_info.components["libsdl2"].names["cmake_find_package_multi"] = sdl2_cmake_target + self.cpp_info.components["libsdl2"].includedirs.append(os.path.join("include", "SDL2")) + self.cpp_info.components["libsdl2"].libs = ["SDL2" + postfix] + if self.options.get_safe("iconv", False): + self.cpp_info.components["libsdl2"].requires.append("libiconv::libiconv") + if self.settings.os == "Linux": + self.cpp_info.components["libsdl2"].system_libs = ["dl", "rt", "pthread"] + self.cpp_info.components["libsdl2"].requires.append("xorg::xorg") + if self.options.alsa: + self.cpp_info.components["libsdl2"].requires.append("libalsa::libalsa") + if self.options.pulse: + self.cpp_info.components["libsdl2"].requires.append("pulseaudio::pulseaudio") + if self.options.opengl: + self.cpp_info.components["libsdl2"].requires.append("opengl::opengl") + if self.options.jack: + self._add_libraries_from_pc("jack") + if self.options.sndio: + self._add_libraries_from_pc("sndio") + if self.options.nas: + self.cpp_info.components["libsdl2"].libs.append("audio") + if self.options.esd: + self._add_libraries_from_pc("esound") + if self.options.directfb: + self._add_libraries_from_pc("directfb") + if self.options.video_rpi: + self.cpp_info.components["libsdl2"].libs.append("bcm_host") + self.cpp_info.components["libsdl2"].includedirs.extend([ + "/opt/vc/include", + "/opt/vc/include/interface/vcos/pthreads", + "/opt/vc/include/interface/vmcs_host/linux" + ]) + self.cpp_info.components["libsdl2"].libdirs.append("/opt/vc/lib") + self.cpp_info.components["libsdl2"].sharedlinkflags.append("-Wl,-rpath,/opt/vc/lib") + self.cpp_info.components["libsdl2"].exelinkflags.append("-Wl,-rpath,/opt/vc/lib") + elif self.settings.os == "Macos": + self.cpp_info.components["libsdl2"].frameworks = ["Cocoa", "Carbon", "IOKit", "CoreVideo", "CoreAudio", "AudioToolbox", "ForceFeedback"] + if tools.Version(self.version) >= "2.0.14": + self.cpp_info.components["libsdl2"].frameworks.append("Metal") + elif self.settings.os == "Windows": + self.cpp_info.components["libsdl2"].system_libs = ["user32", "gdi32", "winmm", "imm32", "ole32", "oleaut32", "version", "uuid", "advapi32", "setupapi", "shell32"] + if self.settings.compiler == "gcc": + self.cpp_info.components["libsdl2"].system_libs.append("mingw32") + # SDL2main + if self.options.sdl2main: + self.cpp_info.components["sdl2main"].names["cmake_find_package"] = "SDL2main" + self.cpp_info.components["sdl2main"].names["cmake_find_package_multi"] = "SDL2main" + self.cpp_info.components["sdl2main"].libs = ["SDL2main" + postfix] + self.cpp_info.components["sdl2main"].requires = ["libsdl2"] diff --git a/recipes/sdl/all/test_package/CMakeLists.txt b/recipes/sdl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9a7af977eb114 --- /dev/null +++ b/recipes/sdl/all/test_package/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(SDL2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +if(SDL2_SHARED) + target_link_libraries(${PROJECT_NAME} SDL2::SDL2main SDL2::SDL2) +else() + target_link_libraries(${PROJECT_NAME} SDL2::SDL2main SDL2::SDL2-static) +endif() + +function(add_option option) + if(${option}) + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "${option}") + endif() +endfunction() + +add_option(WITH_X11) +add_option(WITH_ALSA) +add_option(WITH_PULSE) +add_option(WITH_ESD) +add_option(WITH_ARTS) +add_option(WITH_DIRECTFB) +add_option(WITH_DIRECTX) diff --git a/recipes/sdl/all/test_package/conanfile.py b/recipes/sdl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..614945c3a0ac8 --- /dev/null +++ b/recipes/sdl/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conans import ConanFile, CMake, tools, RunEnvironment +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + self.build_cmake() + + def build_cmake(self): + cmake = CMake(self) + cmake.definitions["SDL2_SHARED"] = self.options["sdl"].shared + if self.settings.os == "Linux": + cmake.definitions["WITH_X11"] = self.options["sdl"].x11 + cmake.definitions["WITH_ALSA"] = self.options["sdl"].alsa + cmake.definitions["WITH_PULSE"] = self.options["sdl"].pulse + cmake.definitions["WITH_ESD"] = self.options["sdl"].esd + cmake.definitions["WITH_ARTS"] = self.options["sdl"].arts + cmake.definitions["WITH_DIRECTFB"] = self.options["sdl"].directfb + if self.settings.os == "Windows": + cmake.definitions["WITH_DIRECTX"] = self.options["sdl"].directx + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sdl/all/test_package/test_package.cpp b/recipes/sdl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..62a211f91d303 --- /dev/null +++ b/recipes/sdl/all/test_package/test_package.cpp @@ -0,0 +1,81 @@ +#include +#include +#include +#include +#include +#include + +static void throw_exception(const char * message, const char * name) +{ + std::stringstream s; + s << message << " - " << name; + throw std::runtime_error(s.str().c_str()); +} + +static void check_audio_driver(const char * name) +{ + std::cout << "checking for audio driver " << name << " ... "; + bool found = false; + int count = SDL_GetNumAudioDrivers(); + for (int i = 0; i < count; ++i) { + if (0 == strcmp(name, SDL_GetAudioDriver(i))) { + found = true; + break; + } + } + if (!found) + throw_exception("audio driver wasn't found", name); + std::cout << "OK!" << std::endl; +} + +static void check_video_driver(const char * name) +{ + std::cout << "checking for video driver " << name << " ... "; + bool found = false; + int count = SDL_GetNumVideoDrivers(); + for (int i = 0; i < count; ++i) { + if (0 == strcmp(name, SDL_GetVideoDriver(i))) { + found = true; + break; + } + } + if (!found) + throw_exception("video driver wasn't found", name); + std::cout << "OK!" << std::endl; +} + + +int main(int argc, char *argv[]) try +{ + SDL_version v; + SDL_GetVersion(&v); + std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; +#ifdef WITH_X11 + check_video_driver("x11"); +#endif +#ifdef WITH_ALSA + check_audio_driver("alsa"); +#endif +#ifdef WITH_PULSE + check_audio_driver("pulseaudio"); +#endif +#ifdef WITH_ESD + check_audio_driver("esd"); +#endif +#ifdef WITH_ARTS + check_audio_driver("arts"); +#endif +#ifdef WITH_DIRECTFB + check_video_driver("directfb"); +#endif +#ifdef WITH_DIRECTX + check_audio_driver("directsound"); +#endif + return EXIT_SUCCESS; +} +catch (std::runtime_error & e) +{ + std::cout << "FAIL!" << std::endl; + std::cerr << e.what() << std::endl; + return EXIT_FAILURE; +} diff --git a/recipes/sdl/config.yml b/recipes/sdl/config.yml new file mode 100644 index 0000000000000..819ebd6fb8395 --- /dev/null +++ b/recipes/sdl/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.14": + folder: all diff --git a/recipes/serf/all/conandata.yml b/recipes/serf/all/conandata.yml index 540d0d0d109e0..23c5beea465b7 100644 --- a/recipes/serf/all/conandata.yml +++ b/recipes/serf/all/conandata.yml @@ -13,3 +13,5 @@ patches: base_path: "source_subfolder" - patch_file: "patches/0003-1.3.9-scons-msvc.patch" base_path: "source_subfolder" + - patch_file: "patches/0004-1.3.9-scons-python-spaces.patch" + base_path: "source_subfolder" diff --git a/recipes/serf/all/patches/0004-1.3.9-scons-python-spaces.patch b/recipes/serf/all/patches/0004-1.3.9-scons-python-spaces.patch new file mode 100644 index 0000000000000..ea3344e6a98ac --- /dev/null +++ b/recipes/serf/all/patches/0004-1.3.9-scons-python-spaces.patch @@ -0,0 +1,17 @@ +conan-center-index/recipes/apr/all/patches/0004-1.3.9-scons-python-spaces.patch + +This corrects build failure if python is in a path with spaces, +e.g. the default system-wide C:\Program Files\Python39 + +The patch is a cherry-pick from upstream r1809132 +--- SConstruct.orig 2021-04-21 11:31:44.866021500 -0500 ++++ SConstruct 2021-04-21 11:50:22.148062300 -0500 +@@ -159,7 +159,7 @@ + + env.Append(BUILDERS = { + 'GenDef' : +- Builder(action = sys.executable + ' build/gen_def.py $SOURCES > $TARGET', ++ Builder(action = '"%s" build/gen_def.py $SOURCES > $TARGET' % (sys.executable,), + suffix='.def', src_suffix='.h') + }) + diff --git a/recipes/sml/all/conandata.yml b/recipes/sml/all/conandata.yml index dd41d93202df6..02120efcecbb0 100644 --- a/recipes/sml/all/conandata.yml +++ b/recipes/sml/all/conandata.yml @@ -2,3 +2,7 @@ sources: "1.1.4": url: https://github.com/boost-ext/sml/archive/v1.1.4.tar.gz sha256: 897c78077f5a4d22b0de253b8689a8ea6d8adfba8d7b4877d6f5c76277e00976 +patches: + "1.1.4": + - patch_file: "patches/0001-fix-clang12-error.patch" + base_path: "source_subfolder" diff --git a/recipes/sml/all/conanfile.py b/recipes/sml/all/conanfile.py index 930ca1fafc026..a6adafa82d656 100644 --- a/recipes/sml/all/conanfile.py +++ b/recipes/sml/all/conanfile.py @@ -12,37 +12,45 @@ class SMLConan(ConanFile): license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" settings = "compiler" - no_copy_source = True + exports_sources = "patches/*" @property def _source_subfolder(self): return "source_subfolder" - @property - def _minimum_compilers_version(self): + @property + def _minimum_compilers_version(self): return { - "Visual Studio": "15", - "gcc": "5", - "clang": "5", - "apple-clang": "5.1", - } + "Visual Studio": "15", + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + } + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + strip_root=True, destination=self._source_subfolder) def configure(self): - if self.settings.compiler.cppstd: + if self.settings.compiler.cppstd: check_min_cppstd(self, "14") - minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("SML requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("SML requires C++14, which your compiler does not support.") - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "sml-" + self.version - os.rename(extracted_dir, self._source_subfolder) + minimum_version = self._minimum_compilers_version.get( + str(self.settings.compiler), False) + if not minimum_version: + self.output.warn( + "SML requires C++14. Your compiler is unknown. Assuming it supports C++14.") + elif tools.Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + "SML requires C++14, which your compiler does not support.") + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + # tools.patch(patch_file="patches/0001-fix-clang12-error.patch") def package(self): - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + self.copy(pattern="*", dst="include", + src=os.path.join(self._source_subfolder, "include")) self.copy("*LICENSE.md", dst="licenses", keep_path=False) def package_id(self): diff --git a/recipes/sml/all/patches/0001-fix-clang12-error.patch b/recipes/sml/all/patches/0001-fix-clang12-error.patch new file mode 100644 index 0000000000000..df7761176a44b --- /dev/null +++ b/recipes/sml/all/patches/0001-fix-clang12-error.patch @@ -0,0 +1,14 @@ +diff --git a/sml-1.1.4/include/boost/ b/sml-1.1.4/include/boost/ +index b75b41f..a4e6430 100644 + +--- a/include/boost/sml.hpp ++++ b/include/boost/sml.hpp +@@ -549,6 +549,8 @@ template + const char *get_type_name() { + #if defined(_MSC_VER) && !defined(__clang__) + return detail::get_type_name(__FUNCSIG__, make_index_sequence{}); ++#elif defined(__clang__) && __clang_major__ >= 12 ++ return detail::get_type_name(__PRETTY_FUNCTION__, make_index_sequence{}); + #elif defined(__clang__) + return detail::get_type_name(__PRETTY_FUNCTION__, make_index_sequence{}); + #elif defined(__GNUC__) diff --git a/recipes/spscqueue/all/conandata.yml b/recipes/spscqueue/all/conandata.yml new file mode 100644 index 0000000000000..38a339ea59d52 --- /dev/null +++ b/recipes/spscqueue/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/rigtorp/SPSCQueue/archive/refs/tags/v1.0.tar.gz" + sha256: "ac7f88cc7716bb95810e1d5dfac627363cba24c685acfb35261dae13288a48ff" diff --git a/recipes/spscqueue/all/conanfile.py b/recipes/spscqueue/all/conanfile.py new file mode 100644 index 0000000000000..73d84bb580b7c --- /dev/null +++ b/recipes/spscqueue/all/conanfile.py @@ -0,0 +1,41 @@ +from conans import ConanFile, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class SpscqueueConan(ConanFile): + name = "spscqueue" + description = "A bounded single-producer single-consumer wait-free and lock-free queue written in C++11." + license = "MIT" + topics = ("spscqueue", "thread", "queue") + homepage = "https://github.com/rigtorp/SPSCQueue" + url = "https://github.com/conan-io/conan-center-index" + settings = "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("gcc < 5 not supported") + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "SPSCQueue" + self.cpp_info.names["cmake_find_package_multi"] = "SPSCQueue" diff --git a/recipes/spscqueue/all/test_package/CMakeLists.txt b/recipes/spscqueue/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..129391e42efa9 --- /dev/null +++ b/recipes/spscqueue/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(SPSCQueue REQUIRED CONFIG) +find_package(Threads REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} SPSCQueue::SPSCQueue Threads::Threads) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/spscqueue/all/test_package/conanfile.py b/recipes/spscqueue/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/spscqueue/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/spscqueue/all/test_package/test_package.cpp b/recipes/spscqueue/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..461eb0e7eff27 --- /dev/null +++ b/recipes/spscqueue/all/test_package/test_package.cpp @@ -0,0 +1,19 @@ +#include + +#include +#include + +int main() { + rigtorp::SPSCQueue q(2); + + auto t = std::thread([&] { + while (!q.front()); + std::cout << *q.front() << std::endl; + q.pop(); + }); + + q.push(1); + t.join(); + + return 0; +} diff --git a/recipes/spscqueue/config.yml b/recipes/spscqueue/config.yml new file mode 100644 index 0000000000000..edab1ee152d36 --- /dev/null +++ b/recipes/spscqueue/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all diff --git a/recipes/szip/all/conanfile.py b/recipes/szip/all/conanfile.py index 28cdabd6dae81..29d894884262e 100644 --- a/recipes/szip/all/conanfile.py +++ b/recipes/szip/all/conanfile.py @@ -1,7 +1,9 @@ import os - from conans import ConanFile, CMake, tools +required_conan_version = ">=1.33.0" + + class SzipConan(ConanFile): name = "szip" description = "C Implementation of the extended-Rice lossless compression " \ @@ -39,15 +41,16 @@ def config_options(self): del self.options.fPIC def configure(self): + if self.options.shared: + del self.options.fPIC del self.settings.compiler.libcxx del self.settings.compiler.cppstd def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def build(self): - for patch in self.conan_data["patches"][self.version]: + for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") @@ -72,7 +75,6 @@ def package(self): cmake.install() def package_info(self): + self.cpp_info.libs = tools.collect_libs(self) self.cpp_info.names["cmake_find_package"] = "SZIP" self.cpp_info.names["cmake_find_package_multi"] = "SZIP" - - self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/thrift/all/conandata.yml b/recipes/thrift/all/conandata.yml index 48490e3bdc886..cb4c33cda2681 100644 --- a/recipes/thrift/all/conandata.yml +++ b/recipes/thrift/all/conandata.yml @@ -5,6 +5,9 @@ sources: "0.14.1": sha256: 5AE1C4D16452A22EAF9D802BA7489907147C2B316FF38C9758918552FAE5132C url: https://github.com/apache/thrift/archive/refs/tags/v0.14.1.tar.gz + "0.14.2": + url: "https://github.com/apache/thrift/archive/v0.14.2.tar.gz" + sha256: "f966cdac6bb8d149a9950a761e6ee6f3b22d5a6073da43a333d3468f159ebeaa" patches: "0.13.0": - patch_file: "patches/cmake-0.13.0.patch" @@ -12,3 +15,6 @@ patches: "0.14.1": - patch_file: "patches/cmake-0.14.1.patch" base_path: "source_subfolder" + "0.14.2": + - patch_file: "patches/cmake-0.14.1.patch" + base_path: "source_subfolder" diff --git a/recipes/thrift/config.yml b/recipes/thrift/config.yml index e6ab3afa791c5..4c596b16fcf42 100644 --- a/recipes/thrift/config.yml +++ b/recipes/thrift/config.yml @@ -3,3 +3,5 @@ versions: folder: all "0.14.1": folder: all + "0.14.2": + folder: all diff --git a/recipes/tiny-bignum-c/all/CMakeLists.txt b/recipes/tiny-bignum-c/all/CMakeLists.txt new file mode 100644 index 0000000000000..3b95272b16ee7 --- /dev/null +++ b/recipes/tiny-bignum-c/all/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.4) +project(tiny-bignum-c C) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_library(${PROJECT_NAME} source_subfolder/bn.c) +set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +install(FILES source_subfolder/bn.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/tiny-bignum-c/all/conandata.yml b/recipes/tiny-bignum-c/all/conandata.yml new file mode 100644 index 0000000000000..18f9bae3b2ab8 --- /dev/null +++ b/recipes/tiny-bignum-c/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20200203": + url: "https://github.com/kokke/tiny-bignum-c/archive/cb8b53925ae79e5fb8f6a2f21b371fb2c3c8e7ec.tar.gz" + sha256: "932ff413b78cb25d49c86220dce7017198cfbb4fc85f658709d39e3706f3c478" diff --git a/recipes/tiny-bignum-c/all/conanfile.py b/recipes/tiny-bignum-c/all/conanfile.py new file mode 100644 index 0000000000000..2221185ba1d11 --- /dev/null +++ b/recipes/tiny-bignum-c/all/conanfile.py @@ -0,0 +1,63 @@ +from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.33.0" + + +class TinybignumcConan(ConanFile): + name = "tiny-bignum-c" + description = "Small portable multiple-precision unsigned integer arithmetic in C." + license = "Unlicense" + topics = ("tiny-bignum-c", "bignum", "arbitrary-precision", "multi-precision") + homepage = "https://github.com/kokke/tiny-bignum-c" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["tiny-bignum-c"] diff --git a/recipes/tiny-bignum-c/all/test_package/CMakeLists.txt b/recipes/tiny-bignum-c/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b9b613cbb24a --- /dev/null +++ b/recipes/tiny-bignum-c/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/tiny-bignum-c/all/test_package/conanfile.py b/recipes/tiny-bignum-c/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/tiny-bignum-c/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tiny-bignum-c/all/test_package/test_package.c b/recipes/tiny-bignum-c/all/test_package/test_package.c new file mode 100644 index 0000000000000..be32d2b25a2f5 --- /dev/null +++ b/recipes/tiny-bignum-c/all/test_package/test_package.c @@ -0,0 +1,31 @@ +#include + +#include + +void factorial(struct bn* n, struct bn* res) { + struct bn tmp; + + bignum_assign(&tmp, n); + bignum_dec(n); + + while (!bignum_is_zero(n)) { + bignum_mul(&tmp, n, res); + bignum_dec(n); + bignum_assign(&tmp, res); + } + + bignum_assign(res, &tmp); +} + +int main(void) { + struct bn num; + struct bn result; + char buf[8192]; + + bignum_from_int(&num, 100); + factorial(&num, &result); + bignum_to_string(&result, buf, sizeof(buf)); + printf("factorial(100) using bignum = %s\n", buf); + + return 0; +} diff --git a/recipes/tiny-bignum-c/config.yml b/recipes/tiny-bignum-c/config.yml new file mode 100644 index 0000000000000..10b93e6c20db8 --- /dev/null +++ b/recipes/tiny-bignum-c/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20200203": + folder: all diff --git a/recipes/tiny-utf8/all/conandata.yml b/recipes/tiny-utf8/all/conandata.yml new file mode 100644 index 0000000000000..c9806c8a7d557 --- /dev/null +++ b/recipes/tiny-utf8/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.3.2": + url: "https://github.com/DuffsDevice/tiny-utf8/archive/refs/tags/v4.3.2.tar.gz" + sha256: "3c4545e2f06052ee05c614e4ad365adaa28ae2edf5902ffc9c1eb2ecce0d3338" diff --git a/recipes/tiny-utf8/all/conanfile.py b/recipes/tiny-utf8/all/conanfile.py new file mode 100644 index 0000000000000..ec98309c7d165 --- /dev/null +++ b/recipes/tiny-utf8/all/conanfile.py @@ -0,0 +1,38 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.33.0" + + +class Tinyutf8Conan(ConanFile): + name = "tiny-utf8" + description = "Tiny-utf8 is a library for extremely easy integration of Unicode into an arbitrary C++11 project." + license = "BSD-3-Clause" + topics = ("tiny-utf8", "utf8") + homepage = "https://github.com/DuffsDevice/tiny-utf8" + url = "https://github.com/conan-io/conan-center-index" + settings = "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENCE", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "tinyutf8" + self.cpp_info.names["cmake_find_package_multi"] = "tinyutf8" diff --git a/recipes/tiny-utf8/all/test_package/CMakeLists.txt b/recipes/tiny-utf8/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..192805961b302 --- /dev/null +++ b/recipes/tiny-utf8/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tinyutf8 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} tinyutf8::tinyutf8) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/tiny-utf8/all/test_package/conanfile.py b/recipes/tiny-utf8/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/tiny-utf8/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tiny-utf8/all/test_package/test_package.cpp b/recipes/tiny-utf8/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a208623001dc6 --- /dev/null +++ b/recipes/tiny-utf8/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include + +#include +#include + +int main() { + tiny_utf8::string str = u8"!🌍 olleH"; + std::for_each(str.rbegin(), str.rend(), [](char32_t codepoint) { + std::cout << codepoint; + }); + + return 0; +} diff --git a/recipes/tiny-utf8/config.yml b/recipes/tiny-utf8/config.yml new file mode 100644 index 0000000000000..ef8763e534823 --- /dev/null +++ b/recipes/tiny-utf8/config.yml @@ -0,0 +1,3 @@ +versions: + "4.3.2": + folder: all diff --git a/recipes/tl-function-ref/all/conandata.yml b/recipes/tl-function-ref/all/conandata.yml new file mode 100644 index 0000000000000..ceb2b7df89a38 --- /dev/null +++ b/recipes/tl-function-ref/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.0": + url: "https://github.com/TartanLlama/function_ref/archive/refs/tags/v1.0.0.tar.gz" + sha256: "6e374c40c40d3978cfcdd4ef9ed1417627898f37ffb306970f86e339644ed3ca" diff --git a/recipes/tl-function-ref/all/conanfile.py b/recipes/tl-function-ref/all/conanfile.py new file mode 100644 index 0000000000000..16538c87ac487 --- /dev/null +++ b/recipes/tl-function-ref/all/conanfile.py @@ -0,0 +1,42 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.33.0" + + +class TlfunctionrefConan(ConanFile): + name = "tl-function-ref" + description = "A lightweight, non-owning reference to a callable." + license = "CC0-1.0" + topics = ("function_ref", "callable") + homepage = "https://github.com/TartanLlama/function_ref" + url = "https://github.com/conan-io/conan-center-index" + settings = "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 14) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("COPYING", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + + def package_info(self): + self.cpp_info.filenames["cmake_find_package"] = "tl-function-ref" + self.cpp_info.filenames["cmake_find_package_multi"] = "tl-function-ref" + self.cpp_info.names["cmake_find_package"] = "tl" + self.cpp_info.names["cmake_find_package_multi"] = "tl" + self.cpp_info.components["function-ref"].names["cmake_find_package"] = "function-ref" + self.cpp_info.components["function-ref"].names["cmake_find_package_multi"] = "function-ref" diff --git a/recipes/tl-function-ref/all/test_package/CMakeLists.txt b/recipes/tl-function-ref/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3fd164db73e95 --- /dev/null +++ b/recipes/tl-function-ref/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tl-function-ref REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} tl::function-ref) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/tl-function-ref/all/test_package/conanfile.py b/recipes/tl-function-ref/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/tl-function-ref/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tl-function-ref/all/test_package/test_package.cpp b/recipes/tl-function-ref/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b9838debdaceb --- /dev/null +++ b/recipes/tl-function-ref/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include + +#include + +bool f_called = false; +void f() { + f_called = true; +} + +int main() { + std::cout << f_called << std::endl; + tl::function_ref fr = f; + fr(); + std::cout << f_called << std::endl; + + return 0; +} diff --git a/recipes/tl-function-ref/config.yml b/recipes/tl-function-ref/config.yml new file mode 100644 index 0000000000000..40341aa3db6cd --- /dev/null +++ b/recipes/tl-function-ref/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.0": + folder: all diff --git a/recipes/tlx/all/CMakeLists.txt b/recipes/tlx/all/CMakeLists.txt new file mode 100644 index 0000000000000..af7cd55f3e626 --- /dev/null +++ b/recipes/tlx/all/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.4) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + +add_subdirectory(source_subfolder) diff --git a/recipes/tlx/all/conandata.yml b/recipes/tlx/all/conandata.yml new file mode 100644 index 0000000000000..e414bf345ca6b --- /dev/null +++ b/recipes/tlx/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "0.5.20200222": + url: "https://github.com/tlx/tlx/archive/refs/tags/v0.5.20200222.tar.gz" + sha256: "99e63691af3ada066682243f3a65cd6eb32700071cdd6cfedb18777b5ff5ff4d" +patches: + "0.5.20200222": + - patch_file: "patches/0001-fix-dll-install.patch" + base_path: "source_subfolder" + - patch_file: "patches/0002-fix-shared-apple.patch" + base_path: "source_subfolder" diff --git a/recipes/tlx/all/conanfile.py b/recipes/tlx/all/conanfile.py new file mode 100644 index 0000000000000..bc38b1c9087e3 --- /dev/null +++ b/recipes/tlx/all/conanfile.py @@ -0,0 +1,119 @@ +from conans import ConanFile, CMake, tools +import os +import textwrap + +required_conan_version = ">=1.33.0" + + +class TlxConan(ConanFile): + name = "tlx" + description = "tlx is a collection of C++ helpers and extensions " \ + "universally needed, but not found in the STL." + license = "BSL-1.0" + topics = ("tlx", "data-structure", "algorithm") + homepage = "https://github.com/tlx/tlx" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt", "patches/**" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + # Do not force PIC + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "-fPIC", "") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["TLX_BUILD_TESTS"] = False + self._cmake.definitions["TLX_USE_GCOV"] = False + self._cmake.definitions["TLX_TRY_COMPILE_HEADERS"] = False + self._cmake.definitions["TLX_MORE_TESTS"] = False + self._cmake.definitions["TLX_BUILD_STATIC_LIBS"] = not self.options.shared + self._cmake.definitions["TLX_BUILD_SHARED_LIBS"] = self.options.shared + self._cmake.configure() + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "CMake")) + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"tlx": "tlx::tlx"} + ) + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake") + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, + "conan-official-{}-targets.cmake".format(self.name)) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "tlx" + self.cpp_info.names["cmake_find_package_multi"] = "tlx" + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.names["pkg_config"] = "tlx" + self.cpp_info.libs = tools.collect_libs(self) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/tlx/all/patches/0001-fix-dll-install.patch b/recipes/tlx/all/patches/0001-fix-dll-install.patch new file mode 100644 index 0000000000000..ca386c44d7c70 --- /dev/null +++ b/recipes/tlx/all/patches/0001-fix-dll-install.patch @@ -0,0 +1,10 @@ +--- a/tlx/CMakeLists.txt ++++ b/tlx/CMakeLists.txt +@@ -86,6 +86,7 @@ if(TLX_BUILD_SHARED_LIBS) + install(TARGETS tlx + EXPORT tlx-targets + COMPONENT Libraries ++ RUNTIME DESTINATION ${TLX_INSTALL_BIN_DIR} + ARCHIVE DESTINATION ${TLX_INSTALL_LIB_DIR} + LIBRARY DESTINATION ${TLX_INSTALL_LIB_DIR}) + diff --git a/recipes/tlx/all/patches/0002-fix-shared-apple.patch b/recipes/tlx/all/patches/0002-fix-shared-apple.patch new file mode 100644 index 0000000000000..269b9e4754223 --- /dev/null +++ b/recipes/tlx/all/patches/0002-fix-shared-apple.patch @@ -0,0 +1,16 @@ +patch version greater than 1023 in dylib is not allowed on Apple OS + +--- a/tlx/CMakeLists.txt ++++ b/tlx/CMakeLists.txt +@@ -73,8 +73,10 @@ if(TLX_BUILD_SHARED_LIBS) + add_library(tlx SHARED ${LIBTLX_SOURCES}) + set_target_properties(tlx PROPERTIES + OUTPUT_NAME "${TLX_LIBNAME}" +- VERSION "${TLX_VERSION}" + SOVERSION "${TLX_SOVERSION}") ++ if(NOT APPLE) ++ set_target_properties(tlx PROPERTIES VERSION "${TLX_VERSION}") ++ endif() + + target_compile_definitions(tlx PUBLIC ${TLX_DEFINITIONS}) + target_include_directories(tlx PUBLIC diff --git a/recipes/tlx/all/test_package/CMakeLists.txt b/recipes/tlx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..fd91354f6aca4 --- /dev/null +++ b/recipes/tlx/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tlx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} tlx) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/tlx/all/test_package/conanfile.py b/recipes/tlx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/tlx/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tlx/all/test_package/test_package.cpp b/recipes/tlx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a043de0f1f924 --- /dev/null +++ b/recipes/tlx/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + tlx::ThreadPool threadpool; + return 0; +} diff --git a/recipes/tlx/config.yml b/recipes/tlx/config.yml new file mode 100644 index 0000000000000..08dbe5e6d3977 --- /dev/null +++ b/recipes/tlx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.5.20200222": + folder: all diff --git a/recipes/tmx/all/CMakeLists.txt b/recipes/tmx/all/CMakeLists.txt new file mode 100644 index 0000000000000..3e8ca3a66d243 --- /dev/null +++ b/recipes/tmx/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper C) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/tmx/all/conandata.yml b/recipes/tmx/all/conandata.yml new file mode 100644 index 0000000000000..015638445fd3e --- /dev/null +++ b/recipes/tmx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.4.0": + url: "https://github.com/baylej/tmx/archive/refs/tags/tmx_1.4.0.tar.gz" + sha256: "5ab52e72976141260edd1b15ea34e1626c0f4ba9b8d2afe7f4d68b51fc9fedf7" diff --git a/recipes/tmx/all/conanfile.py b/recipes/tmx/all/conanfile.py new file mode 100644 index 0000000000000..93e8e5416d14c --- /dev/null +++ b/recipes/tmx/all/conanfile.py @@ -0,0 +1,118 @@ +from conans import ConanFile, CMake, tools +import os +import textwrap + +required_conan_version = ">=1.33.0" + + +class TmxConan(ConanFile): + name = "tmx" + description = "A portable C library to load tiled maps in your games." + license = "BSD-2-Clause" + topics = ("tmx", "tiled-map", "loader") + homepage = "https://github.com/baylej/tmx" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_zlib": [True, False], + "with_zstd": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_zlib": True, + "with_zstd": False, + } + + exports_sources = "CMakeLists.txt" + generators = "cmake", "cmake_find_package" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def requirements(self): + self.requires("libxml2/2.9.10") + if self.options.with_zlib: + self.requires("zlib/1.2.11") + if self.options.with_zstd: + self.requires("zstd/1.5.0") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + "${CMAKE_BINARY_DIR}", "${CMAKE_CURRENT_BINARY_DIR}") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["WANT_ZLIB"] = self.options.with_zlib + self._cmake.definitions["WANT_ZSTD"] = self.options.with_zstd + if self.options.with_zstd: + self._cmake.definitions["ZSTD_PREFER_STATIC"] = not self.options["zstd"].shared + self._cmake.configure() + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("COPYING", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"tmx": "tmx::tmx"} + ) + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake") + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, + "conan-official-{}-targets.cmake".format(self.name)) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "tmx" + self.cpp_info.names["cmake_find_package_multi"] = "tmx" + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.libs = ["tmx"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines.append("TMXEXPORT=__declspec(dllimport)") diff --git a/recipes/tmx/all/test_package/CMakeLists.txt b/recipes/tmx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8caed204543d3 --- /dev/null +++ b/recipes/tmx/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tmx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} tmx) diff --git a/recipes/tmx/all/test_package/conanfile.py b/recipes/tmx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ba0da7cfd6cbc --- /dev/null +++ b/recipes/tmx/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + tmx_path = os.path.join(self.source_folder, "externtileset.tmx") + self.run("{} {}".format(bin_path, tmx_path), run_environment=True) diff --git a/recipes/tmx/all/test_package/externtileset.tmx b/recipes/tmx/all/test_package/externtileset.tmx new file mode 100644 index 0000000000000..a3c2b466d8f18 --- /dev/null +++ b/recipes/tmx/all/test_package/externtileset.tmx @@ -0,0 +1,60 @@ + + + + + + + + foo +bar +baz + + + + + + + + + + + + + +5,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,5,5, +5,5,3,6,6,3,3,3,1,1,1,1,1,3,1,1,1,1,1,1,3,3,3,4,4,3,1,3, +8,3,3,6,6,6,3,3,3,3,3,3,1,1,1,3,3,3,3,1,1,1,1,4,1,1,1,3, +8,3,3,6,6,6,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,1,3, +8,3,6,6,6,6,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3, +8,3,6,6,3,3,3,3,3,3,3,3,3,3,3,3,3,3,9,9,9,3,3,3,3,3,3,3, +8,3,6,3,3,3,9,9,9,9,9,9,3,3,3,3,9,9,9,3,9,9,3,3,3,3,2,3, +8,3,3,3,9,9,9,3,3,3,3,9,3,3,3,9,9,3,3,3,3,9,9,3,3,3,2,3, +8,3,3,9,9,3,3,3,3,3,3,9,3,3,3,3,3,3,3,3,3,3,9,9,3,3,2,3, +8,3,3,9,9,3,3,7,7,3,3,9,9,3,3,3,3,3,7,7,3,3,3,9,3,3,2,3, +8,3,3,3,9,3,3,7,7,3,3,3,9,9,3,3,3,3,7,7,3,3,3,9,3,3,2,3, +8,3,3,3,9,9,3,3,3,4,4,4,4,4,4,4,3,3,3,3,3,9,3,9,3,3,2,3, +3,3,3,3,3,9,9,3,3,5,5,5,5,5,5,5,3,3,3,3,3,3,3,9,3,3,2,3, +3,3,3,3,3,3,9,9,3,6,6,6,6,6,6,6,9,9,9,9,3,3,3,9,3,3,2,3, +3,3,3,3,3,3,3,9,9,7,7,7,7,7,7,7,3,3,3,3,3,3,9,9,3,3,2,3, +3,3,3,3,3,3,3,3,3,8,8,8,8,8,8,8,3,3,3,3,9,9,9,3,3,3,2,2, +3,5,3,3,3,3,3,3,3,3,3,9,9,9,9,9,9,9,9,9,9,3,3,3,3,3,5,5, +5,5,3,3,3,4,4,4,4,4,4,4,4,4,4,4,4,4,4,3,3,3,3,3,3,3,3,5 + + + + + + + + + + + + + + + + Hello World + + + diff --git a/recipes/tmx/all/test_package/test_package.c b/recipes/tmx/all/test_package/test_package.c new file mode 100644 index 0000000000000..d790b96587936 --- /dev/null +++ b/recipes/tmx/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include + +#include + +int main(int argc, char **argv) { + if (argc < 2) { + fprintf(stderr, "Need at least one argument\n"); + return 1; + } + + tmx_map *map = tmx_load(argv[1]); + if (map == NULL) { + tmx_perror("Cannot load map"); + return 1; + } + tmx_map_free(map); + + return 0; +} diff --git a/recipes/tmx/all/test_package/tileset.tsx b/recipes/tmx/all/test_package/tileset.tsx new file mode 100644 index 0000000000000..bac88d71da58c --- /dev/null +++ b/recipes/tmx/all/test_package/tileset.tsx @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/recipes/tmx/config.yml b/recipes/tmx/config.yml new file mode 100644 index 0000000000000..c957e4bc2d3c7 --- /dev/null +++ b/recipes/tmx/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.0": + folder: all diff --git a/recipes/tmxlite/all/CMakeLists.txt b/recipes/tmxlite/all/CMakeLists.txt new file mode 100644 index 0000000000000..f39f80ce857c2 --- /dev/null +++ b/recipes/tmxlite/all/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +link_libraries(${CONAN_LIBS}) + +add_subdirectory(source_subfolder/tmxlite) diff --git a/recipes/tmxlite/all/conandata.yml b/recipes/tmxlite/all/conandata.yml new file mode 100644 index 0000000000000..33d0e85a50a95 --- /dev/null +++ b/recipes/tmxlite/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "1.3.0": + url: "https://github.com/fallahn/tmxlite/archive/refs/tags/v1.3.0.tar.gz" + sha256: "f5d2abd23d4516168eb82bbe879998ce41cb17768f8cd72f643f394939123efe" +patches: + "1.3.0": + - patch_file: "patches/0001-include-external-pugixml.patch" + base_path: "source_subfolder" diff --git a/recipes/tmxlite/all/conanfile.py b/recipes/tmxlite/all/conanfile.py new file mode 100644 index 0000000000000..38e769ee77b57 --- /dev/null +++ b/recipes/tmxlite/all/conanfile.py @@ -0,0 +1,98 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class TmxliteConan(ConanFile): + name = "tmxlite" + description = "A lightweight C++14 parsing library for tmx map files created with the Tiled map editor." + license = "Zlib" + topics = ("tmxlite", "tmx", "tiled-map", "parser") + homepage = "https://github.com/fallahn/tmxlite" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "rtti": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "rtti": True, + } + + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("miniz/2.1.0") + self.requires("pugixml/1.11") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 14) + if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + raise ConanInvalidConfiguration("gcc < 5 not supported") + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + # unvendor miniz + tools.remove_files_by_mask(os.path.join(self._source_subfolder, "tmxlite", "src"), "miniz*") + tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "src", "CMakeLists.txt"), + "${PROJECT_DIR}/miniz.c", "") + # unvendor pugixml + tools.rmdir(os.path.join(self._source_subfolder, "tmxlite", "src", "detail")) + tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "src", "CMakeLists.txt"), + "${PROJECT_DIR}/detail/pugixml.cpp", "") + # Don't inject -O3 in compile flags + tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "CMakeLists.txt"), + "-O3", "") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.definitions["TMXLITE_STATIC_LIB"] = not self.options.shared + self._cmake.definitions["PROJECT_STATIC_RUNTIME"] = False + self._cmake.definitions["USE_RTTI"] = self.options.rtti + self._cmake.configure() + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = tools.collect_libs(self) + if not self.options.shared: + self.cpp_info.defines.append("TMXLITE_STATIC") + if self.settings.os == "Android": + self.cpp_info.system_libs.append("log", "android") diff --git a/recipes/tmxlite/all/patches/0001-include-external-pugixml.patch b/recipes/tmxlite/all/patches/0001-include-external-pugixml.patch new file mode 100644 index 0000000000000..bf49ae2efe517 --- /dev/null +++ b/recipes/tmxlite/all/patches/0001-include-external-pugixml.patch @@ -0,0 +1,99 @@ +--- a/tmxlite/src/ImageLayer.cpp ++++ b/tmxlite/src/ImageLayer.cpp +@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/LayerGroup.cpp ++++ b/tmxlite/src/LayerGroup.cpp +@@ -24,7 +24,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/Map.cpp ++++ b/tmxlite/src/Map.cpp +@@ -26,7 +26,7 @@ source distribution. + *********************************************************************/ + + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/Object.cpp ++++ b/tmxlite/src/Object.cpp +@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/ObjectGroup.cpp ++++ b/tmxlite/src/ObjectGroup.cpp +@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/ObjectTypes.cpp ++++ b/tmxlite/src/ObjectTypes.cpp +@@ -24,7 +24,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/Property.cpp ++++ b/tmxlite/src/Property.cpp +@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/TileLayer.cpp ++++ b/tmxlite/src/TileLayer.cpp +@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include +--- a/tmxlite/src/Tileset.cpp ++++ b/tmxlite/src/Tileset.cpp +@@ -25,7 +25,7 @@ and must not be misrepresented as being the original software. + source distribution. + *********************************************************************/ + +-#include "detail/pugixml.hpp" ++#include + #include + #include + #include diff --git a/recipes/tmxlite/all/test_package/CMakeLists.txt b/recipes/tmxlite/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3300ff7750277 --- /dev/null +++ b/recipes/tmxlite/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/tmxlite/all/test_package/conanfile.py b/recipes/tmxlite/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/tmxlite/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tmxlite/all/test_package/test_package.cpp b/recipes/tmxlite/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..04e3345277f76 --- /dev/null +++ b/recipes/tmxlite/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + tmx::Object object; + return 0; +} diff --git a/recipes/tmxlite/config.yml b/recipes/tmxlite/config.yml new file mode 100644 index 0000000000000..426a0e4c79e9b --- /dev/null +++ b/recipes/tmxlite/config.yml @@ -0,0 +1,3 @@ +versions: + "1.3.0": + folder: all diff --git a/recipes/transwarp/all/conandata.yml b/recipes/transwarp/all/conandata.yml new file mode 100644 index 0000000000000..36cc840695ad7 --- /dev/null +++ b/recipes/transwarp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.2.2": + url: "https://github.com/bloomen/transwarp/archive/refs/tags/2.2.2.tar.gz" + sha256: "0458aebbcef0d1cf1949cfc1fce6e5aa902226622783f6eb97f7716a711c8b4d" diff --git a/recipes/transwarp/all/conanfile.py b/recipes/transwarp/all/conanfile.py new file mode 100644 index 0000000000000..8dc43532fab61 --- /dev/null +++ b/recipes/transwarp/all/conanfile.py @@ -0,0 +1,38 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.33.0" + + +class TranswarpConan(ConanFile): + name = "transwarp" + description = "A header-only C++ library for task concurrency." + license = "MIT" + topics = ("transwarp", "concurrency", "asynchronous") + homepage = "https://github.com/bloomen/transwarp" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "compiler" + no_copy_source = True + + @property + def _source_subfolder(self): + return "source_subfolder" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) + self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/transwarp/all/test_package/CMakeLists.txt b/recipes/transwarp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a640b0ed63892 --- /dev/null +++ b/recipes/transwarp/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_compile_definitions(${PROJECT_NAME} PRIVATE TRANSWARP_CPP11) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/transwarp/all/test_package/conanfile.py b/recipes/transwarp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/transwarp/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/transwarp/all/test_package/test_package.cpp b/recipes/transwarp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..13632d2df8d3f --- /dev/null +++ b/recipes/transwarp/all/test_package/test_package.cpp @@ -0,0 +1,39 @@ +#include + +#include +#include + +int main() { + double x = 0; + int y = 0; + + auto parent1 = transwarp::make_task( + transwarp::root, + [&x]() { return 13.3 + x; } + )->named("something"); + auto parent2 = transwarp::make_task( + transwarp::root, + [&y]() { return 42 + y; } + )->named("something else"); + auto child = transwarp::make_task( + transwarp::consume, + [](double a, int b) { return a + b; }, + parent1, + parent2 + )->named("adder"); + + transwarp::parallel executor{4}; + + child->schedule_all(executor); + std::cout << "result = " << child->get() << std::endl; + + x += 2.5; + y += 1; + + child->schedule_all(executor); + std::cout << "result = " << child->get() << std::endl; + + std::ofstream{"basic_with_three_tasks.dot"} << transwarp::to_string(child->edges()); + + return 0; +} diff --git a/recipes/transwarp/config.yml b/recipes/transwarp/config.yml new file mode 100644 index 0000000000000..6d6cfc66eae07 --- /dev/null +++ b/recipes/transwarp/config.yml @@ -0,0 +1,3 @@ +versions: + "2.2.2": + folder: all diff --git a/recipes/trompeloeil/all/conandata.yml b/recipes/trompeloeil/all/conandata.yml index 5076de765a8cb..e06829f055006 100644 --- a/recipes/trompeloeil/all/conandata.yml +++ b/recipes/trompeloeil/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "41": + url: "https://github.com/rollbear/trompeloeil/archive/v41.tar.gz" + sha256: "48986b507497f027e4fa1144a08c2d0b6d81fb476fad024956f8104448ca9ad8" "40": url: "https://github.com/rollbear/trompeloeil/archive/v40.tar.gz" sha256: "e13e3649223a358a5a72fa5a8a1c36325b48e4f3d9d2f2277b17d746797e1734" diff --git a/recipes/trompeloeil/config.yml b/recipes/trompeloeil/config.yml index 9f87c10c6183d..a983ca05f2db7 100644 --- a/recipes/trompeloeil/config.yml +++ b/recipes/trompeloeil/config.yml @@ -1,4 +1,6 @@ versions: + "41": + folder: all "40": folder: all "39": diff --git a/recipes/unqlite/all/CMakeLists.txt b/recipes/unqlite/all/CMakeLists.txt new file mode 100644 index 0000000000000..361b35d4c17d9 --- /dev/null +++ b/recipes/unqlite/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/unqlite/all/conandata.yml b/recipes/unqlite/all/conandata.yml new file mode 100644 index 0000000000000..2800a156996fd --- /dev/null +++ b/recipes/unqlite/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.9": + url: "https://github.com/symisc/unqlite/archive/refs/tags/v1.1.9.tar.gz" + sha256: "33d5b5e7b2ca223942e77d31112d2e20512bc507808414451c8a98a7be5e15c0" diff --git a/recipes/unqlite/all/conanfile.py b/recipes/unqlite/all/conanfile.py new file mode 100644 index 0000000000000..f21327ed31d6d --- /dev/null +++ b/recipes/unqlite/all/conanfile.py @@ -0,0 +1,55 @@ +from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.33.0" + + +class UnqliteConan(ConanFile): + name = "unqlite" + description = "An Embedded NoSQL, Transactional Database Engine." + license = "BSD-2-Clause" + topics = ("unqlite", "nosql", "database", "transactional", "storage") + homepage = "https://unqlite.org" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} + + exports_sources = "CMakeLists.txt" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["unqlite"] diff --git a/recipes/unqlite/all/test_package/CMakeLists.txt b/recipes/unqlite/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b9b613cbb24a --- /dev/null +++ b/recipes/unqlite/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/unqlite/all/test_package/conanfile.py b/recipes/unqlite/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/unqlite/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/unqlite/all/test_package/test_package.c b/recipes/unqlite/all/test_package/test_package.c new file mode 100644 index 0000000000000..487c78dbd5f89 --- /dev/null +++ b/recipes/unqlite/all/test_package/test_package.c @@ -0,0 +1,53 @@ +#include + +#include + +int main(void) { + int i, rc; + unqlite *pDb; + + rc = unqlite_open(&pDb, "test.db", UNQLITE_OPEN_CREATE); + if (rc != UNQLITE_OK) return -1; + + rc = unqlite_kv_store(pDb, "test", -1, "Hello World", 11); + if (rc != UNQLITE_OK) return -1; + + rc = unqlite_kv_store_fmt(pDb, "date", -1, "Current date: %d:%d:%d", 2013,06,07); + if (rc != UNQLITE_OK) return -1; + + rc = unqlite_kv_append(pDb, "msg", -1, "Hello, ", 7); + if (rc == UNQLITE_OK) { + rc = unqlite_kv_append(pDb, "msg", -1, "Current time is: ", 17); + if (rc == UNQLITE_OK) { + rc = unqlite_kv_append_fmt(pDb, "msg", -1, "%d:%d:%d", 10, 16, 53); + } + } + + unqlite_kv_delete(pDb, "test", -1); + + for (i = 0 ; i < 20 ; ++i) { + char zKey[12]; + char zData[34]; + + unqlite_util_random_string(pDb, zKey, sizeof(zKey)); + + rc = unqlite_kv_store(pDb, zKey, sizeof(zKey), zData, sizeof(zData)); + if (rc != UNQLITE_OK) break; + } + + if (rc != UNQLITE_OK) { + const char *zBuf; + int iLen; + unqlite_config(pDb, UNQLITE_CONFIG_ERR_LOG, &zBuf, &iLen); + if (iLen > 0) { + fprintf(stderr, "%s", zBuf); + } + if (rc != UNQLITE_BUSY && rc != UNQLITE_NOTIMPLEMENTED) { + unqlite_rollback(pDb); + } + } + + unqlite_close(pDb); + + return 0; +} diff --git a/recipes/unqlite/config.yml b/recipes/unqlite/config.yml new file mode 100644 index 0000000000000..691d3c3ad3c9f --- /dev/null +++ b/recipes/unqlite/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.9": + folder: all diff --git a/recipes/utf8proc/all/conandata.yml b/recipes/utf8proc/all/conandata.yml index cd6744a5b7fd5..54f58f556ed02 100644 --- a/recipes/utf8proc/all/conandata.yml +++ b/recipes/utf8proc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.6.1": + url: "https://github.com/JuliaStrings/utf8proc/archive/v2.6.1.tar.gz" + sha256: "4c06a9dc4017e8a2438ef80ee371d45868bda2237a98b26554de7a95406b283b" "2.6.0": url: "https://github.com/JuliaStrings/utf8proc/archive/v2.6.0.tar.gz" sha256: "b36ce1534b8035e7febd95c031215ed279ee9d31cf9b464e28b4c688133b22c5" diff --git a/recipes/utf8proc/config.yml b/recipes/utf8proc/config.yml index 9146389d1f22f..eff066250bd3a 100644 --- a/recipes/utf8proc/config.yml +++ b/recipes/utf8proc/config.yml @@ -1,4 +1,6 @@ versions: + "2.6.1": + folder: all "2.6.0": folder: all "2.5.0": diff --git a/recipes/vc/all/CMakeLists.txt b/recipes/vc/all/CMakeLists.txt new file mode 100644 index 0000000000000..361b35d4c17d9 --- /dev/null +++ b/recipes/vc/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/vc/all/conandata.yml b/recipes/vc/all/conandata.yml new file mode 100644 index 0000000000000..18519b07274cc --- /dev/null +++ b/recipes/vc/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.4.1": + url: "https://github.com/VcDevel/Vc/releases/download/1.4.1/Vc-1.4.1.tar.gz" + sha256: "68e609a735326dc3625e98bd85258e1329fb2a26ce17f32c432723b750a4119f" diff --git a/recipes/vc/all/conanfile.py b/recipes/vc/all/conanfile.py new file mode 100644 index 0000000000000..5f1e4914ba6fa --- /dev/null +++ b/recipes/vc/all/conanfile.py @@ -0,0 +1,69 @@ +from conans import ConanFile, CMake, tools +import os + +required_conan_version = ">=1.33.0" + + +class VcConan(ConanFile): + name = "vc" + description = "SIMD Vector Classes for C++." + license = "BSD-3-Clause" + topics = ("vc", "simd", "vectorization", "parallel", "sse", "avx", "neon") + homepage = "https://github.com/VcDevel/Vc" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} + + exports_sources = "CMakeLists.txt" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _patch_sources(self): + cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + tools.replace_in_file(cmakelists, "CMAKE_SOURCE_DIR", "CMAKE_CURRENT_SOURCE_DIR") + tools.replace_in_file(cmakelists, "AddCompilerFlag(\"-fPIC\" CXX_FLAGS libvc_compile_flags)", "") + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def build(self): + self._patch_sources() + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "Vc" + self.cpp_info.names["cmake_find_package_multi"] = "Vc" + self.cpp_info.libs = ["Vc"] diff --git a/recipes/vc/all/test_package/CMakeLists.txt b/recipes/vc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..54585e3f38779 --- /dev/null +++ b/recipes/vc/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Vc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} Vc::Vc) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/vc/all/test_package/conanfile.py b/recipes/vc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/vc/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/vc/all/test_package/test_package.cpp b/recipes/vc/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..eb4100706228d --- /dev/null +++ b/recipes/vc/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include + +#include + +using Vec3D = std::array; + +Vc::float_v scalar_product(Vec3D a, Vec3D b) { + return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; +} + +int main() { + Vec3D a{1, 2, 3}; + Vec3D b{3, 4, 5}; + std::cout << scalar_product(a, b) << std::endl; + return 0; +} diff --git a/recipes/vc/config.yml b/recipes/vc/config.yml new file mode 100644 index 0000000000000..4709a2eb80f4c --- /dev/null +++ b/recipes/vc/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.1": + folder: all diff --git a/recipes/vcglib/all/CMakeLists.txt b/recipes/vcglib/all/CMakeLists.txt new file mode 100644 index 0000000000000..ac660af298764 --- /dev/null +++ b/recipes/vcglib/all/CMakeLists.txt @@ -0,0 +1,27 @@ +cmake_minimum_required(VERSION 3.8) +project(vcglib) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(VCGLIB_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) + +find_package(Eigen3 REQUIRED CONFIG) + +add_library(${PROJECT_NAME} ${VCGLIB_SRC_DIR}/wrap/ply/plylib.cpp) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +target_include_directories(${PROJECT_NAME} PUBLIC ${VCGLIB_SRC_DIR}) +target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen) + +install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + +install(DIRECTORY "${VCGLIB_SRC_DIR}/vcg" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING PATTERN "*.h") +install(DIRECTORY "${VCGLIB_SRC_DIR}/wrap" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING PATTERN "*.h") +install(DIRECTORY "${VCGLIB_SRC_DIR}/img" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING PATTERN "*.h") diff --git a/recipes/vcglib/all/conandata.yml b/recipes/vcglib/all/conandata.yml new file mode 100644 index 0000000000000..c8cca80b2b1c4 --- /dev/null +++ b/recipes/vcglib/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "2020.12": + url: "https://github.com/cnr-isti-vclab/vcglib/archive/refs/tags/2020.12.tar.gz" + sha256: "731c57435e39c4b958a1d766cadd9865d9db35e36410708f2da7818e9fa5f786" +patches: + "2020.12": + - patch_file: "patches/0001-use-external-eigen.patch" + base_path: "source_subfolder" diff --git a/recipes/vcglib/all/conanfile.py b/recipes/vcglib/all/conanfile.py new file mode 100644 index 0000000000000..2cc49f74a7808 --- /dev/null +++ b/recipes/vcglib/all/conanfile.py @@ -0,0 +1,70 @@ +from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.33.0" + + +class VcglibConan(ConanFile): + name = "vcglib" + description = "Library for manipulation, processing, cleaning, simplifying triangle meshes." + license = "GPL-3.0-only" + topics = ("conan", "vcglib", "mesh-processing") + homepage = "https://github.com/cnr-isti-vclab/vcglib" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = ["CMakeLists.txt", "patches/**"] + generators = "cmake", "cmake_find_package_multi" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def requirements(self): + self.requires("eigen/3.3.9") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 11) + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + for patch in self.conan_data.get("patches", {}).get(self.version, []): + tools.patch(**patch) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["vcglib"] diff --git a/recipes/vcglib/all/patches/0001-use-external-eigen.patch b/recipes/vcglib/all/patches/0001-use-external-eigen.patch new file mode 100644 index 0000000000000..78d56161a7a07 --- /dev/null +++ b/recipes/vcglib/all/patches/0001-use-external-eigen.patch @@ -0,0 +1,17 @@ +--- a/vcg/math/eigen.h ++++ b/vcg/math/eigen.h +@@ -53,10 +53,10 @@ struct ei_to_vcgtype; + } + + #include "base.h" +-#include "../../eigenlib/Eigen/LU" +-#include "../../eigenlib/Eigen/Geometry" +-#include "../../eigenlib/Eigen/Array" +-#include "../../eigenlib/Eigen/Core" ++#include ++#include ++#include ++#include + + // add support for unsigned char and short int + namespace Eigen { diff --git a/recipes/vcglib/all/test_package/CMakeLists.txt b/recipes/vcglib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..33ae887aa6aea --- /dev/null +++ b/recipes/vcglib/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/vcglib/all/test_package/conanfile.py b/recipes/vcglib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..bdac6857c5271 --- /dev/null +++ b/recipes/vcglib/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + obj_path = os.path.join(self.source_folder, "cube.obj") + self.run("{} {}".format(bin_path, obj_path), run_environment=True) diff --git a/recipes/vcglib/all/test_package/cube.obj b/recipes/vcglib/all/test_package/cube.obj new file mode 100644 index 0000000000000..4ebd02481d3eb --- /dev/null +++ b/recipes/vcglib/all/test_package/cube.obj @@ -0,0 +1,14 @@ +v 0.000000 2.000000 2.000000 +v 0.000000 0.000000 2.000000 +v 2.000000 0.000000 2.000000 +v 2.000000 2.000000 2.000000 +v 0.000000 2.000000 0.000000 +v 0.000000 0.000000 0.000000 +v 2.000000 0.000000 0.000000 +v 2.000000 2.000000 0.000000 +f 1 2 3 4 +f 8 7 6 5 +f 4 3 7 8 +f 5 1 4 8 +f 5 6 2 1 +f 2 6 7 3 diff --git a/recipes/vcglib/all/test_package/test_package.cpp b/recipes/vcglib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..873e203a1f774 --- /dev/null +++ b/recipes/vcglib/all/test_package/test_package.cpp @@ -0,0 +1,34 @@ +#include +#include + +#include + +class MyVertex; +class MyEdge; +class MyFace; + +struct MyUsedTypes: public vcg::UsedTypes::AsVertexType, vcg::Use::AsEdgeType, vcg::Use::AsFaceType>{}; +class MyVertex: public vcg::Vertex{}; +class MyFace: public vcg::Face{}; +class MyEdge: public vcg::Edge{}; +class MyMesh: public vcg::tri::TriMesh, std::vector , std::vector >{}; + +int main(int argc, char **argv) { + if (argc < 2) { + std::cerr << "Need at least 1 argument" << std::endl; + return -1; + } + + MyMesh m; + int dummymask = 0; + if (vcg::tri::io::Importer::Open(m, argv[1]) != 0) { + std::cerr << "Error reading file " << argv[1] << std::endl; + return -1; + } + + vcg::tri::RequirePerVertexNormal(m); + vcg::tri::UpdateNormal::PerVertexNormalized(m); + std::cout << "Mesh has " << m.VN() << " vert and " << m.FN() << " faces" << std::endl; + + return 0; +} diff --git a/recipes/vcglib/config.yml b/recipes/vcglib/config.yml new file mode 100644 index 0000000000000..39fde63dbe75b --- /dev/null +++ b/recipes/vcglib/config.yml @@ -0,0 +1,3 @@ +versions: + "2020.12": + folder: all diff --git a/recipes/vectorclass/all/CMakeLists.txt b/recipes/vectorclass/all/CMakeLists.txt new file mode 100644 index 0000000000000..a8fe5cc4331f3 --- /dev/null +++ b/recipes/vectorclass/all/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.8) + +project(vectorclass CXX) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +set(SOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/instrset_detect.cpp) + +file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.h") + +add_library(vectorclass STATIC ${SOURCES} ${HEADERS}) +target_compile_features(vectorclass PUBLIC cxx_std_17) +set_target_properties(vectorclass PROPERTIES PUBLIC_HEADER "${HEADERS}") + +include(GNUInstallDirs) +install(TARGETS vectorclass + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/vectorclass/all/conanfile.py b/recipes/vectorclass/all/conanfile.py index e6166a647fa21..f2a0e8cc20e75 100644 --- a/recipes/vectorclass/all/conanfile.py +++ b/recipes/vectorclass/all/conanfile.py @@ -1,4 +1,4 @@ -from conans import ConanFile, tools +from conans import ConanFile, CMake, tools from conans.errors import ConanInvalidConfiguration required_conan_version = ">=1.33.0" @@ -14,13 +14,30 @@ class VectorclassConan(ConanFile): topics = ("conan", "vectorclass", "vector", "simd") homepage = "https://github.com/vectorclass/version2" url = "https://github.com/conan-io/conan-center-index" - no_copy_source = True - settings = "os", "arch", "compiler" + exports_sources = ["CMakeLists.txt"] + generators = "cmake" + settings = ("os", "arch", "compiler", "build_type") + options = { + "fPIC": [True, False] + } + default_options = { + "fPIC": True + } + + _cmake = None @property def _source_subfolder(self): return "source_subfolder" + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == 'Windows': + del self.options.fPIC + @property def _compilers_minimum_version(self): return { @@ -49,13 +66,25 @@ def lazy_lt_semver(v1, v2): elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration("{} {} requires C++17, which your compiler does not support.".format(self.name, self.version)) - def package_id(self): - self.info.header_only() - def source(self): tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + def package(self): self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["vectorclass"] diff --git a/recipes/vectorclass/all/test_package/CMakeLists.txt b/recipes/vectorclass/all/test_package/CMakeLists.txt index 6c1d84c7e3d82..2954126775e7b 100644 --- a/recipes/vectorclass/all/test_package/CMakeLists.txt +++ b/recipes/vectorclass/all/test_package/CMakeLists.txt @@ -1,9 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup() add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/vectorclass/all/test_package/test_package.cpp b/recipes/vectorclass/all/test_package/test_package.cpp index 6a874a78e1719..1c3941ae20360 100644 --- a/recipes/vectorclass/all/test_package/test_package.cpp +++ b/recipes/vectorclass/all/test_package/test_package.cpp @@ -1,8 +1,54 @@ #include #include +#include +#include + +void print_instruction_set() { + // 0 = 80386 instruction set + // 1 or above = SSE (XMM) supported by CPU (not testing for OS support) + // 2 or above = SSE2 + // 3 or above = SSE3 + // 4 or above = Supplementary SSE3 (SSSE3) + // 5 or above = SSE4.1 + // 6 or above = SSE4.2 + // 7 or above = AVX supported by CPU and operating system + // 8 or above = AVX2 + // 9 or above = AVX512F + //10 or above = AVX512VL, AVX512BW, AVX512DQ + const auto instruction_set = instrset_detect(); + switch (instruction_set) { + case 10: + std::cout << "AVX512VL, AVX512BW, AVX512DQ\n"; + case 9: + std::cout << "AVX512F\n"; + case 8: + std::cout << "AVX2\n"; + case 7: + std::cout << "AVX supported by CPU and operating system\n"; + case 6: + std::cout << "SSE4.2\n"; + case 5: + std::cout << "SSE4.1\n"; + case 4: + std::cout << "Supplementary SSE3 (SSSE3)\n"; + case 3: + std::cout << "SSE3\n"; + case 2: + std::cout << "SSE2\n"; + case 1: + std::cout << "SSE (XMM) supported by CPU (not testing for OS support)\n"; + case 0: + std::cout << "80386 instruction set\n"; + break; + default: + throw std::runtime_error("Unexpected instruction set " + std::to_string(instruction_set)); + } +} int main() { + print_instruction_set(); + Vec4i a(10, 11, 12, 13); Vec4i b(20, 21, 22, 23); diff --git a/recipes/xege/all/CMakeLists.txt b/recipes/xege/all/CMakeLists.txt new file mode 100644 index 0000000000000..0496b29838549 --- /dev/null +++ b/recipes/xege/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.0) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/xege/all/conandata.yml b/recipes/xege/all/conandata.yml new file mode 100644 index 0000000000000..2f7535221dfb9 --- /dev/null +++ b/recipes/xege/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "20.08": + url: "https://github.com/wysaid/xege/archive/refs/tags/20.08.tar.gz" + sha256: "33bc63366d093902b5bc68d3d613ebd90e449bc22800b40f2dd98e2b5c44b88a" diff --git a/recipes/xege/all/conanfile.py b/recipes/xege/all/conanfile.py new file mode 100644 index 0000000000000..e3d748b348f87 --- /dev/null +++ b/recipes/xege/all/conanfile.py @@ -0,0 +1,58 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class XegeConan(ConanFile): + name = "xege" + license = "LGPLv2.1" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://xege.org/" + description = "Easy Graphics Engine, a lite graphics library in Windows" + topics = ("ege", "graphics", "gui") + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + exports_sources = ["CMakeLists.txt"] + + def configure(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration( + "This library is only compatible for Windows") + + @property + def _source_subfolder(self): + return "source_subfolder" + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + self.copy("*.h", dst="include", src=self._source_subfolder+"/src") + self.copy("*.lib", dst="lib", keep_path=False) + self.copy("*.dll", dst="bin", keep_path=False) + self.copy("*.so", dst="lib", keep_path=False) + self.copy("*.a", dst="lib", keep_path=False) + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + + def package_info(self): + if self.settings.arch == "x86_64": + self.cpp_info.libs = ["graphics64"] + else: + self.cpp_info.libs = ["graphics"] + self.cpp_info.system_libs = [ + "gdiplus", + "uuid", + "msimg32", + "gdi32", + "imm32", + "ole32", + "oleaut32" + ] diff --git a/recipes/xege/all/test_package/CMakeLists.txt b/recipes/xege/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..dd28555a7ac65 --- /dev/null +++ b/recipes/xege/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.1) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(example example.cpp) +target_link_libraries(example ${CONAN_LIBS}) + +if(MSYS OR MINGW) + target_link_libraries(example -static-libgcc -static-libstdc++) +endif() diff --git a/recipes/xege/all/test_package/conanfile.py b/recipes/xege/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2011b67ca68a5 --- /dev/null +++ b/recipes/xege/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class XegeTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/xege/all/test_package/example.cpp b/recipes/xege/all/test_package/example.cpp new file mode 100644 index 0000000000000..e167cd38f70ed --- /dev/null +++ b/recipes/xege/all/test_package/example.cpp @@ -0,0 +1,11 @@ +#include +#include + +using namespace ege; + +int main() { + initgraph(640, 480); + circle(120, 120, 100); + Sleep(2000); + closegraph(); +} diff --git a/recipes/xege/config.yml b/recipes/xege/config.yml new file mode 100644 index 0000000000000..f6df21024cbf0 --- /dev/null +++ b/recipes/xege/config.yml @@ -0,0 +1,3 @@ +versions: + "20.08": + folder: all diff --git a/recipes/xorstr/all/conandata.yml b/recipes/xorstr/all/conandata.yml new file mode 100644 index 0000000000000..d25c84f64a09c --- /dev/null +++ b/recipes/xorstr/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20210417": + url: "https://github.com/JustasMasiulis/xorstr/archive/8ab293225374e16cbae9a54b6a1bed3ee0bf9681.tar.gz" + sha256: "b52220a50c33f8b13e6aaa2fcd14f31a44d96ba721b014ab921c30b5e3cb61eb" diff --git a/recipes/xorstr/all/conanfile.py b/recipes/xorstr/all/conanfile.py new file mode 100644 index 0000000000000..069c03de54d91 --- /dev/null +++ b/recipes/xorstr/all/conanfile.py @@ -0,0 +1,56 @@ +from conans import ConanFile, tools +from conans.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.33.0" + + +class XorstrConan(ConanFile): + name = "xorstr" + description = "A heavily vectorized c++17 compile time string encryption." + license = "Apache-2.0" + topics = ("conan", "xorstr", "encryption", "string", "vectorized") + homepage = "https://github.com/JustasMasiulis/xorstr" + url = "https://github.com/conan-io/conan-center-index" + no_copy_source = True + settings = "compiler" + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "gcc": "7", + "clang": "5.0", + "apple-clang": "9.1" + } + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 17) + + def lazy_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if not minimum_version: + self.output.warn("{} {} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name, self.version)) + elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration("{} {} requires C++17, which your compiler does not support.".format(self.name, self.version)) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) diff --git a/recipes/xorstr/all/test_package/CMakeLists.txt b/recipes/xorstr/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0029db0945c64 --- /dev/null +++ b/recipes/xorstr/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/xorstr/all/test_package/conanfile.py b/recipes/xorstr/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/xorstr/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xorstr/all/test_package/test_package.cpp b/recipes/xorstr/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f37690b855356 --- /dev/null +++ b/recipes/xorstr/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#define JM_XORSTR_DISABLE_AVX_INTRINSICS +#include + +#include + +int main() { + std::puts(xorstr_("an extra long hello_world")); + return 0; +} diff --git a/recipes/xorstr/config.yml b/recipes/xorstr/config.yml new file mode 100644 index 0000000000000..c91428932c33a --- /dev/null +++ b/recipes/xorstr/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210417": + folder: all diff --git a/recipes/xproperty/all/conandata.yml b/recipes/xproperty/all/conandata.yml new file mode 100644 index 0000000000000..e22cd28ead6ab --- /dev/null +++ b/recipes/xproperty/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.11.0": + url: "https://github.com/jupyter-xeus/xproperty/archive/refs/tags/0.11.0.tar.gz" + sha256: "bf86a11c6758308aa0aa0f64d8dd24cd3e9d78378467b74002f552bfb75fc0eb" diff --git a/recipes/xproperty/all/conanfile.py b/recipes/xproperty/all/conanfile.py new file mode 100644 index 0000000000000..a332714b7b5c7 --- /dev/null +++ b/recipes/xproperty/all/conanfile.py @@ -0,0 +1,70 @@ +from conans import ConanFile, tools +import os +import textwrap + +required_conan_version = ">=1.33.0" + + +class XpropertyConan(ConanFile): + name = "xproperty" + description = "Traitlets-like C++ properties and implementation of the observer pattern." + license = "BSD-3-Clause" + topics = ("conan", "xproperty", "observer", "traitlets") + homepage = "https://github.com/jupyter-xeus/xproperty" + url = "https://github.com/conan-io/conan-center-index" + no_copy_source = True + settings = "compiler" + + @property + def _source_subfolder(self): + return "source_subfolder" + + def requirements(self): + self.requires("xtl/0.7.2") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + tools.check_min_cppstd(self, 14) + + def package_id(self): + self.info.header_only() + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"xproperty": "xproperty::xproperty"} + ) + + @staticmethod + def _create_cmake_module_alias_targets(module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + tools.save(module_file, content) + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake") + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, + "conan-official-{}-targets.cmake".format(self.name)) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "xproperty" + self.cpp_info.names["cmake_find_package_multi"] = "xproperty" + self.cpp_info.builddirs.append(self._module_subfolder) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/xproperty/all/test_package/CMakeLists.txt b/recipes/xproperty/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f01f0f02aa1d4 --- /dev/null +++ b/recipes/xproperty/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(xproperty REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} xproperty) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) diff --git a/recipes/xproperty/all/test_package/conanfile.py b/recipes/xproperty/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/xproperty/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xproperty/all/test_package/test_package.cpp b/recipes/xproperty/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f5c67cdb83490 --- /dev/null +++ b/recipes/xproperty/all/test_package/test_package.cpp @@ -0,0 +1,36 @@ +#include + +#include +#include + +struct Foo: public xp::xobserved { + XPROPERTY(double, Foo, bar); + XPROPERTY(double, Foo, baz); +}; + +int main() { + Foo foo; + + XOBSERVE(foo, bar, [](Foo& f) { + std::cout << "Observer: New value of bar: " << f.bar << std::endl; + }); + + XVALIDATE(foo, bar, [](Foo&, double& proposal) { + std::cout << "Validator: Proposal: " << proposal << std::endl; + if (proposal < 0) + { + throw std::runtime_error("Only non-negative values are valid."); + } + return proposal; + }); + + foo.bar = 1.0; + std::cout << foo.bar << std::endl; + try { + foo.bar = -1.0; + } catch (...) { + std::cout << foo.bar << std::endl; + } + + return 0; +} diff --git a/recipes/xproperty/config.yml b/recipes/xproperty/config.yml new file mode 100644 index 0000000000000..98fa57f62a6c8 --- /dev/null +++ b/recipes/xproperty/config.yml @@ -0,0 +1,3 @@ +versions: + "0.11.0": + folder: all diff --git a/recipes/yyjson/all/CMakeLists.txt b/recipes/yyjson/all/CMakeLists.txt new file mode 100644 index 0000000000000..361b35d4c17d9 --- /dev/null +++ b/recipes/yyjson/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 2.8.11) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup() + +add_subdirectory(source_subfolder) diff --git a/recipes/yyjson/all/conandata.yml b/recipes/yyjson/all/conandata.yml new file mode 100644 index 0000000000000..af7f7407615c8 --- /dev/null +++ b/recipes/yyjson/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.3.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.3.0.tar.gz" + sha256: "f5ad3e3be40f0307a732c2b8aff9a1ba6014a6b346f3ec0b128459607748e990" diff --git a/recipes/yyjson/all/conanfile.py b/recipes/yyjson/all/conanfile.py new file mode 100644 index 0000000000000..731f12936a761 --- /dev/null +++ b/recipes/yyjson/all/conanfile.py @@ -0,0 +1,69 @@ +from conans import ConanFile, CMake, tools +import os + +required_conan_version = ">=1.33.0" + + +class YyjsonConan(ConanFile): + name = "yyjson" + description = "A high performance JSON library written in ANSI C." + license = "MIT" + topics = ("yyjson", "json", "serialization", "deserialization") + homepage = "https://github.com/ibireme/yyjson" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + self._cmake.configure() + return self._cmake + + def build(self): + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "yyjson" + self.cpp_info.names["cmake_find_package_multi"] = "yyjson" + self.cpp_info.libs = ["yyjson"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines.append("YYJSON_IMPORTS") diff --git a/recipes/yyjson/all/test_package/CMakeLists.txt b/recipes/yyjson/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..58e69597f7a4d --- /dev/null +++ b/recipes/yyjson/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(yyjson REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} yyjson::yyjson) diff --git a/recipes/yyjson/all/test_package/conanfile.py b/recipes/yyjson/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9f777f7680ff --- /dev/null +++ b/recipes/yyjson/all/test_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(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 tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/yyjson/all/test_package/test_package.c b/recipes/yyjson/all/test_package/test_package.c new file mode 100644 index 0000000000000..58f4a2835cc30 --- /dev/null +++ b/recipes/yyjson/all/test_package/test_package.c @@ -0,0 +1,29 @@ +#include + +#include +#include + +int main(void) { + const char *json = "{\"name\":\"Mash\",\"star\":4,\"hits\":[2,2,1,3]}"; + + yyjson_doc *doc = yyjson_read(json, strlen(json), 0); + yyjson_val *root = yyjson_doc_get_root(doc); + + yyjson_val *name = yyjson_obj_get(root, "name"); + printf("name: %s\n", yyjson_get_str(name)); + printf("name length:%d\n", (int)yyjson_get_len(name)); + + yyjson_val *star = yyjson_obj_get(root, "star"); + printf("star: %d\n", (int)yyjson_get_int(star)); + + yyjson_val *hits = yyjson_obj_get(root, "hits"); + size_t idx, max; + yyjson_val *hit; + yyjson_arr_foreach(hits, idx, max, hit) { + printf("hit%d: %d\n", (int)idx, (int)yyjson_get_int(hit)); + } + + yyjson_doc_free(doc); + + return 0; +} diff --git a/recipes/yyjson/config.yml b/recipes/yyjson/config.yml new file mode 100644 index 0000000000000..d126790212e0c --- /dev/null +++ b/recipes/yyjson/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.0": + folder: all