mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-24 22:36:10 +01:00
a2a3c55058
* Improve Conan recipe support * export files * supports c++14 * update Conan client in the CI * Better compatibility with Conan 1.x * Manage options and cppstd for Conan 1.x * copy eveything from extra Signed-off-by: Uilian Ries <uilianries@gmail.com>
41 lines
1.3 KiB
Python
41 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
from conan import ConanFile
|
|
from conan.tools.cmake import CMake, cmake_layout
|
|
from conan.tools.build import can_run
|
|
from conan.tools.files import save, load
|
|
import os
|
|
|
|
|
|
class TestPackageConan(ConanFile):
|
|
settings = "os", "compiler", "build_type", "arch"
|
|
generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv"
|
|
test_type = "explicit"
|
|
|
|
def requirements(self):
|
|
self.requires(self.tested_reference_str)
|
|
|
|
def layout(self):
|
|
cmake_layout(self)
|
|
|
|
def generate(self):
|
|
save(self, os.path.join(self.build_folder, "package_folder"),
|
|
self.dependencies[self.tested_reference_str].package_folder)
|
|
save(self, os.path.join(self.build_folder, "license"),
|
|
self.dependencies[self.tested_reference_str].license)
|
|
|
|
def build(self):
|
|
cmake = CMake(self)
|
|
cmake.configure()
|
|
cmake.build()
|
|
|
|
def test(self):
|
|
if can_run(self):
|
|
cmd = os.path.join(self.cpp.build.bindir, "test_package")
|
|
self.run(cmd, env="conanrun")
|
|
|
|
package_folder = load(self, os.path.join(self.build_folder, "package_folder"))
|
|
license = load(self, os.path.join(self.build_folder, "license"))
|
|
assert os.path.isfile(os.path.join(package_folder, "licenses", "LICENSE.txt"))
|
|
assert license == 'BSL-1.0'
|