Skip to content

Commit

Permalink
(#3405) add fire-hpp/0.2
Browse files Browse the repository at this point in the history
* 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
eigenwhat authored Nov 10, 2020
1 parent 48fd422 commit e3e9050
Show file tree
Hide file tree
Showing 6 changed files with 88 additions and 0 deletions.
4 changes: 4 additions & 0 deletions recipes/fire-hpp/all/conandata.yml
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
43 changes: 43 additions & 0 deletions recipes/fire-hpp/all/conanfile.py
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()
11 changes: 11 additions & 0 deletions recipes/fire-hpp/all/test_package/CMakeLists.txt
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)
18 changes: 18 additions & 0 deletions recipes/fire-hpp/all/test_package/conanfile.py
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)
9 changes: 9 additions & 0 deletions recipes/fire-hpp/all/test_package/test_package.cpp
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)
3 changes: 3 additions & 0 deletions recipes/fire-hpp/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
versions:
"0.2":
folder: all

0 comments on commit e3e9050

Please sign in to comment.