| 1 |
import os |
| 2 |
|
| 3 |
from conan import ConanFile |
| 4 |
from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout |
| 5 |
from conan.tools.build import can_run |
| 6 |
|
| 7 |
|
| 8 |
class CppGirExampleConan(ConanFile): |
| 9 |
version = "2.0.0" |
| 10 |
name = "cppgir-example" |
| 11 |
description = "cppgir example" |
| 12 |
license = "MIT Software License" |
| 13 |
url = "https://gitlab.com/mnauw/cppgir.git" |
| 14 |
exports_sources = "src/*", "CMakeLists.txt" |
| 15 |
settings = "os", "compiler", "build_type", "arch" |
| 16 |
build_policy = "missing" |
| 17 |
author = "Mark Nauwelaerts" |
| 18 |
|
| 19 |
def requirements(self): |
| 20 |
req = self.tested_reference_str |
| 21 |
if req is None: |
| 22 |
req = "cppgir/" + self.version |
| 23 |
self.requires(req) |
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
def build_requirements(self): |
| 31 |
self.tool_requires("cppgir/<host_version>", |
| 32 |
options={'header_only': False}) |
| 33 |
|
| 34 |
def layout(self): |
| 35 |
cmake_layout(self, build_folder="build.conan") |
| 36 |
|
| 37 |
def generate(self): |
| 38 |
tc = CMakeToolchain(self) |
| 39 |
tc.generate() |
| 40 |
|
| 41 |
def build(self): |
| 42 |
cmake = CMake(self) |
| 43 |
cmake.configure() |
| 44 |
cmake.build() |
| 45 |
|
| 46 |
def test(self): |
| 47 |
if can_run(self): |
| 48 |
cmd = os.path.join(self.cpp.build.bindir, "ext-gobject") |
| 49 |
self.run(cmd, env="conanrun") |