Skip to content

Commit ab28558

Browse files
committed
Created Conan Package
1 parent 948c8aa commit ab28558

File tree

6 files changed

+87
-0
lines changed

6 files changed

+87
-0
lines changed

CMakeLists.txt

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
cmake_minimum_required(VERSION 3.15)
2+
project(fpgen CXX)
3+
4+
add_library(fpgen PUBLIC)
5+
target_include_directories(fpgen PUBLIC inc)
6+
7+
set_target_properties(
8+
fpgen
9+
PROPERTIES PUBLIC_HEADER
10+
"inc/fpgen.hpp" "inc/aggregators.hpp" "inc/generator.hpp"
11+
"inc/manipulators.hpp" "inc/sources.hpp" "inc/type_traits.hpp"
12+
)
13+
14+
install(TARGETS fpgen)

conanfile.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from conans import ConanFile
2+
3+
4+
class Fpgen(ConanFile):
5+
name = "fpgen"
6+
version = "1.0.1"
7+
# header only, so no settings/options
8+
exports_sources = "inc/*", "include/*"
9+
no_copy_source = True
10+
11+
def package_info(self):
12+
self.cpp_info.includedirs = ["inc", "include"]
13+
14+
def package(self):
15+
self.copy("*.hpp", dst="include", src="inc")
16+
self.copy("*.h", dst="include", src="inc")
17+
18+
def package_id(self):
19+
self.info.header_only()

test_package/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
conan.lock
2+
conanbuildinfo.txt
3+
conaninfo.txt
4+
graph_info.json
5+
build/*
6+
cmake-build-release/*

test_package/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
PROJECT(PackageTest)
2+
cmake_minimum_required(VERSION 2.8.12)
3+
4+
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
5+
set(CMAKE_CXX_FLAGS "-std=c++20")
6+
conan_basic_setup()
7+
8+
ADD_EXECUTABLE(example src/example.cpp)
9+
TARGET_LINK_LIBRARIES(example ${CONAN_LIBS})

test_package/conanfile.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from conans import ConanFile, CMake
2+
import os
3+
4+
5+
# channel = os.getenv("CONAN_CHANNEL", "stable")
6+
# username = os.getenv("CONAN_USERNAME", "memsharded")
7+
8+
9+
class fpgenTestConan(ConanFile):
10+
settings = "os", "compiler", "build_type", "arch"
11+
requires = "fpgen/1.0.1@demo/testing"
12+
generators = "cmake"
13+
14+
def build(self):
15+
cmake = CMake(self)
16+
# self.run('cmake "%s" %s' % (self.conanfile_directory, cmake.command_line))
17+
# self.run("cmake --build . %s" % cmake.build_config)
18+
cmake.configure()
19+
cmake.build()
20+
21+
def imports(self):
22+
self.copy("*.dll", "bin", "bin")
23+
self.copy("*.dylib", "bin", "bin")
24+
25+
def test(self):
26+
os.chdir("bin")
27+
self.run(".%sexample" % os.sep)

test_package/src/example.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#include <vector>
2+
#include <iostream>
3+
#include "fpgen.hpp"
4+
5+
int main() {
6+
std::vector<int> vals = {0,1,2,3};
7+
auto gen = fpgen::from(vals);
8+
9+
for(auto &&val : gen) {
10+
std::cout << val << std::endl;
11+
}
12+
}

0 commit comments

Comments
 (0)