diff --git a/recipes/bzip2/1.0.8/conanfile.py b/recipes/bzip2/1.0.8/conanfile.py index b9739f55e09d9..43537c2212263 100644 --- a/recipes/bzip2/1.0.8/conanfile.py +++ b/recipes/bzip2/1.0.8/conanfile.py @@ -54,4 +54,5 @@ def package(self): def package_info(self): self.cpp_info.name = "BZip2" + self.cpp_info.names["pkg_config"] = "bzip2" self.cpp_info.libs = tools.collect_libs(self) diff --git a/recipes/bzip2/1.0.8/test_package/conanfile.py b/recipes/bzip2/1.0.8/test_package/conanfile.py index 1dd85faada77d..b96cf382c806b 100644 --- a/recipes/bzip2/1.0.8/test_package/conanfile.py +++ b/recipes/bzip2/1.0.8/test_package/conanfile.py @@ -4,15 +4,16 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + generators = "cmake", "pkg_config" def build(self): cmake = CMake(self) cmake.configure() cmake.build() - + def test(self): assert os.path.isfile(os.path.join(self.deps_cpp_info["bzip2"].rootpath, "licenses", "LICENSE")) + assert os.path.isfile(os.path.join(self.build_folder, "bzip2.pc")) if tools.cross_building(self.settings): self.output.warn("Skipping run cross built package") return diff --git a/recipes/catch2/2.x.x/conandata.yml b/recipes/catch2/2.x.x/conandata.yml index a5b9f89c040f7..da6196f593d58 100644 --- a/recipes/catch2/2.x.x/conandata.yml +++ b/recipes/catch2/2.x.x/conandata.yml @@ -2,3 +2,6 @@ sources: 2.9.2: url: https://github.com/catchorg/Catch2/archive/v2.9.2.tar.gz sha256: 54BEA6D80A388A80F895CD0E2343FCA72B0D9093A776AF40904AEFCE49C13BDA + 2.11.0: + url: https://github.com/catchorg/Catch2/archive/v2.11.0.tar.gz + sha256: b9957af46a04327d80833960ae51cf5e67765fd264389bd1e275294907f1a3e0 diff --git a/recipes/catch2/config.yml b/recipes/catch2/config.yml index e0983c98b3e02..94adeb55e56b9 100644 --- a/recipes/catch2/config.yml +++ b/recipes/catch2/config.yml @@ -1,3 +1,5 @@ versions: 2.9.2: folder: 2.x.x + 2.11.0: + folder: 2.x.x diff --git a/recipes/gtest/all/conandata.yml b/recipes/gtest/all/conandata.yml index 6ff839b7e98dc..832a4aae40270 100644 --- a/recipes/gtest/all/conandata.yml +++ b/recipes/gtest/all/conandata.yml @@ -7,8 +7,8 @@ sources: sha256: "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb" patches: "1.8.1": - patch_file: "gtest-1.8.1.patch" - base_path: "source_subfolder" + - patch_file: "patches/gtest-1.8.1.patch" + base_path: "source_subfolder" "1.10.0": - patch_file: "gtest-1.10.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/gtest-1.10.0.patch" + base_path: "source_subfolder" diff --git a/recipes/gtest/all/conanfile.py b/recipes/gtest/all/conanfile.py index f21c6328eefcc..797443f8b1ab9 100644 --- a/recipes/gtest/all/conanfile.py +++ b/recipes/gtest/all/conanfile.py @@ -12,7 +12,7 @@ class GTestConan(ConanFile): homepage = "https://github.com/google/googletest" license = "BSD-3-Clause" topics = ("conan", "gtest", "testing", "google-testing", "unit-test") - exports_sources = ["CMakeLists.txt", "gtest-*.patch"] + 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]} @@ -54,7 +54,8 @@ def _configure_cmake(self): return cmake def build(self): - tools.patch(**self.conan_data["patches"][self.version]) + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) cmake = self._configure_cmake() cmake.build() diff --git a/recipes/gtest/all/gtest-1.10.0.patch b/recipes/gtest/all/patches/gtest-1.10.0.patch similarity index 100% rename from recipes/gtest/all/gtest-1.10.0.patch rename to recipes/gtest/all/patches/gtest-1.10.0.patch diff --git a/recipes/gtest/all/gtest-1.8.1.patch b/recipes/gtest/all/patches/gtest-1.8.1.patch similarity index 100% rename from recipes/gtest/all/gtest-1.8.1.patch rename to recipes/gtest/all/patches/gtest-1.8.1.patch diff --git a/recipes/libalsa/all/conanfile.py b/recipes/libalsa/all/conanfile.py index 6eabca8e83c97..d804aa736c461 100644 --- a/recipes/libalsa/all/conanfile.py +++ b/recipes/libalsa/all/conanfile.py @@ -66,4 +66,6 @@ def package(self): os.unlink(la_file) def package_info(self): - self.cpp_info.libs = ["asound", "dl", "m", "rt", "pthread"] + self.cpp_info.libs = ["asound"] + self.cpp_info.system_libs = ["dl", "m", "rt", "pthread"] + self.cpp_info.names['pkg_config'] = 'alsa' diff --git a/recipes/libjpeg/all/conanfile.py b/recipes/libjpeg/all/conanfile.py index 62c1a80e8586f..badbf0debf0ab 100644 --- a/recipes/libjpeg/all/conanfile.py +++ b/recipes/libjpeg/all/conanfile.py @@ -2,6 +2,7 @@ import shutil from conans import ConanFile, AutoToolsBuildEnvironment, tools from conans.errors import ConanInvalidConfiguration +from conans.tools import os_info class LibjpegConan(ConanFile): @@ -28,6 +29,11 @@ def configure(self): if self.settings.compiler == 'Visual Studio' and self.options.shared: raise ConanInvalidConfiguration("shared builds aren't supported for MSVC") + def build_requirements(self): + if tools.os_info.is_windows and self.settings.compiler != "Visual Studio": + if "CONAN_BASH_PATH" not in os.environ and os_info.detect_windows_subsystem() != 'msys2': + self.build_requires("msys2/20190524") + def source(self): tools.get(**self.conan_data["sources"][self.version]) os.rename("jpeg-" + self.version, self.source_subfolder) diff --git a/recipes/libpq/all/conanfile.py b/recipes/libpq/all/conanfile.py index 45fd2673d3c97..fe84def04aef8 100644 --- a/recipes/libpq/all/conanfile.py +++ b/recipes/libpq/all/conanfile.py @@ -1,5 +1,6 @@ from conans import ConanFile, AutoToolsBuildEnvironment, tools from conans.errors import ConanInvalidConfiguration +from conans.tools import os_info import os @@ -9,7 +10,6 @@ class LibpqConan(ConanFile): topics = ("conan", "libpq", "postgresql", "database", "db") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.postgresql.org/docs/current/static/libpq.html" - author = "Bincrafters " license = "PostgreSQL" settings = "os", "arch", "compiler", "build_type" options = { @@ -24,6 +24,9 @@ class LibpqConan(ConanFile): def build_requirements(self): if self.settings.compiler == "Visual Studio": self.build_requires("strawberryperl/5.30.0.1") + elif tools.os_info.is_windows: + if "CONAN_BASH_PATH" not in os.environ and os_info.detect_windows_subsystem() != 'msys2': + self.build_requires("msys2/20190524") @property def _source_subfolder(self): return "source_subfolder" diff --git a/recipes/minizip/1.2.11/CMakeLists.txt b/recipes/minizip/1.2.11/CMakeLists.txt new file mode 100644 index 0000000000000..73e32af77da35 --- /dev/null +++ b/recipes/minizip/1.2.11/CMakeLists.txt @@ -0,0 +1,82 @@ +# This CMake file has been extracted from VCPKG and is under MIT license: +# https://github.com/microsoft/vcpkg/blob/master/ports/minizip/CMakeLists.txt +cmake_minimum_required(VERSION 3.8) +project(minizip C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +set(PROJECT_VERSION 1.2.11) +set(PROJECT_VERSION_MAJOR 1) +set(PROJECT_VERSION_MINOR 2) +set(PROJECT_VERSION_PATCH 11) + +option(USE_BZIP2 "Build minizip with bzip2 support" ON) +option(BUILD_TOOLS "Build minizip tool" OFF) + +if (MSVC AND WIN32 AND BUILD_SHARED_LIBS) + set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif() + +set(MIN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/contrib/minizip") +include_directories(${MIN_SRC} ${ZLIB_INCLUDE_DIRS}) + +set(SOURCE_FILES + ${MIN_SRC}/ioapi.c + ${MIN_SRC}/unzip.c + ${MIN_SRC}/zip.c + ${MIN_SRC}/mztools.c +) +if(WIN32) + list(APPEND SOURCE_FILES ${MIN_SRC}/iowin32.c) +endif() + +set(HEADER_FILES + ${MIN_SRC}/crypt.h + ${MIN_SRC}/ioapi.h + ${MIN_SRC}/unzip.h + ${MIN_SRC}/zip.h + ${MIN_SRC}/mztools.h +) +if(WIN32) + list(APPEND HEADER_FILES ${MIN_SRC}/iowin32.h) +endif() + +add_library(minizip ${SOURCE_FILES} ${HEADER_FILES}) +target_link_libraries(minizip PUBLIC ${CONAN_LIBS}) +target_compile_definitions(minizip PRIVATE -D_ZLIB_H) + +if(ENABLE_BZIP2) + target_compile_definitions(minizip PRIVATE -DHAVE_BZIP2=1) +endif() +if(MSVC) + target_compile_options(minizip PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) +endif() + +if (BUILD_TOOLS) + add_executable(minizip_bin ${MIN_SRC}/minizip.c) + add_executable(miniunz_bin ${MIN_SRC}/miniunz.c) + + target_link_libraries(minizip_bin minizip ${CONAN_LIBS}) + target_link_libraries(miniunz_bin minizip ${CONAN_LIBS}) + + set_target_properties(minizip_bin PROPERTIES OUTPUT_NAME minizip) + set_target_properties(miniunz_bin PROPERTIES OUTPUT_NAME miniunz) + + if(MSVC) + target_compile_options(minizip_bin PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(miniunz_bin PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + endif() + + install (TARGETS minizip_bin miniunz_bin + RUNTIME DESTINATION bin) +endif() + +install( + TARGETS minizip + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +) + +install(FILES ${HEADER_FILES} DESTINATION include/minizip) diff --git a/recipes/minizip/1.2.11/conandata.yml b/recipes/minizip/1.2.11/conandata.yml new file mode 100644 index 0000000000000..b78fc6385ddd8 --- /dev/null +++ b/recipes/minizip/1.2.11/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.2.11": + sha256: 629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff + url: https://github.com/madler/zlib/archive/v1.2.11.tar.gz diff --git a/recipes/minizip/1.2.11/conanfile.py b/recipes/minizip/1.2.11/conanfile.py new file mode 100644 index 0000000000000..023eda52718ce --- /dev/null +++ b/recipes/minizip/1.2.11/conanfile.py @@ -0,0 +1,70 @@ +import os +import shutil +from conans import ConanFile, tools, CMake + + +class MinizipConan(ConanFile): + name = "minizip" + version = "1.2.11" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://zlib.net" + license = "Zlib" + description = "An experimental package to read and write files in .zip format, written on top of zlib" + topics = ("zip", "compression", "inflate") + settings = "os", "arch", "compiler", "build_type" + options = {"shared": [True, False], "fPIC": [True, False], "bzip2": [True, False], "tools": [True, False]} + default_options = {"shared": False, "fPIC": True, "bzip2": True, "tools": False} + exports_sources = ["CMakeLists.txt", "*.patch"] + generators = "cmake", "cmake_find_package" + + @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 requirements(self): + self.requires("zlib/1.2.11") + if self.options.bzip2: + self.requires("bzip2/1.0.8") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + os.rename("zlib-{}".format(self.version), self._source_subfolder) + + def _configure_cmake(self): + cmake = CMake(self) + cmake.definitions["ENABLE_BZIP2"] = self.options.bzip2 + cmake.definitions["BUILD_TOOLS"] = self.options.tools + cmake.configure(source_folder=self._source_subfolder) + return cmake + + def build(self): + tools.patch(patch_file="minizip.patch", base_path=self._source_subfolder) + shutil.move("CMakeLists.txt", os.path.join(self._source_subfolder, 'CMakeLists.txt')) + cmake = self._configure_cmake() + cmake.build() + + def _extract_license(self): + with tools.chdir(os.path.join(self.source_folder, self._source_subfolder)): + tmp = tools.load("zlib.h") + license_contents = tmp[2:tmp.find("*/", 1)] + tools.save("LICENSE", license_contents) + + def package(self): + self._extract_license() + self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + cmake = self._configure_cmake() + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["minizip"] + self.cpp_info.includedirs = ["include", os.path.join("include", "minizip")] + if self.options.bzip2: + self.cpp_info.defines.append('HAVE_BZIP2') diff --git a/recipes/minizip/1.2.11/minizip.patch b/recipes/minizip/1.2.11/minizip.patch new file mode 100644 index 0000000000000..51ec03ade115b --- /dev/null +++ b/recipes/minizip/1.2.11/minizip.patch @@ -0,0 +1,16 @@ +diff --git a/contrib/minizip/unzip.c b/contrib/minizip/unzip.c +index f12e3329..bfc05f77 100644 +--- a/contrib/minizip/unzip.c ++++ b/contrib/minizip/unzip.c +@@ -68,10 +68,6 @@ + #include + #include + +-#ifndef NOUNCRYPT +- #define NOUNCRYPT +-#endif +- + #include "zlib.h" + #include "unzip.h" + + diff --git a/recipes/minizip/1.2.11/test_package/CMakeLists.txt b/recipes/minizip/1.2.11/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..09de6a3c30cba --- /dev/null +++ b/recipes/minizip/1.2.11/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.0) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(test_package test_package.c) +target_link_libraries(test_package ${CONAN_LIBS}) diff --git a/recipes/minizip/1.2.11/test_package/conanfile.py b/recipes/minizip/1.2.11/test_package/conanfile.py new file mode 100644 index 0000000000000..4d75291c652bc --- /dev/null +++ b/recipes/minizip/1.2.11/test_package/conanfile.py @@ -0,0 +1,18 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestZlibConan(ConanFile): + settings = "os", "compiler", "arch", "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/minizip/1.2.11/test_package/test_package.c b/recipes/minizip/1.2.11/test_package/test_package.c new file mode 100644 index 0000000000000..4660d0af60925 --- /dev/null +++ b/recipes/minizip/1.2.11/test_package/test_package.c @@ -0,0 +1,54 @@ +#include +#include +#include + +#include +#include +#ifdef _WIN32 + #include +#endif + +#include +#include + +const char text[] = "Conveying or northward offending admitting perfectly my."; +const char* zip_fname = "test_minizip.zip"; + +int main(int argc, char** argv) { + zipFile zf = zipOpen64(zip_fname, APPEND_STATUS_CREATE); + if (zf == NULL) { + printf("Error in zipOpen64, fname: %s\n", zip_fname); + exit(EXIT_FAILURE); + } + + int res; + zip_fileinfo zfi = {0}; + res = zipOpenNewFileInZip64(zf, "fname.bin", &zfi, NULL, 0, NULL, 0, NULL, Z_DEFLATED, Z_BEST_COMPRESSION, 0); + if (res != ZIP_OK) { + printf("Error in zipOpenNewFileInZip64, code: %d\n", res); + exit(EXIT_FAILURE); + } + + res = zipWriteInFileInZip(zf, text, sizeof(text)); + if (res != ZIP_OK) { + printf("Error in zipWriteInFileInZip, code: %d\n", res); + exit(EXIT_FAILURE); + } + + res = zipCloseFileInZip(zf); + if (res != ZIP_OK) { + printf("Error in zipCloseFileInZip, code: %d\n", res); + exit(EXIT_FAILURE); + } + + res = zipClose(zf, "Test MiniZip"); + if(res != ZIP_OK) { + printf("Error in zipClose, code: %d\n", res); + exit(EXIT_FAILURE); + } + + printf("ZIP file created, name: %s\n", zip_fname); + + return EXIT_SUCCESS; +} + diff --git a/recipes/openjpeg/all/conanfile.py b/recipes/openjpeg/all/conanfile.py index 5f867c947adf9..3ef050d9b844d 100644 --- a/recipes/openjpeg/all/conanfile.py +++ b/recipes/openjpeg/all/conanfile.py @@ -103,3 +103,4 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread", "m"] self.cpp_info.name = 'OpenJPEG' + self.cpp_info.names['pkg_config'] = 'libopenjp2' diff --git a/recipes/range-v3/all/conandata.yml b/recipes/range-v3/all/conandata.yml new file mode 100644 index 0000000000000..65f07346c9a4a --- /dev/null +++ b/recipes/range-v3/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.9.1": + url: https://github.com/ericniebler/range-v3/archive/0.9.1.tar.gz + sha256: 2b5b442d572b5978ea51c650adfaf0796f39f326404d09b83d846e04f571876b + "0.10.0": + url: https://github.com/ericniebler/range-v3/archive/0.10.0.tar.gz + sha256: 5a1cd44e7315d0e8dcb1eee4df6802221456a9d1dbeac53da02ac7bd4ea150cd diff --git a/recipes/range-v3/all/conanfile.py b/recipes/range-v3/all/conanfile.py new file mode 100644 index 0000000000000..53fcbe7975069 --- /dev/null +++ b/recipes/range-v3/all/conanfile.py @@ -0,0 +1,24 @@ +import os +from conans import ConanFile, CMake, tools + +class Rangev3Conan(ConanFile): + name = "range-v3" + license = "BSL-1.0" + homepage = "https://github.com/ericniebler/range-v3" + url = "https://github.com/conan-io/conan-center-index" + description = "Experimental range library for C++11/14/17" + topics = ("range", "range-library", "proposal", "iterator") + no_copy_source = True + + @property + def _source_subfolder(self): + return os.path.join(self.source_folder, "source_subfolder") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + extracted_folder = self.name + "-" + self.version + os.rename(extracted_folder, self._source_subfolder) + + def package(self): + self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) diff --git a/recipes/range-v3/all/test_package/CMakeLists.txt b/recipes/range-v3/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..375ca9b3cc686 --- /dev/null +++ b/recipes/range-v3/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.5) +project(test_package) + +find_package(range-v3) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} range-v3::range-v3) +set_property(TARGET test_package PROPERTY CXX_STANDARD 14) diff --git a/recipes/range-v3/all/test_package/conanfile.py b/recipes/range-v3/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4e5cabef40600 --- /dev/null +++ b/recipes/range-v3/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_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + self.run("test_package", run_environment=True) diff --git a/recipes/range-v3/all/test_package/test_package.cpp b/recipes/range-v3/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7d3515b640c89 --- /dev/null +++ b/recipes/range-v3/all/test_package/test_package.cpp @@ -0,0 +1,32 @@ +#include +#include + +using namespace ranges; + +// A range that iterates over all the characters in a +// null-terminated string. +class c_string_range + : public view_facade +{ + friend range_access; + char const * sz_; + char const & read() const { return *sz_; } + bool equal(default_sentinel_t) const { return *sz_ == '\0'; } + void next() { ++sz_; } +public: + c_string_range() = default; + explicit c_string_range(char const *sz) : sz_(sz) + { + assert(sz != nullptr); + } +}; + +int main() +{ + c_string_range r("hello world"); + // Iterate over all the characters and print them out + ranges::for_each(r, [](char ch){ + std::cout << ch << ' '; + }); + // prints: h e l l o w o r l d +} \ No newline at end of file diff --git a/recipes/range-v3/config.yml b/recipes/range-v3/config.yml new file mode 100644 index 0000000000000..6895ae8f05494 --- /dev/null +++ b/recipes/range-v3/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.1": + folder: all diff --git a/recipes/sqlite3/all/CMakeLists.txt b/recipes/sqlite3/all/CMakeLists.txt index c357fb3ebf320..eccc8c0ee5675 100644 --- a/recipes/sqlite3/all/CMakeLists.txt +++ b/recipes/sqlite3/all/CMakeLists.txt @@ -19,6 +19,7 @@ option(HAVE_LOCALTIME_R "Use the threadsafe localtime_r()") option(HAVE_POSIX_FALLOCATE "Use posix_fallocate()") option(HAVE_STRERROR_R "Use strerror_r()") option(HAVE_USLEEP "Use usleep() system call to implement the xSleep method") +option(DISABLE_GETHOSTUUID "Disable function gethostuuid") add_library(${PROJECT_NAME} source_subfolder/sqlite3.c source_subfolder/sqlite3.h @@ -68,6 +69,9 @@ endif() if(HAVE_USLEEP) target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_USLEEP) endif() +if(DISABLE_GETHOSTUUID) + target_compile_definitions(${PROJECT_NAME} PRIVATE HAVE_GETHOSTUUID=0) +endif() target_compile_definitions(${PROJECT_NAME} PRIVATE SQLITE_THREADSAFE=${THREADSAFE}) install(TARGETS ${PROJECT_NAME} diff --git a/recipes/sqlite3/all/conanfile.py b/recipes/sqlite3/all/conanfile.py index 8dd7c7c2ad350..ecb366f721f53 100644 --- a/recipes/sqlite3/all/conanfile.py +++ b/recipes/sqlite3/all/conanfile.py @@ -23,7 +23,8 @@ class ConanSqlite3(ConanFile): "enable_json1": [True, False], "enable_rtree": [True, False], "omit_load_extension": [True, False], - "enable_unlock_notify": [True, False] + "enable_unlock_notify": [True, False], + "disable_gethostuuid": [True, False], } default_options = {"shared": False, "fPIC": True, @@ -36,7 +37,8 @@ class ConanSqlite3(ConanFile): "enable_json1": False, "enable_rtree": True, "omit_load_extension": False, - "enable_unlock_notify": True + "enable_unlock_notify": True, + "disable_gethostuuid": False, } _source_subfolder = "source_subfolder" @@ -80,6 +82,8 @@ def _configure_cmake(self): cmake.definitions["HAVE_POSIX_FALLOCATE"] = False if self.settings.os == "Android": cmake.definitions["HAVE_POSIX_FALLOCATE"] = False + if self.options.disable_gethostuuid: + cmake.definitions["DISABLE_GETHOSTUUID"] = True cmake.configure() return cmake diff --git a/recipes/stduuid/all/conandata.yml b/recipes/stduuid/all/conandata.yml new file mode 100644 index 0000000000000..4bece5ecf54aa --- /dev/null +++ b/recipes/stduuid/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + sha256: e96f2ac7c950c3c24d7e2e44a84236277b7774ee346dcc620edf400d9eda0a3c + url: https://github.com/mariusbancila/stduuid/archive/v1.0.tar.gz \ No newline at end of file diff --git a/recipes/stduuid/all/conanfile.py b/recipes/stduuid/all/conanfile.py new file mode 100644 index 0000000000000..76396c6d01f63 --- /dev/null +++ b/recipes/stduuid/all/conanfile.py @@ -0,0 +1,52 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanInvalidConfiguration +from conans.tools import Version +import os + + +class StduuidConan(ConanFile): + name = "stduuid" + description = "A C++17 cross-platform implementation for UUIDs" + topics = ("conan", "uuid", "guid") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mariusbancila/stduuid" + license = "MIT" + settings = "os", "compiler" + requires = "ms-gsl/2.0.0" + + no_copy_source = True + _source_subfolder = "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) + + def requirements(self): + if self.settings.os != "Windows": + self.requires("libuuid/1.0.3") + + def configure(self): + version = Version( self.settings.compiler.version ) + compiler = self.settings.compiler + if self.settings.compiler.cppstd and \ + not any([str(self.settings.compiler.cppstd) == std for std in ["17", "20", "gnu17", "gnu20"]]): + raise ConanInvalidConfiguration("stduuid requires at least c++17") + elif compiler == "Visual Studio": + if version < "16": + raise ConanInvalidConfiguration("stduuid requires at least Visual Studio version 16") + else: + if ( compiler == "gcc" and version < "7" ) or ( compiler == "clang" and version < "5" ): + raise ConanInvalidConfiguration("stduuid requires a compiler that supports at least C++17") + elif compiler == "apple-clang": + if version < "10": + raise ConanInvalidConfiguration("stduuid requires a compiler that supports at least C++17") + + def package(self): + root_dir = self._source_subfolder + include_dir = os.path.join(root_dir, "include") + self.copy(pattern="LICENSE", dst="licenses", src=root_dir) + self.copy(pattern="uuid.h", dst="include", src=include_dir) + + def package_id(self): + self.info.header_only() diff --git a/recipes/stduuid/all/test_package/CMakeLists.txt b/recipes/stduuid/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7eb421d150efc --- /dev/null +++ b/recipes/stduuid/all/test_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 2.8.12) +project(test_package) + +set(CMAKE_VERBOSE_MAKEFILE TRUE) + +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/stduuid/all/test_package/conanfile.py b/recipes/stduuid/all/test_package/conanfile.py new file mode 100644 index 0000000000000..bd7165a553cf4 --- /dev/null +++ b/recipes/stduuid/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/stduuid/all/test_package/test_package.cpp b/recipes/stduuid/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b19cec797852d --- /dev/null +++ b/recipes/stduuid/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include +#include "uuid.h" + +using namespace uuids; +using namespace std::string_literals; + +int main() { + + { + auto str = "47183823-2574-4bfd-b411-99ed177d3e43"s; + auto guid = uuids::uuid::from_string(str); + assert(uuids::to_string(guid) == str); + } + + { + uuid const guid = uuids::uuid_random_generator{}(); + assert(!guid.is_nil()); + assert(guid.size() == 16); + assert(guid.version() == uuids::uuid_version::random_number_based); + assert(guid.variant() == uuids::uuid_variant::rfc); + } + +} \ No newline at end of file diff --git a/recipes/stduuid/config.yml b/recipes/stduuid/config.yml new file mode 100644 index 0000000000000..e48437cd10c0d --- /dev/null +++ b/recipes/stduuid/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all \ No newline at end of file diff --git a/recipes/tinycbor/all/conandata.yml b/recipes/tinycbor/all/conandata.yml new file mode 100644 index 0000000000000..bd867242996ba --- /dev/null +++ b/recipes/tinycbor/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.5.3": + url: "https://github.com/intel/tinycbor/archive/v0.5.3.tar.gz" + sha256: "956eb4b670ea4969eaee67395b5bb6437b153960385b77357d6692e979d1b12d" +patches: + "0.5.3": + - patch_file: "patches/conan.patch" + base_path: "source_subfolder" + diff --git a/recipes/tinycbor/all/conanfile.py b/recipes/tinycbor/all/conanfile.py new file mode 100644 index 0000000000000..8f88ea357c6b1 --- /dev/null +++ b/recipes/tinycbor/all/conanfile.py @@ -0,0 +1,91 @@ +import os +from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conans.errors import ConanInvalidConfiguration + +class tinycborConan(ConanFile): + name = "tinycbor" + license = "MIT" + homepage = "https://github.com/intel/tinycbor" + url = "https://github.com/conan-io/conan-center-index" + description = ("A small CBOR encoder and decoder library, \ + optimized for very fast operation with very small footprint.") + settings = "os", "arch", "compiler", "build_type" + options = {"fPIC": [True, False], "shared": [True, False]} + default_options = {"fPIC": True, "shared": False} + topics = ("conan", "CBOR", "encoder", "decoder") + exports_sources = ["patches/*"] + _source_subfolder = "source_subfolder" + _env_build = None + _env_vars = [] + + 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.settings.os != "Linux" and self.options.shared: + raise ConanInvalidConfiguration("Shared library only supported on Linux platform") + + def source(self): + tools.get(**self.conan_data["sources"][self.version]) + extracted_dir = self.name + "-" + self.version + os.rename(extracted_dir, self._source_subfolder) + + def _configure_autotools(self): + if not self._env_build: + self._env_build = AutoToolsBuildEnvironment(self) + self._env_vars = self._env_build.vars + self._env_vars['DESTDIR'] = self.package_folder + if self.settings.os == "Windows": + self._env_vars["BUILD_SHARED"] = "0" + self._env_vars["BUILD_STATIC"] = "1" + else: + self._env_vars["BUILD_SHARED"] = "1" if self.options.shared else "0" + self._env_vars["BUILD_STATIC"] = "1" if not self.options.shared else "0" + self._env_build.fpic = self.options.fPIC + return self._env_build, self._env_vars + + def _build_nmake(self): + with tools.chdir(self._source_subfolder): + vcvars_command = tools.vcvars_command(self.settings) + self.run("%s && nmake -f Makefile.nmake" % vcvars_command) + + def _build_make(self): + with tools.chdir(self._source_subfolder): + env_build, env_vars = self._configure_autotools() + env_build.make(vars=env_vars) + + def build(self): + for patch in self.conan_data["patches"][self.version]: + tools.patch(**patch) + if self.settings.compiler == "Visual Studio": + self._build_nmake() + else: + self._build_make() + + def _package_unix(self): + with tools.chdir(self._source_subfolder): + env_build, env_vars = self._configure_autotools() + env_build.install(vars=env_vars) + tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + tools.rmdir(os.path.join(self.package_folder, "bin")) + + def _package_visual(self): + self.copy("tinycbor.lib", src=os.path.join(self._source_subfolder, "lib"), dst="lib") + for header in ["cbor.h", "cborjson.h", "tinycbor-version.h"]: + self.copy(header, src=os.path.join(self._source_subfolder, "src"), dst="include") + + def package(self): + self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + if self.settings.compiler == "Visual Studio": + self._package_visual() + else: + self._package_unix() + + def package_info(self): + self.cpp_info.libs = tools.collect_libs(self) + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m"] + self.cpp_info.includedirs = ["include", os.path.join("include","tinycbor")] diff --git a/recipes/tinycbor/all/patches/conan.patch b/recipes/tinycbor/all/patches/conan.patch new file mode 100644 index 0000000000000..7ded856e536c5 --- /dev/null +++ b/recipes/tinycbor/all/patches/conan.patch @@ -0,0 +1,33 @@ +--- Makefile 2019-10-22 08:11:21.000000000 -0700 ++++ Makefile_fix 2019-12-20 10:58:06.255975751 -0800 +@@ -1,15 +1,15 @@ + # Variables: +-prefix = /usr/local ++#prefix = /usr/local + exec_prefix = $(prefix) + bindir = $(exec_prefix)/bin + libdir = $(exec_prefix)/lib + includedir = $(prefix)/include + pkgconfigdir = $(libdir)/pkgconfig + +-CFLAGS = -Wall -Wextra +-LDFLAGS_GCSECTIONS = -Wl,--gc-sections ++CFLAGS += -Wall -Wextra ++LDFLAGS_GCSECTIONS += -Wl,--gc-sections + LDFLAGS += $(if $(gc_sections-pass),$(LDFLAGS_GCSECTIONS)) +-LDLIBS = -lm ++LDLIBS += -lm + + GIT_ARCHIVE = git archive --prefix="$(PACKAGE)/" -9 + INSTALL = install +@@ -31,8 +31,8 @@ + # + CBORDUMP_SOURCES = tools/cbordump/cbordump.c + +-BUILD_SHARED = $(shell file -L /bin/sh 2>/dev/null | grep -q ELF && echo 1) +-BUILD_STATIC = 1 ++BUILD_SHARED ?= $(shell file -L /bin/sh 2>/dev/null | grep -q ELF && echo 1) ++BUILD_STATIC ?= 1 + + ifneq ($(BUILD_STATIC),1) + ifneq ($(BUILD_SHARED),1) diff --git a/recipes/tinycbor/all/test_package/CMakeLists.txt b/recipes/tinycbor/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d4fdee1a8a79c --- /dev/null +++ b/recipes/tinycbor/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +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}) diff --git a/recipes/tinycbor/all/test_package/conanfile.py b/recipes/tinycbor/all/test_package/conanfile.py new file mode 100644 index 0000000000000..fcae7e3c40edd --- /dev/null +++ b/recipes/tinycbor/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class apriltagTestConan(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/tinycbor/all/test_package/example.cpp b/recipes/tinycbor/all/test_package/example.cpp new file mode 100644 index 0000000000000..a8abd1183cdfc --- /dev/null +++ b/recipes/tinycbor/all/test_package/example.cpp @@ -0,0 +1,15 @@ +#include +#include +#include "cbor.h" + +int main(int argc, char *argv[]) +{ + CborParser parser; + CborValue it; + size_t length; + uint8_t *buf = (uint8_t*)malloc(sizeof(int[10])); + CborError err = cbor_parser_init(buf, length, 0, &parser, &it); + + printf("Tinycbor test_package ran successfully \n"); + return 0; +} \ No newline at end of file diff --git a/recipes/tinycbor/config.yml b/recipes/tinycbor/config.yml new file mode 100644 index 0000000000000..2a0554e18df80 --- /dev/null +++ b/recipes/tinycbor/config.yml @@ -0,0 +1,3 @@ +versions: + "0.5.3": + folder: all diff --git a/recipes/zlib/1.2.11/conanfile.py b/recipes/zlib/1.2.11/conanfile.py index 82c20746b5299..a929412e25bf6 100644 --- a/recipes/zlib/1.2.11/conanfile.py +++ b/recipes/zlib/1.2.11/conanfile.py @@ -164,4 +164,5 @@ def package_info(self): self.cpp_info.defines.append('MINIZIP_DLL') self.cpp_info.libs.append('zlib' if self.settings.os == "Windows" else "z") self.cpp_info.name = "ZLIB" + self.cpp_info.names["pkg_config"] = "zlib" diff --git a/recipes/zlib/1.2.11/test_package/conanfile.py b/recipes/zlib/1.2.11/test_package/conanfile.py index 1a102ba9d3031..d0706d2d0eefd 100644 --- a/recipes/zlib/1.2.11/test_package/conanfile.py +++ b/recipes/zlib/1.2.11/test_package/conanfile.py @@ -6,7 +6,7 @@ class TestZlibConan(ConanFile): settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + generators = "cmake", "pkg_config" def configure(self): del self.settings.compiler.libcxx @@ -19,6 +19,7 @@ def build(self): def test(self): assert os.path.exists(os.path.join(self.deps_cpp_info["zlib"].rootpath, "licenses", "LICENSE")) + assert os.path.exists(os.path.join(self.build_folder, "zlib.pc")) if "x86" in self.settings.arch: self.run(os.path.join("bin", "test"), run_environment=True) if self.options["zlib"].minizip: