-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f590070
commit 15a40d8
Showing
8 changed files
with
191 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
cmake_minimum_required(VERSION 2.8.11) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(re2 REQUIRED CONFIG) | ||
|
||
add_subdirectory(source_subfolder/) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
sources: | ||
"v2019.1": | ||
sha256: 332586221ef53a615cc6595cc54643610b1f9f77acd2862860a1eda6f03de8b9 | ||
url: https://github.com/google/effcee/archive/refs/tags/v2019.1.zip | ||
patches: | ||
"v2019.1": | ||
- base_path: "source_subfolder" | ||
patch_file: "patches/0001-substitute-conan-libs.patch" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
import os | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
class EffceeConan(ConanFile): | ||
name = "effcee" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
homepage = "https://github.com/google/effcee/" | ||
description = "Zstandard - Fast real-time compression algorithm" | ||
topics = ("conan", "effcee", "strings", "algorithm", "matcher") | ||
license = "Apache 2.0" | ||
exports_sources = ["CMakeLists.txt", "patches/**"] | ||
generators = "cmake", "cmake_find_package_multi" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = {"shared": [True, False], "fPIC": [True, False]} | ||
default_options = {"shared": False, "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 | ||
|
||
def configure(self): | ||
if self.options.shared: | ||
del self.options.fPIC | ||
|
||
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["EFFCEE_BUILD_TESTING"] = False | ||
self._cmake.definitions["EFFCEE_BUILD_SAMPLES"] = False | ||
self._cmake.configure(build_folder=self._build_subfolder) | ||
return self._cmake | ||
|
||
def _patch_sources(self): | ||
for patch in self.conan_data.get("patches", {}).get(self.version, []): | ||
tools.patch(**patch) | ||
|
||
def requirements(self): | ||
self.requires('re2/20210601') | ||
|
||
def build(self): | ||
self._patch_sources() | ||
cmake = self._configure_cmake() | ||
cmake.build() | ||
|
||
def package(self): | ||
self.copy(pattern="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) | ||
|
12 changes: 12 additions & 0 deletions
12
recipes/effcee/all/patches/0001-substitute-conan-libs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff --git a/CMakeLists.txt b/CMakeLists.txt | ||
index d96e44a..6268fe3 100644 | ||
--- a/CMakeLists.txt | ||
+++ b/CMakeLists.txt | ||
@@ -33,7 +33,6 @@ include(cmake/setup_build.cmake) | ||
include(cmake/utils.cmake) | ||
include(GNUInstallDirs) | ||
|
||
-add_subdirectory(third_party) | ||
add_subdirectory(effcee) | ||
add_subdirectory(fuzzer) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(effcee REQUIRED) | ||
|
||
add_executable(effcee-example main.cc) | ||
|
||
target_link_libraries(effcee-example ${CONAN_LIBS}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import os | ||
from conans import ConanFile, CMake, tools | ||
|
||
|
||
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): | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2017 The Effcee Authors. | ||
// | ||
// 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 <iostream> | ||
#include <sstream> | ||
|
||
#include "effcee/effcee.h" | ||
|
||
// Checks standard input against the list of checks provided as command line | ||
// arguments. | ||
// | ||
// Example: | ||
// cat <<EOF >sample_data.txt | ||
// Bees | ||
// Make | ||
// Delicious Honey | ||
// EOF | ||
// effcee-example <sample_data.txt "CHECK: Bees" "CHECK-NOT:Sting" "CHECK: Honey" | ||
int main(int argc, char* argv[]) { | ||
// Read the command arguments as a list of check rules. | ||
std::ostringstream checks_stream; | ||
for (int i = 1; i < argc; ++i) { | ||
checks_stream << argv[i] << "\n"; | ||
} | ||
// Read stdin as the input to match. | ||
std::stringstream input_stream; | ||
std::cin >> input_stream.rdbuf(); | ||
|
||
// Attempt to match. The input and checks arguments can be provided as | ||
// std::string or pointer to char. | ||
auto result = effcee::Match(input_stream.str(), checks_stream.str(), | ||
effcee::Options().SetChecksName("checks")); | ||
|
||
// Successful match result converts to true. | ||
if (result) { | ||
std::cout << "The input matched your check list!" << std::endl; | ||
} else { | ||
// Otherwise, you can get a status code and a detailed message. | ||
switch (result.status()) { | ||
case effcee::Result::Status::NoRules: | ||
std::cout << "error: Expected check rules as command line arguments\n"; | ||
break; | ||
case effcee::Result::Status::Fail: | ||
std::cout << "The input failed to match your check rules:\n"; | ||
break; | ||
default: | ||
break; | ||
} | ||
std::cout << result.message() << std::endl; | ||
return 1; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
versions: | ||
"2019.1": | ||
folder: all |