-
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.
* fire-hpp: added initial recipe, prerelease snapshot * fire-hpp: renamed copy of bsl so hook doesn't think it's for the recipe * fire-hpp: added c++11 check, switched test_package to use find_package() * fire-hpp: put CXX_STANDARD setting back into test_package/CMakeLists.txt * fire-hpp: removed copy of BSL, switched to extraction from header file. * fire-hpp: replaced prerelease with 0.2. (yay!)
- Loading branch information
Showing
6 changed files
with
88 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,4 @@ | ||
sources: | ||
"0.2": | ||
sha256: 50ac76005e5d45590355a51e5e1b62aba65c56f2003335acce0370da13d77b28 | ||
url: https://github.com/kongaskristjan/fire-hpp/archive/v0.2.tar.gz |
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,43 @@ | ||
from conans import ConanFile, CMake, tools | ||
import os | ||
|
||
class FireHppConan(ConanFile): | ||
name = "fire-hpp" | ||
homepage = "https://github.com/kongaskristjan/fire-hpp" | ||
url = "https://github.com/conan-io/conan-center-index" | ||
description = "Fire for C++: Create fully functional CLIs using function signatures" | ||
topics = ("command-line", "argument", "parser") | ||
license = "BSL-1.0" | ||
no_copy_source = True | ||
settings = "os", "arch", "compiler", "build_type" | ||
|
||
_source_subfolder = "source_subfolder" | ||
_build_subfolder = "build_subfolder" | ||
_cmake = None | ||
|
||
def configure(self): | ||
if self.settings.compiler.cppstd: | ||
tools.check_min_cppstd(self, 11) | ||
|
||
def source(self): | ||
tools.get(**self.conan_data["sources"][self.version]) | ||
extracted_dir = "{}-{}".format(self.name, self.version) | ||
os.rename(extracted_dir, self._source_subfolder) | ||
|
||
def _configure_cmake(self): | ||
if self._cmake: | ||
return self._cmake | ||
self._cmake = CMake(self) | ||
self._cmake.definitions["FIRE_EXAMPLES"] = False | ||
self._cmake.definitions["FIRE_UNIT_TESTS"] = False | ||
self._cmake.configure(source_folder=self._source_subfolder, build_folder=self._build_subfolder) | ||
return self._cmake | ||
|
||
def package(self): | ||
cmake = self._configure_cmake() | ||
cmake.install() | ||
self.copy("LICENCE", dst="licenses", src=self._source_subfolder) | ||
tools.rmdir(os.path.join(self.package_folder, "lib")) | ||
|
||
def package_id(self): | ||
self.info.header_only() |
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 CXX) | ||
|
||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) | ||
conan_basic_setup() | ||
|
||
find_package(fire-hpp REQUIRED) | ||
|
||
add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) | ||
target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE fire-hpp::fire-hpp) | ||
set_property(TARGET ${CMAKE_PROJECT_NAME} 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,18 @@ | ||
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 not tools.cross_building(self.settings): | ||
bin_path = os.path.join("bin", "test_package") | ||
bin_args = "-x=1 -y=2" | ||
self.run("{} {}".format(bin_path, bin_args), 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,9 @@ | ||
#include <fire-hpp/fire.hpp> | ||
#include <iostream> | ||
|
||
int fired_main(int x = fire::arg("-x"), int y = fire::arg("-y")) { | ||
std::cout << x + y << std::endl; | ||
return 0; | ||
} | ||
|
||
FIRE(fired_main) |
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: | ||
"0.2": | ||
folder: all |