-
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.
* add effcee recipe * correct version name * Apply suggestions from code review Fix conan build Co-authored-by: Uilian Ries <uilianries@gmail.com> * set minimal cpp_std to 14 * force cpp11 * Apply suggestions from code review Co-authored-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Chris Mc <prince.chrismc@gmail.com> * simplify test * set min cpp standard to cpp11 in test package * forbid overriding of runting in windows * make EFFCEE_ENABLE_SHARED_CRT dependend from compiler's runtime * override runtime only for MSVC * add patch for install * forbid shared lib with mt runtime * move checks to validate method * import invalid configuration * Update recipes/effcee/all/CMakeLists.txt Export all symbols on windows Co-authored-by: Chris Mc <prince.chrismc@gmail.com> * Update recipes/effcee/all/conanfile.py Co-authored-by: Chris Mc <prince.chrismc@gmail.com> * Apply suggestions from code review Co-authored-by: Uilian Ries <uilianries@gmail.com> * correct review changes Co-authored-by: Uilian Ries <uilianries@gmail.com> Co-authored-by: Chris Mc <prince.chrismc@gmail.com>
- Loading branch information
1 parent
b2d9911
commit 71d7732
Showing
9 changed files
with
169 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,15 @@ | ||
cmake_minimum_required(VERSION 3.4) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) | ||
|
||
if(NOT CMAKE_CXX_STANDARD) | ||
set(CMAKE_CXX_STANDARD 11) | ||
endif() | ||
|
||
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,10 @@ | ||
sources: | ||
"2019.1": | ||
sha256: 332586221ef53a615cc6595cc54643610b1f9f77acd2862860a1eda6f03de8b9 | ||
url: https://github.com/google/effcee/archive/refs/tags/v2019.1.zip | ||
patches: | ||
"2019.1": | ||
- base_path: "source_subfolder" | ||
patch_file: "patches/0001-substitute-conan-libs.patch" | ||
- base_path: "source_subfolder" | ||
patch_file: "patches/0002-fix_install.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,77 @@ | ||
import os | ||
from conans import ConanFile, CMake, tools | ||
from conans.errors import ConanInvalidConfiguration | ||
|
||
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 validate(self): | ||
if self.settings.compiler.get_safe("cppstd"): | ||
tools.check_min_cppstd(self, "11") | ||
if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime: | ||
raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") | ||
|
||
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.definitions["RE2_BUILD_TESTING"] = False | ||
if self.settings.compiler == "Visual Studio": | ||
self._cmake.definitions["EFFCEE_ENABLE_SHARED_CRT"] = (self.settings.compiler.runtime in ["MD", "MDd"]) | ||
|
||
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,15 @@ | ||
diff --git a/effcee/CMakeLists.txt b/effcee/CMakeLists.txt | ||
index 840c87f..af94ca9 100644 | ||
--- a/effcee/CMakeLists.txt | ||
+++ b/effcee/CMakeLists.txt | ||
@@ -13,9 +13,7 @@ install( | ||
effcee.h | ||
DESTINATION | ||
include/effcee) | ||
-install(TARGETS effcee | ||
- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
+install(TARGETS effcee DESTINATION ${CMAKE_INSTALL_LIBDIR}) | ||
|
||
if(EFFCEE_BUILD_TESTING) | ||
add_executable(effcee-test |
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,13 @@ | ||
cmake_minimum_required(VERSION 3.1) | ||
project(test_package) | ||
|
||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup(TARGETS) | ||
|
||
find_package(effcee REQUIRED) | ||
|
||
add_executable(effcee-example main.cc) | ||
|
||
target_link_libraries(effcee-example effcee::effcee) | ||
set_property(TARGET effcee-example PROPERTY CXX_STANDARD 11) |
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,17 @@ | ||
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): | ||
if tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "effcee-example") | ||
self.run(bin_path, run_environment=True) |
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,7 @@ | ||
#include "effcee/effcee.h" | ||
|
||
int main(void) { | ||
auto match = effcee::Match("foo bar qux", "foo", | ||
effcee::Options().SetChecksName("checks")); | ||
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 |