Skip to content

Commit

Permalink
(#11088) fast-cpp-csv-parser: add version cci.20211104 and modernize
Browse files Browse the repository at this point in the history
  • Loading branch information
toge authored Jun 8, 2022
1 parent 7447e7e commit 9051a69
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 14 deletions.
3 changes: 3 additions & 0 deletions recipes/fast-cpp-csv-parser/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sources:
"cci.20211104":
url: "https://github.com/ben-strasser/fast-cpp-csv-parser/archive/5a417973b4cea674a5e4a3b88a23098a2ab75479.zip"
sha256: "33a22bda2603a87b8f36c79673339490f58656d92a4882e788de3f4ef7ec57b2"
"cci.20200830":
url: "https://github.com/ben-strasser/fast-cpp-csv-parser/archive/1165be530d19ed730228dd122f2df0896be8f64e.zip"
sha256: "28ae9e3b95dcb7a78086ff1425f3bd1258407ebedc34d8517c5bcb8084b5833e"
Expand Down
24 changes: 14 additions & 10 deletions recipes/fast-cpp-csv-parser/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,16 @@

from conans import ConanFile, tools

required_conan_version = ">=1.33.0"

class FastcppcsvparserConan(ConanFile):
name = "fast-cpp-csv-parser"
description = "C++11 header-only library for reading comma separated value (CSV) files."
license = "BSD-3-Clause"
topics = ("conan", "fast-cpp-csv-parser", "csv", "parser", "header-only")
homepage = "https://github.com/ben-strasser/fast-cpp-csv-parser"
url = "https://github.com/conan-io/conan-center-index"
settings = "os", "compiler"
homepage = "https://github.com/ben-strasser/fast-cpp-csv-parser"
topics = ("csv", "parser", "header-only")
settings = "os", "arch", "compiler", "build_type"
no_copy_source = True
options = {"with_thread": [True, False]}
default_options = {"with_thread": True}
Expand All @@ -18,15 +20,13 @@ class FastcppcsvparserConan(ConanFile):
def _source_subfolder(self):
return "source_subfolder"

def configure(self):
if self.settings.compiler.cppstd:
def validate(self):
if self.settings.compiler.get_safe("cppstd"):
tools.check_min_cppstd(self, 11)

def source(self):
tools.get(**self.conan_data["sources"][self.version])
url = self.conan_data["sources"][self.version]["url"]
extracted_dir = self.name + "-" + os.path.splitext(os.path.basename(url))[0]
os.rename(extracted_dir, self._source_subfolder)
tools.get(**self.conan_data["sources"][self.version],
destination=self._source_subfolder, strip_root=True)

def package(self):
self.copy("LICENSE", dst="licenses", src=self._source_subfolder)
Expand All @@ -36,8 +36,12 @@ def package_id(self):
self.info.header_only()

def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.frameworkdirs = []
self.cpp_info.libdirs = []
self.cpp_info.resdirs = []
self.cpp_info.includedirs = ["include", os.path.join("include", "fast-cpp-csv-parser")]
if not self.options.with_thread:
self.cpp_info.defines.append("CSV_IO_NO_THREAD")
if self.settings.os == "Linux" and self.options.with_thread:
if self.settings.os in ["Linux", "FreeBSD"] and self.options.with_thread:
self.cpp_info.system_libs.append("pthread")
8 changes: 5 additions & 3 deletions recipes/fast-cpp-csv-parser/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ cmake_minimum_required(VERSION 3.1)
project(test_package)

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()
conan_basic_setup(TARGETS)

find_package(fast-cpp-csv-parser REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.cpp)
target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS})
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11)
target_link_libraries(${PROJECT_NAME} fast-cpp-csv-parser::fast-cpp-csv-parser)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11)
2 changes: 1 addition & 1 deletion recipes/fast-cpp-csv-parser/all/test_package/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

class TestPackageConan(ConanFile):
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
generators = "cmake", "cmake_find_package_multi"

def build(self):
cmake = CMake(self)
Expand Down
2 changes: 2 additions & 0 deletions recipes/fast-cpp-csv-parser/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
versions:
"cci.20211104":
folder: all
"cci.20200830":
folder: all
"20191004":
Expand Down

0 comments on commit 9051a69

Please sign in to comment.