Skip to content

Commit

Permalink
sync with 5.10
Browse files Browse the repository at this point in the history
Contribute to NP-637
  • Loading branch information
jellespijker committed Dec 12, 2024
1 parent 262c57f commit 9034cf0
Showing 1 changed file with 21 additions and 19 deletions.
40 changes: 21 additions & 19 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 = {
Expand All @@ -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)
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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)

0 comments on commit 9034cf0

Please sign in to comment.