diff --git a/conanfile.py b/conanfile.py index 400991d..9a08001 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,29 +1,48 @@ # -*- coding: utf-8 -*- from conans import ConanFile +from conans.errors import ConanInvalidConfiguration class NameofConan(ConanFile): - name = 'nameof' - version = '0.9.0' - description = 'Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum.' + name = "nameof" + version = "0.9.0" + description = "Header-only C++17 library provides nameof macros and functions to simply obtain the name of a variable, type, function, macro, and enum." topics = ( - 'conan', - 'nameof', - 'cplusplus', - 'enum-to-string', - 'serialization', - 'reflection', - 'header-only', - 'compile-time' + "conan", + "nameof", + "cplusplus", + "enum-to-string", + "serialization", + "reflection", + "header-only", + "compile-time" ) - url = 'https://github.com/Neargye/nameof' - homepage = 'https://github.com/Neargye/nameof' - author = 'Daniil Goncharov ' - license = 'MIT' + url = "https://github.com/Neargye/nameof" + homepage = "https://github.com/Neargye/nameof" + author = "Daniil Goncharov " + license = "MIT" exports_sources = ["include/*", "LICENCE"] exports = ["LICENSE"] no_copy_source = True + @property + def supported_compiler(self): + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + if compiler == "Visual Studio" and version >= "15": + return True + if compiler == "gcc" and version >= "7": + return True + if compiler == "clang" and version >= "5": + return True + if compiler == "apple-clang" and version >= "9": + return True + return False + + def configure(self): + if not self.supported_compiler: + raise ConanInvalidConfiguration("nameof: Unsupported compiler (https://github.com/Neargye/nameof#compiler-compatibility).") + def package(self): self.copy("include/*") self.copy("LICENSE", dst="licenses")