Skip to content

Commit

Permalink
(#5739) add pdqsort/cci.20210314
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm authored Jun 4, 2021
1 parent acd4ec3 commit cd32561
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/pdqsort/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
sources:
"cci.20210314":
url: "https://github.com/orlp/pdqsort/archive/b1ef26a55cdb60d236a5cb199c4234c704f46726.zip"
sha256: "1d3233bb341d70db17006487a53602b2b1596a5ba8fd496001610a30af066060"
28 changes: 28 additions & 0 deletions recipes/pdqsort/all/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
8 changes: 8 additions & 0 deletions recipes/pdqsort/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
17 changes: 17 additions & 0 deletions recipes/pdqsort/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -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)
15 changes: 15 additions & 0 deletions recipes/pdqsort/all/test_package/test_package.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include <pdqsort.h>

#include <iostream>

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;
}
3 changes: 3 additions & 0 deletions recipes/pdqsort/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"cci.20210314":
folder: all

0 comments on commit cd32561

Please sign in to comment.