Sfoglia il codice sorgente

Basic Conan packaging files added (#157).

The previous conanfile.txt has been replaced by the conanfile.py.
main
offa 5 anni fa
parent
commit
1d63bcabeb
5 ha cambiato i file con 82 aggiunte e 8 eliminazioni
  1. +37
    -0
      conanfile.py
  2. +0
    -8
      conanfile.txt
  3. +14
    -0
      test_package/CMakeLists.txt
  4. +25
    -0
      test_package/conanfile.py
  5. +6
    -0
      test_package/example.cpp

+ 37
- 0
conanfile.py Vedi File

@@ -0,0 +1,37 @@
import os

from conans import ConanFile, CMake, tools


class ScopeguardConan(ConanFile):
name = "scope-guard"
version = "0.3.5"
license = "MIT"
author = "offa <offa@github>"
url = "https://github.com.offa/scope-guard"
description = "Implementation of Scoped Guards and Unique Resource as proposed in P0052."
homepage = "https://github.com/mrtazz/restclient-cpp"
topics = ("cpp", "cpp17", "p0052", "scope-guard",
"scope-exit", "scope-fail", "scope-success", "unique-resource", "cmake")
no_copy_source = True
_source_dir = "{}-{}".format(name, version)
scm = {
"type": "git",
"subfolder": _source_dir,
"url": "{}.git".format(homepage),
"revision": version
}
requires = (
"Catch2/2.9.2@catchorg/stable",
"trompeloeil/v34@rollbear/stable"
)


def _configure_cmake(self):
cmake = CMake(self)
cmake.configure(source_folder=self._source_dir, build_folder="build")
return cmake

def package(self):
cmake = self._configure_cmake()
cmake.install()

+ 0
- 8
conanfile.txt Vedi File

@@ -1,8 +0,0 @@
[requires]
Catch2/2.9.2@catchorg/stable
trompeloeil/v34@rollbear/stable

[generators]
cmake_find_package
cmake_paths


+ 14
- 0
test_package/CMakeLists.txt Vedi File

@@ -0,0 +1,14 @@
cmake_minimum_required(VERSION 2.8.12)
project(PackageTest CXX)

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

add_executable(example example.cpp)
target_link_libraries(example ${CONAN_LIBS})

# CTest is a testing tool that can be used to test your project.
# enable_testing()
# add_test(NAME example
# WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/bin
# COMMAND example)

+ 25
- 0
test_package/conanfile.py Vedi File

@@ -0,0 +1,25 @@
import os

from conans import ConanFile, CMake, tools


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

def build(self):
cmake = CMake(self)
# Current dir is "test_package/build/<build_id>" and CMakeLists.txt is
# in "test_package"
cmake.configure()
cmake.build()

def imports(self):
self.copy("*.dll", dst="bin", src="bin")
self.copy("*.dylib*", dst="bin", src="lib")
self.copy('*.so*', dst='bin', src='lib')

def test(self):
if not tools.cross_building(self.settings):
os.chdir("bin")
self.run(".%sexample" % os.sep)

+ 6
- 0
test_package/example.cpp Vedi File

@@ -0,0 +1,6 @@
#include <iostream>
#include "hello.h"

int main() {
hello();
}

Loading…
Annulla
Salva