-
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
Showing
8 changed files
with
436 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,7 @@ | ||
cmake_minimum_required(VERSION 2.8.11) | ||
project(cmake_wrapper) | ||
|
||
include(conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
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,4 @@ | ||
sources: | ||
"1.0": | ||
url: "https://github.com/lzfse/lzfse/archive/lzfse-1.0.tar.gz" | ||
sha256: "cf85f373f09e9177c0b21dbfbb427efaedc02d035d2aade65eb58a3cbf9ad267" |
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,58 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
class LzfseConan(ConanFile): | ||
name = "lzfse" | ||
description = "Lempel-Ziv style data compression algorithm using Finite State Entropy coding." | ||
license = "BSD-3-Clause" | ||
topics = ("conan", "lzfse", "compression", "decompression") | ||
homepage = "https://github.com/lzfse/lzfse" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
exports_sources = "CMakeLists.txt" | ||
generators = "cmake" | ||
settings = "os", "arch", "compiler", "build_type" | ||
options = {"shared": [True, False], "fPIC": [True, False]} | ||
default_options = {"shared": False, "fPIC": True} | ||
|
||
@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): | ||
del self.settings.compiler.libcxx | ||
del self.settings.compiler.cppstd | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
os.rename("{0}-{0}-{1}".format(self.name, self.version), self._source_subfolder) | ||
|
||
def build(self): | ||
tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), | ||
"POSITION_INDEPENDENT_CODE TRUE", "") | ||
cmake = CMake(self) | ||
cmake.definitions["LZFSE_BUNDLE_MODE"] = False | ||
cmake.configure(build_folder=self._build_subfolder) | ||
cmake.build(target="lzfse") | ||
|
||
def package(self): | ||
self.copy("LICENSE", dst="licenses", src=self._source_subfolder) | ||
self.copy("lzfse.h", dst="include", src=os.path.join(self._source_subfolder, "src")) | ||
build_lib_dir = os.path.join(self._build_subfolder, "lib") | ||
build_bin_dir = os.path.join(self._build_subfolder, "bin") | ||
self.copy(pattern="*.a", dst="lib", src=build_lib_dir, keep_path=False) | ||
self.copy(pattern="*.lib", dst="lib", src=build_lib_dir, keep_path=False) | ||
self.copy(pattern="*.dylib", dst="lib", src=build_lib_dir, keep_path=False) | ||
self.copy(pattern="*.so", dst="lib", src=build_lib_dir, keep_path=False) | ||
self.copy(pattern="*.dll", dst="bin", src=build_bin_dir, keep_path=False) | ||
|
||
def package_info(self): | ||
self.cpp_info.libs = tools.collect_libs(self) |
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 3.1) | ||
project(test_package C) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
add_executable(${PROJECT_NAME} test_package.c) | ||
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) | ||
set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) |
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,18 @@ | ||
import os | ||
|
||
from conans import ConanFile, CMake, tools | ||
|
||
class TestPackageConan(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "cmake" | ||
|
||
def build(self): | ||
cmake = CMake(self) | ||
cmake.configure() | ||
cmake.build() | ||
|
||
def test(self): | ||
if not tools.cross_building(self.settings): | ||
txt_name = os.path.join(self.source_folder, "test.txt") | ||
bin_path = os.path.join("bin", "test_package") | ||
self.run("{0} -encode -i {1}".format(bin_path, txt_name), 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 @@ | ||
I'm waiting to be compressed. |
Oops, something went wrong.