Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to Conan2 #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 18 additions & 26 deletions conanfile.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
import re

from conans import CMake, ConanFile, tools


def get_version():
try:
content = tools.load("CMakeLists.txt")
version = re.search("set\\(MORE_CONCEPTS_VERSION (.*)\\)", content).group(1)
return version.strip()
except OSError:
return None

from conan import ConanFile
from conan.tools.cmake import CMakeToolchain, CMake
from conan.tools.files import load, copy

class MoreConcepts(ConanFile):
name = "more_concepts"
version = get_version()
revision_mode = "scm"
description = "C++20 concepts library, providing container concepts and more."
homepage = "https://github.com/MiSo1289/more_concepts"
Expand All @@ -26,21 +17,22 @@ class MoreConcepts(ConanFile):
"tests/*",
"CMakeLists.txt",
)

def build(self):
cmake = CMake(self)

do_test = tools.get_env("CONAN_RUN_TESTS", True)
cmake.definitions["BUILD_TESTING"] = do_test

cmake.configure()
cmake.build()

if do_test:
cmake.test()
no_copy_source = True

def package(self):
self.copy("*.hpp", dst="include", src="include")
copy(self, "*.hpp", self.source_folder, self.package_folder)

def package_id(self):
self.info.header_only()
self.info.clear()

def package_info(self):
self.cpp_info.bindirs = []
self.cpp_info.libdirs = []

def set_version(self):
try:
content = load(self, "CMakeLists.txt")
version = re.search("set\\(MORE_CONCEPTS_VERSION (.*)\\)", content).group(1)
self.version = version.strip()
except OSError:
return None