diff --git a/.github/workflows/conan-package.yml b/.github/workflows/package.yml similarity index 56% rename from .github/workflows/conan-package.yml rename to .github/workflows/package.yml index d0f493dd16..6b38400ddf 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/package.yml @@ -1,4 +1,4 @@ -name: conan-package +name: package on: push: @@ -9,7 +9,7 @@ on: - 'conanfile.py' - 'conandata.yml' - 'CMakeLists.txt' - - '.github/workflows/conan-package.yml' + - '.github/workflows/package.yml' branches: - main - 'CURA-*' @@ -29,7 +29,7 @@ on: - 'conanfile.py' - 'conandata.yml' - 'CMakeLists.txt' - - '.github/workflows/conan-package.yml' + - '.github/workflows/package.yml' branches: - main - 'CURA-*' @@ -40,7 +40,15 @@ on: jobs: conan-package: - uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@main + uses: ultimaker/cura-workflows/.github/workflows/conan-package.yml@NP-637_conan_v2_wasm # FIXME: Use `main` branch with: platform_wasm: true secrets: inherit + + npm-package: + needs: [ conan-package ] + if: ${{ github.event_name == 'push' && (github.ref_name == 'main' || startsWith(github.ref_name, 'NP-') || startsWith(github.ref_name, '5.')) }} # FIXME: have a more generic way to determine release branches + uses: ultimaker/cura-workflows/.github/workflows/npm-package.yml@NP-637_conan_v2_wasm # FIXME: Use `main` branch + with: + package_version_full: ${{ needs.conan-package.outputs.package_version_full }} + secrets: inherit diff --git a/CuraEngineJS/.npmrc b/CuraEngineJS/.npmrc deleted file mode 100644 index 858f5af943..0000000000 --- a/CuraEngineJS/.npmrc +++ /dev/null @@ -1,3 +0,0 @@ -//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN} -@ultimaker:registry=https://npm.pkg.github.com -always-auth=true diff --git a/CuraEngineJS/package-lock.json b/CuraEngineJS/package-lock.json deleted file mode 100644 index 40e4254ba7..0000000000 --- a/CuraEngineJS/package-lock.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "name": "@ultimaker/curaenginejs", - "version": "0.2.3", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "@ultimaker/curaenginejs", - "version": "0.2.1", - "devDependencies": {} - } - } -} diff --git a/CuraEngineJS/package.json b/CuraEngineJS/package.json deleted file mode 100644 index 9ccdc78abd..0000000000 --- a/CuraEngineJS/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "@ultimaker/curaenginejs", - "version": "0.2.3", - "description": "CuraEngineJS a TS component to run CuraEngine in a browser", - "main": "dist/CuraEngine.js", - "scripts": { - "install_curaengine": "conan install ${npm_package_config_conan_package} -s build_type=Release --build=missing --update -c tools.build:skip_test=True -pr:h cura_wasm.jinja -if dist && rm -f dist/*conan*", - "build": "npm run install_curaengine", - "prepublishOnly": "npm run build" - }, - "config": { - "conan_package": "curaengine/5.9.0@_/_" - }, - "repository": { - "type": "git", - "url": "https://github.com/Ultimaker/CuraEngine.git" - }, - "keywords": [ - "Cura", - "CuraEngine", - "Slicer" - ], - "author": "UltiMaker", - "license": "", - "bugs": { - "url": "https://github.com/Ultimaker/CuraEngine/issues" - }, - "homepage": "https://github.com/Ultimaker/CuraEngine#readme", - "dependencies": { - }, - "devDependencies": { - }, - "files": [ - "dist", - "package.json", - "README.md" - ] -} \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 8a3c74258b..0146155226 100644 --- a/conanfile.py +++ b/conanfile.py @@ -4,9 +4,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import copy, mkdir, update_conandata -from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout 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" @@ -22,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 = { @@ -42,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) @@ -61,8 +72,10 @@ def export_sources(self): copy(self, "CuraEngine.rc", self.recipe_folder, self.export_sources_folder) copy(self, "LICENSE", self.recipe_folder, self.export_sources_folder) copy(self, "*", os.path.join(self.recipe_folder, "src"), os.path.join(self.export_sources_folder, "src")) - copy(self, "*", os.path.join(self.recipe_folder, "include"), os.path.join(self.export_sources_folder, "include")) - copy(self, "*", os.path.join(self.recipe_folder, "benchmark"), os.path.join(self.export_sources_folder, "benchmark")) + copy(self, "*", os.path.join(self.recipe_folder, "include"), + os.path.join(self.export_sources_folder, "include")) + copy(self, "*", os.path.join(self.recipe_folder, "benchmark"), + os.path.join(self.export_sources_folder, "benchmark")) copy(self, "*", os.path.join(self.recipe_folder, "stress_benchmark"), os.path.join(self.export_sources_folder, "stress_benchmark")) copy(self, "*", os.path.join(self.recipe_folder, "tests"), os.path.join(self.export_sources_folder, "tests")) @@ -86,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") @@ -136,7 +155,8 @@ def generate(self): tc.variables["ENABLE_TESTING"] = not self.conf.get("tools.build:skip_test", False, check_type=bool) tc.variables["ENABLE_BENCHMARKS"] = self.options.enable_benchmarks tc.variables["EXTENSIVE_WARNINGS"] = self.options.enable_extensive_warnings - tc.variables["OLDER_APPLE_CLANG"] = self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14" + tc.variables["OLDER_APPLE_CLANG"] = self.settings.compiler == "apple-clang" and Version( + self.settings.compiler.version) < "14" tc.variables["ENABLE_THREADING"] = not (self.settings.arch == "wasm" and self.settings.os == "Emscripten") if self.options.enable_plugins: tc.variables["ENABLE_PLUGINS"] = True @@ -180,7 +200,7 @@ def build(self): cmake.configure() cmake.build() - self.send_sentry_debug_files(binary_basename = "CuraEngine") + self.send_sentry_debug_files(binary_basename="CuraEngine") def deploy(self): copy(self, "CuraEngine*", src=os.path.join(self.package_folder, "bin"), dst=self.deploy_folder) @@ -202,3 +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": + self.python_requires["npmpackage"].module.conf_package_json(self)