Permalink
Browse files

Merge pull request #10 from uilianries/master

Update Conan Support
  • Loading branch information...
hanickadot committed Oct 8, 2018
2 parents a509688 + d26825e commit 1ad5444a0448146b55f4980f6c00dbf547dcc3a7
Showing with 96 additions and 2 deletions.
  1. +15 −0 .conan/build.py
  2. +11 −0 .conan/test_package/CMakeLists.txt
  3. +20 −0 .conan/test_package/conanfile.py
  4. +30 −0 .conan/test_package/test_package.cpp
  5. +2 −0 .gitignore
  6. +14 −0 .travis.yml
  7. +4 −2 conanfile.py
View
@@ -0,0 +1,15 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from cpt.packager import ConanMultiPackager
if __name__ == "__main__":
builder = ConanMultiPackager(
username="crte",
upload="https://api.bintray.com/conan/hanickadot/ctre",
upload_only_when_stable=True,
stable_branch_pattern="v?\d+\.\d+.*",
test_folder=os.path.join(".conan", "test_package"))
builder.add_common_builds()
builder.run()
@@ -0,0 +1,11 @@
project(test_package CXX)
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
@@ -0,0 +1,20 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile, CMake, tools, RunEnvironment
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):
assert os.path.exists(os.path.join(self.deps_cpp_info["CTRE"].rootpath, "licenses", "LICENSE"))
bin_path = os.path.join("bin", "test_package")
self.run(bin_path, run_environment=True)
@@ -0,0 +1,30 @@
#include <cstdlib>
#include <cassert>
#include <string_view>
#include <optional>
#include <ctre.hpp>
using namespace std::string_view_literals;
using namespace ctre::literals;
struct date { std::string_view year; std::string_view month; std::string_view day; };
constexpr std::optional<date> extract_date(std::string_view s) noexcept {
if (auto [whole, year, month, day] = "^([0-9]{4})/([0-9]{1,2}+)/([0-9]{1,2}+)$"_ctre.match(s); whole
) {
return date{year.to_view(), month.to_view(), day.to_view()};
} else {
return std::nullopt;
}
}
int main() {
assert(extract_date("2018/08/27"sv).has_value());
assert(extract_date("2018/08/27"sv)->year == "2018"sv);
assert(extract_date("2018/08/27"sv)->month == "08"sv);
assert(extract_date("2018/08/27"sv)->day == "27"sv);
return EXIT_SUCCESS;
}
View
@@ -4,3 +4,5 @@ test
result
tests/benchmark-exec/*
!tests/benchmark-exec/*.cpp
*.pyc
.conan/test_package/build
View
@@ -22,6 +22,20 @@ matrix:
sources: ['ubuntu-toolchain-r-test', 'llvm-toolchain-trusty-6.0']
packages: ['g++-8', 'clang-6.0']
- os: linux
language: python
python: "3.6"
services:
- docker
env:
- COMPILER=g++-8
- CONAN_GCC_VERSIONS=8
- CONAN_DOCKER_IMAGE=lasote/conangcc8
install:
- pip install -U conan conan-package-tools
script:
- python .conan/build.py
- os: osx
osx_image: xcode9.4
View
@@ -1,11 +1,13 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from conans import ConanFile
class CtreConan(ConanFile):
name = "CTRE"
version = "2.0"
license = "MIT"
url = "https://github.com/hanickadot/compile-time-regular-expressions.git"
url = "https://github.com/hanickadot/compile-time-regular-expressions"
author = "Hana Dusíková (ctre@hanicka.net)"
description = "Compile Time Regular Expression for C++17/20"
homepage = "https://github.com/hanickadot/compile-time-regular-expressions"
@@ -17,8 +19,8 @@ class CtreConan(ConanFile):
}
def package(self):
self.copy("LICENSE", "licenses")
self.copy("*.hpp")
self.copy("LICENSE")
def package_id(self):
self.info.header_only()

0 comments on commit 1ad5444

Please sign in to comment.