Skip to content

Commit

Permalink
Merge branch 'main' into feature_issue-15583_spiral_z-hop
Browse files Browse the repository at this point in the history
  • Loading branch information
saumyaj3 authored Apr 30, 2024
2 parents e5d0b4a + fb484b8 commit 9fba093
Show file tree
Hide file tree
Showing 65 changed files with 1,956 additions and 698 deletions.
1 change: 1 addition & 0 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9]+.[0-9]+'

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/conan-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ on:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9].[0-9]*'
- '[0-9].[0-9][0-9]*'
tags:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gcodeanalyzer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ on:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9]+.[0-9]+'

permissions:
Expand Down
43 changes: 17 additions & 26 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# NOTE: Best to keep all of these remarks in, they might prove useful in the future.
# This is basically just the standard one that is sugested on 'new workflow'.
# This is basically just the standard one that is suggested on 'new workflow'.

name: Scorecard supply-chain security
on:
Expand All @@ -21,51 +21,42 @@ jobs:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
# Needed for Code scanning upload
security-events: write
# Needed to publish results and get a badge (see publish_results below).
# Needed for GitHub OIDC token if publish_results is true
id-token: write
# Uncomment the permissions below if installing in a private repository.
# contents: read
# actions: read

steps:
- name: "Checkout code"
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
persist-credentials: false

- name: "Run analysis"
uses: ossf/scorecard-action@e38b1902ae4f44df626f11ba0734b14fb91f8f86 # v2.1.2
uses: ossf/scorecard-action@0864cf19026789058feabb7e87baa5f140aac736 # v2.3.1
with:
results_file: results.sarif
results_format: sarif
# (Optional) "write" PAT token. Uncomment the `repo_token` line below if:
# - you want to enable the Branch-Protection check on a *public* repository, or
# - you are installing Scorecard on a *private* repository
# To create the PAT, follow the steps in https://github.com/ossf/scorecard-action#authentication-with-pat.
# repo_token: ${{ secrets.SCORECARD_TOKEN }}

# Public repositories:
# - Publish results to OpenSSF REST API for easy access by consumers
# - Allows the repository to include the Scorecard badge.
# - See https://github.com/ossf/scorecard-action#publishing-results.
# For private repositories:
# - `publish_results` will always be set to `false`, regardless
# of the value entered here.
# Scorecard team runs a weekly scan of public GitHub repos,
# see https://github.com/ossf/scorecard#public-data.
# Setting `publish_results: true` helps us scale by leveraging your workflow to
# extract the results instead of relying on our own infrastructure to run scans.
# And it's free for you!
publish_results: true

# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
# Upload the results as artifacts (optional). Commenting out will disable
# uploads of run results in SARIF format to the repository Actions tab.
# https://docs.github.com/en/actions/advanced-guides/storing-workflow-data-as-artifacts
- name: "Upload artifact"
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: SARIF file
path: results.sarif
retention-days: 5

# Upload the results to GitHub's code scanning dashboard.
# Upload the results to GitHub's code scanning dashboard (optional).
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@17573ee1cc1b9d061760f3a006fc4aac4f944fd5 # v2.2.4
uses: github/codeql-action/upload-sarif@83a02f7883b12e0e4e1a146174f5e2292a01e601 # v2.16.4
with:
sarif_file: results.sarif
1 change: 1 addition & 0 deletions .github/workflows/stress_benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9]+.[0-9]+'

permissions:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ on:
- main
- 'CURA-*'
- 'PP-*'
- 'NP-*'
- '[0-9]+.[0-9]+'

pull_request:
Expand Down
74 changes: 44 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,23 @@ option(ENABLE_SENTRY "Send crash data via Sentry" OFF)
option(ENABLE_MORE_COMPILER_OPTIMIZATION_FLAGS "Enable more optimization flags" ON)
option(USE_SYSTEM_LIBS "Use the system libraries if available" OFF)
option(OLDER_APPLE_CLANG "Apple Clang <= 13 used" OFF)
option(ENABLE_THREADING "Enable threading support" ON)

# Generate the plugin types
find_package(protobuf REQUIRED)
find_package(asio-grpc REQUIRED)
find_package(gRPC REQUIRED)
find_package(curaengine_grpc_definitions REQUIRED)
option(OLDER_APPLE_CLANG "Apple Clang <= 13 used" OFF)
if (${ENABLE_ARCUS} OR ${ENABLE_PLUGINS})
find_package(protobuf REQUIRED)
endif ()

MESSAGE(STATUS "Compiling with plugins support: ${ENABLE_PLUGINS}")
MESSAGE(STATUS "Building with plugins support: ${ENABLE_PLUGINS}")
if (${ENABLE_PLUGINS})
find_package(asio-grpc REQUIRED)
find_package(gRPC REQUIRED)
find_package(curaengine_grpc_definitions REQUIRED)
find_package(semver REQUIRED)
MESSAGE(STATUS "Plugin secure remotes allowed: ${ENABLE_REMOTE_PLUGINS}")
endif ()

if (ENABLE_ARCUS)
message(STATUS "Building with Arcus")
message(STATUS "Building with Arcus: ${ENABLE_ARCUS}")
if (${ENABLE_ARCUS})
find_package(arcus REQUIRED)
protobuf_generate_cpp(engine_PB_SRCS engine_PB_HEADERS Cura.proto)
endif ()
Expand Down Expand Up @@ -153,18 +155,20 @@ set(engine_SRCS # Except main.cpp.
src/utils/ToolpathVisualizer.cpp
src/utils/VoronoiUtils.cpp
src/utils/VoxelUtils.cpp
)
)

add_library(_CuraEngine STATIC ${engine_SRCS} ${engine_PB_SRCS})
use_threads(_CuraEngine)
if (ENABLE_THREADING)
use_threads(_CuraEngine)
endif ()

target_include_directories(_CuraEngine
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}> # Include Cura.pb.h
)
)

target_compile_definitions(_CuraEngine
PUBLIC
Expand All @@ -182,7 +186,7 @@ target_compile_definitions(_CuraEngine
$<$<CONFIG:RelWithDebInfo>:ASSERT_INSANE_OUTPUT>
$<$<CONFIG:RelWithDebInfo>:USE_CPU_TIME>
$<$<CONFIG:RelWithDebInfo>:DEBUG>
)
)

enable_sanitizers(_CuraEngine)

Expand All @@ -191,9 +195,10 @@ if (${EXTENSIVE_WARNINGS})
endif ()

if (ENABLE_ARCUS)
target_link_libraries(_CuraEngine PUBLIC arcus::arcus )
target_link_libraries(_CuraEngine PUBLIC arcus::arcus)
endif ()

find_package(mapbox-wagyu REQUIRED)
find_package(clipper REQUIRED)
find_package(RapidJSON REQUIRED)
find_package(stb REQUIRED)
Expand All @@ -202,7 +207,6 @@ find_package(spdlog REQUIRED)
find_package(fmt REQUIRED)
find_package(range-v3 REQUIRED)
find_package(scripta REQUIRED)
find_package(semver REQUIRED)

if (ENABLE_SENTRY)
find_package(sentry REQUIRED)
Expand All @@ -218,17 +222,18 @@ target_link_libraries(_CuraEngine
range-v3::range-v3
fmt::fmt
clipper::clipper
mapbox-wagyu::mapbox-wagyu
rapidjson
stb::stb
boost::boost
scripta::scripta
semver::semver
curaengine_grpc_definitions::curaengine_grpc_definitions
asio-grpc::asio-grpc
grpc::grpc
protobuf::libprotobuf
$<$<BOOL:${ENABLE_SENTRY}>:sentry::sentry>
$<$<BOOL:${ENABLE_TESTING}>:GTest::gtest>)
$<$<TARGET_EXISTS:semver::semver>:semver::semver>
$<$<TARGET_EXISTS:curaengine_grpc_definitions::curaengine_grpc_definitions>:curaengine_grpc_definitions::curaengine_grpc_definitions>
$<$<TARGET_EXISTS:asio-grpc::asio-grpc>:asio-grpc::asio-grpc>
$<$<TARGET_EXISTS:grpc::grpc>:grpc::grpc>
$<$<TARGET_EXISTS:protobuf::libprotobuf>:protobuf::libprotobuf>
$<$<TARGET_EXISTS:sentry::sentry>:sentry::sentry>
$<$<TARGET_EXISTS:GTest::gtest>:GTest::gtest>)

target_compile_definitions(_CuraEngine PRIVATE
$<$<BOOL:${ENABLE_SENTRY}>:SENTRY_URL=\"${SENTRY_URL}\">
Expand All @@ -244,18 +249,26 @@ else ()
SET(CMAKE_RC_COMPILER_INIT windres)
SET(CMAKE_RC_COMPILE_OBJECT
"<CMAKE_RC_COMPILER> <FLAGS> -O coff <DEFINES> -i <SOURCE> -o <OBJECT>"
)
)
endif ()
add_executable(CuraEngine src/main.cpp ${RES_FILES}) # ..., but don't forget the glitter!
if (ENABLE_SENTRY)
set_target_properties(CuraEngine PROPERTIES LINK_FLAGS "/DEBUG:FULL")
endif ()
endif (NOT WIN32)

use_threads(CuraEngine)
if (ENABLE_THREADING)
use_threads(CuraEngine)
endif ()

if (CMAKE_CXX_PLATFORM_ID STREQUAL "emscripten")
message(STATUS "Building for Emscripten")
target_link_options(_CuraEngine PUBLIC -Wno-unused-command-line-argument -sINVOKE_RUN=0 -sEXPORT_NAME=CuraEngine -sEXPORTED_RUNTIME_METHODS=[callMain,FS] -sFORCE_FILESYSTEM=1 -sALLOW_MEMORY_GROWTH=1 -sEXPORT_ES6=1 -sMODULARIZE=1 -sSINGLE_FILE=1 -sENVIRONMENT=worker -sERROR_ON_UNDEFINED_SYMBOLS=0 -lembind --embind-emit-tsd CuraEngine.d.ts)
endif ()

target_link_libraries(CuraEngine PRIVATE
_CuraEngine
$<$<BOOL:${ENABLE_SENTRY}>:sentry::sentry>
$<$<TARGET_EXISTS:sentry::sentry>:sentry::sentry>
)
target_compile_definitions(CuraEngine PRIVATE
$<$<BOOL:${ENABLE_SENTRY}>:SENTRY_URL=\"${SENTRY_URL}\">
Expand All @@ -282,10 +295,11 @@ if (ENABLE_TESTING OR ENABLE_BENCHMARKS)
GTest::gtest
GTest::gmock
clipper::clipper
curaengine_grpc_definitions::curaengine_grpc_definitions
asio-grpc::asio-grpc
grpc::grpc
protobuf::libprotobuf)
mapbox-wagyu::mapbox-wagyu
$<$<TARGET_EXISTS:curaengine_grpc_definitions::curaengine_grpc_definitions>:curaengine_grpc_definitions::curaengine_grpc_definitions>
$<$<TARGET_EXISTS:asio-grpc::asio-grpc>:asio-grpc::asio-grpc>
$<$<TARGET_EXISTS:grpc::grpc>:grpc::grpc>
$<$<TARGET_EXISTS:protobuf::libprotobuf>:protobuf::libprotobuf>)
if (ENABLE_ARCUS)
target_link_libraries(test_helpers PUBLIC arcus::arcus)
endif ()
Expand All @@ -295,7 +309,7 @@ if (ENABLE_BENCHMARKS)
add_subdirectory(benchmark)
if (NOT WIN32)
add_subdirectory(stress_benchmark)
endif()
endif ()
endif ()

if (ENABLE_TESTING)
Expand Down
1 change: 1 addition & 0 deletions Cura.proto
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ message ObjectList
// 0 ... 99: Broadcasts
// 100 ... 199: Modify
// 200 ... 299: Generate
// IMPORTANT: If you add a slot ID also update the SlotID enum in include/plugins/slots.h
enum SlotID {
SETTINGS_BROADCAST = 0;
SIMPLIFY_MODIFY = 100;
Expand Down
9 changes: 7 additions & 2 deletions benchmark/simplify_benchmark.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
// Copyright (c) 2023 UltiMaker
// Copyright (c) 2024 UltiMaker
// CuraEngine is released under the terms of the AGPLv3 or higher

#ifndef CURAENGINE_BENCHMARK_SIMPLIFY_BENCHMARK_H
#define CURAENGINE_BENCHMARK_SIMPLIFY_BENCHMARK_H

#include "../tests/ReadTestPolygons.h"
#include "plugins/slots.h"
#include "utils/Simplify.h"
#include "utils/channel.h"

#include <fmt/format.h>

#include <benchmark/benchmark.h>
#include <filesystem>

#ifdef ENABLE_PLUGINS
#include "plugins/slots.h"
#include <grpcpp/create_channel.h>
#endif

namespace cura
{
Expand Down Expand Up @@ -58,6 +61,7 @@ BENCHMARK_DEFINE_F(SimplifyTestFixture, simplify_local)(benchmark::State& st)

BENCHMARK_REGISTER_F(SimplifyTestFixture, simplify_local);

#ifdef ENABLE_PLUGINS
BENCHMARK_DEFINE_F(SimplifyTestFixture, simplify_slot_noplugin)(benchmark::State& st)
{
for (auto _ : st)
Expand All @@ -71,6 +75,7 @@ BENCHMARK_DEFINE_F(SimplifyTestFixture, simplify_slot_noplugin)(benchmark::State
}

BENCHMARK_REGISTER_F(SimplifyTestFixture, simplify_slot_noplugin);
#endif

} // namespace cura
#endif // CURAENGINE_BENCHMARK_SIMPLIFY_BENCHMARK_H
6 changes: 4 additions & 2 deletions conandata.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
version: "5.7.0-alpha.1"
version: "5.8.0-alpha.0"
requirements:
- "scripta/0.1.0@ultimaker/testing"
requirements_arcus:
- "arcus/5.3.1"
requirements_plugins:
- "curaengine_grpc_definitions/(latest)@ultimaker/testing"
- "scripta/0.1.0@ultimaker/testing"
Loading

0 comments on commit 9fba093

Please sign in to comment.