diff --git a/conanfile.py b/conanfile.py index e3af37d7df..0146155226 100644 --- a/conanfile.py +++ b/conanfile.py @@ -3,9 +3,11 @@ import os from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout from conan.tools.files import copy, mkdir, update_conandata +from conan.tools.microsoft import check_min_vs, is_msvc from conan.tools.scm import Version, Git required_conan_version = ">=2.7.0" @@ -21,7 +23,7 @@ class CuraEngineConan(ConanFile): exports = "LICENSE*" settings = "os", "compiler", "build_type", "arch" package_type = "application" - python_requires = "sentrylibrary/1.0.0@ultimaker/stable" + python_requires = "sentrylibrary/1.0.0@ultimaker/stable", "npmpackage/[>=1.0.0]@ultimaker/np_637" python_requires_extend = "sentrylibrary.SentryLibrary" options = { @@ -41,6 +43,16 @@ class CuraEngineConan(ConanFile): "with_cura_resources": False, } + @property + def _compilers_minimum_version(self): + return { + "gcc": "12", + "clang": "14", + "apple-clang": "13", + "msvc": "191", + "visual_studio": "17", + } + def init(self): base = self.python_requires["sentrylibrary"].module.SentryLibrary self.options.update(base.options, base.default_options) @@ -87,6 +99,12 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 20) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") def build_requirements(self): self.test_requires("standardprojectsettings/[>=0.2.0]@ultimaker/stable") @@ -204,22 +222,6 @@ def package_info(self): ext = ".exe" if self.settings.os == "Windows" else "" self.conf_info.define_path("user.curaengine:curaengine", os.path.join(self.package_folder, "bin", f"CuraEngine{ext}")) + if self.settings.os == "Emscripten": - package_json = { - "name": f"@ultimaker/{self.name.lower()}js", - "version": f"{str(self.version).replace('+', '-')}", # npm will otherwise 'sanitize' the version number - "description": f"JavaScript / TypeScript bindings for {self.name}, a {self.description}", - "main": "bin/CuraEngine.js", - "repository": { - "type": "git", - "url": self.url - }, - "author": self.author, - "license": self.license, - "keywords": self.topics, - "files": [ - "bin", - "package.json" - ] - } - self.conf_info.define(f"user.{self.name.lower()}:package_json", package_json) + self.python_requires["npmpackage"].module.conf_package_json(self)