diff --git a/recipes/pdqsort/all/conandata.yml b/recipes/pdqsort/all/conandata.yml new file mode 100644 index 0000000000000..ad55de6e7ed19 --- /dev/null +++ b/recipes/pdqsort/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20210314": + url: "https://github.com/orlp/pdqsort/archive/b1ef26a55cdb60d236a5cb199c4234c704f46726.zip" + sha256: "1d3233bb341d70db17006487a53602b2b1596a5ba8fd496001610a30af066060" diff --git a/recipes/pdqsort/all/conanfile.py b/recipes/pdqsort/all/conanfile.py new file mode 100644 index 0000000000000..14f9652e0e043 --- /dev/null +++ b/recipes/pdqsort/all/conanfile.py @@ -0,0 +1,28 @@ +from conans import ConanFile, tools + +required_conan_version = ">=1.33.0" + + +class PdqsortConan(ConanFile): + name = "pdqsort" + description = "Pattern-defeating quicksort." + license = "Zlib" + topics = ("conan", "pdqsort", "sort") + homepage = "https://github.com/orlp/pdqsort" + 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.txt", dst="licenses", src=self._source_subfolder) + self.copy("pdqsort.h", dst="include", src=self._source_subfolder) diff --git a/recipes/pdqsort/all/test_package/CMakeLists.txt b/recipes/pdqsort/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..196188113685c --- /dev/null +++ b/recipes/pdqsort/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/pdqsort/all/test_package/conanfile.py b/recipes/pdqsort/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5216332f39f5c --- /dev/null +++ b/recipes/pdqsort/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/pdqsort/all/test_package/test_package.cpp b/recipes/pdqsort/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cd3fe658f6d2e --- /dev/null +++ b/recipes/pdqsort/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include + +#include + +int main() { + int v[10] = {3, -102, 4, 30, 432, -13531, -43, 1, 0, -3}; + + pdqsort(v, v + 10); + for (int i = 0; i < 10; ++i) { + std::cout << v[i] << ' '; + } + std::cout << std::endl; + + return 0; +} diff --git a/recipes/pdqsort/config.yml b/recipes/pdqsort/config.yml new file mode 100644 index 0000000000000..f68bd3d138f36 --- /dev/null +++ b/recipes/pdqsort/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210314": + folder: all