From f5d4bcf0d2cd03569b1575f2ddf10b3701edb312 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 May 2024 08:25:28 +0200 Subject: [PATCH 1/6] Added wasm package creation Modified conditions for the creation of conan packages in 'conan-package.yml' to exclude 'master' branch. Also added a new package creation workflow for WebAssembly (wasm). This change is temporary for the 'NP-202_conan_wasm_package' branch, needs to be reverted once the related PR is merged to main. Contribute to NP-202 --- .github/workflows/conan-package.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 64ab6141b3..9a9d46c1fe 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -54,7 +54,7 @@ jobs: conan-package-create-macos: needs: [ conan-recipe-version, conan-package-export ] - if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }} + if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }} uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-macos.yml@main with: recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} @@ -62,7 +62,7 @@ jobs: conan-package-create-windows: needs: [ conan-recipe-version, conan-package-export ] - if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }} + if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }} uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-windows.yml@main with: recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} @@ -70,8 +70,17 @@ jobs: conan-package-create-linux: needs: [ conan-recipe-version, conan-package-export ] - if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'master' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }} + if: ${{ ((github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) || github.event_name == 'pull_request') }} uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-linux.yml@main with: recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} secrets: inherit + +# FIXME: Remove the references to the NP-202_conan_wasm_package branch once https://github.com/Ultimaker/cura-workflows/pull/19 is merged to main + conan-package-create-wasm: + needs: [ conan-recipe-version, conan-package-export ] + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'NP-202_conan_wasm_package' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }} + uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-wasm.yml@NP-202_conan_wasm_package + with: + recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} + secrets: inherit From 51cc6a306bad9fe60b99ae3b72816620a29de9b0 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 May 2024 09:48:04 +0200 Subject: [PATCH 2/6] Add SingleShape include in slicer.cpp A necessary inclusion of "geometry/SingleShape.h" has been added to the slicer.cpp file. This is needed for our implementation of the splitIntoParts() function. Contribute to NP-202 --- src/slicer.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/slicer.cpp b/src/slicer.cpp index fa8fded180..1e12d21018 100644 --- a/src/slicer.cpp +++ b/src/slicer.cpp @@ -13,6 +13,7 @@ #include "Application.h" #include "Slice.h" #include "geometry/OpenPolyline.h" +#include "geometry/SingleShape.h" // Needed to our call of splitIntoParts() #include "plugins/slots.h" #include "raft.h" #include "settings/AdaptiveLayerHeights.h" From 55aa0770cfac2e5437c90298018ef82e00004397 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Tue, 28 May 2024 09:53:55 +0200 Subject: [PATCH 3/6] Refactor method overrides and use std::move The virtual keyword was removed from override methods in various BeadingStrategy classes to improve clarity. The std::move function was also used in the BeadingStrategyFactory.cpp file to transfer ownership of a unique_ptr, improving efficiency and semantic accuracy. Contribute to NP-202 --- include/BeadingStrategy/LimitedBeadingStrategy.h | 2 +- .../OuterWallInsetBeadingStrategy.h | 2 +- .../RedistributeBeadingStrategy.h | 2 +- .../BeadingStrategy/WideningBeadingStrategy.h | 16 ++++++++-------- src/BeadingStrategy/BeadingStrategyFactory.cpp | 8 ++++---- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/BeadingStrategy/LimitedBeadingStrategy.h b/include/BeadingStrategy/LimitedBeadingStrategy.h index 42d34f86a4..3e15eefec2 100644 --- a/include/BeadingStrategy/LimitedBeadingStrategy.h +++ b/include/BeadingStrategy/LimitedBeadingStrategy.h @@ -35,7 +35,7 @@ class LimitedBeadingStrategy : public BeadingStrategy coord_t getOptimalThickness(coord_t bead_count) const override; coord_t getTransitionThickness(coord_t lower_bead_count) const override; coord_t getOptimalBeadCount(coord_t thickness) const override; - virtual std::string toString() const override; + std::string toString() const override; coord_t getTransitioningLength(coord_t lower_bead_count) const override; diff --git a/include/BeadingStrategy/OuterWallInsetBeadingStrategy.h b/include/BeadingStrategy/OuterWallInsetBeadingStrategy.h index c8c6eae31d..840c04f888 100644 --- a/include/BeadingStrategy/OuterWallInsetBeadingStrategy.h +++ b/include/BeadingStrategy/OuterWallInsetBeadingStrategy.h @@ -25,7 +25,7 @@ class OuterWallInsetBeadingStrategy : public BeadingStrategy coord_t getOptimalBeadCount(coord_t thickness) const override; coord_t getTransitioningLength(coord_t lower_bead_count) const override; - virtual std::string toString() const; + std::string toString() const override; private: BeadingStrategyPtr parent_; diff --git a/include/BeadingStrategy/RedistributeBeadingStrategy.h b/include/BeadingStrategy/RedistributeBeadingStrategy.h index 2f8304bf39..52d41e1a93 100644 --- a/include/BeadingStrategy/RedistributeBeadingStrategy.h +++ b/include/BeadingStrategy/RedistributeBeadingStrategy.h @@ -45,7 +45,7 @@ class RedistributeBeadingStrategy : public BeadingStrategy coord_t getTransitioningLength(coord_t lower_bead_count) const override; double getTransitionAnchorPos(coord_t lower_bead_count) const override; - virtual std::string toString() const; + std::string toString() const override; protected: /*! diff --git a/include/BeadingStrategy/WideningBeadingStrategy.h b/include/BeadingStrategy/WideningBeadingStrategy.h index bda69f345d..cd0f00c406 100644 --- a/include/BeadingStrategy/WideningBeadingStrategy.h +++ b/include/BeadingStrategy/WideningBeadingStrategy.h @@ -27,14 +27,14 @@ class WideningBeadingStrategy : public BeadingStrategy virtual ~WideningBeadingStrategy() override = default; - virtual Beading compute(coord_t thickness, coord_t bead_count) const override; - virtual coord_t getOptimalThickness(coord_t bead_count) const override; - virtual coord_t getTransitionThickness(coord_t lower_bead_count) const override; - virtual coord_t getOptimalBeadCount(coord_t thickness) const override; - virtual coord_t getTransitioningLength(coord_t lower_bead_count) const override; - virtual double getTransitionAnchorPos(coord_t lower_bead_count) const override; - virtual std::vector getNonlinearThicknesses(coord_t lower_bead_count) const override; - virtual std::string toString() const override; + Beading compute(coord_t thickness, coord_t bead_count) const override; + coord_t getOptimalThickness(coord_t bead_count) const override; + coord_t getTransitionThickness(coord_t lower_bead_count) const override; + coord_t getOptimalBeadCount(coord_t thickness) const override; + coord_t getTransitioningLength(coord_t lower_bead_count) const override; + double getTransitionAnchorPos(coord_t lower_bead_count) const override; + std::vector getNonlinearThicknesses(coord_t lower_bead_count) const override; + std::string toString() const override; protected: BeadingStrategyPtr parent_; diff --git a/src/BeadingStrategy/BeadingStrategyFactory.cpp b/src/BeadingStrategy/BeadingStrategyFactory.cpp index c929bd5d9f..8b2d289449 100644 --- a/src/BeadingStrategy/BeadingStrategyFactory.cpp +++ b/src/BeadingStrategy/BeadingStrategyFactory.cpp @@ -41,22 +41,22 @@ BeadingStrategyPtr BeadingStrategyFactory::makeStrategy( wall_add_middle_threshold, inward_distributed_center_wall_count); spdlog::debug("Applying the Redistribute meta-strategy with outer-wall width = {}, inner-wall width = {}", preferred_bead_width_outer, preferred_bead_width_inner); - ret = make_unique(preferred_bead_width_outer, minimum_variable_line_ratio, move(ret)); + ret = make_unique(preferred_bead_width_outer, minimum_variable_line_ratio, std::move(ret)); if (print_thin_walls) { spdlog::debug("Applying the Widening Beading meta-strategy with minimum input width {} and minimum output width {}.", min_feature_size, min_bead_width); - ret = make_unique(move(ret), min_feature_size, min_bead_width); + ret = make_unique(std::move(ret), min_feature_size, min_bead_width); } if (outer_wall_offset > 0) { spdlog::debug("Applying the OuterWallOffset meta-strategy with offset = {}", outer_wall_offset); - ret = make_unique(outer_wall_offset, move(ret)); + ret = make_unique(outer_wall_offset, std::move(ret)); } // Apply the LimitedBeadingStrategy last, since that adds a 0-width marker wall which other beading strategies shouldn't touch. spdlog::debug("Applying the Limited Beading meta-strategy with maximum bead count = {}", max_bead_count); - ret = make_unique(max_bead_count, move(ret)); + ret = make_unique(max_bead_count, std::move(ret)); return ret; } } // namespace cura From 58aaaf0c669beadb836a7b8e1bd2269759d75e82 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 29 May 2024 08:59:50 +0200 Subject: [PATCH 4/6] Add deploy method in conanfile.py Added a new deploy method in conanfile.py that copies CuraEngine files from the package_folder/bin directory to the installation folder. This change is intended to provide additional deployment capabilities to the script. Contribute to NP-207 --- conanfile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/conanfile.py b/conanfile.py index 127a23576f..8e325411cd 100644 --- a/conanfile.py +++ b/conanfile.py @@ -217,6 +217,9 @@ def build(self): self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} releases set-commits -o {sentry_org} -p {sentry_project} --commit \"Ultimaker/CuraEngine@{self.conan_data['commit']}\" {self.version}") self.run(f"sentry-cli --auth-token {os.environ['SENTRY_TOKEN']} releases finalize -o {sentry_org} -p {sentry_project} {self.version}") + def deploy(self): + copy(self, "CuraEngine*", src=os.path.join(self.package_folder, "bin"), dst=self.install_folder) + def package(self): match self.settings.os: case "Windows": From 40e0b5b54edc80e022525cbdba267bca40c24fe3 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 5 Jun 2024 17:48:51 +0200 Subject: [PATCH 5/6] fix grammar Contribute to NP-207 and NP-206 --- src/slicer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/slicer.cpp b/src/slicer.cpp index 1e12d21018..f66e2d40ec 100644 --- a/src/slicer.cpp +++ b/src/slicer.cpp @@ -13,7 +13,7 @@ #include "Application.h" #include "Slice.h" #include "geometry/OpenPolyline.h" -#include "geometry/SingleShape.h" // Needed to our call of splitIntoParts() +#include "geometry/SingleShape.h" // Needed in order to call splitIntoParts() #include "plugins/slots.h" #include "raft.h" #include "settings/AdaptiveLayerHeights.h" From 793e742451911113764ad443e1311d46f05798d7 Mon Sep 17 00:00:00 2001 From: Jelle Spijker Date: Wed, 5 Jun 2024 17:49:20 +0200 Subject: [PATCH 6/6] Use `main` conan-package-create workflow Contribute to NP-207 and NP-206 --- .github/workflows/conan-package.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/conan-package.yml b/.github/workflows/conan-package.yml index 9a9d46c1fe..eb5829a6a7 100644 --- a/.github/workflows/conan-package.yml +++ b/.github/workflows/conan-package.yml @@ -76,11 +76,10 @@ jobs: recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} secrets: inherit -# FIXME: Remove the references to the NP-202_conan_wasm_package branch once https://github.com/Ultimaker/cura-workflows/pull/19 is merged to main conan-package-create-wasm: needs: [ conan-recipe-version, conan-package-export ] - if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || github.ref_name == 'NP-202_conan_wasm_package' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }} - uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-wasm.yml@NP-202_conan_wasm_package + if: ${{ (github.event_name == 'push' && (github.ref_name == 'main' || needs.conan-recipe-version.outputs.is_release_branch == 'true')) }} + uses: ultimaker/cura-workflows/.github/workflows/conan-package-create-wasm.yml@main with: recipe_id_full: ${{ needs.conan-recipe-version.outputs.recipe_id_full }} secrets: inherit