Compare commits

..

14 Commits

Author SHA1 Message Date
SoftFever
2b59b6e974 Update README.md 2022-07-18 13:03:21 +08:00
Jack Li
8f594471c0 update readme 2022-07-18 12:56:14 +08:00
Jack Li
0977e3077f Add Voron 0.1 and Prusa MK3S support 2022-07-18 12:34:25 +08:00
Jack Li
f087cd0db9 fix voron image ratio issue 2022-07-18 11:05:34 +08:00
Jack Li
5e615feef5 reduce image size 2022-07-18 10:02:55 +08:00
Jack Li
5f1725246f Change name so that it can co-exist with official build 2022-07-18 10:02:36 +08:00
Jack Li
829fc90e6f Add missing process file 2022-07-18 10:01:57 +08:00
SoftFever
cc94674e39 Update README.md 2022-07-17 20:45:21 +08:00
SoftFever
f16521adf6 update build script 2022-07-17 19:30:48 +08:00
SoftFever
fc9d18faff Add Voron process settings 2022-07-17 19:24:44 +08:00
Jack Li
ff768a6f68 WIP: add voron process setting 2022-07-17 12:53:41 +08:00
Jack Li
9c0f6f1c72 Add Voron machine support 2022-07-17 12:53:06 +08:00
Jack Li
7a7369c9ce Allow users to export .gcode files 2022-07-17 10:33:57 +08:00
Jack Li
687593f8d2 add build scripts 2022-07-17 10:27:18 +08:00
16607 changed files with 297721 additions and 3092173 deletions

View File

@@ -1,120 +0,0 @@
#
# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
#
Language: Cpp
AccessModifierOffset: -4
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: true
AlignConsecutiveDeclarations: true
AlignEscapedNewlines: DontAlign
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: true
AllowShortCaseLabelsOnASingleLine: true
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: false
AfterFunction: true
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: true
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: false
SplitEmptyRecord: false
SplitEmptyNamespace: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
BreakInheritanceList: BeforeColon
BreakBeforeTernaryOperators: false
BreakConstructorInitializersBeforeComma: false
BreakConstructorInitializers: BeforeComma
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 140
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: true
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- forever
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^<Q.*'
Priority: 200
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 4
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
#KeepLineBreaksForNonEmptyLines: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 4
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 150
PenaltyBreakBeforeFirstCallParameter: 300
PenaltyBreakComment: 500
PenaltyBreakFirstLessLess: 400
PenaltyBreakString: 600
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 50
PenaltyReturnTypeOnItsOwnLine: 300
PointerAlignment: Left
ReflowComments: true
SortIncludes: false
SortUsingDeclarations: false
SpaceAfterCStyleCast: true
SpaceAfterTemplateKeyword: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeRangeBasedForLoopColon: true
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: false
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 4
UseTab: Never

View File

@@ -1,19 +0,0 @@
---
allowed-tools: Bash(git checkout --branch:*), Bash(git add:*), Bash(git status:*), Bash(git push:*), Bash(git commit:*), Bash(gh pr create:*)
description: Commit, push, and open a PR
---
## Context
- Current git status: !`git status`
- Current git diff (staged and unstaged changes): !`git diff HEAD`
- Current branch: !`git branch --show-current`
## Your task
Based on the above changes:
1. Create a new branch if on main
2. Create a single commit with an appropriate message
3. Push the branch to origin
4. Create a pull request using `gh pr create`
5. You have the capability to call multiple tools in a single response. You MUST do all of the above in a single message. Do not use any other tools or do anything else. Do not send any other text or messages besides these tool calls.

View File

@@ -1,38 +0,0 @@
---
allowed-tools: Bash(gh issue view:*), Bash(gh search:*), Bash(gh issue list:*), Bash(gh api:*), Bash(gh issue comment:*)
description: Find duplicate GitHub issues
---
Find up to 3 likely duplicate issues for a given GitHub issue.
To do this, follow these steps precisely:
1. Use an agent to check if the Github issue (a) is closed, (b) does not need to be deduped (eg. because it is broad product feedback without a specific solution, or positive feedback), or (c) already has a duplicates comment that you made earlier. If so, do not proceed.
2. Use an agent to view a Github issue, and ask the agent to return a summary of the issue
3. Then, launch 5 parallel agents to search Github for duplicates of this issue, using diverse keywords and search approaches, using the summary from #1
4. Next, feed the results from #1 and #2 into another agent, so that it can filter out false positives, that are likely not actually duplicates of the original issue. If there are no duplicates remaining, do not proceed.
5. Finally, comment back on the issue with a list of up to three duplicate issues (or zero, if there are no likely duplicates)
Notes (be sure to tell this to your agents, too):
- Use `gh` to interact with Github, rather than web fetch
- Do not use other tools, beyond `gh` (eg. don't use other MCP servers, file edit, etc.)
- Make a todo list first
- For your comment, follow the following format precisely (assuming for this example that you found 3 suspected duplicates):
---
Found 3 possible duplicate issues:
1. <link to issue>
2. <link to issue>
3. <link to issue>
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 OrcaSlicer bot
---

View File

@@ -1,40 +0,0 @@
---
allowed-tools: Bash(gh issue list:*), Bash(gh issue view:*), Bash(gh issue edit:*), TodoWrite
description: Triage GitHub issues and label critical ones for oncall
---
You're an oncall triage assistant for GitHub issues. Your task is to identify critical issues that require immediate oncall attention and apply the "oncall" label.
Repository: OrcaSlicer/OrcaSlicer
Task overview:
1. First, get all open bugs updated in the last 3 days with at least 50 engagements:
```bash
gh issue list --repo OrcaSlicer/OrcaSlicer --state open --label bug --limit 1000 --json number,title,updatedAt,comments,reactions | jq -r '.[] | select((.updatedAt >= (now - 259200 | strftime("%Y-%m-%dT%H:%M:%SZ"))) and ((.comments | length) + ([.reactions[].content] | length) >= 50)) | "\(.number)"'
```
2. Save the list of issue numbers and create a TODO list with ALL of them. This ensures you process every single one.
3. For each issue in your TODO list:
- Use `gh issue view <number> --repo OrcaSlicer/OrcaSlicer --json title,body,labels,comments` to get full details
- Read and understand the full issue content and comments to determine actual user impact
- Evaluate: Is this truly blocking users from using Claude Code?
- Consider: "crash", "stuck", "frozen", "hang", "unresponsive", "cannot use", "blocked", "broken"
- Does it prevent core functionality? Can users work around it?
- Be conservative - only flag issues that truly prevent users from getting work done
4. For issues that are truly blocking and don't already have the "oncall" label:
- Use `gh issue edit <number> --repo OrcaSlicer/OrcaSlicer --add-label "oncall"`
- Mark the issue as complete in your TODO list
5. After processing all issues, provide a summary:
- List each issue number that received the "oncall" label
- Include the issue title and brief reason why it qualified
- If no issues qualified, state that clearly
Important:
- Process ALL issues in your TODO list systematically
- Don't post any comments to issues
- Only add the "oncall" label, never remove it
- Use individual `gh issue view` commands instead of bash for loops to avoid approval prompts

View File

@@ -1,10 +0,0 @@
# Add directories or file patterns to ignore during indexing (e.g. foo/ or *.csv)
deps/
build_*/
build/
localization/
sandboxes/
resources/*
!resources/web/
!resources/dailytip
!resources/shaders

View File

@@ -1,2 +0,0 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

View File

@@ -1,44 +0,0 @@
{
"name": "OrcaSlicer",
"build": {
"dockerfile": "Dockerfile",
"args": {
"PLATFORM": "linux/amd64",
"BASE_IMAGE": "mcr.microsoft.com/devcontainers/cpp:ubuntu-22.04"
},
"options": ["--platform=linux/amd64"]
},
"runArgs": ["--platform=linux/amd64"],
"features": {
"ghcr.io/devcontainers/features/desktop-lite:1": {
"password": "orca"
}
},
"customizations": {
"vscode": {
"settings": {
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vscode.cmake-tools",
"ms-vscode.cpptools-extension-pack"
]
}
},
"forwardPorts": [6080],
"portsAttributes": {
"6080": {
"label": "VNC web client (noVNC)",
"onAutoForward": "silent"
}
},
"otherPortsAttributes": {
"onAutoForward": "ignore"
},
"onCreateCommand": {
"Set postCreate executable flag": "chmod +x .devcontainer/postCreate.sh"
},
"postCreateCommand": "sudo .devcontainer/postCreate.sh"
}

View File

@@ -1,15 +0,0 @@
#!/bin/bash
# Update and upgrade all system packages
apt update
apt upgrade -y
build_linux="./build_linux.sh -u"
echo "-----------------------------------------"
echo "Running ${build_linux}..."
echo "-----------------------------------------"
${build_linux}
echo "------------------------------"
echo "Installing missing packages..."
echo "------------------------------"
apt install -y libgl1-mesa-dev m4 autoconf libtool

View File

@@ -1,30 +0,0 @@
Build
Build.bat
/build/
deps/build
MYMETA.json
MYMETA.yml
_build
blib
xs/buildtmp
*.o
*.log
MANIFEST.bak
xs/MANIFEST.bak
xs/assertlib*
.init_bundle.ini
.vs/*
local-lib
/src/TAGS
/.vscode/
build-linux/*
deps/build-linux/*
**/.DS_Store
install_*
build_*/
!build_linux.sh
SVG
scripts/Dockerfile
scripts/DockerBuild.sh
scripts/DockerRun.sh
scripts/.dockerignore

2801
.doxygen

File diff suppressed because it is too large Load Diff

2
.gitattributes vendored
View File

@@ -1,2 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto

3
.github/FUNDING.yml vendored
View File

@@ -1,3 +0,0 @@
github: SoftFever
ko_fi: SoftFever
custom: https://paypal.me/softfever3d

View File

@@ -1,133 +0,0 @@
name: 🐞 Bug Report
description: File a bug report
labels: ["bug"]
body:
- type: markdown
attributes:
value: |
**Thank you for using Orca Slicer and wanting to report a bug.**
Please note that this is not the place to make feature requests or ask for help.
For this, please use the [Feature request](https://github.com/OrcaSlicer/OrcaSlicer/issues/new?assignees=&labels=&projects=&template=feature_request.yml) issue type or you can discuss your idea on our [Discord server](https://discord.gg/P4VE9UY9gJ) with others.
Before filing, please check if the issue already exists (either open or closed) by using the search bar on the issues page. If it does, comment there. Even if it's closed, we can reopen it based on your comment.
- type: checkboxes
attributes:
label: Is there an existing issue for this problem?
description: Please search to see if an issue already exists for the bug you encountered.
options:
- label: I have searched the existing issues
required: true
- type: input
id: version
attributes:
label: OrcaSlicer Version
description: Which version of Orca Slicer are you running? You can see the full version in `Help` -> `About Orca Slicer`.
placeholder: e.g. 1.9.0
validations:
required: true
- type: dropdown
id: os_type
attributes:
label: "Operating System (OS)"
description: "What OSes are you are experiencing issues on?"
multiple: true
options:
- Linux
- macOS
- Windows
validations:
required: true
- type: input
id: os_version
attributes:
label: "OS Version"
description: "What OS version does this relate to?"
placeholder: "i.e. OS: Windows 7/8/10/11 ..., Ubuntu 22.04/Fedora 36 ..., macOS 10.15/11.1/12.3 ..."
validations:
required: true
- type: textarea
id: system_info
attributes:
label: Additional system information
description: For the performance issue, please also show the CPU, Memory information; For the 3D Rendering issue, please also show the Display Card information.
placeholder: |
CPU: 11th gen Intel r core tm i7-1185g7/AMD Ryzen 7 6800h/...
Memory: 32/16 GB...
Display Card: NVIDIA Quadro P400/...
validations:
required: false
- type: input
id: printer
attributes:
label: Printer
description: Which printer was selected
placeholder: Voron 2.4/VzBot/Prusa MK4/Bambu Lab X1 series/Bambu Lab P1P/...
validations:
required: true
- type: textarea
id: reproduce_steps
attributes:
label: How to reproduce
description: Please described the detailed steps to reproduce this issue
placeholder: |
1. Go to '...'
2. Click on '...'
3. Scroll down to '...'
4. See error
validations:
required: true
- type: textarea
id: actual_results
attributes:
label: Actual results
description: What happens after the above steps? Please, enclose a screenshot whenever possible (even when you think the description is clear).
validations:
required: true
- type: textarea
id: expected_results
attributes:
label: Expected results
description: What should happen after the above steps?
validations:
required: true
- type: markdown
id: file_required
attributes:
value: |
Please be sure to add the following files:
* Please upload a ZIP archive containing the **project file** used when the problem arise. Please export it just before or after the problem occurs. Even if you did nothing and/or there is no object, export it! (We need the configurations in project file).
You can export the project file from the application menu in `File`->`Save project as...`, then zip it
* A **log file** for crashes and similar issues.
You can find your log file here:
Windows: `%APPDATA%\OrcaSlicer\log` or usually `C:\Users\<your username>\AppData\Roaming\OrcaSlicer\log`
MacOS: `$HOME/Library/Application Support/OrcaSlicer/log`
Linux: `$HOME/.config/OrcaSlicer/log`
If Orca Slicer still starts, you can also reach this directory from the application menu in `Help` -> `Show Configuration Folder`
You can zip the log directory, or just select the newest logs when this issue happens, and zip them
- type: textarea
id: file_uploads
attributes:
label: Project file & Debug log uploads
description: Drop the project file and debug log here
placeholder: |
Project File: `File` -> `Save project as...` then zip it & drop it here
Log File: `Help` -> `Show Configuration Folder`, then zip the log directory, or just select the newest logs in `log` when this issue happens and zip them, then drop the zip file here
validations:
required: true
- type: checkboxes
id: file_checklist
attributes:
label: Checklist of files to include
options:
- label: Log file
- label: Project file
- type: textarea
attributes:
label: Anything else?
description: |
Screenshots? References? Anything that will give us more context about the issue you are encountering!
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false

View File

@@ -1,8 +0,0 @@
blank_issues_enabled: false
contact_links:
- name: Community Support (Discord channel)
url: https://discord.gg/P4VE9UY9gJ
about: Please ask and answer support "how do I?"questions here.
- name: Discussion Forum
url: https://github.com/OrcaSlicer/OrcaSlicer/discussions
about: Please raise ideas and feature suggestions here.

View File

@@ -1,66 +0,0 @@
name: 🚀 Feature Request / Enhancement
description: Suggest an improvement to make Orca Slicer even better!
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this feature request!
If your idea is still at the formulation stage, or you're not sure it would
be useful to many users, you can raise it as a discussion topic under [Ideas](https://github.com/OrcaSlicer/OrcaSlicer/discussions/categories/ideas)
or you can raise it on the [Discord server](https://discord.gg/P4VE9UY9gJ).
- type: checkboxes
attributes:
label: Is there an existing issue for this feature request?
description: |
Please search to see if an issue already exists for a feature, or perhaps one similar.
You can then comment and react so that we know know much interest there is in the feature request.
options:
- label: I have searched the existing issues
required: true
- type: textarea
attributes:
label: Is your feature request related to a problem?
description: A clear and concise description of what the problem is.
placeholder: I'm always frustrated when [...]
validations:
required: true
- type: dropdown
attributes:
label: Which printers will be beneficial to this feature?
description: Select affected printer firmware type.
multiple: true
options:
- Klipper
- Marlin
- Others
- All
validations:
required: true
- type: textarea
attributes:
label: Describe the solution you'd like
description: A clear and concise description of what you want to happen.
placeholder: It should do [...]
validations:
required: true
- type: textarea
attributes:
label: Describe alternatives you've considered
description: A clear and concise description of any alternative solutions or features you've considered.
placeholder: |
1. [...]
2. [...]
3. [...]
validations:
required: false
- type: textarea
attributes:
label: Additional context
description: |
Add any other context, diagrams, illustations or screenshots about the feature request here.
Tip: You can attach images or log files by clicking this area to highlight it and then dragging files in.
validations:
required: false

View File

@@ -1,11 +0,0 @@
name: 'Apt Install Deps'
description: 'Install the packages needed for building and deploying'
runs:
using: 'composite'
steps:
- name: Install dependencies from build_linux.sh
shell: bash
run: |
mkdir -p ${{ github.workspace }}/deps/build/destdir
sudo env "ORCA_UPDATER_SIG_KEY=$ORCA_UPDATER_SIG_KEY" ./build_linux.sh -ur
sudo chown $USER -R ./

View File

@@ -1,18 +0,0 @@
version: 2
updates:
# Only care about major updates to github actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
ignore: # Only suggest major updates for built-in actions
- dependency-name: "github/*"
update-types: ["version-update:semver-patch", "version-update:semver-minor"]
- dependency-name: "actions/*"
update-types: ["version-update:semver-patch", "version-update:semver-minor"]
# Docker dependencies
- package-ecosystem: "docker"
directory: "/"
schedule:
interval: "monthly"
# no support for c/cpp

View File

@@ -1,21 +0,0 @@
# Description
<!--
> Please provide a summary of the changes made in this PR. Include details such as:
> * What issue does this PR address or fix?
> * What new features or enhancements does this PR introduce?
> * Are there any breaking changes or dependencies that need to be considered?
-->
# Screenshots/Recordings/Graphs
<!--
> Please attach relevant screenshots to showcase the UI changes.
> Please attach images that can help explain the changes.
-->
## Tests
<!--
> Please describe the tests that you have conducted to verify the changes made in this PR.
-->

View File

@@ -1,26 +0,0 @@
name: Assign Issue
on:
schedule:
- cron: 0 0 * * *
issue_comment:
types: [created]
workflow_dispatch:
jobs:
assign:
permissions:
issues: write
runs-on: ubuntu-latest
steps:
- name: Assign the user or unassign stale assignments
# Note: v3.0.0 is broken (dist/index.mjs vs action.yml expects index.js)
# See: https://github.com/takanome-dev/assign-issue-action/issues/426
uses: takanome-dev/assign-issue-action@v2.2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
maintainers: 'noisyfox,softfever'
days_until_unassign: 30
block_assignment: false
reminder_days: 7
max_assignments: 12

View File

@@ -1,31 +0,0 @@
name: Auto-close duplicate issues
description: Auto-closes issues that are duplicates of existing issues
on:
schedule:
- cron: "0 9 * * *"
workflow_dispatch:
jobs:
auto-close-duplicates:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Auto-close duplicate issues
run: bun run scripts/auto-close-duplicates.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }}
GITHUB_REPOSITORY_NAME: ${{ github.event.repository.name }}
STATSIG_API_KEY: ${{ secrets.STATSIG_API_KEY }}

View File

@@ -1,44 +0,0 @@
name: Backfill Duplicate Comments
description: Triggers duplicate detection for old issues that don't have duplicate comments
on:
workflow_dispatch:
inputs:
days_back:
description: 'How many days back to look for old issues'
required: false
default: '90'
type: string
dry_run:
description: 'Dry run mode (true to only log what would be done)'
required: false
default: 'true'
type: choice
options:
- 'true'
- 'false'
jobs:
backfill-duplicate-comments:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
issues: read
actions: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Backfill duplicate comments
run: bun run scripts/backfill-duplicate-comments.ts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DAYS_BACK: ${{ inputs.days_back }}
DRY_RUN: ${{ inputs.dry_run }}

View File

@@ -1,235 +0,0 @@
name: Build all
on:
push:
branches:
- main
- release/*
paths:
- 'deps/**'
- 'src/**'
- '**/CMakeLists.txt'
- 'version.inc'
- 'localization/**'
- 'resources/**'
- ".github/workflows/build_*.yml"
- 'scripts/flatpak/**'
pull_request:
branches:
- main
- release/*
paths:
- 'deps/**'
- 'deps_src/**'
- 'src/**'
- '**/CMakeLists.txt'
- 'version.inc'
- ".github/workflows/build_*.yml"
- 'build_linux.sh'
- 'build_release_vs2022.bat'
- 'build_release_macos.sh'
- 'scripts/flatpak/**'
schedule:
- cron: '0 17 * * *' # run once a day at 1 AM Singapore time (UTC+8)
workflow_dispatch: # allows for manual dispatch
inputs:
build-deps-only:
description: 'Only build dependencies (bypasses caching)'
type: boolean
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build_linux:
strategy:
fail-fast: false
# Don't run scheduled builds on forks:
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
uses: ./.github/workflows/build_check_cache.yml
with:
os: ${{ vars.SELF_HOSTED && 'orca-lnx-server' || 'ubuntu-24.04' }}
build-deps-only: ${{ inputs.build-deps-only || false }}
secrets: inherit
build_windows:
# Don't run scheduled builds on forks:
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
uses: ./.github/workflows/build_check_cache.yml
with:
os: ${{ vars.SELF_HOSTED && 'orca-win-server' || 'windows-latest' }}
build-deps-only: ${{ inputs.build-deps-only || false }}
force-build: ${{ github.event_name == 'schedule' }}
secrets: inherit
build_macos_arch:
strategy:
fail-fast: false
matrix:
arch:
- arm64
- x86_64
# Don't run scheduled builds on forks:
if: ${{ !cancelled() && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
uses: ./.github/workflows/build_check_cache.yml
with:
os: ${{ vars.SELF_HOSTED && 'orca-macos-arm64' || 'macos-14' }}
arch: ${{ matrix.arch }}
build-deps-only: ${{ inputs.build-deps-only || false }}
force-build: ${{ github.event_name == 'schedule' }}
secrets: inherit
build_macos_universal:
name: Build macOS Universal
needs: build_macos_arch
if: ${{ !cancelled() && needs.build_macos_arch.result == 'success' && !inputs.build-deps-only && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
uses: ./.github/workflows/build_orca.yml
with:
os: ${{ vars.SELF_HOSTED && 'orca-macos-arm64' || 'macos-14' }}
arch: universal
macos-combine-only: true
secrets: inherit
unit_tests:
name: Unit Tests
runs-on: ${{ vars.SELF_HOSTED && 'orca-lnx-server' || 'ubuntu-24.04' }}
needs: build_linux
if: ${{ !cancelled() && success() }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
sparse-checkout: |
.github
scripts
tests
- name: Apt-Install Dependencies
if: ${{ !vars.SELF_HOSTED }}
uses: ./.github/actions/apt-install-deps
- name: Restore Test Artifact
uses: actions/download-artifact@v8
with:
name: ${{ github.sha }}-tests
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~4.3.0" # use most recent 4.3.x version
useLocalCache: true # <--= Use the local cache (default is 'false').
useCloudCache: true
- name: Unpackage and Run Unit Tests
timeout-minutes: 20
run: |
tar -xvf build_tests.tar
scripts/run_unit_tests.sh
- name: Upload Test Logs
uses: actions/upload-artifact@v7
if: ${{ failure() }}
with:
name: unit-test-logs
path: build/tests/**/*.log
- name: Publish Test Results
if: always()
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: "ctest_results.xml"
- name: Delete Test Artifact
if: success()
uses: geekyeggo/delete-artifact@v5
with:
name: ${{ github.sha }}-tests
flatpak:
name: "Flatpak"
container:
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-49
options: --privileged
volumes:
- /usr/local/lib/android:/usr/local/lib/android
- /usr/share/dotnet:/usr/share/dotnet
- /opt/ghc:/opt/ghc1
- /usr/local/share/boost:/usr/local/share/boost1
- /opt/hostedtoolcache:/opt/hostedtoolcache1
strategy:
fail-fast: false
matrix:
variant:
- arch: x86_64
runner: ubuntu-24.04
- arch: aarch64
runner: ubuntu-24.04-arm
# Don't run scheduled builds on forks; skip entirely on self-hosted runners
if: ${{ !cancelled() && !vars.SELF_HOSTED && (github.event_name != 'schedule' || github.repository == 'OrcaSlicer/OrcaSlicer') }}
runs-on: ${{ matrix.variant.runner }}
env:
date:
ver:
ver_pure:
steps:
- name: "Remove unneeded stuff to free disk space"
run:
rm -rf /usr/local/lib/android/* /usr/share/dotnet/* /opt/ghc1/* "/usr/local/share/boost1/*" /opt/hostedtoolcache1/*
- uses: actions/checkout@v6
- name: Get the version and date
run: |
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
ver="PR-${{ github.event.number }}"
git_commit_hash="${{ github.event.pull_request.head.sha }}"
else
ver=V$ver_pure
git_commit_hash="${{ github.sha }}"
fi
echo "ver=$ver" >> $GITHUB_ENV
echo "ver_pure=$ver_pure" >> $GITHUB_ENV
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
shell: bash
# Manage flatpak-builder cache externally so PRs restore but never upload
- name: Restore flatpak-builder cache
if: github.event_name == 'pull_request'
uses: actions/cache/restore@v5
with:
path: .flatpak-builder
key: flatpak-builder-${{ matrix.variant.arch }}-${{ github.event.pull_request.base.sha }}
restore-keys: flatpak-builder-${{ matrix.variant.arch }}-
- name: Save/restore flatpak-builder cache
if: github.event_name != 'pull_request'
uses: actions/cache@v5
with:
path: .flatpak-builder
key: flatpak-builder-${{ matrix.variant.arch }}-${{ github.sha }}
restore-keys: flatpak-builder-${{ matrix.variant.arch }}-
- name: Disable debug info for faster CI builds
run: |
sed -i '/^build-options:/a\ no-debuginfo: true\n strip: true' \
scripts/flatpak/com.orcaslicer.OrcaSlicer.yml
shell: bash
- name: Inject git commit hash into Flatpak manifest
run: |
sed -i "/name: OrcaSlicer/{n;s|buildsystem: simple|buildsystem: simple\n build-options:\n env:\n git_commit_hash: \"$git_commit_hash\"|}" \
scripts/flatpak/com.orcaslicer.OrcaSlicer.yml
shell: bash
- uses: flatpak/flatpak-github-actions/flatpak-builder@master
with:
bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
manifest-path: scripts/flatpak/com.orcaslicer.OrcaSlicer.yml
cache: false
arch: ${{ matrix.variant.arch }}
upload-artifact: false
- name: Upload artifacts Flatpak
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
path: '/__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak'
- name: Deploy Flatpak to nightly release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main'
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: /__w/OrcaSlicer/OrcaSlicer/OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
asset_name: OrcaSlicer-Linux-flatpak_nightly_${{ matrix.variant.arch }}.flatpak
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted

View File

@@ -1,64 +0,0 @@
name: Check Cache
on:
workflow_call:
inputs:
os:
required: true
type: string
arch:
required: false
type: string
build-deps-only:
required: false
type: boolean
force-build:
required: false
type: boolean
jobs:
check_cache: # determines if there is a cache and outputs variables used in caching process
name: Check Cache
runs-on: ${{ inputs.os }}
outputs:
cache-key: ${{ steps.set_outputs.outputs.cache-key }}
cache-path: ${{ steps.set_outputs.outputs.cache-path }}
valid-cache: ${{ steps.cache_deps.outputs.cache-hit }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: 'false'
- name: set outputs
id: set_outputs
env:
# Keep macOS cache keys and paths architecture-specific.
cache-os: ${{ runner.os == 'macOS' && format('macos-{0}', inputs.arch) || (runner.os == 'Windows' && 'windows' || 'linux-clang') }}
dep-folder-name: ${{ runner.os == 'macOS' && format('/{0}', inputs.arch) || '/OrcaSlicer_dep' }}
output-cmd: ${{ runner.os == 'Windows' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
run: |
echo cache-key=${{ env.cache-os }}-cache-orcaslicer_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }}
echo cache-path=${{ github.workspace }}/deps/build${{ env.dep-folder-name }} >> ${{ env.output-cmd }}
- name: load cache
id: cache_deps
uses: actions/cache@v5
with:
path: ${{ steps.set_outputs.outputs.cache-path }}
key: ${{ steps.set_outputs.outputs.cache-key }}
lookup-only: true
build_deps: # call next step
name: Build Deps
needs: [check_cache]
uses: ./.github/workflows/build_deps.yml
with:
cache-key: ${{ needs.check_cache.outputs.cache-key }}
cache-path: ${{ needs.check_cache.outputs.cache-path }}
valid-cache: ${{ needs.check_cache.outputs.valid-cache == 'true' }}
os: ${{ inputs.os }}
arch: ${{ inputs.arch }}
build-deps-only: ${{ inputs.build-deps-only }}
force-build: ${{ inputs.force-build }}
secrets: inherit

View File

@@ -1,140 +0,0 @@
on:
workflow_call:
inputs:
cache-key:
required: true
type: string
cache-path:
required: true
type: string
valid-cache:
required: true
type: boolean
os:
required: true
type: string
arch:
required: false
type: string
build-deps-only:
required: false
type: boolean
force-build:
required: false
type: boolean
jobs:
build_deps:
name: Build Deps
if: ${{ !cancelled() && (inputs.build-deps-only || inputs.force-build || inputs.valid-cache != true) }}
runs-on: ${{ inputs.os }}
env:
date:
steps:
# Setup the environment
- name: Checkout
uses: actions/checkout@v6
with:
lfs: 'false'
- name: load cached deps
uses: actions/cache@v5
with:
path: ${{ inputs.cache-path }}
key: ${{ inputs.cache-key }}
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~4.3.0" # use most recent 4.3.x version
useLocalCache: true # <--= Use the local cache (default is 'false').
useCloudCache: true
- name: setup dev on Windows
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Get the date on Ubuntu and macOS
if: runner.os != 'Windows'
run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
shell: bash
- name: Get the date on Windows
if: runner.os == 'Windows'
run: echo "date=$(Get-Date -Format 'yyyyMMdd')" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
shell: pwsh
# Build Dependencies
- name: Build on Windows
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}
run: |
if (-not "${{ vars.SELF_HOSTED }}") {
choco install strawberryperl
}
.\build_release_vs.bat deps
.\build_release_vs.bat pack
shell: pwsh
- name: Build on Mac ${{ inputs.arch }}
if: runner.os == 'macOS'
working-directory: ${{ github.workspace }}
run: |
if [ -z "${{ vars.SELF_HOSTED }}" ]; then
brew install automake texinfo libtool
fi
./build_release_macos.sh -dx ${{ !vars.SELF_HOSTED && '-1' || '' }} -a ${{ inputs.arch }} -t 10.15
(cd "${{ github.workspace }}/deps/build/${{ inputs.arch }}" && \
find . -mindepth 1 -maxdepth 1 ! -name 'OrcaSlicer_dep' -exec rm -rf {} +)
- name: Apt-Install Dependencies
if: runner.os == 'Linux' && !vars.SELF_HOSTED
uses: ./.github/actions/apt-install-deps
- name: Build on Ubuntu
if: runner.os == 'Linux'
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/deps/build/destdir
./build_linux.sh -drlL
cd deps/build
tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir
# Upload Artifacts
# - name: Upload Mac ${{ inputs.arch }} artifacts
# if: runner.os == 'macOS'
# uses: actions/upload-artifact@v6
# with:
# name: OrcaSlicer_dep_mac_${{ env.date }}
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep*.tar.gz
# - name: Upload Windows artifacts
# if: runner.os == 'Windows'
# uses: actions/upload-artifact@v6
# with:
# name: OrcaSlicer_dep_win64_${{ env.date }}
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep*.zip
# - name: Upload Ubuntu artifacts
# if: runner.os == 'Linux' && !env.ACT
# env:
# ubuntu-ver: '2404'
# uses: actions/upload-artifact@v6
# with:
# name: OrcaSlicer_dep_ubuntu_${{ env.ubuntu-ver }}_${{ env.date }}
# path: ${{ github.workspace }}/deps/build/OrcaSlicer_dep_ubuntu_*.tar.gz
build_orca:
name: Build OrcaSlicer
needs: [build_deps]
if: ${{ !cancelled() && !inputs.build-deps-only && (inputs.force-build || (inputs.valid-cache == true && needs.build_deps.result == 'skipped') || (inputs.valid-cache != true && success())) }}
uses: ./.github/workflows/build_orca.yml
with:
cache-key: ${{ inputs.cache-key }}
cache-path: ${{ inputs.cache-path }}
os: ${{ inputs.os }}
arch: ${{ inputs.arch }}
secrets: inherit

View File

@@ -1,463 +0,0 @@
on:
workflow_call:
inputs:
cache-key:
required: false
type: string
cache-path:
required: false
type: string
os:
required: true
type: string
arch:
required: false
type: string
macos-combine-only:
required: false
type: boolean
default: false
jobs:
build_orca:
name: Build OrcaSlicer
runs-on: ${{ inputs.os }}
env:
date:
ver:
ver_pure:
ubuntu-ver: '2404'
ubuntu-ver-str: '_Ubuntu2404'
ORCA_UPDATER_SIG_KEY: ${{ secrets.ORCA_UPDATER_SIG_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
lfs: 'false'
- name: load cached deps
if: ${{ !(runner.os == 'macOS' && inputs.macos-combine-only) }}
uses: actions/cache@v5
with:
path: ${{ inputs.cache-path }}
key: ${{ inputs.cache-key }}
fail-on-cache-miss: true
- uses: lukka/get-cmake@latest
with:
cmakeVersion: "~4.3.0" # use most recent 4.3.x version
useLocalCache: true # <--= Use the local cache (default is 'false').
useCloudCache: true
- name: Get the version and date on Ubuntu and macOS
if: runner.os != 'Windows'
run: |
ver_pure=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
ver="PR-${{ github.event.number }}"
git_commit_hash="${{ github.event.pull_request.head.sha }}"
else
ver=V$ver_pure
git_commit_hash=""
fi
echo "ver=$ver" >> $GITHUB_ENV
echo "ver_pure=$ver_pure" >> $GITHUB_ENV
echo "date=$(date +'%Y%m%d')" >> $GITHUB_ENV
echo "git_commit_hash=$git_commit_hash" >> $GITHUB_ENV
shell: bash
- name: Get the version and date on Windows
if: runner.os == 'Windows'
run: |
$date = Get-Date -Format 'yyyyMMdd'
$ref = "${{ github.ref }}"
$eventName = "${{ github.event_name }}"
$prNumber = "${{ github.event.number }}"
if ($eventName -eq 'pull_request') {
$ver = "PR" + $prNumber
$git_commit_hash = "${{ github.event.pull_request.head.sha }}"
} else {
$versionContent = Get-Content version.inc -Raw
if ($versionContent -match 'set\(SoftFever_VERSION "(.*?)"\)') {
$ver = $matches[1]
}
$ver = "V$ver"
$git_commit_hash = ""
}
echo "ver=$ver" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "date=$date" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "git_commit_hash=$git_commit_hash" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8
echo "date: ${{ env.date }} version: ${{ env.ver }}"
shell: pwsh
# Mac
- name: Install tools mac
if: runner.os == 'macOS' && !inputs.macos-combine-only
run: |
if [ -z "${{ vars.SELF_HOSTED }}" ]; then
brew install libtool
brew list
fi
mkdir -p ${{ github.workspace }}/deps/build/${{ inputs.arch }}
- name: Free disk space
if: runner.os == 'macOS' && !inputs.macos-combine-only && !vars.SELF_HOSTED
run: |
df -hI /dev/disk3s1s1
sudo find /Applications -maxdepth 1 -type d -name "Xcode_*.app" ! -name "Xcode_15.4.app" -exec rm -rf {} +
sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/*
df -hI /dev/disk3s1s1
- name: Build slicer mac
if: runner.os == 'macOS' && !inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
./build_release_macos.sh -s -n -x ${{ !vars.SELF_HOSTED && '-1' || '' }} -a ${{ inputs.arch }} -t 10.15
- name: Pack macOS app bundle ${{ inputs.arch }}
if: runner.os == 'macOS' && !inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
tar -czvf OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}.tar.gz -C build/${{ inputs.arch }} OrcaSlicer
- name: Upload macOS app bundle ${{ inputs.arch }}
if: runner.os == 'macOS' && !inputs.macos-combine-only
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}.tar.gz
- name: Download macOS app bundles
if: runner.os == 'macOS' && inputs.macos-combine-only
uses: actions/download-artifact@v8
with:
pattern: OrcaSlicer_Mac_bundle_*_${{ github.sha }}
path: ${{ github.workspace }}/mac_bundles
- name: Extract macOS app bundles
if: runner.os == 'macOS' && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
mkdir -p build/arm64 build/x86_64
arm_bundle=$(find "${{ github.workspace }}/mac_bundles/OrcaSlicer_Mac_bundle_arm64_${{ github.sha }}" -name '*.tar.gz' -print -quit)
x86_bundle=$(find "${{ github.workspace }}/mac_bundles/OrcaSlicer_Mac_bundle_x86_64_${{ github.sha }}" -name '*.tar.gz' -print -quit)
tar -xzvf "$arm_bundle" -C "${{ github.workspace }}/build/arm64"
tar -xzvf "$x86_bundle" -C "${{ github.workspace }}/build/x86_64"
- name: Build universal mac app bundle
if: runner.os == 'macOS' && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
./build_release_macos.sh -u -x ${{ !vars.SELF_HOSTED && '-1' || '' }} -a universal -t 10.15
- name: Delete intermediate per-arch artifacts
if: runner.os == 'macOS' && inputs.macos-combine-only
uses: geekyeggo/delete-artifact@v5
with:
name: |
OrcaSlicer_Mac_bundle_arm64_${{ github.sha }}
OrcaSlicer_Mac_bundle_x86_64_${{ github.sha }}
# Thanks to RaySajuuk, it's working now
- name: Sign app and notary
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && runner.os == 'macOS' && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
CERTIFICATE_ID: ${{ secrets.MACOS_CERTIFICATE_ID }}
run: |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db
echo -n "$BUILD_CERTIFICATE_BASE64" | base64 --decode --output $CERTIFICATE_PATH
security create-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH
security unlock-keychain -p $KEYCHAIN_PASSWORD $KEYCHAIN_PATH
# Set the temporary keychain as the default to prevent codesign from accessing the locked login keychain
security default-keychain -s "$KEYCHAIN_PATH"
security import $CERTIFICATE_PATH -P $P12_PASSWORD -A -t cert -f pkcs12 -k $KEYCHAIN_PATH
security list-keychain -d user -s $KEYCHAIN_PATH
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $P12_PASSWORD $KEYCHAIN_PATH
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app
# Sign OrcaSlicer_profile_validator.app if it exists
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app
fi
# Create main OrcaSlicer DMG without the profile validator helper
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
# Create separate OrcaSlicer_profile_validator DMG if the app exists
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
fi
# Notarize main DMG
xcrun notarytool submit "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}" --wait
xcrun stapler staple OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
# Notarize profile validator DMG if it exists
if [ -f "OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg" ]; then
xcrun notarytool submit "OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}" --wait
xcrun stapler staple OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
fi
- name: Create DMG without notary
if: github.ref != 'refs/heads/main' && runner.os == 'macOS' && inputs.macos-combine-only
working-directory: ${{ github.workspace }}
run: |
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_dmg/Applications
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
# Create separate OrcaSlicer_profile_validator DMG if the app exists
if [ -f "${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
mkdir -p ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg
rm -rf ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/*
cp -R ${{ github.workspace }}/build/universal/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/
ln -sfn /Applications ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg/Applications
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/universal/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
fi
- name: Upload artifacts mac
if: runner.os == 'macOS' && inputs.macos-combine-only
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Mac_universal_${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
- name: Upload OrcaSlicer_profile_validator DMG mac
if: runner.os == 'macOS' && inputs.macos-combine-only && !vars.SELF_HOSTED
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_profile_validator_Mac_universal_DMG_${{ env.ver }}
path: ${{ github.workspace }}/OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
if-no-files-found: ignore
- name: Deploy Mac release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && runner.os == 'macOS' && inputs.macos-combine-only && !vars.SELF_HOSTED
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
asset_name: OrcaSlicer_Mac_universal_nightly.dmg
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Deploy Mac OrcaSlicer_profile_validator DMG release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && runner.os == 'macOS' && inputs.macos-combine-only && !vars.SELF_HOSTED
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ${{ github.workspace }}/OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
asset_name: OrcaSlicer_profile_validator_Mac_universal_nightly.dmg
asset_content_type: application/octet-stream
max_releases: 1
# Windows
- name: setup MSVC
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Install nsis
if: runner.os == 'Windows' && !vars.SELF_HOSTED
run: |
dir "C:/Program Files (x86)/Windows Kits/10/Include"
choco install nsis
- name: Build slicer Win
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}
env:
WindowsSdkDir: 'C:\Program Files (x86)\Windows Kits\10\'
WindowsSDKVersion: '10.0.26100.0\'
run: .\build_release_vs.bat slicer
- name: Create installer Win
if: runner.os == 'Windows' && !vars.SELF_HOSTED
working-directory: ${{ github.workspace }}/build
run: |
cpack -G NSIS
- name: Pack app
if: runner.os == 'Windows'
working-directory: ${{ github.workspace }}/build
shell: cmd
run: '"C:/Program Files/7-Zip/7z.exe" a -tzip OrcaSlicer_Windows_${{ env.ver }}_portable.zip ${{ github.workspace }}/build/OrcaSlicer'
- name: Pack PDB
if: runner.os == 'Windows' && !vars.SELF_HOSTED
working-directory: ${{ github.workspace }}/build/src/Release
shell: cmd
run: '"C:/Program Files/7-Zip/7z.exe" a -m0=lzma2 -mx9 Debug_PDB_${{ env.ver }}_for_developers_only.7z *.pdb'
- name: Upload artifacts Win zip
if: runner.os == 'Windows'
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Windows_${{ env.ver }}_portable
path: ${{ github.workspace }}/build/OrcaSlicer
- name: Upload artifacts Win installer
if: runner.os == 'Windows' && !vars.SELF_HOSTED
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Windows_${{ env.ver }}
path: ${{ github.workspace }}/build/OrcaSlicer*.exe
- name: Upload artifacts Win PDB
if: runner.os == 'Windows' && !vars.SELF_HOSTED
uses: actions/upload-artifact@v7
with:
name: PDB
path: ${{ github.workspace }}/build/src/Release/Debug_PDB_${{ env.ver }}_for_developers_only.7z
- name: Upload OrcaSlicer_profile_validator Win
if: runner.os == 'Windows' && !vars.SELF_HOSTED
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_profile_validator_Windows_${{ env.ver }}
path: ${{ github.workspace }}/build/src/Release/OrcaSlicer_profile_validator.exe
- name: Deploy Windows release portable
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && runner.os == 'Windows' && !vars.SELF_HOSTED
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ${{ github.workspace }}/build/OrcaSlicer_Windows_${{ env.ver }}_portable.zip
asset_name: OrcaSlicer_Windows_nightly_portable.zip
asset_content_type: application/x-zip-compressed
max_releases: 1
- name: Deploy Windows release installer
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && runner.os == 'Windows' && !vars.SELF_HOSTED
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ${{ github.workspace }}/build/OrcaSlicer_Windows_Installer_${{ env.ver }}.exe
asset_name: OrcaSlicer_Windows_Installer_nightly.exe
asset_content_type: application/x-msdownload
max_releases: 1
- name: Deploy Windows OrcaSlicer_profile_validator release
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && runner.os == 'Windows' && !vars.SELF_HOSTED
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ${{ github.workspace }}/build/src/Release/OrcaSlicer_profile_validator.exe
asset_name: OrcaSlicer_profile_validator_Windows_nightly.exe
asset_content_type: application/x-msdownload
max_releases: 1
# Ubuntu
- name: Apt-Install Dependencies
if: runner.os == 'Linux' && !vars.SELF_HOSTED
uses: ./.github/actions/apt-install-deps
# Tests must built at the same time as the slicer;
# if you untangle them feel free to separate them here too
- name: Build slicer and tests
if: runner.os == 'Linux'
shell: bash
run: |
./build_linux.sh -istrlL
mv -n ./build/OrcaSlicer_Linux_V${{ env.ver_pure }}.AppImage ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
chmod +x ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
tar -cvpf build_tests.tar build/tests
# Use tar because upload-artifacts won't always preserve directory structure
# and doesn't preserve file permissions
- name: Upload Test Artifact
if: runner.os == 'Linux'
uses: actions/upload-artifact@v7
with:
name: ${{ github.sha }}-tests
overwrite: true
path: build_tests.tar
retention-days: 5
if-no-files-found: error
- name: Build orca_custom_preset_tests
if: github.ref == 'refs/heads/main' && runner.os == 'Linux' && !vars.SELF_HOSTED
working-directory: ${{ github.workspace }}/build/src/Release
shell: bash
run: |
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -g 1
cd ${{ github.workspace }}/resources/profiles
zip -r orca_custom_preset_tests.zip user/
- name: Upload artifacts Ubuntu
if: ${{ ! env.ACT && runner.os == 'Linux' }}
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_Linux_ubuntu_${{ env.ubuntu-ver }}_${{ env.ver }}
path: './build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage'
- name: Upload OrcaSlicer_profile_validator Ubuntu
if: ${{ ! env.ACT && runner.os == 'Linux' && !vars.SELF_HOSTED }}
uses: actions/upload-artifact@v7
with:
name: OrcaSlicer_profile_validator_Linux_ubuntu_${{ env.ubuntu-ver }}_${{ env.ver }}
path: './build/src/Release/OrcaSlicer_profile_validator'
- name: Deploy Ubuntu release
if: ${{ github.repository == 'OrcaSlicer/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && runner.os == 'Linux' && !vars.SELF_HOSTED }}
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
asset_name: OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_nightly.AppImage
asset_content_type: application/octet-stream
max_releases: 1 # optional, if there are more releases than this matching the asset_name, the oldest ones are going to be deleted
- name: Deploy Ubuntu release
if: ${{ github.repository == 'OrcaSlicer/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && runner.os == 'Linux' && !vars.SELF_HOSTED }}
uses: rickstaa/action-create-tag@v1
with:
tag: "nightly-builds"
tag_exists_error: false
force_push_tag: true
message: "nightly-builds"
- name: Deploy Ubuntu OrcaSlicer_profile_validator release
if: ${{ github.repository == 'OrcaSlicer/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && runner.os == 'Linux' && !vars.SELF_HOSTED }}
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ./build/src/Release/OrcaSlicer_profile_validator
asset_name: OrcaSlicer_profile_validator_Linux${{ env.ubuntu-ver-str }}_nightly
asset_content_type: application/octet-stream
max_releases: 1
- name: Deploy orca_custom_preset_tests
if: ${{ github.repository == 'OrcaSlicer/OrcaSlicer' && ! env.ACT && github.ref == 'refs/heads/main' && runner.os == 'Linux' && !vars.SELF_HOSTED }}
uses: WebFreak001/deploy-nightly@v3.2.0
with:
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
release_id: 137995723
asset_path: ${{ github.workspace }}/resources/profiles/orca_custom_preset_tests.zip
asset_name: orca_custom_preset_tests.zip
asset_content_type: application/octet-stream
max_releases: 1

View File

@@ -1,44 +0,0 @@
name: Check locale
on:
pull_request:
branches:
- main
paths:
- 'localization/**'
- ".github/workflows/check_locale.yml"
jobs:
check_translation:
name: Check translation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Install gettext
run: |
sudo apt-get update
sudo apt-get install -y gettext
# don't call ./run_gentext.sh as most translators never sync with main branch...
- name: Check translation format
run: |
echo $PWD
pot_file="./localization/i18n/OrcaSlicer.pot"
for dir in ./localization/i18n/*/
do
dir=${dir%*/} # remove the trailing "/"
lang=${dir##*/} # extract the language identifier
if [ -f "$dir/OrcaSlicer_${lang}.po" ]; then
mkdir -p ./resources/i18n/${lang}/
msgfmt --check-format -o ./resources/i18n/${lang}/OrcaSlicer.mo $dir/OrcaSlicer_${lang}.po
# Check the exit status of the msgfmt command
if [ $? -ne 0 ]; then
echo "Error encountered with msgfmt command for language ${lang}."
exit 1 # Exit the script with an error status
fi
fi
done

View File

@@ -1,118 +0,0 @@
name: Check profiles
on:
pull_request:
branches:
- main
paths:
- 'resources/profiles/**'
- ".github/workflows/check_profiles.yml"
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'warning'
permissions:
contents: read
jobs:
check_profiles:
name: Check profiles
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Run extra JSON check
id: extra_json_check
continue-on-error: true
run: |
set +e
python3 ./scripts/orca_extra_profile_check.py 2>&1 | tee ${{ runner.temp }}/extra_json_check.log
exit ${PIPESTATUS[0]}
# download
- name: Download
working-directory: ${{ github.workspace }}
run: |
curl -LJO https://github.com/SoftFever/Orca_tools/releases/download/1/OrcaSlicer_profile_validator
chmod +x ./OrcaSlicer_profile_validator
# validate profiles
- name: validate system profiles
id: validate_system
continue-on-error: true
run: |
set +e
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2 2>&1 | tee ${{ runner.temp }}/validate_system.log
exit ${PIPESTATUS[0]}
- name: validate custom presets
id: validate_custom
continue-on-error: true
working-directory: ${{ github.workspace }}
run: |
set +e
curl -LJO https://github.com/OrcaSlicer/OrcaSlicer/releases/download/nightly-builds/orca_custom_preset_tests.zip
unzip -q ./orca_custom_preset_tests.zip -d ${{ github.workspace }}/resources/profiles
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2 2>&1 | tee ${{ runner.temp }}/validate_custom.log
exit ${PIPESTATUS[0]}
- name: Prepare comment artifact
if: ${{ always() && github.event_name == 'pull_request' && (steps.extra_json_check.outcome == 'failure' || steps.validate_system.outcome == 'failure' || steps.validate_custom.outcome == 'failure') }}
run: |
mkdir -p ${{ runner.temp }}/profile-check-results
{
echo "## :x: Profile Validation Errors"
echo ""
if [ "${{ steps.extra_json_check.outcome }}" = "failure" ]; then
echo "### Extra JSON Check Failed"
echo ""
echo '```'
head -c 30000 ${{ runner.temp }}/extra_json_check.log || echo "No output captured"
echo '```'
echo ""
fi
if [ "${{ steps.validate_system.outcome }}" = "failure" ]; then
echo "### System Profile Validation Failed"
echo ""
echo '```'
head -c 30000 ${{ runner.temp }}/validate_system.log || echo "No output captured"
echo '```'
echo ""
fi
if [ "${{ steps.validate_custom.outcome }}" = "failure" ]; then
echo "### Custom Preset Validation Failed"
echo ""
echo '```'
head -c 30000 ${{ runner.temp }}/validate_custom.log || echo "No output captured"
echo '```'
echo ""
fi
echo "---"
echo "*Please fix the above errors and push a new commit.*"
} > ${{ runner.temp }}/profile-check-results/pr_comment.md
echo "${{ github.event.pull_request.number }}" > ${{ runner.temp }}/profile-check-results/pr_number.txt
- name: Upload comment artifact
if: ${{ always() && github.event_name == 'pull_request' && (steps.extra_json_check.outcome == 'failure' || steps.validate_system.outcome == 'failure' || steps.validate_custom.outcome == 'failure') }}
uses: actions/upload-artifact@v7
with:
name: profile-check-results
path: ${{ runner.temp }}/profile-check-results/
retention-days: 1
- name: Fail if any check failed
if: ${{ always() && (steps.extra_json_check.outcome == 'failure' || steps.validate_system.outcome == 'failure' || steps.validate_custom.outcome == 'failure') }}
run: |
echo "One or more profile checks failed. See above for details."
exit 1

View File

@@ -1,46 +0,0 @@
name: Post profile check comment
# NOTE: The workflow name in the 'workflows' filter below must match the 'name'
# field in check_profiles.yml exactly. If that name changes, update it here too.
on:
workflow_run:
workflows: ["Check profiles"]
types:
- completed
permissions:
pull-requests: write
jobs:
post_comment:
name: Post PR comment
runs-on: ubuntu-24.04
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'failure' }}
steps:
- name: Download artifact
id: download
uses: actions/download-artifact@v8
continue-on-error: true
with:
name: profile-check-results
run-id: ${{ github.event.workflow_run.id }}
github-token: ${{ github.token }}
- name: Post comment on PR
if: ${{ steps.download.outcome == 'success' }}
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
if [ ! -f pr_number.txt ] || [ ! -f pr_comment.md ]; then
echo "No comment artifact found, skipping."
exit 0
fi
PR_NUMBER=$(cat pr_number.txt)
if ! [[ "$PR_NUMBER" =~ ^[0-9]+$ ]]; then
echo "Invalid PR number: $PR_NUMBER"
exit 1
fi
gh pr comment "$PR_NUMBER" --body-file pr_comment.md

View File

@@ -1,81 +0,0 @@
name: Orca Issue Dedupe
description: Automatically dedupe GitHub issues using AI
on:
issues:
types: [opened]
workflow_dispatch:
inputs:
issue_number:
description: 'Issue number to process for duplicate detection'
required: true
type: string
jobs:
dedupe-issues:
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
issues: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Run Claude Code slash command
uses: anthropics/claude-code-base-action@beta
with:
prompt: "/dedupe ${{ github.repository }}/issues/${{ github.event.issue.number || inputs.issue_number }}"
claude_code_oauth_token: ${{ secrets.CLAUDE_CODE_OAUTH_TOKEN }}
claude_args: "--model claude-sonnet-4-5-20250929"
claude_env: |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Log duplicate comment event to Statsig
if: always()
env:
STATSIG_API_KEY: ${{ secrets.STATSIG_API_KEY }}
run: |
ISSUE_NUMBER=${{ github.event.issue.number || inputs.issue_number }}
REPO=${{ github.repository }}
if [ -z "$STATSIG_API_KEY" ]; then
echo "STATSIG_API_KEY not found, skipping Statsig logging"
exit 0
fi
# Prepare the event payload
EVENT_PAYLOAD=$(jq -n \
--arg issue_number "$ISSUE_NUMBER" \
--arg repo "$REPO" \
--arg triggered_by "${{ github.event_name }}" \
'{
events: [{
eventName: "github_duplicate_comment_added",
value: 1,
metadata: {
repository: $repo,
issue_number: ($issue_number | tonumber),
triggered_by: $triggered_by,
workflow_run_id: "${{ github.run_id }}"
},
time: (now | floor | tostring)
}]
}')
# Send to Statsig API
echo "Logging duplicate comment event to Statsig for issue #${ISSUE_NUMBER}"
RESPONSE=$(curl -s -w "\n%{http_code}" -X POST https://events.statsigapi.net/v1/log_event \
-H "Content-Type: application/json" \
-H "STATSIG-API-KEY: ${STATSIG_API_KEY}" \
-d "$EVENT_PAYLOAD")
HTTP_CODE=$(echo "$RESPONSE" | tail -n1)
BODY=$(echo "$RESPONSE" | head -n-1)
if [ "$HTTP_CODE" -eq 200 ] || [ "$HTTP_CODE" -eq 202 ]; then
echo "Successfully logged duplicate comment event for issue #${ISSUE_NUMBER}"
else
echo "Failed to log duplicate comment event for issue #${ISSUE_NUMBER}. HTTP ${HTTP_CODE}: ${BODY}"
fi

View File

@@ -1,78 +0,0 @@
name: Generate Doxygen Documentation
on:
schedule:
- cron: '0 0 * * 1' # Every Monday at midnight UTC
workflow_dispatch: # Manual trigger
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
build-and-deploy:
name: Build and Deploy Docs
runs-on: ubuntu-latest
timeout-minutes: 60
# Only run on main branch of the main repository
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main'
permissions:
contents: read
steps:
- uses: thejerrybao/setup-swap-space@v1
with:
swap-space-path: /swapfile
swap-size-gb: 8
remove-existing-swap-files: true
- name: Checkout repository
uses: actions/checkout@v6
- name: Install Doxygen and Graphviz
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y doxygen graphviz
- name: Generate documentation
run: |
set -euo pipefail
# Override DOT_NUM_THREADS to avoid parallel dot race condition bug
sed -i 's/^DOT_NUM_THREADS.*/DOT_NUM_THREADS = 1/' .doxygen
doxygen .doxygen
# Verify documentation was generated
if [ ! -f "internal_docs/index.html" ]; then
echo "Error: Documentation generation failed - index.html not found"
exit 1
fi
- name: Install Rclone
run: |
set -euo pipefail
sudo -v
curl -fsSL https://rclone.org/install.sh | sudo bash
- name: optimize
run: |
set -euo pipefail
rm -f internal_docs/Nodes.xml internal_docs/Tokens.xml
find internal_docs -name "*.map" -type f -delete || true
find internal_docs -name "*.md5" -type f -delete || true
- name: upload
# We configure rclone dynamically using environment variables
run: |
set -euo pipefail
# Remove existing config if it exists to avoid conflicts
rclone config delete cloudflare 2>/dev/null || true
rclone config create cloudflare s3 \
provider Cloudflare \
access_key_id ${{ secrets.R2_ACCESS_KEY_ID }} \
secret_access_key ${{ secrets.R2_SECRET_ACCESS_KEY }} \
endpoint ${{ secrets.R2_ENDPOINT }}
rclone sync internal_docs/ cloudflare:orcaslicer-internals \
--progress \
--transfers 512 \
--checkers 512
echo "Documentation upload completed successfully"

View File

@@ -1,44 +0,0 @@
on:
push:
paths:
- '**.sh'
- 'scripts/linux.d/*'
pull_request:
paths:
- '**.sh'
- 'scripts/linux.d/*'
schedule:
- cron: '55 7 * * *' # run once a day near midnight US Pacific time
workflow_dispatch: # allows for manual dispatch
name: "Shellcheck"
permissions: {}
jobs:
shellcheck:
name: Shellcheck
runs-on: ubuntu-latest
steps:
- name: Cache shellcheck download
id: cache-shellcheck-v0_11
uses: actions/cache@v5
with:
path: ~/shellcheck
key: ${{ runner.os }}-shellcheck-v0_11
- name: Download shellcheck
if: steps.cache-shellcheck-v0_11.outputs.cache-hit != 'true'
shell: bash
env:
INPUT_VERSION: "v0.11.0"
run: |
curl -L#o ~/sc.tar.xz "https://github.com/koalaman/shellcheck/releases/download/${INPUT_VERSION}/shellcheck-${INPUT_VERSION}.linux.x86_64.tar.xz"
tar -xvf ~/sc.tar.xz -C ~
mv ~/shellcheck-"${INPUT_VERSION}"/shellcheck ~/shellcheck
- uses: actions/checkout@v6
with:
fetch-depth: 1
- name: Shellcheck scripts
run: 'find . -not -name \*.md \( -path ./scripts/linux.d/\* -o -name \*.sh \) -print0 | xargs -0 ~/shellcheck'

View File

@@ -1,38 +0,0 @@
name: Update Translation Catalog
on:
# schedule:
# - cron: 0 0 * * 1
workflow_dispatch:
jobs:
update_translation:
name: Update translation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.12'
- name: Install gettext
run: |
sudo apt-get update
sudo apt-get install -y gettext
- name: Update translation catalog
run: |
./scripts/run_gettext.sh --full
git add localization/i18n/*
- name: Commit translation catalog updates
uses: qoomon/actions--create-commit@v1
id: commit
with:
message: Update translation catalog
skip-empty: true
- name: Push changes
run: git push

View File

@@ -1,14 +0,0 @@
name: Publish to WinGet
on:
release:
types: [ released ]
jobs:
publish:
runs-on: windows-latest
steps:
- uses: vedantmgoyal9/winget-releaser@main
with:
identifier: SoftFever.OrcaSlicer
version: ${{ github.event.release.tag_name }}
token: ${{ secrets.WINGET_TOKEN }}
installers-regex: '\.exe$'

33
.gitignore vendored
View File

@@ -1,9 +1,7 @@
Build
Build.bat
/build*/
CMakeLists.txt.user
**/CMakeLists.txt.autosave
deps/build*
/build/
deps/build
MYMETA.json
MYMETA.yml
_build
@@ -19,30 +17,9 @@ xs/assertlib*
local-lib
/src/TAGS
/.vscode/
/.vscode
build-linux/*
deps/build*/*
deps/build-linux/*
**/.DS_Store
install_*
build_*/
install_dir
install_release
SVG
src/OrcaSlicer-doc/
.idea/
/.cache/
*.mo
**/process_full/
**/machine_full/
**/filament_full/
/deps/DL_CACHE/
/deps/DL_CACHE
**/.flatpak-builder/
*.no-debug.yml
resources/profiles/user/default
*.code-workspace
deps_src/build/
test.js
/.cache/
.clangd
internal_docs/
*.flatpak
/flatpak-repo/

8
.idea/.gitignore generated vendored
View File

@@ -1,8 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

2
.idea/OrcaSlicer.iml generated
View File

@@ -1,2 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />

View File

@@ -1,7 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<clangFormatSettings>
<option name="ENABLED" value="true" />
</clangFormatSettings>
</code_scheme>
</component>

View File

@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>

4
.idea/misc.xml generated
View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
</project>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/OrcaSlicer.iml" filepath="$PROJECT_DIR$/.idea/OrcaSlicer.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

View File

@@ -1,23 +0,0 @@
# Repository Guidelines
## Project Structure & Module Organization
OrcaSlicers C++17 sources live in `src/`, split by feature modules and platform adapters. User assets, icons, and printer presets are in `resources/`; translations stay in `localization/`. Tests sit in `tests/`, grouped by domain (`libslic3r/`, `sla_print/`, etc.) with fixtures under `tests/data/`. CMake helpers reside in `cmake/`, and longer references in `doc/` and `SoftFever_doc/`. Automation scripts belong in `scripts/` and `tools/`. Treat everything in `deps/` and `deps_src/` as vendored snapshots—do not modify without mirroring upstream tags.
## Build, Test, and Development Commands
Use out-of-source builds:
- `cmake -S . -B build -DCMAKE_BUILD_TYPE=Release` configures dependencies and generates build files.
- `cmake --build build --target OrcaSlicer --config Release` compiles the app; add `--parallel` to speed up.
- `cmake --build build --target tests` then `ctest --test-dir build --output-on-failure` runs automated suites.
Platform helpers such as `build_linux.sh`, `build_release_macos.sh`, and `build_release_vs2022.bat` wrap the same flow with toolchain flags. Use `build_release_macos.sh -sx` when reproducing macOS build issues, and `scripts/DockerBuild.sh` for reproducible container builds.
## Coding Style & Naming Conventions
`.clang-format` enforces 4-space indents, a 140-column limit, aligned initializers, and brace wrapping for classes and functions. Run `clang-format -i <file>` before committing; the CMake `clang-format` target is available when LLVM tools are on your PATH. Prefer `CamelCase` for classes, `snake_case` for functions and locals, and `SCREAMING_CASE` for constants, matching conventions in `src/`. Keep headers self-contained and align include order with the IWYU pragmas.
## Testing Guidelines
Unit tests rely on Catch2 (`tests/catch2/`). Name specs after the component under test—for example `tests/libslic3r/TestPlanarHole.cpp`—and tag long-running cases so `ctest -L fast` remains useful. Cover new algorithms with deterministic fixtures or sample G-code stored in `tests/data/`. Document manual printer validation or regression slicer checks in your PR when automated coverage is insufficient.
## Commit & Pull Request Guidelines
The history favors concise, sentence-style subject lines with optional issue references, e.g., `Fix grid lines origin for multiple plates (#10724)`. Squash fixups locally before opening a PR. Complete `.github/pull_request_template.md`, include reproduction steps or screenshots for UI changes, and mention impacted presets or translations. Link issues via `Closes #NNNN` when applicable, and call out dependency bumps or profile migrations for maintainer review.
## Security & Configuration Tips
Follow `SECURITY.md` for vulnerability reporting. Keep API tokens and printer credentials out of tracked configs; use `sandboxes/` for experimental settings. When touching third-party code in `deps_src/`, record the upstream commit or release in your PR description and run the relevant platform build script to confirm integration.

BIN
BambuStudio.mo Normal file

Binary file not shown.

103
BambuStudio.sublime-project Normal file
View File

@@ -0,0 +1,103 @@
{
"build_systems":
[
{
"name": "List",
//"file_regex": " at ([^-\\s]*) line ([0-9]*)",
// "file_regex": " at (D\\:\\/src\\/Slic3r\\/.*?) line ([0-9]*)",
"shell_cmd": "ls -l"
},
{
"name": "Run",
"working_dir": "$project_path",
"file_regex": " at (.*?) line ([0-9]*)",
// "shell_cmd": "chdir & perl slic3r.pl --DataDir \"C:\\Users\\Public\\Documents\\Prusa3D\\Slic3r settings MK2\" --gui \"..\\Slic3r-tests\\gap fill torture 20 -rt.stl\""
"shell_cmd": "chdir & perl slic3r.pl"
},
{
"name": "full",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"shell_cmd": "chdir & perl Build.pl"
},
{
"name": "xs",
"working_dir": "$project_path/build",
// for Visual Studio:
"file_regex": "^(..[^:]*)\\(([0-9]+)\\)(.*)$",
// For GCC:
// "file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"shell_cmd": "chdir & ninja -j 6 -v",
"env": {
// "PATH": "C:\\Program Files (x86)\\MSBuild\\12.0\\bin\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\BIN\\amd64;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\IDE;C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\Common7\\Tools;%PATH%;c:\\wperl64d\\site\\bin;c:\\wperl64d\\bin",
// "PERL_CPANM_HOME": "c:\\wperl64d\\cpanm",
// "WXDIR": "D:\\src-perl\\wxWidgets-3.0.3-beta1",
// "BOOST_DIR": "D:\\src-perl\\boost_1_61_0",
// "BOOST_INCLUDEDIR": "D:\\src-perl\\boost_1_61_0",
// "BOOST_LIBRARYDIR": "D:\\src-perl\\boost_1_61_0\\stage\\x64\\lib",
// "SLIC3R_STATIC": "1"
}
},
{
"name": "xs & run",
"working_dir": "$project_path/build",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"shell_cmd": "chdir & ninja -j 6 & cd .. & perl slic3r.pl --gui \"..\\Slic3r-tests\\star3-big2.stl\""
},
{
"name": "Slic3r - clean",
"working_dir": "$project_path/build",
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"shell_cmd": ["chdir & ninja clean"]
},
{
"name": "run tests",
"working_dir": "$project_path/build",
// for Visual Studio:
"file_regex": "^(..[^:]*)\\(([0-9]+)\\)(.*)$",
"shell_cmd": "chdir & ctest --verbose"
},
{
"name": "Clean & Configure",
"working_dir": "$project_path",
// for Visual Studio:
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"shell_cmd": "chdir & rmdir /S /Q build & mkdir build & cd build & cmake -G Ninja .. -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_RULE_PROGRESS=OFF -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo"
},
{
"name": "Configure",
"working_dir": "$project_path/build",
// for Visual Studio:
"file_regex": "^(..[^:]*)(?::|\\()([0-9]+)(?::|\\))(?:([0-9]+):)?\\s*(.*)",
"shell_cmd": "cmake -G Ninja .. -DCMAKE_COLOR_MAKEFILE=OFF -DCMAKE_RULE_PROGRESS=OFF -DCMAKE_RULE_MESSAGES=OFF -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=RelWithDebInfo"
}
],
"folders":
[
{
"path": ".",
// "folder_exclude_patterns": [".svn", "._d", ".metadata", ".settings"],
"file_exclude_patterns": ["XS.c", "*.pch", "*.ilk", "*.js" ]
}
],
"settings":
{
"sublimegdb_workingdir": "${folder:${project_path:run}}",
// NOTE: You MUST provide --interpreter=mi for the plugin to work
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -ex 'target localhost:2345'",
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl --args perl slic3r.pl",
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl --args slic3r.pl ",
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -e C:\\Strawberry\\perl\\bin\\perl.exe -s C:\\Strawberry\\perl\\site\\lib\\auto\\Slic3r\\XS\\XS.xs.dll --args perl slic3r.pl -j 1 --gui D:\\src\\Slic3r-tests\\star3-big.stl",
"sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi perl.exe --args perl slic3r.pl -j 1 --gui", // D:\\src\\Slic3r-tests\\star3-big.stl",
// "sublimegdb_commandline": "D:\\Qt\\Tools\\mingw492_32\\bin\\gdb.exe --interpreter=mi -x slic3r.gdb",
// "arguments": "slic3r -j 1 --gui ../Slic3r-tests/star3-big.stl",
// "arguments": "../slic3r.pl -j 1 --gui",
// "sublimegdb_exec_cmd": "-exec-continue",
// Add "pending breakpoints" for symbols that are dynamically loaded from
// external shared libraries
"debug_ext" : true,
"run_after_init": false,
"close_views": false
}
}

132
Build.PL Normal file
View File

@@ -0,0 +1,132 @@
#!/usr/bin/perl
print "This script is currently used for installing Perl dependenices for running\n";
print "the libslic3r unit / integration tests through Perl prove.\n";
print "If you don't plan to run the unit / integration tests, you don't need to\n";
print "install these dependencies to build and run BambuSlicer.\n";
use strict;
use warnings;
use Config;
use File::Spec;
my %prereqs = qw(
Devel::CheckLib 0
ExtUtils::MakeMaker 6.80
ExtUtils::ParseXS 3.22
ExtUtils::XSpp 0
ExtUtils::XSpp::Cmd 0
ExtUtils::CppGuess 0
ExtUtils::Typemaps 0
ExtUtils::Typemaps::Basic 0
File::Basename 0
File::Spec 0
Getopt::Long 0
Module::Build::WithXSpp 0.14
Moo 1.003001
POSIX 0
Scalar::Util 0
Test::More 0
IO::Scalar 0
Time::HiRes 0
);
my %recommends = qw(
Class::XSAccessor 0
Test::Harness 0
);
my $sudo = grep { $_ eq '--sudo' } @ARGV;
my $nolocal = grep { $_ eq '--nolocal' } @ARGV;
my @missing_prereqs = ();
if ($ENV{SLIC3R_NO_AUTO}) {
foreach my $module (sort keys %prereqs) {
my $version = $prereqs{$module};
next if eval "use $module $version; 1";
push @missing_prereqs, $module if exists $prereqs{$module};
print "Missing prerequisite $module $version\n";
}
foreach my $module (sort keys %recommends) {
my $version = $recommends{$module};
next if eval "use $module $version; 1";
print "Missing optional $module $version\n";
}
} else {
my @try = (
$ENV{CPANM} // (),
File::Spec->catfile($Config{sitebin}, 'cpanm'),
File::Spec->catfile($Config{installscript}, 'cpanm'),
);
my $cpanm;
foreach my $path (@try) {
if (-e $path) { # don't use -x because it fails on Windows
$cpanm = $path;
last;
}
}
if (!$cpanm) {
if ($^O =~ /^(?:darwin|linux)$/ && system(qw(which cpanm)) == 0) {
$cpanm = 'cpanm';
}
}
die <<'EOF'
cpanm was not found. Please install it before running this script.
There are several ways to install cpanm, try one of these:
apt-get install cpanminus
curl -L http://cpanmin.us | perl - --sudo App::cpanminus
cpan App::cpanminus
If it is installed in a non-standard location you can do:
CPANM=/path/to/cpanm perl Build.PL
EOF
if !$cpanm;
my @cpanm_args = ();
push @cpanm_args, "--sudo" if $sudo;
# install local::lib without --local-lib otherwise it's not usable afterwards
if (!eval "use local::lib qw(local-lib); 1") {
my $res = system $cpanm, @cpanm_args, 'local::lib';
warn "Warning: local::lib is required. You might need to run the `cpanm --sudo local::lib` command in order to install it.\n"
if $res != 0;
}
push @cpanm_args, ('--local-lib', 'local-lib') if ! $nolocal;
# make sure our cpanm is updated (old ones don't support the ~ syntax)
system $cpanm, @cpanm_args, 'App::cpanminus';
my %modules = (%prereqs, %recommends);
foreach my $module (sort keys %modules) {
my $version = $modules{$module};
my @cmd = ($cpanm, @cpanm_args);
# temporary workaround for upstream bug in test
push @cmd, '--notest'
if $module =~ /^(?:OpenGL|Test::Harness)$/;
push @cmd, "$module~$version";
my $res = system @cmd;
if ($res != 0) {
if (exists $prereqs{$module}) {
push @missing_prereqs, $module;
} else {
printf "Don't worry, this module is optional.\n";
}
}
}
}
print "\n";
print "In the next step, you need to build the BambuStudio C++ library.\n";
print "1) Create a build directory and change to it\n";
print "2) run cmake .. -DCMAKE_BUILD_TYPE=Release\n";
print "3) run make\n";
print "4) to execute the automatic tests, run ctest --verbose\n";
__END__

234
CLAUDE.md
View File

@@ -1,234 +0,0 @@
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
OrcaSlicer is an open-source 3D slicer application forked from Bambu Studio, built using C++ with wxWidgets for the GUI and CMake as the build system. The project uses a modular architecture with separate libraries for core slicing functionality, GUI components, and platform-specific code.
## Build Commands
### Building on Windows
**Always use this command to build the project when testing build issues on Windows.**
```bash
cmake --build . --config %build_type% --target ALL_BUILD -- -m
```
### Building on macOS
**Always use this command to build the project when testing build issues on macOS.**
```bash
cmake --build build/arm64 --config RelWithDebInfo --target all --
```
### Building on Linux
**Always use this command to build the project when testing build issues on Linux.**
```bash
cmake --build build/arm64 --config RelWithDebInfo --target all --
```
### Build test:
**Always use this command to build the project when testing build issues on Windows.**
```bash
cmake --build . --config %build_type% --target ALL_BUILD -- -m
```
### Building on macOS
**Always use this command to build the project when testing build issues on macOS.**
```bash
cmake --build build/arm64 --config RelWithDebInfo --target all --
```
### Building on Linux
**Always use this command to build the project when testing build issues on Linux.**
```bash
cmake --build build --config RelWithDebInfo --target all --
```
### Build System
- Uses CMake with minimum version 3.13 (maximum 3.31.x on Windows)
- Primary build directory: `build/`
- Dependencies are built in `deps/build/`
- The build process is split into dependency building and main application building
- Windows builds use Visual Studio generators
- macOS builds use Xcode by default, Ninja with -x flag
- Linux builds use Ninja generator
### Testing
Tests are located in the `tests/` directory and use the Catch2 testing framework. Test structure:
- `tests/libslic3r/` - Core library tests (21 test files)
- Geometry processing, algorithms, file formats (STL, 3MF, AMF)
- Polygon operations, clipper utilities, Voronoi diagrams
- `tests/fff_print/` - Fused Filament Fabrication tests (12 test files)
- Slicing algorithms, G-code generation, print mechanics
- Fill patterns, extrusion, support material
- `tests/sla_print/` - Stereolithography tests (4 test files)
- SLA-specific printing algorithms, support generation
- `tests/libnest2d/` - 2D nesting algorithm tests
- `tests/slic3rutils/` - Utility function tests
- `tests/sandboxes/` - Experimental/sandbox test code
Run all tests after building:
```bash
cd build && ctest
```
Run tests with verbose output:
```bash
cd build && ctest --output-on-failure
```
Run individual test suites:
```bash
# From build directory
ctest --test-dir ./tests/libslic3r/libslic3r_tests
ctest --test-dir ./tests/fff_print/fff_print_tests
ctest --test-dir ./tests/sla_print/sla_print_tests
# and so on
```
## Architecture
### Core Libraries
- **libslic3r/**: Core slicing engine and algorithms (platform-independent)
- Main slicing logic, geometry processing, G-code generation
- Key classes: Print, PrintObject, Layer, GCode, Config
- Modular design with specialized subdirectories:
- `GCode/` - G-code generation, cooling, pressure equalization, thumbnails
- `Fill/` - Infill pattern implementations (gyroid, honeycomb, lightning, etc.)
- `Support/` - Tree supports and traditional support generation
- `Geometry/` - Advanced geometry operations, Voronoi diagrams, medial axis
- `Format/` - File I/O for 3MF, AMF, STL, OBJ, STEP formats
- `SLA/` - SLA-specific print processing and support generation
- `Arachne/` - Advanced wall generation using skeletal trapezoidation
- **src/slic3r/**: Main application framework and GUI
- GUI application built with wxWidgets
- Integration between libslic3r core and user interface
- Located in `src/slic3r/GUI/` (not shown in this directory but exists)
### Key Algorithmic Components
- **Arachne Wall Generation**: Variable-width perimeter generation using skeletal trapezoidation
- **Tree Supports**: Organic support generation algorithm
- **Lightning Infill**: Sparse infill optimization for internal structures
- **Adaptive Slicing**: Variable layer height based on geometry
- **Multi-material**: Multi-extruder and soluble support processing
- **G-code Post-processing**: Cooling, fan control, pressure advance, conflict checking
### File Format Support
- **3MF/BBS_3MF**: Native format with extensions for multi-material and metadata
- **STL**: Standard tessellation language for 3D models
- **AMF**: Additive Manufacturing Format with color/material support
- **OBJ**: Wavefront OBJ with material definitions
- **STEP**: CAD format support for precise geometry
- **G-code**: Output format with extensive post-processing capabilities
### External Dependencies
- **Clipper2**: Advanced 2D polygon clipping and offsetting
- **libigl**: Computational geometry library for mesh operations
- **TBB**: Intel Threading Building Blocks for parallelization
- **wxWidgets**: Cross-platform GUI framework
- **OpenGL**: 3D graphics rendering and visualization
- **CGAL**: Computational Geometry Algorithms Library (selective use)
- **OpenVDB**: Volumetric data structures for advanced operations
- **Eigen**: Linear algebra library for mathematical operations
## File Organization
### Resources and Configuration
- `resources/profiles/` - Printer and material profiles organized by manufacturer
- `resources/printers/` - Printer-specific configurations and G-code templates
- `resources/images/` - UI icons, logos, calibration images
- `resources/calib/` - Calibration test patterns and data
- `resources/handy_models/` - Built-in test models (benchy, calibration cubes)
### Internationalization and Localization
- `localization/i18n/` - Source translation files (.pot, .po)
- `resources/i18n/` - Runtime language resources
- Translation managed via `scripts/run_gettext.sh` / `scripts/run_gettext.bat`
### Platform-Specific Code
- `src/libslic3r/Platform.cpp` - Platform abstractions and utilities
- `src/libslic3r/MacUtils.mm` - macOS-specific utilities (Objective-C++)
- Windows-specific build scripts and configurations
- Linux distribution support scripts in `scripts/linux.d/`
### Build and Development Tools
- `cmake/modules/` - Custom CMake find modules and utilities
- `scripts/` - Python utilities for profile generation and validation
- `tools/` - Windows build tools (gettext utilities)
- `deps/` - External dependency build configurations
## Development Workflow
### Code Style and Standards
- **C++17 standard** with selective C++20 features
- **Naming conventions**: PascalCase for classes, snake_case for functions/variables
- **Header guards**: Use `#pragma once`
- **Memory management**: Prefer smart pointers, RAII patterns
- **Thread safety**: Use TBB for parallelization, be mindful of shared state
### Common Development Tasks
#### Adding New Print Settings
1. Define setting in `PrintConfig.cpp` with proper bounds and defaults
2. Add UI controls in appropriate GUI components
3. Update serialization in config save/load
4. Add tooltips and help text for user guidance
5. Test with different printer profiles
#### Modifying Slicing Algorithms
1. Core algorithms live in `libslic3r/` subdirectories
2. Performance-critical code should be profiled and optimized
3. Consider multi-threading implications (TBB integration)
4. Validate changes don't break existing profiles
5. Add regression tests where appropriate
#### GUI Development
1. GUI code resides in `src/slic3r/GUI/` (not visible in current tree)
2. Use existing wxWidgets patterns and custom controls
3. Support both light and dark themes
4. Consider DPI scaling on high-resolution displays
5. Maintain cross-platform compatibility
#### Adding Printer Support
1. Create JSON profile in `resources/profiles/[manufacturer].json`
2. Add printer-specific start/end G-code templates
3. Configure build volume, capabilities, and material compatibility
4. Test thoroughly with actual hardware when possible
5. Follow existing profile structure and naming conventions
### Dependencies and Build System
- **CMake-based** with separate dependency building phase
- **Dependencies** built once in `deps/build/`, then linked to main application
- **Cross-platform** considerations important for all changes
- **Resource files** embedded at build time, platform-specific handling
### Performance Considerations
- **Slicing algorithms** are CPU-intensive, profile before optimizing
- **Memory usage** can be substantial with complex models
- **Multi-threading** extensively used via TBB
- **File I/O** optimized for large 3MF files with embedded textures
- **Real-time preview** requires efficient mesh processing
## Important Development Notes
### Codebase Navigation
- Use search tools extensively - codebase has 500k+ lines
- Key entry points: `src/OrcaSlicer.cpp` for application startup
- Core slicing: `libslic3r/Print.cpp` orchestrates the slicing pipeline
- Configuration: `PrintConfig.cpp` defines all print/printer/material settings
### Compatibility and Stability
- **Backward compatibility** maintained for project files and profiles
- **Cross-platform** support essential (Windows/macOS/Linux)
- **File format** changes require careful version handling
- **Profile migrations** needed when settings change significantly
### Quality and Testing
- **Regression testing** important due to algorithm complexity
- **Performance benchmarks** help catch performance regressions
- **Memory leak** detection important for long-running GUI application
- **Cross-platform** testing required before releases

View File

@@ -1,74 +1,5 @@
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.0")
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "" FORCE)
endif()
cmake_minimum_required(VERSION 3.13)
# Verify that your CMake version is exactly 3.5 series or higher on windows
if ( (MSVC OR WIN32) AND (${CMAKE_VERSION} VERSION_LESS "3.5") )
message(FATAL_ERROR "CMake current version ${CMAKE_VERSION} is too old. Minimum required is 3.5.")
endif()
# The following line used to be in tests/CMakeLists.txt
# Having it there causes rebuilds of all targets on any CMakeLists.txt change under tests/
# It has no effect on how code is compiled or linked.
# It just lets you later do `set_property(TARGET foo PROPERTY FOLDER "bar")`
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
if (WIN32)
# Detect known CI environments
set(IS_CI FALSE)
if(DEFINED ENV{CI})
set(IS_CI TRUE)
elseif(DEFINED ENV{GITHUB_ACTIONS})
set(IS_CI TRUE)
elseif(DEFINED ENV{GITLAB_CI})
set(IS_CI TRUE)
elseif(DEFINED ENV{TF_BUILD})
set(IS_CI TRUE)
elseif(DEFINED ENV{BUILD_NUMBER}) # Jenkins
set(IS_CI TRUE)
endif()
# Detect common misconfiguration (Strawberry Perl in PATH before CMake)
# We use ENV to check the PATH order
string(REPLACE "\\" "/" ENV_PATH "$ENV{PATH}")
string(FIND "${ENV_PATH}" "Strawberry/c/bin" STRAWBERRY_POS)
string(FIND "${ENV_PATH}" "Program Files/CMake/bin" CMAKE_POS)
if (STRAWBERRY_POS GREATER -1 AND CMAKE_POS GREATER -1 AND STRAWBERRY_POS LESS CMAKE_POS)
set(_warning_text "
#############################################################
Detected Strawberry Perl's 'c/bin' appearing before CMake in PATH.
This is known to cause CMake to misbehave (e.g., missing modules).
Please adjust your PATH so that:
C:\\Program Files\\CMake\\bin
appears before:
C:\\Strawberry\\c\\bin
You can do this in Environment Variables settings.
#############################################################
")
if(NOT IS_CI)
message(FATAL_ERROR "${_warning_text}")
endif()
endif()
endif ()
if (APPLE)
# if CMAKE_OSX_DEPLOYMENT_TARGET is not set, set it to 11.3
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.3" CACHE STRING "Minimum OS X deployment version" FORCE)
endif ()
message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
endif ()
project(OrcaSlicer)
# Backward compatibility for old CMake versions
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_VERSION VERSION_LESS "3.25")
set(LINUX ON CACHE BOOL "" FORCE)
endif ()
project(BambuStudio)
include("version.inc")
include(GNUInstallDirs)
@@ -82,76 +13,37 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
endif()
if (DEFINED BBL_RELEASE_TO_PUBLIC)
add_compile_definitions("BBL_RELEASE_TO_PUBLIC=${BBL_RELEASE_TO_PUBLIC}")
else ()
add_compile_definitions("BBL_RELEASE_TO_PUBLIC=$<CONFIG:Release>")
endif ()
find_package(Git)
if(DEFINED ENV{git_commit_hash} AND NOT "$ENV{git_commit_hash}" STREQUAL "")
message(STATUS "Specified git commit hash: $ENV{git_commit_hash}")
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
# Convert the given hash to short hash
execute_process(
COMMAND ${GIT_EXECUTABLE} rev-parse --short "$ENV{git_commit_hash}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
else()
# No .git directory (e.g., Flatpak sandbox) — truncate directly
string(SUBSTRING "$ENV{git_commit_hash}" 0 7 GIT_COMMIT_HASH)
endif()
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
elseif(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
# Check current Git commit hash
execute_process(
COMMAND ${GIT_EXECUTABLE} log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
add_definitions("-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"")
endif()
if(DEFINED ENV{SLIC3R_STATIC})
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
else()
set(SLIC3R_STATIC_INITIAL 1)
if (MSVC OR MINGW OR APPLE)
set(SLIC3R_STATIC_INITIAL 1)
else()
set(SLIC3R_STATIC_INITIAL 0)
endif()
endif()
option(SLIC3R_STATIC "Compile OrcaSlicer with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
option(SLIC3R_GUI "Compile OrcaSlicer with GUI components (OpenGL, wxWidgets)" 1)
option(SLIC3R_FHS "Assume OrcaSlicer is to be installed in a FHS directory structure" 0)
option(SLIC3R_PROFILE "Compile OrcaSlicer with an invasive Shiny profiler" 0)
option(SLIC3R_STATIC "Compile BambuStudio with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
option(SLIC3R_GUI "Compile BambuStudio with GUI components (OpenGL, wxWidgets)" 1)
option(SLIC3R_FHS "Assume BambuStudio is to be installed in a FHS directory structure" 0)
option(SLIC3R_WX_STABLE "Build against wxWidgets stable (3.0) as oppsed to dev (3.1) on Linux" 0)
option(SLIC3R_PROFILE "Compile BambuStudio with an invasive Shiny profiler" 0)
option(SLIC3R_PCH "Use precompiled headers" 1)
option(SLIC3R_MSVC_COMPILE_PARALLEL "Compile on Visual Studio in parallel" 1)
option(SLIC3R_MSVC_PDB "Generate PDB files on MSVC in Release mode" 1)
option(SLIC3R_PERL_XS "Compile XS Perl module and enable Perl unit and integration tests" 0)
option(SLIC3R_ASAN "Enable ASan on Clang and GCC" 0)
# If SLIC3R_FHS is 1 -> SLIC3R_DESKTOP_INTEGRATION is always 0, othrewise variable.
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow performing desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
set(SLIC3R_GTK "3" CACHE STRING "GTK version to use with wxWidgets on Linux")
set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
set(IS_CROSS_COMPILE FALSE)
option (COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
if (${COLORED_OUTPUT})
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
add_compile_options (-fcolor-diagnostics)
endif ()
endif ()
if (APPLE)
list(LENGTH CMAKE_OSX_ARCHITECTURES _arch_len)
if (_arch_len GREATER 1)
message(FATAL_ERROR "OrcaSlicer only supports building for one architecture at a time. Please make sure only one architecture is specified in CMAKE_OSX_ARCHITECTURES")
endif ()
set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST)
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
@@ -161,24 +53,16 @@ if (APPLE)
if (CMAKE_MACOSX_BUNDLE)
set(CMAKE_INSTALL_RPATH @executable_path/../Frameworks)
endif()
SET(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "com.orcaslicer.OrcaSlicer")
message(STATUS "Orca: IS_CROSS_COMPILE: ${IS_CROSS_COMPILE}")
endif ()
# Proposal for C++ unit tests and sandboxes
option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
option(BUILD_TESTS "Build unit tests" OFF)
option(ORCA_TOOLS "Build Orca tools" OFF)
if (FLATPAK)
set(SLIC3R_FHS ON CACHE BOOL "" FORCE)
set(SLIC3R_DESKTOP_INTEGRATION OFF CACHE BOOL "" FORCE)
endif ()
option(SLIC3R_BUILD_TESTS "Build unit tests" OFF)
if (IS_CROSS_COMPILE)
message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!")
set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(SLIC3R_PERL_XS OFF CACHE BOOL "" FORCE)
set(SLIC3R_BUILD_TESTS OFF CACHE BOOL "" FORCE)
endif ()
# Print out the SLIC3R_* cache options
@@ -198,13 +82,6 @@ if(SLIC3R_DESKTOP_INTEGRATION)
add_definitions(-DSLIC3R_DESKTOP_INTEGRATION)
endif ()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(STATUS "Automatically setting CMAKE_INSTALL_PREFIX")
set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${CMAKE_BINARY_DIR}/OrcaSlicer")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(IS_CLANG_CL TRUE)
@@ -232,79 +109,35 @@ if (MSVC)
# C4244: 'conversion' conversion from 'type1' to 'type2', possible loss of data. An integer type is converted to a smaller integer type.
# C4267: The compiler detected a conversion from size_t to a smaller type.
add_compile_options(/wd4244 /wd4267)
# Disable warnings on comparison of unsigned and signed
# C4018: signed/unsigned mismatch
add_compile_options(/wd4018)
endif ()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang" AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 15)
add_compile_definitions(BOOST_NO_CXX98_FUNCTION_BASE _HAS_AUTO_PTR_ETC=0)
endif()
if (MINGW)
add_compile_options(-Wa,-mbig-obj)
endif ()
if (NOT MSVC)
# ARMs (Raspberry PI) use an unsigned char by default. Let's make it consistent for OrcaSlicer on all platforms.
# ARMs (Raspberry PI) use an unsigned char by default. Let's make it consistent for BambuStudio on all platforms.
add_compile_options(-fsigned-char)
endif ()
if ("${DEP_BUILD_DIR}" STREQUAL "")
get_filename_component(BIN_DIR_NAME ${CMAKE_BINARY_DIR} NAME)
if (APPLE AND BIN_DIR_NAME STREQUAL "${CMAKE_OSX_ARCHITECTURES}")
file(RELATIVE_PATH BIN_DIR_NAME ${CMAKE_BINARY_DIR}/../.. ${CMAKE_BINARY_DIR})
endif ()
set(DEP_BUILD_DIR "${CMAKE_SOURCE_DIR}/deps/${BIN_DIR_NAME}" CACHE PATH "Path to dependencies build directory" FORCE)
message(STATUS "DEP_BUILD_DIR: ${DEP_BUILD_DIR} (generated automatically and saved to cache)")
set(AUTOGENERATED_DEP_BUILD_DIR ${DEP_BUILD_DIR} CACHE PATH "Provides the last autogenerated DEP_BUILD_DIR" FORCE)
else ()
message(STATUS "DEP_BUILD_DIR: ${DEP_BUILD_DIR} (from cache or command line)")
endif ()
if ("${CMAKE_PREFIX_PATH}" STREQUAL "" OR "${CMAKE_PREFIX_PATH}" STREQUAL "${AUTOGENERATED_PREFIX_PATH}")
if (DEFINED AUTOGENERATED_DEP_BUILD_DIR AND NOT "${DEP_BUILD_DIR}" STREQUAL "${AUTOGENERATED_DEP_BUILD_DIR}")
message(STATUS "CMAKE_PREFIX_PATH is being re-generated due to DEP_BUILD_DIR being manually updated")
set(REGEN_DESTDIR TRUE)
unset(AUTOGENERATED_DEP_BUILD_DIR CACHE)
endif ()
else ()
unset(AUTOGENERATED_PREFIX_PATH CACHE)
endif ()
# Display and check CMAKE_PREFIX_PATH
if ("${CMAKE_PREFIX_PATH}" STREQUAL "" OR REGEN_DESTDIR)
set(CMAKE_PREFIX_PATH "${DEP_BUILD_DIR}/OrcaSlicer_dep/usr/local" CACHE PATH "Path to dependencies install directory" FORCE)
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (generated automatically and saved to cache)")
set(AUTOGENERATED_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "Provides the last autogenerated CMAKE_PREFIX_PATH" FORCE)
unset(REGEN_DESTDIR CACHE)
else ()
message(STATUS "SLIC3R_STATIC: ${SLIC3R_STATIC}")
if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "")
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (from cache or command line)")
endif ()
set(PREFIX_PATH_CHECK ${CMAKE_PREFIX_PATH})
# the CMAKE_PREFIX_PATH environment variable is separate from the CMAKE_PREFIX_PATH cache variable and provides additional paths to search for libraries.
if (NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
set(PREFIX_PATH_CHECK ${CMAKE_PREFIX_PATH})
elseif (NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
message(STATUS "CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH} (from environment)")
list(APPEND PREFIX_PATH_CHECK $ENV{CMAKE_PREFIX_PATH})
set(PREFIX_PATH_CHECK $ENV{CMAKE_PREFIX_PATH})
else ()
message(STATUS "CMAKE_PREFIX_PATH: (default)")
endif ()
# Check all directories in CMAKE_PREFIX_PATH variables
foreach (DIR ${PREFIX_PATH_CHECK})
if (NOT EXISTS "${DIR}")
message(WARNING "CMAKE_PREFIX_PATH element doesn't exist: ${DIR}")
endif ()
endforeach ()
if (APPLE)
set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
set(CMAKE_MACOSX_BUNDLE ON CACHE BOOL "")
endif ()
if (APPLE AND CMAKE_MACOSX_RPATH AND "${CMAKE_INSTALL_RPATH}" STREQUAL "")
set(CMAKE_INSTALL_RPATH ${CMAKE_PREFIX_PATH})
endif ()
# Add our own cmake module path.
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
@@ -318,7 +151,7 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT WIN32)
# Add DEBUG flags to debug builds.
add_compile_definitions("$<IF:$<CONFIG:Debug>,DEBUG,NDEBUG>")
add_compile_options("$<$<CONFIG:DEBUG>:-DDEBUG>")
endif()
# To be able to link libslic3r with the Perl XS module.
@@ -345,11 +178,7 @@ if(WIN32)
endif()
else()
# Try to use the default Windows 10 SDK path.
if (DEFINED ENV{WindowsSdkDir} AND DEFINED ENV{WindowsSDKVersion})
set(WIN10SDK_INCLUDE_PATH "$ENV{WindowsSdkDir}/Include/$ENV{WindowsSDKVersion}")
else ()
set(WIN10SDK_INCLUDE_PATH "C:/Program Files (x86)/Windows Kits/10/Include/10.0.26100.0")
endif ()
set(WIN10SDK_INCLUDE_PATH "$ENV{WindowsSdkDir}/Include/$ENV{WindowsSDKVersion}")
if (NOT EXISTS "${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h")
message("${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h was not found")
message("STL fixing by the Netfabb service will not be compiled")
@@ -359,7 +188,7 @@ if(WIN32)
if(WIN10SDK_INCLUDE_PATH)
message("Building with Win10 Netfabb STL fixing service support")
add_definitions(-DHAS_WIN10SDK)
include_directories(SYSTEM "${WIN10SDK_INCLUDE_PATH}")
include_directories("${WIN10SDK_INCLUDE_PATH}")
else()
message("Building without Win10 Netfabb STL fixing service support")
endif()
@@ -387,7 +216,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
find_package(Threads REQUIRED)
find_package(DBus REQUIRED)
include_directories(SYSTEM ${DBUS_INCLUDE_DIRS})
include_directories(${DBUS_INCLUDE_DIRS})
endif()
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUXX)
@@ -404,22 +233,6 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
# On GCC and Clang, no return from a non-void function is a warning only. Here, we make it an error.
add_compile_options(-Werror=return-type)
# Since some portions of code are just commented out or put under conditional compilation, there are
# a bunch of warning related to unused functions and variables. Suppress those warnings to not pollute
# compilers diagnostics output with warnings we not going to look at
add_compile_options(-Wno-unused-function -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unused-label -Wno-unused-local-typedefs)
# Ignore signed/unsigned comparison warnings
add_compile_options(-Wno-sign-compare)
# The mismatch of tabs and spaces throughout the project can sometimes
# cause this warning to appear even though the indentation is fine.
# Some includes also cause the warning
add_compile_options(-Wno-misleading-indentation)
# Disable warning if enum value does not have a corresponding case in switch statement
add_compile_options(-Wno-switch)
# removes LOTS of extraneous Eigen warnings (GCC only supports it since 6.1)
# https://eigen.tuxfamily.org/bz/show_bug.cgi?id=1221
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0)
@@ -433,38 +246,14 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
add_compile_options(-Wno-deprecated-declarations)
endif()
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 15)
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wno-error=enum-constexpr-conversion HAS_WNO_ERROR_ENUM_CONSTEXPR_CONV)
if(HAS_WNO_ERROR_ENUM_CONSTEXPR_CONV)
add_compile_options(-Wno-error=enum-constexpr-conversion)
endif()
endif()
#GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
# We will turn the warning of for GCC for now:
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
# We will turn the warning of for GCC for now:
add_compile_options(-Wno-unknown-pragmas)
endif()
# Compress the debug info with zstd to save space in Flatpak CI builds
if(FLATPAK)
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 13.0) OR
("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15.0))
add_compile_options(-gz=zstd)
endif()
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-error=template-id-cdtor" )
endif()
endif()
if (SLIC3R_ASAN)
@@ -477,8 +266,6 @@ if (SLIC3R_ASAN)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=address")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=address")
else()
add_compile_definitions(_DISABLE_STRING_ANNOTATION=1 _DISABLE_VECTOR_ANNOTATION=1)
endif ()
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
@@ -491,12 +278,6 @@ if (APPLE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=partial-availability -Werror=unguarded-availability -Werror=unguarded-availability-new")
endif ()
if(MSVC)
# Ignore truncating casts in initializers & constructors
# https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4305
add_compile_options(/wd4305)
endif()
# Where all the bundled libraries reside?
set(LIBDIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(LIBDIR_BIN ${CMAKE_CURRENT_BINARY_DIR}/src)
@@ -504,18 +285,18 @@ message(STATUS "LIBDIR: ${LIBDIR}")
message(STATUS "LIBDIR_BIN: ${LIBDIR_BIN}")
# For the bundled boost libraries (boost::nowide)
include_directories(SYSTEM ${LIBDIR})
include_directories(${LIBDIR})
# For generated header files
include_directories(SYSTEM ${LIBDIR_BIN}/dev-utils/platform)
include_directories(${LIBDIR_BIN}/platform)
# For ligigl
include_directories(SYSTEM ${LIBDIR}/libigl)
include_directories(${LIBDIR}/libigl)
if(WIN32)
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS)
if(MSVC)
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x602 -DBOOST_SYSTEM_USE_UTF8 )
# Force the source code encoding to UTF-8. See OrcaSlicer GH pull request #5583
add_definitions(-DBOOST_ALL_NO_LIB -DBOOST_USE_WINAPI_VERSION=0x601 -DBOOST_SYSTEM_USE_UTF8 )
# Force the source code encoding to UTF-8. See BambuStudio GH pull request #5583
add_compile_options("$<$<C_COMPILER_ID:MSVC>:/utf-8>")
add_compile_options("$<$<CXX_COMPILER_ID:MSVC>:/utf-8>")
endif(MSVC)
@@ -527,62 +308,38 @@ add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE -DWXINTL_NO_GETTEXT_MACRO)
add_definitions(-DwxNO_UNSAFE_WXSTRING_CONV)
if (SLIC3R_PROFILE)
message("OrcaSlicer will be built with a Shiny invasive profiler")
message("BambuStudio will be built with a Shiny invasive profiler")
add_definitions(-DSLIC3R_PROFILE)
endif ()
# Disable optimization for RelWithDebInfo
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "/O2")
string(REGEX REPLACE "/O2" "/Od" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
# Disable optimization even with debugging on.
if (0)
message(STATUS "Perl compiled without optimization. Disabling optimization for the BambuStudio build.")
message("Old CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Old CMAKE_CXX_FLAGS_RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Old CMAKE_CXX_FLAGS: ${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_RELEASE "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELEASE "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_CXX_FLAGS "/MD /Od /Zi /EHsc /DWIN32 /DTBB_USE_ASSERT")
set(CMAKE_C_FLAGS "/MD /Od /Zi /DWIN32 /DTBB_USE_ASSERT")
endif()
if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "/O2")
string(REGEX REPLACE "/O2" "/Od" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
if("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "-O2")
string(REGEX REPLACE "-O2" "-O0" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()
if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "-O2")
string(REGEX REPLACE "-O2" "-O0" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
endif()
if(MSVC)
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES "/Ob1")
string(REGEX REPLACE "/Ob1" "/Ob0" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
endif()
if(CMAKE_CXX_FLAGS_RELWITHDEBINFO MATCHES "/Ob1")
string(REGEX REPLACE "/Ob1" "/Ob0" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} /RTC1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} /RTC1")
endif()
list(REMOVE_DUPLICATES CMAKE_C_FLAGS_RELWITHDEBINFO)
list(REMOVE_DUPLICATES CMAKE_CXX_FLAGS_RELWITHDEBINFO)
# Find and configure boost
if(SLIC3R_STATIC)
# Use static boost libraries.
set(Boost_USE_STATIC_LIBS ON)
# Use boost libraries linked statically to the C++ runtime.
# set(Boost_USE_STATIC_RUNTIME ON)
else()
add_definitions(-DBOOST_LOG_DYN_LINK)
endif()
#set(Boost_DEBUG ON)
# set(Boost_COMPILER "-mgw81")
# boost::process was introduced first in version 1.64.0,
# boost::beast::detail::base64 was introduced first in version 1.66.0
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
set(Boost_NO_SYSTEM_PATHS TRUE)
find_package(Boost 1.83.0 REQUIRED COMPONENTS system filesystem thread log log_setup locale regex chrono atomic date_time iostreams program_options nowide)
set(MINIMUM_BOOST_VERSION "1.66.0")
set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time;iostreams")
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components})
add_library(boost_libs INTERFACE)
add_library(boost_headeronly INTERFACE)
@@ -599,7 +356,7 @@ endif()
function(slic3r_remap_configs targets from_Cfg to_Cfg)
if(MSVC)
string(TOUPPER ${from_Cfg} from_CFG)
foreach(tgt ${targets})
if(TARGET ${tgt})
set_target_properties(${tgt} PROPERTIES MAP_IMPORTED_CONFIG_${from_CFG} ${to_Cfg})
@@ -608,17 +365,36 @@ function(slic3r_remap_configs targets from_Cfg to_Cfg)
endif()
endfunction()
target_include_directories(boost_headeronly SYSTEM INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
if(TARGET Boost::system)
message(STATUS "Boost::boost exists")
target_link_libraries(boost_headeronly INTERFACE Boost::boost)
# Only from cmake 3.12
# list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets)
set(_boost_targets "")
foreach(comp ${_boost_components})
list(APPEND _boost_targets "Boost::${comp}")
endforeach()
target_link_libraries(boost_libs INTERFACE
boost_headeronly # includes the custom compile definitions as well
${_boost_targets}
)
slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release)
else()
target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
endif()
# Find and configure intel-tbb
if(SLIC3R_STATIC)
set(TBB_STATIC 1)
endif()
set(TBB_DEBUG 1)
set(CMAKE_MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo Release "")
find_package(TBB REQUIRED)
# include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
# include_directories(${TBB_INCLUDE_DIRS})
# add_definitions(${TBB_DEFINITIONS})
# if(MSVC)
# # Suppress implicit linking of the TBB libraries by the Visual Studio compiler.
@@ -628,9 +404,11 @@ find_package(TBB REQUIRED)
# add_definitions(-DTBB_USE_CAPTURED_EXCEPTION=0)
find_package(OpenSSL REQUIRED)
if (APPLE)
find_package(CURL CONFIG REQUIRED)
else()
find_package(CURL REQUIRED)
find_package(Freetype REQUIRED)
endif()
add_library(libcurl INTERFACE)
target_link_libraries(libcurl INTERFACE CURL::libcurl)
@@ -661,7 +439,7 @@ if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_CURL)
find_package(OpenSSL REQUIRED)
message("OpenSSL include dir: ${OPENSSL_INCLUDE_DIR}")
message("OpenSSL libraries: ${OPENSSL_LIBRARIES}")
target_include_directories(libcurl SYSTEM INTERFACE ${OPENSSL_INCLUDE_DIR})
target_include_directories(libcurl INTERFACE ${OPENSSL_INCLUDE_DIR})
target_link_libraries(libcurl INTERFACE ${OPENSSL_LIBRARIES})
endif()
endif()
@@ -699,53 +477,49 @@ find_package(PNG REQUIRED)
set(OpenGL_GL_PREFERENCE "LEGACY")
find_package(OpenGL REQUIRED)
if(APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
set(OPENGL_LIBRARIES "-framework OpenGL" CACHE STRING "OpenGL framework" FORCE)
endif()
set(GLEW_ROOT "${CMAKE_PREFIX_PATH}")
message("GLEW_ROOT: ${GLEW_ROOT}")
# Find glew or use bundled version
if (SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_GLEW)
set(GLEW_USE_STATIC_LIBS ON)
set(GLEW_VERBOSE ON)
endif()
find_package(GLEW REQUIRED)
find_package(GLEW)
if (NOT TARGET GLEW::GLEW)
message(STATUS "GLEW not found, using bundled version.")
add_library(glew STATIC ${LIBDIR}/glew/src/glew.c)
set(GLEW_FOUND TRUE)
set(GLEW_INCLUDE_DIRS ${LIBDIR}/glew/include/)
target_compile_definitions(glew PUBLIC GLEW_STATIC)
target_include_directories(glew PUBLIC ${GLEW_INCLUDE_DIRS})
add_library(GLEW::GLEW ALIAS glew)
endif ()
find_package(glfw3 REQUIRED)
# Find the Cereal serialization library
find_package(cereal REQUIRED)
if (NOT TARGET cereal::cereal)
set_target_properties(cereal PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(cereal::cereal ALIAS cereal)
else ()
set_target_properties(cereal::cereal PROPERTIES IMPORTED_GLOBAL TRUE)
endif ()
# l10n
set(L10N_DIR "${SLIC3R_RESOURCES_DIR}/i18n")
set(BBL_L18N_DIR "${CMAKE_CURRENT_SOURCE_DIR}/localization/i18n")
set(BBL_L18N_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bbl/i18n")
add_custom_target(gettext_make_pot
COMMAND xgettext --keyword=L --keyword=_L --keyword=_u8L --keyword=L_CONTEXT:1,2c --keyword=_L_PLURAL:1,2 --add-comments=TRN --from-code=UTF-8 --no-location --debug --boost
-f "${BBL_L18N_DIR}/list.txt"
-o "${BBL_L18N_DIR}/OrcaSlicer.pot"
COMMAND hintsToPot ${SLIC3R_RESOURCES_DIR} ${BBL_L18N_DIR}
-o "${BBL_L18N_DIR}/BambuStudio.pot"
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate pot file from strings in the source tree"
)
add_custom_target(gettext_merge_po_with_pot
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Merge localization po with new generated pot file"
COMMENT "Merge localization po with new generted pot file"
)
file(GLOB BBL_L10N_PO_FILES "${BBL_L18N_DIR}/*/OrcaSlicer*.po")
file(GLOB BBL_L10N_PO_FILES "${BBL_L18N_DIR}/*/BambuStudio*.po")
foreach(po_file ${BBL_L10N_PO_FILES})
GET_FILENAME_COMPONENT(po_dir "${po_file}" DIRECTORY)
SET(po_new_file "${po_dir}/OrcaSlicer_.po")
SET(po_new_file "${po_dir}/BambuStudio_.po")
add_custom_command(
TARGET gettext_merge_po_with_pot PRE_BUILD
COMMAND msgmerge -N -o ${po_file} ${po_file} "${BBL_L18N_DIR}/OrcaSlicer.pot"
COMMAND msgmerge -N -o ${po_file} ${po_file} "${BBL_L18N_DIR}/BambuStudio.pot"
DEPENDS ${po_file}
)
endforeach()
@@ -753,11 +527,11 @@ add_custom_target(gettext_po_to_mo
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "Generate localization po files (binary) from mo files (texts)"
)
file(GLOB L10N_PO_FILES "${BBL_L18N_DIR}/*/OrcaSlicer*.po")
file(GLOB L10N_PO_FILES "${BBL_L18N_DIR}/*/BambuStudio*.po")
foreach(po_file ${BBL_L10N_PO_FILES})
GET_FILENAME_COMPONENT(SECOND_FOLDER_ABSOLUTE ${po_file} DIRECTORY)
string(REGEX REPLACE ".*/(.*)" "\\1" po_dir "${SECOND_FOLDER_ABSOLUTE}" )
SET(mo_file "${L10N_DIR}/${po_dir}/OrcaSlicer.mo")
SET(mo_file "${L10N_DIR}/${po_dir}/BambuStudio.mo")
add_custom_command(
TARGET gettext_po_to_mo PRE_BUILD
COMMAND msgfmt ARGS --check-format -o ${mo_file} ${po_file}
@@ -784,27 +558,13 @@ else ()
"OpenVDB installation with the OPENVDB_FIND_MODULE_PATH cache variable.")
endif ()
find_path(SPNAV_INCLUDE_DIR spnav.h)
if (SPNAV_INCLUDE_DIR)
find_library(SPNAV_LIB NAMES libspnav.a) # Force linking libspnav statically
if (SPNAV_LIB)
add_definitions(-DHAVE_SPNAV)
message(STATUS "SPNAV library found")
else()
message(STATUS "SPNAV library NOT found, Spacenavd not supported")
endif()
else()
message(STATUS "SPNAV library NOT found, Spacenavd not supported")
endif()
set(TOP_LEVEL_PROJECT_DIR ${PROJECT_SOURCE_DIR})
function(orcaslicer_copy_dlls target config postfix output_dlls)
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set(_arch "x64")
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "X86")
set(_arch "x86")
else ()
message(FATAL_ERROR "Unable to detect architecture")
function(bambustudio_copy_dlls target config postfix output_dlls)
if ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_bits 64)
elseif ("${CMAKE_SIZEOF_VOID_P}" STREQUAL "4")
set(_bits 32)
endif ()
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
@@ -821,9 +581,9 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
message ("set out_dir to CMAKE_CURRENT_BINARY_DIR: ${_out_dir}")
endif ()
file(COPY ${TOP_LEVEL_PROJECT_DIR}/deps/GMP/gmp/lib/win-${_arch}/libgmp-10.dll
${TOP_LEVEL_PROJECT_DIR}/deps/MPFR/mpfr/lib/win-${_arch}/libmpfr-4.dll
${TOP_LEVEL_PROJECT_DIR}/deps/WebView2/lib/win-${_arch}/WebView2Loader.dll
file(COPY ${TOP_LEVEL_PROJECT_DIR}/deps/GMP/gmp/lib/win${_bits}/libgmp-10.dll
${TOP_LEVEL_PROJECT_DIR}/deps/MPFR/mpfr/lib/win${_bits}/libmpfr-4.dll
${TOP_LEVEL_PROJECT_DIR}/deps/WebView2/lib/win${_bits}/WebView2Loader.dll
DESTINATION ${_out_dir})
file(COPY ${CMAKE_PREFIX_PATH}/bin/occt/TKBO.dll
@@ -852,7 +612,6 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
${CMAKE_PREFIX_PATH}/bin/occt/TKXCAF.dll
${CMAKE_PREFIX_PATH}/bin/occt/TKXDESTEP.dll
${CMAKE_PREFIX_PATH}/bin/occt/TKXSBase.dll
${CMAKE_PREFIX_PATH}/bin/freetype.dll
DESTINATION ${_out_dir})
set(${output_dlls}
@@ -887,88 +646,58 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
${_out_dir}/TKXDESTEP.dll
${_out_dir}/TKXSBase.dll
${_out_dir}/freetype.dll
PARENT_SCOPE
)
endfunction()
# libslic3r, OrcaSlicer GUI and the OrcaSlicer executable.
add_subdirectory(deps_src)
# libslic3r, BambuStudio GUI and the BambuStudio executable.
add_subdirectory(src)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT OrcaSlicer_app_gui)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT BambuStudio_app_gui)
add_dependencies(gettext_make_pot hintsToPot)
# Perl bindings, currently only used for the unit / integration tests of libslic3r.
# Also runs the unit / integration tests.
#FIXME Port the tests into C++ to finally get rid of the Perl!
if (SLIC3R_PERL_XS)
add_subdirectory(xs)
endif ()
if(SLIC3R_BUILD_SANDBOXES)
add_subdirectory(sandboxes)
endif()
if(BUILD_TESTS)
if(SLIC3R_BUILD_TESTS)
add_subdirectory(tests)
endif()
if (NOT WIN32 AND NOT APPLE)
set(SLIC3R_APP_CMD "orca-slicer")
configure_file(${LIBDIR}/dev-utils/platform/unix/build_appimage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh USE_SOURCE_PERMISSIONS @ONLY)
option(BUILD_BBS_TEST_TOOLS "Build bbs test tools" OFF)
if(BUILD_BBS_TEST_TOOLS)
add_subdirectory(bbs_test_tools)
endif()
# Resources install target, configure fhs.hpp on UNIX
if (WIN32)
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "./resources")
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
include(InstallRequiredSystemLibraries)
install (PROGRAMS ${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} DESTINATION ".")
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
elseif (SLIC3R_FHS)
# CMAKE_INSTALL_FULL_DATAROOTDIR: read-only architecture-independent data root (share)
set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/OrcaSlicer")
set(SLIC3R_FHS_RESOURCES "${CMAKE_INSTALL_FULL_DATAROOTDIR}/BambuStudio")
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/ DESTINATION ${SLIC3R_FHS_RESOURCES}
PATTERN "*/udev" EXCLUDE
)
install(FILES src/dev-utils/platform/unix/OrcaSlicer.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
install(FILES src/platform/unix/BambuStudio.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/applications)
foreach(SIZE 32 128 192)
install(FILES ${SLIC3R_RESOURCES_DIR}/images/OrcaSlicer_${SIZE}px.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME OrcaSlicer.png
install(FILES ${SLIC3R_RESOURCES_DIR}/images/BambuStudio_${SIZE}px.png
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/icons/hicolor/${SIZE}x${SIZE}/apps RENAME BambuStudio.png
)
endforeach()
install(DIRECTORY ${SLIC3R_RESOURCES_DIR}/udev/ DESTINATION lib/udev/rules.d)
elseif (CMAKE_MACOSX_BUNDLE)
# install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/OrcaSlicer.app/Contents/resources")
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/BambuStudio.app/Contents/resources")
else ()
install(FILES src/dev-utils/platform/unix/OrcaSlicer.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/applications)
install(FILES src/platform/unix/BambuStudio.desktop DESTINATION ${CMAKE_INSTALL_PREFIX}/resources/applications)
install(DIRECTORY "${SLIC3R_RESOURCES_DIR}/" DESTINATION "${CMAKE_INSTALL_PREFIX}/resources")
endif ()
install(FILES ${CMAKE_SOURCE_DIR}/LICENSE.txt DESTINATION ".")
configure_file(${LIBDIR}/dev-utils/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/dev-utils/platform/unix/fhs.hpp)
set (CPACK_PACKAGE_NAME "OrcaSlicer")
set (CPACK_PACKAGE_VENDOR "SoftFever")
set (CPACK_PACKAGE_VERSION_MAJOR "${ORCA_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${ORCA_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${ORCA_VERSION_PATCH}")
set (CPACK_PACKAGE_FILE_NAME "OrcaSlicer_Windows_Installer_V${SoftFever_VERSION}")
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Orca Slicer is an open source slicer for FDM printers")
set (CPACK_PACKAGE_HOMEPAGE_URL "https://github.com/OrcaSlicer/OrcaSlicer")
set (CPACK_PACKAGE_INSTALL_DIRECTORY ${CPACK_PACKAGE_NAME})
set (CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}/resources/images\\\\OrcaSlicer.ico")
set (CPACK_NSIS_MUI_ICON "${CPACK_PACKAGE_ICON}")
set (CPACK_NSIS_MUI_UNIICON "${CPACK_PACKAGE_ICON}")
set (CPACK_NSIS_INSTALLED_ICON_NAME "$INSTDIR\\\\orca-slicer.exe")
set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
CreateShortCut \\\"$DESKTOP\\\\OrcaSlicer.lnk\\\" \\\"$INSTDIR\\\\orca-slicer.exe\\\"
")
set (CPACK_PACKAGE_CHECKSUM SHA256)
set (CPACK_PACKAGE_INSTALL_REGISTRY_KEY "OrcaSlicer")
set (CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
set (CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
# set (CPACK_NSIS_MODIFY_PATH "ON")
set(CPACK_PACKAGE_EXECUTABLES "orca-slicer;OrcaSlicer")
set(CPACK_CREATE_DESKTOP_LINKS "orca-slicer")
set (CPACK_RESOURCE_FILE_LICENSE ${CMAKE_SOURCE_DIR}/LICENSE.txt) # must also include in install command
set(CPACK_WIX_UPGRADE_GUID "058245e8-20e0-4a95-9ab7-1acfe17ad511")
set(CPACK_GENERATOR NSIS)
include(CPack)
configure_file(${LIBDIR}/platform/unix/fhs.hpp.in ${LIBDIR_BIN}/platform/unix/fhs.hpp)

257
README.md
View File

@@ -1,209 +1,80 @@
<div align="center">
<picture>
<img alt="OrcaSlicer logo" src="resources/images/OrcaSlicer.png" width="15%" height="15%">
</picture>
A modified version of Bambu Studio.
It has following changes:
<a href="https://trendshift.io/repositories/15552" target="_blank"><img src="https://trendshift.io/api/badge/repositories/15552" alt="OrcaSlicer%2FOrcaSlicer | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
- Support third-party machines:
- Voron 2.4
- Voron Trident
- Voron 0.1
- Prusa MK3S
- Export to to .gcode file.
[![GitHub Repo stars](https://img.shields.io/github/stars/OrcaSlicer/OrcaSlicer)](https://github.com/OrcaSlicer/OrcaSlicer/stargazers) [![Build all](https://github.com/OrcaSlicer/OrcaSlicer/actions/workflows/build_all.yml/badge.svg?branch=main)](https://github.com/OrcaSlicer/OrcaSlicer/actions/workflows/build_all.yml)
Video: https://youtu.be/zCc7mVwu2xQ
![image](https://user-images.githubusercontent.com/103989404/179447873-b7b2a200-7a00-409d-b9d5-b0522f5f2ec8.png)
![image](https://user-images.githubusercontent.com/103989404/179447890-a124bd43-dab2-46b7-b0da-ef6c67783d9c.png)
![image](https://user-images.githubusercontent.com/103989404/179396355-fc07135a-fd08-430c-aa8d-dc1060ae94d1.png)
![image](https://user-images.githubusercontent.com/103989404/179447933-7752235a-a6eb-468c-a304-6eb0875c4c95.png)
![image](https://user-images.githubusercontent.com/103989404/179396363-d9868dfc-f8d5-4227-ad19-a439dfc31ce5.png)
![image](https://user-images.githubusercontent.com/103989404/179398283-f71ea1bd-18a8-4526-9678-a3c63bc36964.png)
OrcaSlicer: an open source Next-Gen Slicing Software for Precision 3D Prints.
Optimize your prints with ultra-fast slicing, intelligent support generation, and seamless printer compatibility—engineered for perfection.
<h3>
Image credits:
1. Voron 2.4: vorondesign.com
2. Voron bed texture: VoronUsers/bryansj
3. Voron 0.1: myself
4. Prusa MK3S: Prusa3d
# Official links and community
#### Official Website:
<a href="https://www.orcaslicer.com/" style="font-size:2em;">OrcaSlicer.com</a>
=========================SPLIT=========================
#### Github Repository:
<a href="https://github.com/OrcaSlicer/OrcaSlicer"><img src="https://img.shields.io/badge/OrcaSlicer-181717?style=flat&logo=github&logoColor=white" width="200" alt="GitHub Logo"/> </a>
![image](https://user-images.githubusercontent.com/106916061/179006347-497d24c0-9bd6-45b7-8c49-d5cc8ecfe5d7.png)
# BambuStudio
Bambu Studio is a cutting-edge, feature-rich slicing software.
It contains project-based workflows, systematically optimized slicing algorithms, and an easy-to-use graphic interface, bringing users an incredibly smooth printing experience.
#### Follow us:
<a href="https://twitter.com/real_OrcaSlicer"><img src="https://img.shields.io/badge/real__OrcaSlicer-000000?style=flat&logo=x&logoColor=white" width="200" alt="X Logo"/> </a>
Prebuilt Windows, macOS 64-bit releases are available through the [github releases page](https://github.com/bambulab/BambuStudio/releases/).
Linux version currently is not supported.
#### Join our Discord community:
<a href="https://discord.gg/P4VE9UY9gJ"><img src="https://img.shields.io/badge/-Discord-5865F2?style=flat&logo=discord&logoColor=fff" width="200" alt="discord logo"/> </a>
Bambu Studio is based on [PrusaSlicer](https://github.com/prusa3d/PrusaSlicer) by Prusa Research, which is from [Slic3r](https://github.com/Slic3r/Slic3r) by Alessandro Ranellucci and the RepRap community.
<table border="2" style="border-color: #ffa500; background-color:rgb(232, 220, 180); color: #856404;">
<tr>
<td>
<strong>⚠️ CAUTION:</strong><br>
Several clickbait and malicious websites, such as <b>orca-slicer[.]com</b> and <b>orcaslicer[.]net</b>, are pretending to be the official OrcaSlicer site. These sites may redirect you to dangerous downloads or contain misleading information.<br>
<b>Our only official website is <a href="https://www.orcaslicer.com/">www.orcaslicer.com</a>.</b><br><br>
If you come across any of these in search results, please <b>report them</b> as unsafe or phishing to help keep the community secure with:<br>
- <a href="https://safebrowsing.google.com/safebrowsing/report_phish/">Google Safe Browsing</a><br>
- <a href="https://www.microsoft.com/en-us/wdsi/support/report-unsafe-site">Microsoft Security Intelligence</a><br>
- <a href="https://ipthreat.net/tools/reportphishing">IPThreat</a>
</td>
</tr>
</table>
See the [wiki](https://github.com/bambulab/BambuStudio/wiki) and the [documentation directory](https://github.com/bambulab/BambuStudio/tree/master/doc) for more informations.
</div>
# What are Bambu Studio's main features?
Key features are:
- Basic slicing features & GCode viewer
- Multiple plates management
- Remote control & monitoring
- Auto-arrange objects
- Auto-orient objects
- Hybrid/Tree/Normal support types, Customized support
- multi-material printing and rich painting tools
- multi-platform (Win/Mac/Linux) support
- Global/Object/Part level slicing parameters
# Main features
Other major features are:
- Advanced cooling logic controlling fan speed and dynamic print speed
- Auto brim according to mechanical analysis
- Support arc path(G2/G3)
- Support STEP format
- Assembly & explosion view
- Flushing transition-filament into infill/object during filament change
- **[Advanced Calibration Tools](https://www.orcaslicer.com/wiki/Calibration)**
Comprehensive suite: temperature towers, flow rate, retraction & more for optimal performance.
- **[Precise Wall](https://www.orcaslicer.com/wiki/quality_settings_precision#precise-wall) and [Seam Control](https://www.orcaslicer.com/wiki/quality_settings_seam)**
Adjust outer wall spacing and apply scarf seams to enhance print accuracy.
- **[Sandwich Mode](https://www.orcaslicer.com/wiki/quality_settings_wall_and_surfaces#innerouterinner) and [Polyholes](https://www.orcaslicer.com/wiki/quality_settings_precision#polyholes) Support**
Use varied infill [patterns](https://www.orcaslicer.com/wiki/strength_settings_patterns) and accurate hole shapes for improved clarity.
- **[Overhang](https://www.orcaslicer.com/wiki/quality_settings_overhangs) and [Support Optimization](https://www.orcaslicer.com/wiki#support-settings)**
Modify geometry for printable overhangs with precise support placement.
- **[Granular Controls and Customization](https://www.orcaslicer.com/wiki#process-settings)**
Fine-tune print speed, layer height, pressure, and temperature with precision.
- **Network Printer Support**
Seamless integration with Klipper, PrusaLink, and OctoPrint for remote control.
- **[Mouse Ear Brims](https://www.orcaslicer.com/wiki/others_settings_brim) & [Adaptive Bed Mesh](https://www.orcaslicer.com/wiki/printer_basic_information_adaptive_bed_mesh)**
Automatic brims and adaptive mesh calibration ensure consistent adhesion.
- **User-Friendly Interface**
Intuitive drag-and-drop design with pre-made profiles for popular printers.
- **[Open-Source](https://github.com/OrcaSlicer/OrcaSlicer) & [Community Driven](https://discord.gg/P4VE9UY9gJ)**
Regular updates fueled by continuous community contributions.
- **Wide Printer Compatibility**
Supports a broad range of printers: Bambu Lab, Prusa, Creality, Voron, and more.
- Additional features can be found in the [change notes](https://github.com/OrcaSlicer/OrcaSlicer/releases/).
# How to compile
Following platforms are currently supported to compile:
- Windows 64-bit, [Compile Guide](https://github.com/bambulab/BambuStudio/wiki/Windows-Compile-Guide)
- Mac 64-bit, [Compile Guide](https://github.com/bambulab/BambuStudio/wiki/Mac-Compile-Guide)
# Wiki
The [wiki](https://www.orcaslicer.com/wiki) aims to provide a detailed explanation of the slicer settings, including how to maximize their use and how to calibrate and set up your printer.
- **[Access the wiki here](https://www.orcaslicer.com/wiki)**
- **[Contribute to the wiki](https://www.orcaslicer.com/wiki/How-to-wiki)**
# Download
## Stable Release
📥 **[Download the Latest Stable Release](https://github.com/OrcaSlicer/OrcaSlicer/releases/latest)**
Visit our GitHub Releases page for the latest stable version of OrcaSlicer, recommended for most users.
## Nightly Builds
🌙 **[Download the Latest Nightly Build](https://github.com/OrcaSlicer/OrcaSlicer/releases/tag/nightly-builds)**
Explore the latest developments in OrcaSlicer with our nightly builds. Feedback on these versions is highly appreciated.
# How to install
## Windows
Download the **Windows Installer exe** for your preferred version from the [releases page](https://github.com/OrcaSlicer/OrcaSlicer/releases).
- *For convenience there is also a portable build available.*
<details>
<summary>Troubleshooting</summary>
- *If you have troubles to run the build, you might need to install following runtimes:*
- [MicrosoftEdgeWebView2RuntimeInstallerX64](https://github.com/OrcaSlicer/OrcaSlicer/releases/download/v1.0.10-sf2/MicrosoftEdgeWebView2RuntimeInstallerX64.exe)
- [Details of this runtime](https://aka.ms/webview2)
- [Alternative Download Link Hosted by Microsoft](https://go.microsoft.com/fwlink/p/?LinkId=2124703)
- [vcredist2019_x64](https://github.com/OrcaSlicer/OrcaSlicer/releases/download/v1.0.10-sf2/vcredist2019_x64.exe)
- [Alternative Download Link Hosted by Microsoft](https://aka.ms/vs/17/release/vc_redist.x64.exe)
- This file may already be available on your computer if you've installed visual studio. Check the following location: `%VCINSTALLDIR%Redist\MSVC\v142`
</details>
Windows Package Manager
```shell
winget install --id=SoftFever.OrcaSlicer -e
```
## Mac
1. Download the DMG for your computer: `arm64` version for Apple Silicon and `x86_64` for Intel CPU.
2. Drag OrcaSlicer.app to Application folder.
3. *If you want to run a build from a PR, you also need to follow the instructions below:*
<details>
<summary>Quarantine</summary>
- Option 1 (You only need to do this once. After that the app can be opened normally.):
- Step 1: Hold _cmd_ and right click the app, from the context menu choose **Open**.
- Step 2: A warning window will pop up, click _Open_
- Option 2:
Execute this command in terminal:
```shell
xattr -dr com.apple.quarantine /Applications/OrcaSlicer.app
```
- Option 3:
- Step 1: open the app, a warning window will pop up
![mac_cant_open](./SoftFever_doc/mac_cant_open.png)
- Step 2: in `System Settings` -> `Privacy & Security`, click `Open Anyway`:
![mac_security_setting](./SoftFever_doc/mac_security_setting.png)
</details>
## Linux (Ubuntu)
1. If you run into trouble executing it, try this command in the terminal:
`chmod +x /path_to_appimage/OrcaSlicer_Linux.AppImage`
# How to Compile
All updated build instructions for Windows, macOS, and Linux are now available on the official [OrcaSlicer Wiki - How to build](https://www.orcaslicer.com/wiki/How-to-build) page.
Please refer to the wiki to ensure you're following the latest and most accurate steps for your platform.
# Klipper Note
If you're running Klipper, it's recommended to add the following configuration to your `printer.cfg` file.
```gcode
# Enable object exclusion
[exclude_object]
# Enable arcs support
[gcode_arcs]
resolution: 0.1
```
# Supports
**OrcaSlicer** is an open-source project and I'm deeply grateful to all my sponsors and backers.
Their generous support enables me to purchase filaments and other essential 3D printing materials for the project.
Thank you! :)
## Sponsors:
<table>
<tr>
<td>
<a href="https://qidi3d.com/" style="display:inline-block; border-radius:8px; background:#fff;">
<img src="SoftFever_doc\sponsor_logos\QIDI.png" alt="QIDI" width="100" height="100">
</a>
</td>
<td>
<a href="https://bigtree-tech.com/" style="display:inline-block; border-radius:8px; background:#222;">
<img src="SoftFever_doc\sponsor_logos\BigTreeTech.png" alt="BIGTREE TECH" width="100" height="100">
</a>
</td>
</tr>
</table>
## Backers:
**Ko-fi supporters** ☕: [Backers list](https://github.com/user-attachments/files/16147016/Supporters_638561417699952499.csv)
## Support me
<a href="https://github.com/sponsors/SoftFever"><img src="https://img.shields.io/badge/GitHub%20Sponsors-30363D?style=flat&logo=GitHub-Sponsors&logoColor=EA4AAA" height="50"></a>
<a href="https://ko-fi.com/G2G5IP3CP"><img src="https://img.shields.io/badge/Support_me_on_Ko--fi-FF5E5B?style=flat&logo=ko-fi&logoColor=white" height="50"></a>
<a href="https://paypal.me/softfever3d"><img src="https://img.shields.io/badge/PayPal-003087?style=flat&logo=paypal&logoColor=fff" height="50"></a>
## Some Background
Open-source slicing has always been built on a tradition of collaboration and attribution. [Slic3r](https://github.com/Slic3r/Slic3r), created by Alessandro Ranellucci and the RepRap community, laid the foundation. [PrusaSlicer](https://github.com/prusa3d/PrusaSlicer) by Prusa Research built on Slic3r and acknowledged that heritage. [Bambu Studio](https://github.com/bambulab/BambuStudio) in turn forked from PrusaSlicer, and [SuperSlicer](https://github.com/supermerill/SuperSlicer) by @supermerill extended PrusaSlicer with community-driven enhancements. Each project carried the work of its predecessors forward, crediting those who came before.
OrcaSlicer began in that same spirit, drawing from BambuStudio, PrusaSlicer, and ideas inspired by CuraSlicer and SuperSlicer. But it has since grown far beyond its origins. Through relentless innovation — introducing advanced calibration tools, precise wall and seam control, tree supports, adaptive slicing, and hundreds of other features — OrcaSlicer has become the most widely used and actively developed open-source slicer in the 3D printing community. Many of its innovations have been adopted by other slicers, making it a driving force for the entire industry.
The OrcaSlicer logo was designed by community member Justin Levine (@freejstnalxndr).
# Report issue
You can add an issue to the [github tracker](https://github.com/bambulab/BambuStudio/issues) if **it isn't already present.**
# License
- **OrcaSlicer** is licensed under the GNU Affero General Public License, version 3.
- The **GNU Affero General Public License**, version 3 ensures that if you use any part of this software in any way (even behind a web server), your software must be released under the same license.
- OrcaSlicer includes a **pressure advance calibration pattern test** adapted from Andrew Ellis' generator, which is licensed under GNU General Public License, version 3. Ellis' generator is itself adapted from a generator developed by Sineos for Marlin, which is licensed under GNU General Public License, version 3.
- The **Bambu networking plugin** is based on non-free libraries from BambuLab. It is optional to the OrcaSlicer and provides extended functionalities for Bambulab printer users.
Bambu Studio is licensed under the GNU Affero General Public License, version 3. Bambu Studio is based on PrusaSlicer by PrusaResearch.
PrusaSlicer is licensed under the GNU Affero General Public License, version 3. PrusaSlicer is owned by Prusa Research. PrusaSlicer is originally based on Slic3r by Alessandro Ranellucci.
Slic3r is licensed under the GNU Affero General Public License, version 3. Slic3r was created by Alessandro Ranellucci with the help of many other contributors.
The GNU Affero General Public License, version 3 ensures that if you use any part of this software in any way (even behind a web server), your software must be released under the same license.
The BambuNetworking and BambuTunnel plugins are based on non-free libraries. They are optional to the Bambu Studio and provides extended functionalities for users.

1
Readme.txt Normal file
View File

@@ -0,0 +1 @@
Init Version

View File

@@ -1,47 +0,0 @@
# Security Policy
At OrcaSlicer, we are committed to maintaining the security of our ecosystem. Our policy is to ensure that we do not introduce vulnerabilities and that any security issues are addressed promptly and responsibly. We appreciate your help in improving the security of OrcaSlicer and thank you for your responsible disclosure.
Reporting Security Bugs
## To report a security bug, please follow these guidelines:
* Email Security Bugs:
Send an email to the lead maintainer at softfeverever@gmail.com.
Include the word "SECURITY" in the subject line of your email.
* Response Times:
The lead maintainer will acknowledge receipt of your email within one week (7 days).
A detailed response will follow within 48 hours, outlining the next steps for handling your report.
After the initial reply, the security team will keep you informed about the progress toward a fix and any announcements.
* Information and Collaboration:
We may request additional information or guidance as we work on addressing the issue.
* Handling the Report:
OrcaSlicer will confirm the problem and determine the affected versions.
We will audit the code to find any similar issues and prepare fixes for all releases still under maintenance.
Fixes will be released as quickly as possible.
* Third-Party Modules:
Report security issues in third-party modules to the respective maintainer of those modules.
## Security Disclosure Guidelines
When disclosing a vulnerability, please follow these steps to ensure your report is clear and actionable:
* Provide Detailed Information:
Scope: Clearly define the scope of the vulnerability.
Potential Impact: Let us know who could be affected by this exploit.
Reproduction Steps: Document detailed steps to reproduce the vulnerability.
Reference OWASP Guidelines:
Follow the <a href="https://cheatsheetseries.owasp.org/cheatsheets/Vulnerability_Disclosure_Cheat_Sheet.html">OWASP Vulnerability Disclosure Cheat Sheet</a> for best practices in vulnerability disclosure.
## Security Recommendations
To enhance security when using OrcaSlicer, we recommend following these steps:
* SEE SOMETHING: If you notice anything suspicious or have concerns, please report it.
* SAY SOMETHING: If you have any doubts or need assistance, do not hesitate to contact us.
### Thank you for your commitment to the security of OrcaSlicer. Your efforts help us maintain a safe and reliable ecosystem.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 98 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 126 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 729 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 228 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 353 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 13 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 305 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

5821
bbl/i18n/BambuStudio.pot Normal file

File diff suppressed because it is too large Load Diff

17765
bbl/i18n/de/BambuStudio_de.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

17650
bbl/i18n/es/BambuStudio_es.po Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

109
bbl/i18n/list.txt Normal file
View File

@@ -0,0 +1,109 @@
src/slic3r/GUI/Gizmos/GLGizmoFdmSupports.cpp
src/slic3r/GUI/Gizmos/GLGizmoFlatten.cpp
src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp
src/slic3r/GUI/Gizmos/GLGizmoMove.cpp
src/slic3r/GUI/Gizmos/GLGizmoRotate.cpp
src/slic3r/GUI/Gizmos/GLGizmoScale.cpp
src/slic3r/GUI/Gizmos/GLGizmosManager.cpp
src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp
src/slic3r/GUI/Gizmos/GizmoObjectManipulation.cpp
src/slic3r/GUI/Gizmos/GLGizmoAdvancedCut.cpp
src/slic3r/GUI/Gizmos/GLGizmoSimplify.cpp
src/slic3r/GUI/Gizmos/GLGizmoFaceDetector.cpp
src/slic3r/GUI/Gizmos/GLGizmoModifier.cpp
src/slic3r/GUI/GUI.cpp
src/slic3r/GUI/GUI_App.cpp
src/slic3r/GUI/GUI_Init.cpp
src/slic3r/GUI/GUI_Factories.cpp
src/slic3r/GUI/GUI_ObjectList.cpp
src/slic3r/GUI/GUI_ObjectSettings.cpp
src/slic3r/GUI/GUI_ObjectTable.cpp
src/slic3r/GUI/GUI_ObjectTable.hpp
src/slic3r/GUI/GUI_ObjectTableSettings.cpp
src/slic3r/GUI/GUI_ObjectTableSettings.hpp
src/slic3r/GUI/GUI_Preview.cpp
src/slic3r/GUI/Widgets/SideTools.cpp
src/slic3r/GUI/Widgets/AMSControl.cpp
src/slic3r/GUI/ImGuiWrapper.cpp
src/slic3r/GUI/Jobs/ArrangeJob.cpp
src/slic3r/GUI/Jobs/OrientJob.cpp
src/slic3r/GUI/Jobs/FillBedJob.cpp
src/slic3r/GUI/Jobs/Job.cpp
src/slic3r/GUI/Jobs/PlaterJob.cpp
src/slic3r/GUI/Jobs/RotoptimizeJob.cpp
src/slic3r/GUI/Jobs/BindJob.cpp
src/slic3r/GUI/Jobs/PrintJob.cpp
src/slic3r/GUI/AboutDialog.cpp
src/slic3r/GUI/AMSMaterialsSetting.cpp
src/slic3r/GUI/AMSSetting.cpp
src/slic3r/GUI/BBLTopbar.cpp
src/slic3r/GUI/BackgroundSlicingProcess.cpp
src/slic3r/GUI/BedShapeDialog.cpp
src/slic3r/GUI/BedShapeDialog.hpp
src/slic3r/GUI/ConfigManipulation.cpp
src/slic3r/GUI/DeviceManager.cpp
src/slic3r/GUI/ExtraRenderers.cpp
src/slic3r/GUI/Field.cpp
src/slic3r/GUI/GCodeViewer.cpp
src/slic3r/GUI/GLCanvas3D.cpp
src/slic3r/GUI/Calibration.cpp
src/slic3r/GUI/CameraPopup.cpp
src/slic3r/GUI/ConnectPrinter.cpp
src/slic3r/GUI/DebugToolDialog.cpp
src/slic3r/GUI/HMSPanel.cpp
src/slic3r/GUI/MainFrame.cpp
src/slic3r/GUI/MediaPlayCtrl.cpp
src/slic3r/GUI/Mouse3DController.cpp
src/slic3r/GUI/StatusPanel.cpp
src/slic3r/GUI/Monitor.cpp
src/slic3r/GUI/MsgDialog.cpp
src/slic3r/GUI/NotificationManager.hpp
src/slic3r/GUI/NotificationManager.cpp
src/slic3r/GUI/ObjectDataViewModel.cpp
src/slic3r/GUI/OpenGLManager.cpp
src/slic3r/GUI/OptionsGroup.cpp
src/slic3r/GUI/ParamsPanel.cpp
src/slic3r/GUI/PartPlate.cpp
src/slic3r/GUI/Plater.cpp
src/slic3r/GUI/Preferences.cpp
src/slic3r/GUI/PresetComboBoxes.cpp
src/slic3r/GUI/PresetHints.cpp
src/slic3r/GUI/ProgressStatusBar.cpp
src/slic3r/GUI/PublishDialog.cpp
src/slic3r/GUI/SavePresetDialog.cpp
src/slic3r/GUI/Search.cpp
src/slic3r/GUI/Selection.cpp
src/slic3r/GUI/SelectMachine.cpp
src/slic3r/GUI/SendSystemInfoDialog.cpp
src/slic3r/GUI/BindDialog.cpp
src/slic3r/GUI/Tab.cpp
src/slic3r/GUI/Tab.hpp
src/slic3r/GUI/UnsavedChangesDialog.cpp
src/slic3r/GUI/Auxiliary.cpp
src/slic3r/GUI/UpdateDialogs.cpp
src/slic3r/GUI/WipeTowerDialog.cpp
src/slic3r/GUI/wxExtensions.cpp
src/slic3r/GUI/WebUserLoginDialog.cpp
src/slic3r/GUI/WebGuideDialog.cpp
src/slic3r/GUI/KBShortcutsDialog.hpp
src/slic3r/GUI/KBShortcutsDialog.cpp
src/slic3r/Utils/FixModelByWin10.cpp
src/slic3r/Utils/PresetUpdater.cpp
src/slic3r/Utils/Http.cpp
src/slic3r/Utils/Process.cpp
src/slic3r/GUI/Jobs/PrintJob.cpp
src/libslic3r/GCode.cpp
src/libslic3r/ExtrusionEntity.cpp
src/libslic3r/Flow.cpp
src/libslic3r/Format/AMF.cpp
src/libslic3r/miniz_extension.cpp
src/libslic3r/Preset.cpp
src/libslic3r/Print.cpp
src/libslic3r/PrintBase.cpp
src/libslic3r/PrintConfig.cpp
src/libslic3r/Zipper.cpp
src/libslic3r/PrintObject.cpp
src/libslic3r/PrintObjectSlice.cpp
src/libslic3r/PlaceholderParser.cpp
src/libslic3r/TreeSupport.cpp

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,4 @@
# Add individual tools as executables in separate directories
add_subdirectory(bbs_gcode_checker)
install(TARGETS bbs_gcode_checker RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}")

View File

@@ -0,0 +1,6 @@
cmake_minimum_required (VERSION 3.8)
project ("bbs_gcode_checker")
add_executable (bbs_gcode_checker "main.cpp" "GCodeChecker.cpp" "GCodeChecker.h" )

View File

@@ -0,0 +1,602 @@
#include "GCodeChecker.h"
#include <fstream>
#include <math.h>
#include <map>
namespace BambuStudio {
//BBS: only check wodth when dE is longer than this value
const double CHECK_WIDTH_E_THRESHOLD = 0.0025;
const double WIDTH_THRESHOLD = 0.012;
const double RADIUS_THRESHOLD = 0.005;
const double filament_diameter = 1.75;
const double Pi = 3.14159265358979323846;
const std::string Extrusion_Role_Tag = " FEATURE: ";
const std::string Width_Tag = " LINE_WIDTH: ";
const std::string Wipe_Start_Tag = " WIPE_START";
const std::string Wipe_End_Tag = " WIPE_END";
const std::string Layer_Change_Tag = " CHANGE_LAYER";
const std::string Height_Tag = " LAYER_HEIGHT: ";
GCodeCheckResult GCodeChecker::parse_file(const std::string& path)
{
std::ifstream file(path);
if (file.fail()) {
std::cout << "Failed to open file " << path << std::endl;
return GCodeCheckResult::ParseFailed;
}
std::string line_raw;
std::string line;
while (std::getline(file, line_raw)) {
const char *c = line_raw.c_str();
c = skip_whitespaces(c);
if (std::toupper(*c) == 'N')
c = skip_word(c);
c = skip_whitespaces(c);
line = c;
if (parse_line(line) != GCodeCheckResult::Success) {
std::cout << "Failed to parse line " << line_raw << std::endl;
return GCodeCheckResult::ParseFailed;
}
}
if (m_layer_num == 0) {
std::cout << "Invalid gcode file without layer change comment" << std::endl;
return GCodeCheckResult::ParseFailed;
}
return GCodeCheckResult::Success;
}
bool GCodeChecker::include_chinese(const char* str)
{
char c;
while(1)
{
c=*str++;
if (is_end_of_line(c))
break;
if ((c & 0x80) && (*str & 0x80))
return true;
}
return false;
}
GCodeCheckResult GCodeChecker::parse_line(const std::string& line)
{
// update start position
m_start_position = m_end_position;
GCodeCheckResult ret;
const char *c = skip_whitespaces(line.c_str());
if (include_chinese(c)) {
//chinese is forbidden
return GCodeCheckResult::ParseFailed;
} if (is_end_of_line(*c)) {
//BBS: skip empty line
return GCodeCheckResult::Success;
} else if (is_comment_line(*c)) {
GCodeLine gcode_line;
gcode_line.m_raw = c;
ret = parse_comment(gcode_line);
if (ret != GCodeCheckResult::Success)
return ret;
} else {
GCodeLine gcode_line;
gcode_line.m_raw = c;
ret = parse_command(gcode_line);
if (ret != GCodeCheckResult::Success)
return ret;
ret = check_line_width(gcode_line);
if (ret != GCodeCheckResult::Success)
return ret;
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_comment(GCodeLine& line)
{
const char *c = line.m_raw.c_str();
c++;
std::string comment = c;
// extrusion role tag
if (starts_with(comment, Extrusion_Role_Tag)) {
m_role = string_to_role(comment.substr(Extrusion_Role_Tag.length()));
} else if (starts_with(comment, Wipe_Start_Tag)) {
m_wiping = true;
} else if (starts_with(comment, Wipe_End_Tag)) {
m_wiping = false;
} else if (starts_with(comment, Height_Tag)) {
std::string str = comment.substr(Height_Tag.size());
if (!parse_double_from_str(str, m_height)) {
std::cout << "invalid height comment with invalid value!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
} else if (starts_with(comment, Width_Tag)) {
std::string str = comment.substr(Width_Tag.size());
if (!parse_double_from_str(str, m_width)) {
std::cout << "invalid width comment with invalid value!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
} else if (starts_with(comment, Layer_Change_Tag)) {
m_layer_num++;
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_command(GCodeLine& gcode_line)
{
const std::string cmd = gcode_line.cmd();
GCodeCheckResult ret = GCodeCheckResult::Success;
switch (::toupper(cmd[0])) {
case 'G':
{
switch (::atoi(&cmd[1]))
{
case 0:
case 1: { ret = parse_G0_G1(gcode_line); break; } // Move
case 2:
case 3: { ret = parse_G2_G3(gcode_line); break; } // Move
case 90: { ret = parse_G90(gcode_line); break; } // Set to Absolute Positioning
case 91: { ret = parse_G91(gcode_line); break; } // Set to Relative Positioning
case 92: { ret = parse_G92(gcode_line); break; } // Set Position
default: { break; }
}
break;
}
case 'M':{
switch (::atoi(&cmd[1]))
{
case 82: { ret = parse_M82(gcode_line); break; } // Set to Absolute extrusion
case 83: { ret = parse_M83(gcode_line); break; } // Set to Relative extrusion
default: { break; }
}
break;
}
case 'T':{
break;
}
default: {
//BBS: other g command? impossible! must be invalid
ret = GCodeCheckResult::ParseFailed;
break;
}
}
return ret;
}
GCodeCheckResult GCodeChecker::parse_axis(GCodeLine& gcode_line)
{
const std::string cmd = gcode_line.m_raw;
const char* c = cmd.c_str();
c = skip_word(c);
while (! is_end_of_gcode_line(*c)) {
c = skip_whitespaces(c);
if (is_end_of_gcode_line(*c))
break;
Axis axis = UNKNOWN_AXIS;
switch (*c) {
case 'X': axis = X; break;
case 'Y': axis = Y; break;
case 'Z': axis = Z; break;
case 'E': axis = E; break;
case 'F': axis = F; break;
case 'I': axis = I; break;
case 'J': axis = J; break;
default:
//BBS: invalid command which has invalid axis
std::cout << "Invalid gcode because of invalid axis!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
char *pend = nullptr;
double v = strtod(++c, &pend);
if (pend != nullptr && is_end_of_word(*pend) && !isnan(v) && !isinf(v)) {
gcode_line.m_axis[int(axis)] = v;
if (gcode_line.m_mask & (1 << int(axis))) {
//BBS: invalid command which has duplicated axis
std::cout << "Invalid gcode because of duplicated axis!" << std::endl;
return GCodeCheckResult::ParseFailed;
} else {
gcode_line.m_mask |= 1 << int(axis);
}
if (c == pend) {
//BBS: invalid command which has invalid axis value
std::cout << "Invalid gcode because of invalid axis value!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
c = pend;
} else {
//BBS: invalid command for invalid axis value
std::cout << "Invalid gcode because of invalid axis value!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_G0_G1(GCodeLine& gcode_line)
{
if (parse_axis(gcode_line) != GCodeCheckResult::Success)
return GCodeCheckResult::ParseFailed;
//BBS: invalid G1 command which has no axis or invalid axis
if ((!gcode_line.m_mask) ||
gcode_line.has(I) ||
gcode_line.has(J)) {
std::cout << "Invalid G0_G1 gcode because of no axis or invalid axis!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
//BBS: invalid G1 command which has zero speed
if (gcode_line.has(F) && gcode_line.get(F) == 0.0) {
std::cout << "Invalid G0_G1 gcode because has F axis but 0 speed!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_G2_G3(GCodeLine& gcode_line)
{
if (parse_axis(gcode_line) != GCodeCheckResult::Success)
return GCodeCheckResult::ParseFailed;
//BBS: invalid G2_G3 command which has no axis or Z axis
if (!gcode_line.m_mask) {
std::cout << "Invalid G2_G3 gcode because of no axis or has Z axis!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
//BBS: invalid G2_G3 command which has zero speed
if (gcode_line.has(F) && gcode_line.get(F) == 0.0) {
std::cout << "Invalid G2_G3 gcode because has F axis but 0 speed!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
//BBS: invalid G2_G3 command which has no I and J axis
if (!gcode_line.has(I) &&
!gcode_line.has(J)) {
std::cout << "Invalid G2_G3 gcode because of no I and J axis at same time!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
//BBS: invalid G2_G3 command which has no X and Y axis at same time
if (!gcode_line.has(X) &&
!gcode_line.has(Y)) {
if (!gcode_line.has(X) || !gcode_line.has(P) || (int)gcode_line.get(P) != 1) {
std::cout << "Invalid G2_G3 gcode because of no X and Y axis at same time!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_G90(const GCodeLine& gcode_line)
{
const char* c = gcode_line.m_raw.c_str();
//BBS: G90 is single command with no argument
if (!is_single_gcode_word(c)) {
std::cout << "Invalid G90 gcode with invalid end!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
m_global_positioning_type = EPositioningType::Absolute;
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_G91(const GCodeLine& gcode_line)
{
const char* c = gcode_line.m_raw.c_str();
//BBS: G91 is single command with no argument
if (!is_single_gcode_word(c)) {
std::cout << "Invalid G91 gcode with invalid end!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
m_global_positioning_type = EPositioningType::Relative;
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_G92(GCodeLine& gcode_line)
{
if (parse_axis(gcode_line) != GCodeCheckResult::Success)
return GCodeCheckResult::ParseFailed;
//BBS: invalid G92 command which has no axis or invalid axis
if (!gcode_line.m_mask ||
gcode_line.has(F) ||
gcode_line.has(I) ||
gcode_line.has(J)) {
std::cout << "Invalid G2_G3 gcode because of no axis or invalid axis!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
if (gcode_line.has(X))
m_origin[X] = m_end_position[X] - gcode_line.get(X);
if (gcode_line.has(Y))
m_origin[Y] = m_end_position[Y] - gcode_line.get(Y);
if (gcode_line.has(Z))
m_origin[Z] = m_end_position[Z] - gcode_line.get(Z);
if (gcode_line.has(E))
m_end_position[E] = gcode_line.get(E);
for (unsigned char a = X; a <= E; ++a) {
m_origin[a] = m_end_position[a];
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_M82(const GCodeLine& gcode_line)
{
const char* c = gcode_line.m_raw.c_str();
//BBS: M82 is single command with no argument
if (!is_single_gcode_word(c)) {
std::cout << "Invalid M82 gcode with invalid end!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
m_e_local_positioning_type = EPositioningType::Absolute;
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::parse_M83(const GCodeLine& gcode_line)
{
const char* c = gcode_line.m_raw.c_str();
//BBS: M83 is single command with no argument
if (!is_single_gcode_word(c)) {
std::cout << "Invalid M83 gcode with invalid end!" << std::endl;
return GCodeCheckResult::ParseFailed;
}
m_e_local_positioning_type = EPositioningType::Relative;
return GCodeCheckResult::Success;
}
double GCodeChecker::calculate_G1_width(const std::array<double, 3>& source,
const std::array<double, 3>& target,
double e, double height, bool is_bridge) const
{
double volume = e * Pi * (filament_diameter/2.0f) * (filament_diameter/2.0f);
std::array<double, 3> delta = { target[0] - source[0],
target[1] - source[1],
target[2] - source[2] };
double length = sqrt(delta[0] * delta[0] + delta[1] * delta[1] + delta[2] * delta[2]);
double mm3_per_mm = volume / length;
return is_bridge? 2 * sqrt(mm3_per_mm/Pi) :
(mm3_per_mm / height) + height * (1 - 0.25 * Pi);
}
double GCodeChecker::calculate_G2_G3_width(const std::array<double, 2>& source,
const std::array<double, 2>& target,
const std::array<double, 2>& center,
bool is_ccw, double e, double height,
bool is_bridge) const
{
std::array<double, 2> v1 = { source[0] - center[0], source[1] - center[1] };
std::array<double, 2> v2 = { target[0] - center[0], target[1] - center[1] };
double dot = v1[0] * v2[0] + v1[1] * v2[1];
double cross = v1[0] * v2[1] - v1[1] * v2[0];
double radian = atan2(cross, dot);
radian = is_ccw ?
(radian < 0 ? 2 * Pi + radian : radian) :
(radian < 0 ? -radian : 2 * Pi - radian);
double radius = sqrt(v1[0] * v1[0] + v1[1] * v1[1]);
double length = radius * radian;
double volume = e * Pi * (filament_diameter/2) * (filament_diameter/2);
double mm3_per_mm = volume / length;
return is_bridge? 2 * sqrt(mm3_per_mm/Pi) :
(mm3_per_mm / height) + height * (1 - 0.25 * Pi);
}
GCodeCheckResult GCodeChecker::check_line_width(const GCodeLine& gcode_line)
{
//BBS: don't need to check extrusion before first layer
if (m_layer_num <= 0) {
return GCodeCheckResult::Success;
}
GCodeCheckResult ret = GCodeCheckResult::Success;
//BBS: only need to handle G0 G1 G2 G3
const std::string cmd = gcode_line.cmd();
int cmd_id = ::atoi(&cmd[1]);
if (::toupper(cmd[0]) == 'G')
switch (::atoi(&cmd[1]))
{
case 0:
case 1: { ret = check_G0_G1_width(gcode_line); break; }
case 2:
case 3: { ret = check_G2_G3_width(gcode_line); break; }
default: { break; }
}
return ret;
}
GCodeCheckResult GCodeChecker::check_G0_G1_width(const GCodeLine& line)
{
auto absolute_position = [this](Axis axis, const GCodeLine& lineG1) {
bool is_relative = (m_global_positioning_type == EPositioningType::Relative);
if (axis == E)
is_relative |= (m_e_local_positioning_type == EPositioningType::Relative);
if (lineG1.has(Axis(axis))) {
double ret = lineG1.get(Axis(axis));
return is_relative ? m_start_position[axis] + ret : m_origin[axis] + ret;
} else
return m_start_position[axis];
};
auto move_type = [this](const std::array<double, 4>& delta_pos) {
EMoveType type = EMoveType::Noop;
if (m_wiping)
type = EMoveType::Wipe;
else if (delta_pos[E] < 0.0f)
type = (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f) ? EMoveType::Travel : EMoveType::Retract;
else if (delta_pos[E] > 0.0f) {
if (delta_pos[X] == 0.0f && delta_pos[Y] == 0.0f)
type = (delta_pos[Z] == 0.0f) ? EMoveType::Unretract : EMoveType::Travel;
else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f)
type = EMoveType::Extrude;
}
else if (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f)
type = EMoveType::Travel;
return type;
};
for (unsigned char a = X; a <= E; ++a) {
m_end_position[a] = absolute_position((Axis)a, line);
}
// calculates movement deltas
std::array<double, 4> delta_pos;
for (unsigned char a = X; a <= E; ++a)
delta_pos[a] = m_end_position[a] - m_start_position[a];
// Todo: currently, for precision, there alwasy has possible to generate
// such gcode because of decimal truncation
/*if (line.has(Axis(E)) && delta_pos[E] == 0.0 && !m_wiping) {
std::cout << "Invalid GCode because has E axis but 0 extrusion" << std::endl;
return GCodeCheckResult::CheckFailed;
}*/
EMoveType type = move_type(delta_pos);
if (type == EMoveType::Extrude && m_end_position[Z] == 0.0f)
type = EMoveType::Travel;
//BBS: calculate line width and compare.
//Don't need to check gap fill which has verious width
if (type == EMoveType::Extrude &&
m_role != erGapFill &&
delta_pos[E] > CHECK_WIDTH_E_THRESHOLD) {
std::array<double, 3> source = { m_start_position[X], m_start_position[Y], m_start_position[Z] };
std::array<double, 3> target = { m_end_position[X], m_end_position[Y], m_end_position[Z] };
bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill;
double width_real = calculate_G1_width(source, target, delta_pos[E], m_height, is_bridge);
if (fabs(width_real - m_width) > WIDTH_THRESHOLD) {
std::cout << "Invalid G0_G1 because has abnormal line width." << std::endl;
std::cout << "Width: " << m_width << " Width_real: " << width_real << std::endl;
return GCodeCheckResult::CheckFailed;
}
}
return GCodeCheckResult::Success;
}
GCodeCheckResult GCodeChecker::check_G2_G3_width(const GCodeLine& line)
{
auto absolute_position = [this](Axis axis, const GCodeLine& lineG2_3) {
bool is_relative = (m_global_positioning_type == EPositioningType::Relative);
if (axis == E)
is_relative |= (m_e_local_positioning_type == EPositioningType::Relative);
if (lineG2_3.has(Axis(axis))) {
double ret = lineG2_3.get(Axis(axis));
if (axis == I)
return m_start_position[X] + ret;
else if (axis == J)
return m_start_position[Y] + ret;
else
return is_relative ? m_start_position[axis] + ret : m_origin[axis] + ret;
} else {
if (axis == I)
return m_start_position[X];
else if (axis == J)
return m_start_position[Y];
else
return m_start_position[axis];
}
};
auto move_type = [this](const double& delta_E) {
EMoveType type = EMoveType::Noop;
if (m_wiping)
type = EMoveType::Wipe;
else if (delta_E < 0.0f || delta_E == 0.0f)
type = EMoveType::Travel;
else
type = EMoveType::Extrude;
return type;
};
for (unsigned char a = X; a <= E; ++a) {
m_end_position[a] = absolute_position((Axis)a, line);
}
std::array<double, 2> source = { m_start_position[X], m_start_position[Y] };
std::array<double, 2> target = { m_end_position[X], m_end_position[Y] };
std::array<double, 2> center = { absolute_position(I, line),absolute_position(J, line) };
const std::string& cmd = line.cmd();
bool is_ccw = (::atoi(&cmd[1]) == 2) ? false : true;
double delta_e = m_end_position[E] - m_start_position[E];
EMoveType type = move_type(delta_e);
//BBS: judge whether is normal arc by radius
double radius1 = sqrt(pow((source[0] - center[0]), 2) + pow((source[1] - center[1]), 2));
double radius2 = sqrt(pow((target[0] - center[0]), 2) + pow((target[1] - center[1]), 2));
if (fabs(radius2 - radius1) > RADIUS_THRESHOLD) {
std::cout << "Invalid G2_G3 because of abnormal radius." << std::endl;
std::cout << "radius1: " << radius1 << " radius2: " << radius2 << std::endl;
return GCodeCheckResult::CheckFailed;
}
//BBS: calculate line width and compare
//Don't need to check gap fill which has verious width
if (type == EMoveType::Extrude &&
m_role != erGapFill &&
delta_e > CHECK_WIDTH_E_THRESHOLD) {
bool is_bridge = m_role == erOverhangPerimeter || m_role == erBridgeInfill;
double width_real = calculate_G2_G3_width(source, target, center, is_ccw, delta_e, m_height, is_bridge);
if (fabs(width_real - m_width) > WIDTH_THRESHOLD) {
std::cout << "Invalid G2_G3 because has abnormal line width." << std::endl;
std::cout << "Width: " << m_width << " Width_real: " << width_real << std::endl;
return GCodeCheckResult::CheckFailed;
}
}
return GCodeCheckResult::Success;
}
const std::map<std::string, ExtrusionRole> string_to_role_map = {
{ "Inner wall", erPerimeter },
{ "Outer wall", erExternalPerimeter },
{ "Overhang wall", erOverhangPerimeter },
{ "Sparse infill", erInternalInfill },
{ "Internal solid infill", erSolidInfill },
{ "Top surface", erTopSolidInfill },
{ "Bottom surface", erBottomSurface },
{ "Ironing", erIroning },
{ "Bridge", erBridgeInfill },
{ "Gap infill", erGapFill },
{ "Skirt", erSkirt },
{ "Brim", erBrim },
{ "Support", erSupportMaterial },
{ "Support interface", erSupportMaterialInterface },
{ "Support transition", erSupportTransition },
{ "Prime tower", erWipeTower },
{ "Custom", erCustom },
{ "Mixed", erMixed }
};
ExtrusionRole GCodeChecker::string_to_role(const std::string &role)
{
for (auto it = string_to_role_map.begin(); it != string_to_role_map.end(); it++) {
if (role == it->first)
return it->second;
}
return erNone;
}
}

View File

@@ -0,0 +1,181 @@
#ifndef _GCodeChecker_H_
#define _GCodeChecker_H_
#include <iostream>
#include <string>
#include <vector>
#include <array>
namespace BambuStudio {
enum class GCodeCheckResult : unsigned char
{
Success,
ParseFailed,
CheckFailed,
Count
};
enum class EMoveType : unsigned char
{
Noop,
Retract,
Unretract,
Tool_change,
Color_change,
Pause_Print,
Custom_GCode,
Travel,
Wipe,
Extrude,
Count
};
enum Axis {
X=0,
Y,
Z,
E,
F,
I,
J,
P,
NUM_AXES,
UNKNOWN_AXIS = NUM_AXES,
};
enum ExtrusionRole : uint8_t {
erNone,
erPerimeter,
erExternalPerimeter,
erOverhangPerimeter,
erInternalInfill,
erSolidInfill,
erTopSolidInfill,
erBottomSurface,
erIroning,
erBridgeInfill,
erGapFill,
erSkirt,
erBrim,
erSupportMaterial,
erSupportMaterialInterface,
erSupportTransition,
erWipeTower,
erCustom,
// Extrusion role for a collection with multiple extrusion roles.
erMixed,
erCount
};
class GCodeChecker {
public:
class GCodeLine {
public:
GCodeLine() {}
const std::string cmd() const {
const char *cmd = GCodeChecker::skip_whitespaces(m_raw.c_str());
return std::string(cmd, GCodeChecker::skip_word(cmd) - cmd);
}
bool has(Axis axis) const { return (m_mask & (1 << int(axis))) != 0; }
double get(Axis axis) const { return m_axis[int(axis)]; }
std::string m_raw;
double m_axis[NUM_AXES] = { 0.0f };
uint32_t m_mask = 0;
};
enum class EPositioningType : unsigned char
{
Absolute,
Relative
};
GCodeChecker() {}
GCodeCheckResult parse_file(const std::string& path);
private:
bool include_chinese(const char* str);
GCodeCheckResult parse_line(const std::string& line);
GCodeCheckResult parse_command(GCodeLine& gcode_line);
GCodeCheckResult parse_axis(GCodeLine& gcode_line);
GCodeCheckResult parse_G0_G1(GCodeLine& gcode_line);
GCodeCheckResult parse_G2_G3(GCodeLine& gcode_line);
GCodeCheckResult parse_G90(const GCodeLine& gcode_line);
GCodeCheckResult parse_G91(const GCodeLine& gcode_line);
GCodeCheckResult parse_G92(GCodeLine& gcode_line);
GCodeCheckResult parse_M82(const GCodeLine& gcode_line);
GCodeCheckResult parse_M83(const GCodeLine& gcode_line);
GCodeCheckResult parse_comment(GCodeLine& gcode_line);
GCodeCheckResult check_line_width(const GCodeLine& gcode_line);
GCodeCheckResult check_G0_G1_width(const GCodeLine& gcode_line);
GCodeCheckResult check_G2_G3_width(const GCodeLine& gcode_line);
double calculate_G1_width(const std::array<double, 3>& source,
const std::array<double, 3>& target,
double e, double height, bool is_bridge) const;
double calculate_G2_G3_width(const std::array<double, 2>& source,
const std::array<double, 2>& target,
const std::array<double, 2>& center,
bool is_ccw, double e, double height, bool is_bridge) const;
public:
static bool is_whitespace(char c) { return c == ' ' || c == '\t'; }
static bool is_end_of_line(char c) { return c == '\r' || c == '\n' || c == 0; }
static bool is_comment_line(char c) { return c == ';'; }
static bool is_end_of_gcode_line(char c) { return is_comment_line(c) || is_end_of_line(c); }
static bool is_end_of_word(char c) { return is_whitespace(c) || is_end_of_gcode_line(c); }
static const char* skip_word(const char *c) {
for (; ! is_end_of_word(*c); ++ c)
; // silence -Wempty-body
return c;
}
static const char* skip_whitespaces(const char *c) {
for (; is_whitespace(*c); ++ c)
; // silence -Wempty-body
return c;
}
static bool is_single_gcode_word(const char* c) {
c = skip_word(c);
c = skip_whitespaces(c);
return is_end_of_gcode_line(*c);
}
static bool starts_with(const std::string &comment, const std::string &tag) {
size_t tag_len = tag.size();
return comment.size() >= tag_len && comment.substr(0, tag_len) == tag;
}
static ExtrusionRole string_to_role(const std::string& role);
//BBS: Returns true if the number was parsed correctly into out and the number spanned the whole input string.
static bool parse_double_from_str(const std::string& input, double& out) {
size_t read = 0;
try {
out = std::stod(input, &read);
return input.size() == read;
} catch (...) {
return false;
}
}
private:
EPositioningType m_global_positioning_type = EPositioningType::Absolute;
EPositioningType m_e_local_positioning_type = EPositioningType::Absolute;
std::array<double, 4> m_start_position = { 0.0, 0.0, 0.0, 0.0 };
std::array<double, 4> m_end_position = { 0.0, 0.0, 0.0, 0.0 };
std::array<double, 4> m_origin = { 0.0, 0.0, 0.0, 0.0 };
//BBS: use these value to save information from comment
ExtrusionRole m_role = erNone;
bool m_wiping = false;
int m_layer_num = 0;
double m_height = 0.0;
double m_width = 0.0;
};
}
#endif

View File

@@ -0,0 +1,24 @@
#include "GCodeChecker.h"
using namespace std;
using namespace BambuStudio;
int main(int argc, char *argv[])
{
if (argc != 2) {
cout << "Invalid input arguments" << endl;
return -1;
}
string path(argv[1]);
cout << "Start to check file " << path << endl;
GCodeChecker checker;
//BBS: parse and check whether has invalid gcode
if (checker.parse_file(path) != GCodeCheckResult::Success) {
cout << "Failed to parse and check file " << path << endl;
return -1;
}
cout << "Success to parse and check file" << path << endl;
return 0;
}

View File

@@ -1,377 +0,0 @@
#!/bin/bash
# OrcaSlicer Flatpak Build Script
# This script builds and packages OrcaSlicer as a Flatpak package locally
# Based on the GitHub Actions workflow in .github/workflows/build_all.yml
set -e
SECONDS=0
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Default values
ARCH=$(uname -m)
BUILD_DIR="build_flatpak"
CLEANUP=false
INSTALL_RUNTIME=false
JOBS=$(nproc)
FORCE_CLEAN=false
ENABLE_CCACHE=false
DISABLE_ROFILES_FUSE=false
NO_DEBUGINFO=true
CACHE_DIR=".flatpak-builder"
# Help function
show_help() {
echo "Usage: $0 [OPTIONS]"
echo ""
echo "Build OrcaSlicer as a Flatpak package"
echo ""
echo "Options:"
echo " -a, --arch ARCH Target architecture (x86_64, aarch64) [default: $ARCH]"
echo " -d, --build-dir DIR Build directory [default: $BUILD_DIR]"
echo " -j, --jobs JOBS Number of parallel build jobs for flatpak-builder and modules [default: $JOBS]"
echo " -c, --cleanup Clean build directory before building"
echo " -f, --force-clean Force clean build (disables caching)"
echo " --ccache Enable ccache for faster rebuilds (requires ccache in SDK)"
echo " --disable-rofiles-fuse Disable rofiles-fuse (workaround for FUSE issues)"
echo " --with-debuginfo Include debug info (slower builds, needed for Flathub)"
echo " --cache-dir DIR Flatpak builder cache directory [default: $CACHE_DIR]"
echo " -i, --install-runtime Install required Flatpak runtime and SDK"
echo " -h, --help Show this help message"
echo ""
echo "Examples:"
echo " $0 # Build for current architecture with caching enabled"
echo " $0 -f # Force clean build (no caching)"
echo " $0 --ccache -j 8 # Use ccache and 8 parallel jobs for faster builds"
echo " $0 -a x86_64 -c # Build for x86_64 and cleanup first"
echo " $0 -i -j 16 --ccache # Install runtime, build with 16 jobs and ccache"
}
# Parse command line arguments
while [[ $# -gt 0 ]]; do
case $1 in
-a|--arch)
ARCH="$2"
shift 2
;;
-d|--build-dir)
BUILD_DIR="$2"
shift 2
;;
-j|--jobs)
JOBS="$2"
shift 2
;;
-c|--cleanup)
CLEANUP=true
shift
;;
-f|--force-clean)
FORCE_CLEAN=true
shift
;;
--ccache)
ENABLE_CCACHE=true
shift
;;
--disable-rofiles-fuse)
DISABLE_ROFILES_FUSE=true
shift
;;
--with-debuginfo)
NO_DEBUGINFO=false
shift
;;
--cache-dir)
CACHE_DIR="$2"
shift 2
;;
-i|--install-runtime)
INSTALL_RUNTIME=true
shift
;;
-h|--help)
show_help
exit 0
;;
*)
echo -e "${RED}Error: Unknown option $1${NC}"
show_help
exit 1
;;
esac
done
# Validate architecture
if [[ "$ARCH" != "x86_64" && "$ARCH" != "aarch64" ]]; then
echo -e "${RED}Error: Unsupported architecture '$ARCH'. Supported: x86_64, aarch64${NC}"
exit 1
fi
# Validate jobs parameter
if ! [[ "$JOBS" =~ ^[1-9][0-9]*$ ]]; then
echo -e "${RED}Error: Jobs must be a positive integer, got '$JOBS'${NC}"
exit 1
fi
echo -e "${BLUE}OrcaSlicer Flatpak Build Script${NC}"
echo -e "${BLUE}================================${NC}"
echo -e "Architecture: ${GREEN}$ARCH${NC}"
echo -e "Build directory: ${GREEN}$BUILD_DIR${NC}"
echo -e "Cache directory: ${GREEN}$CACHE_DIR${NC}"
echo -e "Parallel jobs: ${GREEN}$JOBS${NC}"
if [[ "$FORCE_CLEAN" == true ]]; then
echo -e "Cache mode: ${RED}DISABLED (force clean)${NC}"
else
echo -e "Cache mode: ${GREEN}ENABLED${NC}"
fi
if [[ "$ENABLE_CCACHE" == true ]]; then
echo -e "Ccache: ${GREEN}ENABLED${NC}"
else
echo -e "Ccache: ${YELLOW}DISABLED${NC}"
fi
echo ""
# Check available disk space (flatpak builds need several GB)
AVAILABLE_SPACE=$(df . | awk 'NR==2 {print $4}')
REQUIRED_SPACE=$((5 * 1024 * 1024)) # 5GB in KB
if [[ $AVAILABLE_SPACE -lt $REQUIRED_SPACE ]]; then
echo -e "${YELLOW}Warning: Low disk space detected.${NC}"
echo -e "Available: $(( AVAILABLE_SPACE / 1024 / 1024 ))GB, Recommended: 5GB+"
echo -e "Continue anyway? (y/N)"
read -r response
if [[ ! "$response" =~ ^[Yy]$ ]]; then
echo "Build cancelled by user"
exit 1
fi
fi
# Check if flatpak is installed
if ! command -v flatpak &> /dev/null; then
echo -e "${RED}Error: Flatpak is not installed. Please install it first.${NC}"
echo "On Ubuntu/Debian: sudo apt install flatpak"
echo "On Fedora: sudo dnf install flatpak"
echo "On Arch: sudo pacman -S flatpak"
exit 1
fi
# Check if flatpak-builder is installed
if ! command -v flatpak-builder &> /dev/null; then
echo -e "${RED}Error: flatpak-builder is not installed. Please install it first.${NC}"
echo "On Ubuntu/Debian: sudo apt install flatpak-builder"
echo "On Fedora: sudo dnf install flatpak-builder"
echo "On Arch: sudo pacman -S flatpak-builder"
exit 1
fi
# Check additional build dependencies
echo -e "${YELLOW}Checking build dependencies...${NC}"
MISSING_DEPS=()
if ! command -v cmake &> /dev/null; then
MISSING_DEPS+=("cmake")
fi
if ! command -v ninja &> /dev/null && ! command -v make &> /dev/null; then
MISSING_DEPS+=("ninja or make")
fi
if ! command -v pkg-config &> /dev/null; then
MISSING_DEPS+=("pkg-config")
fi
if [ ${#MISSING_DEPS[@]} -ne 0 ]; then
echo -e "${RED}Error: Missing required build dependencies: ${MISSING_DEPS[*]}${NC}"
echo "On Ubuntu/Debian: sudo apt install cmake ninja-build pkg-config"
echo "On Fedora: sudo dnf install cmake ninja-build pkgconfig"
exit 1
fi
echo -e "${GREEN}All required dependencies found${NC}"
# Install runtime and SDK if requested
if [[ "$INSTALL_RUNTIME" == true ]]; then
echo -e "${YELLOW}Installing GNOME runtime and SDK...${NC}"
flatpak install --user -y flathub org.gnome.Platform//49
flatpak install --user -y flathub org.gnome.Sdk//49
fi
# Check if required runtime is available
if ! flatpak info --user org.gnome.Platform//49 &> /dev/null; then
echo -e "${RED}Error: GNOME Platform 49 runtime is not installed.${NC}"
echo "Run with -i flag to install it automatically, or install manually:"
echo "flatpak install --user flathub org.gnome.Platform//49"
exit 1
fi
if ! flatpak info --user org.gnome.Sdk//49 &> /dev/null; then
echo -e "${RED}Error: GNOME SDK 49 is not installed.${NC}"
echo "Run with -i flag to install it automatically, or install manually:"
echo "flatpak install --user flathub org.gnome.Sdk//49"
exit 1
fi
# Get version information
echo -e "${YELLOW}Getting version information...${NC}"
if [[ -f "version.inc" ]]; then
VER_PURE=$(grep 'set(SoftFever_VERSION' version.inc | cut -d '"' -f2)
VER="V$VER_PURE"
DATE=$(date +'%Y%m%d')
echo -e "Version: ${GREEN}$VER${NC}"
echo -e "Date: ${GREEN}$DATE${NC}"
else
echo -e "${RED}Error: version.inc not found${NC}"
exit 1
fi
# Cleanup build directory if requested
if [[ "$CLEANUP" == true ]]; then
echo -e "${YELLOW}Cleaning up flatpak-specific build directories...${NC}"
rm -rf deps/build_flatpak build_flatpak
echo -e "${YELLOW}Cleaning up flatpak build directories...${NC}"
rm -rf "$BUILD_DIR"
# Only clean cache if force-clean is enabled
if [[ "$FORCE_CLEAN" == true ]]; then
echo -e "${YELLOW}Cleaning up flatpak build cache...${NC}"
rm -rf "$CACHE_DIR"
else
echo -e "${BLUE}Preserving build cache at: $CACHE_DIR${NC}"
fi
echo -e "${BLUE}Note: Host build directories (deps/build, build) are preserved${NC}"
fi
# Create build directory
mkdir -p "$BUILD_DIR"
rm -rf "$BUILD_DIR/build-dir"
# Check if flatpak manifest exists
if [[ ! -f "./scripts/flatpak/com.orcaslicer.OrcaSlicer.yml" ]]; then
echo -e "${RED}Error: Flatpak manifest not found at scripts/flatpak/com.orcaslicer.OrcaSlicer.yml${NC}"
exit 1
fi
# Build the Flatpak
echo -e "${YELLOW}Building Flatpak package...${NC}"
echo -e "This may take a while (30+ minutes depending on your system)..."
echo ""
BUNDLE_NAME="OrcaSlicer-Linux-flatpak_${VER}_${ARCH}.flatpak"
# Remove any existing bundle
rm -f "$BUNDLE_NAME"
# Create necessary directories inside repo
mkdir -p "$BUILD_DIR/cache" "$BUILD_DIR/flatpak-builder"
# Set environment variables to match GitHub Actions
export FLATPAK_BUILDER_N_JOBS=$JOBS
echo -e "${BLUE}Running flatpak-builder...${NC}"
echo -e "Using $JOBS parallel jobs for flatpak-builder and $FLATPAK_BUILDER_N_JOBS for module builds"
# Check flatpak-builder version to determine available options
FLATPAK_BUILDER_VERSION=$(flatpak-builder --version 2>/dev/null | head -1 | awk '{print $2}' || echo "unknown")
echo -e "flatpak-builder version: $FLATPAK_BUILDER_VERSION"
# Build command with caching support
BUILDER_ARGS=(
--arch="$ARCH"
--user
--install-deps-from=flathub
--repo="$BUILD_DIR/repo"
--verbose
--state-dir="$CACHE_DIR"
--jobs="$JOBS"
--mirror-screenshots-url=https://dl.flathub.org/media/
)
# Add force-clean only if explicitly requested (disables caching)
if [[ "$FORCE_CLEAN" == true ]]; then
BUILDER_ARGS+=(--force-clean)
echo -e "${YELLOW}Using --force-clean (caching disabled)${NC}"
else
echo -e "${GREEN}Using build cache for faster rebuilds${NC}"
fi
# Add ccache if enabled
if [[ "$ENABLE_CCACHE" == true ]]; then
BUILDER_ARGS+=(--ccache)
echo -e "${GREEN}Using ccache for compiler caching${NC}"
fi
# Disable rofiles-fuse if requested (workaround for FUSE issues)
if [[ "$DISABLE_ROFILES_FUSE" == true ]]; then
BUILDER_ARGS+=(--disable-rofiles-fuse)
echo -e "${YELLOW}rofiles-fuse disabled${NC}"
fi
# Use a temp manifest with no-debuginfo if requested
MANIFEST="scripts/flatpak/com.orcaslicer.OrcaSlicer.yml"
if [[ "$NO_DEBUGINFO" == true ]]; then
MANIFEST="scripts/flatpak/com.orcaslicer.OrcaSlicer.no-debug.yml"
sed '/^build-options:/a\ no-debuginfo: true\n strip: true' \
scripts/flatpak/com.orcaslicer.OrcaSlicer.yml > "$MANIFEST"
echo -e "${YELLOW}Debug info disabled (using temp manifest)${NC}"
fi
if ! flatpak-builder \
"${BUILDER_ARGS[@]}" \
"$BUILD_DIR/build-dir" \
"$MANIFEST"; then
echo -e "${RED}Error: flatpak-builder failed${NC}"
echo -e "${YELLOW}Check the build log above for details${NC}"
rm -f "scripts/flatpak/com.orcaslicer.OrcaSlicer.no-debug.yml"
exit 1
fi
# Clean up temp manifest
rm -f "scripts/flatpak/com.orcaslicer.OrcaSlicer.no-debug.yml"
# Create bundle
echo -e "${YELLOW}Creating Flatpak bundle...${NC}"
if ! flatpak build-bundle \
"$BUILD_DIR/repo" \
"$BUNDLE_NAME" \
com.orcaslicer.OrcaSlicer \
--arch="$ARCH"; then
echo -e "${RED}Error: Failed to create Flatpak bundle${NC}"
exit 1
fi
# Success message
echo ""
echo -e "${GREEN}✓ Flatpak build completed successfully!${NC}"
echo -e "Bundle created: ${GREEN}$BUNDLE_NAME${NC}"
echo -e "Size: ${GREEN}$(du -h "$BUNDLE_NAME" | cut -f1)${NC}"
if [[ "$FORCE_CLEAN" != true ]]; then
echo -e "Build cache: ${GREEN}$CACHE_DIR${NC} (preserved for faster future builds)"
fi
echo ""
echo -e "${BLUE}To install the Flatpak:${NC}"
echo -e "flatpak install --user $BUNDLE_NAME"
echo ""
echo -e "${BLUE}To run OrcaSlicer:${NC}"
echo -e "flatpak run com.orcaslicer.OrcaSlicer"
echo ""
echo -e "${BLUE}To uninstall:${NC}"
echo -e "flatpak uninstall --user com.orcaslicer.OrcaSlicer"
echo ""
if [[ "$FORCE_CLEAN" != true ]]; then
echo -e "${BLUE}Cache Management:${NC}"
echo -e "• Subsequent builds will be faster thanks to caching"
echo -e "• To force a clean build: $0 -f"
echo -e "• To clean cache manually: rm -rf $CACHE_DIR"
fi
elapsed=$SECONDS
printf "\nBuild completed in %dh %dm %ds\n" $((elapsed/3600)) $((elapsed%3600/60)) $((elapsed%60))

View File

@@ -1,275 +0,0 @@
#!/usr/bin/env bash
set -e # Exit immediately if a command exits with a non-zero status.
SECONDS=0
SCRIPT_NAME=$(basename "$0")
SCRIPT_PATH=$(dirname "$(readlink -f "${0}")")
pushd "${SCRIPT_PATH}" > /dev/null
function usage() {
echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-D][-e][-h][-i][-j N][-p][-r][-s][-t][-u][-l][-L]"
echo " -1: limit builds to one core (where possible)"
echo " -j N: limit builds to N cores (where possible)"
echo " -b: build in Debug mode"
echo " -c: force a clean build"
echo " -C: enable ANSI-colored compile output (GNU/Clang only)"
echo " -d: download and build dependencies in ./deps/ (build prerequisite)"
echo " -D: dry run"
echo " -e: build in RelWithDebInfo mode"
echo " -h: prints this help text"
echo " -i: build the Orca Slicer AppImage (optional)"
echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)"
echo " -r: skip RAM and disk checks (low RAM compiling)"
echo " -s: build the Orca Slicer (optional)"
echo " -t: build tests (optional), requires -s flag"
echo " -u: install system dependencies (asks for sudo password; build prerequisite)"
echo " -l: use Clang instead of GCC (default: GCC)"
echo " -L: use ld.lld as linker (if available)"
echo "For a first use, you want to './${SCRIPT_NAME} -u'"
echo " and then './${SCRIPT_NAME} -dsi'"
}
SLIC3R_PRECOMPILED_HEADERS="ON"
unset name
BUILD_DIR=build
BUILD_CONFIG=Release
while getopts ":1j:bcCdDehiprstulL" opt ; do
case ${opt} in
1 )
export CMAKE_BUILD_PARALLEL_LEVEL=1
;;
j )
export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG
;;
b )
BUILD_DIR=build-dbg
BUILD_CONFIG=Debug
;;
c )
CLEAN_BUILD=1
;;
C )
COLORED_OUTPUT="-DCOLORED_OUTPUT=ON"
;;
d )
BUILD_DEPS="1"
;;
D )
DRY_RUN="1"
;;
e )
BUILD_DIR=build-dbginfo
BUILD_CONFIG=RelWithDebInfo
;;
h ) usage
exit 1
;;
i )
BUILD_IMAGE="1"
;;
p )
SLIC3R_PRECOMPILED_HEADERS="OFF"
;;
r )
SKIP_RAM_CHECK="1"
;;
s )
BUILD_ORCA="1"
;;
t )
BUILD_TESTS="1"
;;
u )
export UPDATE_LIB="1"
;;
l )
USE_CLANG="1"
;;
L )
USE_LLD="1"
;;
* )
echo "Unknown argument '${opt}', aborting."
exit 1
;;
esac
done
if [ ${OPTIND} -eq 1 ] ; then
usage
exit 1
fi
function check_available_memory_and_disk() {
FREE_MEM_GB=$(free --gibi --total | grep 'Mem' | rev | cut --delimiter=" " --fields=1 | rev)
MIN_MEM_GB=10
FREE_DISK_KB=$(df --block-size=1K . | tail -1 | awk '{print $4}')
MIN_DISK_KB=$((10 * 1024 * 1024))
if [[ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]] ; then
echo -e "\nERROR: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (system has only ${FREE_MEM_GB}G available)"
echo && free --human && echo
echo "Invoke with -r to skip RAM and disk checks."
exit 2
fi
if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]] ; then
echo -e "\nERROR: Orca Slicer Builder requires at least $(echo "${MIN_DISK_KB}" |awk '{ printf "%.1fG\n", $1/1024/1024; }') (system has only $(echo "${FREE_DISK_KB}" | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
echo && df --human-readable . && echo
echo "Invoke with -r to skip ram and disk checks."
exit 1
fi
}
function print_and_run() {
cmd=()
# Remove empty arguments, leading and trailing spaces
for item in "$@" ; do
if [[ -n $item ]]; then
cmd+=( "$(echo "${item}" | xargs)" )
fi
done
echo "${cmd[@]}"
if [[ -z "${DRY_RUN}" ]] ; then
"${cmd[@]}"
fi
}
# cmake 4.x compatibility workaround
export CMAKE_POLICY_VERSION_MINIMUM=3.5
DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '"')
DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"')
# Check for direct distribution match to Ubuntu/Debian
if [ "${DISTRIBUTION}" == "ubuntu" ] || [ "${DISTRIBUTION}" == "linuxmint" ] ; then
DISTRIBUTION="debian"
# Check if distribution is Debian/Ubuntu-like based on ID_LIKE
elif [[ "${DISTRIBUTION_LIKE}" == *"debian"* ]] || [[ "${DISTRIBUTION_LIKE}" == *"ubuntu"* ]] ; then
DISTRIBUTION="debian"
elif [[ "${DISTRIBUTION_LIKE}" == *"arch"* ]] ; then
DISTRIBUTION="arch"
elif [[ "${DISTRIBUTION_LIKE}" == *"suse"* ]] ; then
DISTRIBUTION="suse"
fi
if [ ! -f "./scripts/linux.d/${DISTRIBUTION}" ] ; then
echo "Your distribution \"${DISTRIBUTION}\" is not supported by system-dependency scripts in ./scripts/linux.d/"
echo "Please resolve dependencies manually and contribute a script for your distribution to upstream."
exit 1
else
echo "resolving system dependencies for distribution \"${DISTRIBUTION}\" ..."
# shellcheck source=/dev/null
source "./scripts/linux.d/${DISTRIBUTION}"
fi
echo "FOUND_GTK3_DEV=${FOUND_GTK3_DEV}"
if [[ -z "${FOUND_GTK3_DEV}" ]] ; then
echo "Error, you must install the dependencies before."
echo "Use option -u with sudo"
exit 1
fi
echo "Changing date in version..."
{
# change date in version
sed --in-place "s/+UNKNOWN/_$(date '+%F')/" version.inc
}
echo "done"
if [[ -z "${SKIP_RAM_CHECK}" ]] ; then
check_available_memory_and_disk
fi
export CMAKE_C_CXX_COMPILER_CLANG=()
if [[ -n "${USE_CLANG}" ]] ; then
export CMAKE_C_CXX_COMPILER_CLANG=(-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++)
fi
# Configure use of ld.lld as the linker when requested
export CMAKE_LLD_LINKER_ARGS=()
if [[ -n "${USE_LLD}" ]] ; then
if command -v ld.lld >/dev/null 2>&1 ; then
LLD_BIN=$(command -v ld.lld)
export CMAKE_LLD_LINKER_ARGS=(-DCMAKE_LINKER="${LLD_BIN}" -DCMAKE_EXE_LINKER_FLAGS=-fuse-ld=lld -DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld -DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=lld)
else
echo "Error: ld.lld not found. Please install the 'lld' package (e.g., sudo apt install lld) or omit -L."
exit 1
fi
fi
if [[ -n "${BUILD_DEPS}" ]] ; then
echo "Configuring dependencies..."
read -r -a BUILD_ARGS <<< "${DEPS_EXTRA_BUILD_ARGS}"
if [[ -n "${CLEAN_BUILD}" ]]
then
print_and_run rm -fr deps/$BUILD_DIR
fi
mkdir -p deps/$BUILD_DIR
if [[ $BUILD_CONFIG != Release ]] ; then
BUILD_ARGS+=(-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}")
fi
print_and_run cmake -S deps -B deps/$BUILD_DIR "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G Ninja "${COLORED_OUTPUT}" "${BUILD_ARGS[@]}"
print_and_run cmake --build deps/$BUILD_DIR
fi
if [[ -n "${BUILD_ORCA}" ]] || [[ -n "${BUILD_TESTS}" ]] ; then
echo "Configuring OrcaSlicer..."
if [[ -n "${CLEAN_BUILD}" ]] ; then
print_and_run rm -fr $BUILD_DIR
fi
read -r -a BUILD_ARGS <<< "${ORCA_EXTRA_BUILD_ARGS}"
if [[ $BUILD_CONFIG != Release ]] ; then
BUILD_ARGS+=(-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}")
fi
if [[ -n "${BUILD_TESTS}" ]] ; then
BUILD_ARGS+=(-DBUILD_TESTS=ON)
fi
if [[ -n "${ORCA_UPDATER_SIG_KEY}" ]] ; then
BUILD_ARGS+=(-DORCA_UPDATER_SIG_KEY="${ORCA_UPDATER_SIG_KEY}")
fi
print_and_run cmake -S . -B $BUILD_DIR "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G "Ninja Multi-Config" \
-DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} \
-DORCA_TOOLS=ON \
"${COLORED_OUTPUT}" \
"${BUILD_ARGS[@]}"
echo "done"
if [[ -n "${BUILD_ORCA}" ]]; then
echo "Building OrcaSlicer ..."
print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer
echo "Building OrcaSlicer_profile_validator .."
print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer_profile_validator
./scripts/run_gettext.sh
fi
if [[ -n "${BUILD_TESTS}" ]] ; then
echo "Building tests ..."
print_and_run cmake --build ${BUILD_DIR} --config "${BUILD_CONFIG}" --target tests/all
fi
echo "done"
fi
if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then
pushd $BUILD_DIR > /dev/null
build_linux_image="./src/build_linux_image.sh"
if [[ -e ${build_linux_image} ]] ; then
extra_script_args=""
if [[ -n "${BUILD_IMAGE}" ]] ; then
extra_script_args="-i"
fi
print_and_run ${build_linux_image} ${extra_script_args} -R "${BUILD_CONFIG}"
echo "done"
fi
popd > /dev/null # build
fi
elapsed=$SECONDS
printf "\nBuild completed in %dh %dm %ds\n" $((elapsed/3600)) $((elapsed%3600/60)) $((elapsed%60))
popd > /dev/null # ${SCRIPT_PATH}

View File

@@ -1,52 +1,14 @@
set WP=%CD%
set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%
cd deps
mkdir %build_dir%
cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
mkdir build
cd build
set DEPS=%CD%/BambuStudio_dep
cmake ../ -G "Visual Studio 16 2019" -DDESTDIR="%CD%/BambuStudio_dep" -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release --target ALL_BUILD -- -m
echo cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type% %SIG_FLAG%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
mkdir build
cd build
cmake .. -G "Visual Studio 16 2019" -DBBL_RELEASE_TO_PUBLIC=0 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./BambuStudio-SoftFever" -DCMAKE_BUILD_TYPE=Release -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0"
cmake --build . --config Release --target ALL_BUILD -- -m
cmake --build . --target install --config Release

View File

@@ -1,348 +0,0 @@
#!/bin/bash
set -e
set -o pipefail
SECONDS=0
while getopts ":dpa:snt:xbc:i:1Tuh" opt; do
case "${opt}" in
d )
export BUILD_TARGET="deps"
;;
p )
export PACK_DEPS="1"
;;
a )
export ARCH="$OPTARG"
;;
s )
export BUILD_TARGET="slicer"
;;
n )
export NIGHTLY_BUILD="1"
;;
t )
export OSX_DEPLOYMENT_TARGET="$OPTARG"
;;
x )
export SLICER_CMAKE_GENERATOR="Ninja Multi-Config"
export SLICER_BUILD_TARGET="all"
export DEPS_CMAKE_GENERATOR="Ninja"
;;
b )
export BUILD_ONLY="1"
;;
c )
export BUILD_CONFIG="$OPTARG"
;;
i )
export CMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH:+$CMAKE_IGNORE_PREFIX_PATH;}$OPTARG"
;;
1 )
export CMAKE_BUILD_PARALLEL_LEVEL=1
;;
T )
export BUILD_TESTS="1"
;;
u )
export BUILD_TARGET="universal"
;;
h ) echo "Usage: ./build_release_macos.sh [-d]"
echo " -d: Build deps only"
echo " -a: Set ARCHITECTURE (arm64 or x86_64 or universal)"
echo " -s: Build slicer only"
echo " -u: Build universal app only (requires existing arm64 and x86_64 app bundles)"
echo " -n: Nightly build"
echo " -t: Specify minimum version of the target platform, default is 11.3"
echo " -x: Use Ninja Multi-Config CMake generator, default is Xcode"
echo " -b: Build without reconfiguring CMake"
echo " -c: Set CMake build configuration, default is Release"
echo " -i: Add a prefix to ignore during CMake dependency discovery (repeatable), defaults to /opt/local:/usr/local:/opt/homebrew"
echo " -1: Use single job for building"
echo " -T: Build and run tests"
exit 0
;;
* )
;;
esac
done
# Set defaults
if [ -z "$ARCH" ]; then
ARCH="$(uname -m)"
export ARCH
fi
if [ -z "$BUILD_CONFIG" ]; then
export BUILD_CONFIG="Release"
fi
if [ -z "$BUILD_TARGET" ]; then
export BUILD_TARGET="all"
fi
if [ -z "$SLICER_CMAKE_GENERATOR" ]; then
export SLICER_CMAKE_GENERATOR="Xcode"
fi
if [ -z "$SLICER_BUILD_TARGET" ]; then
export SLICER_BUILD_TARGET="ALL_BUILD"
fi
if [ -z "$DEPS_CMAKE_GENERATOR" ]; then
export DEPS_CMAKE_GENERATOR="Unix Makefiles"
fi
if [ -z "$OSX_DEPLOYMENT_TARGET" ]; then
export OSX_DEPLOYMENT_TARGET="11.3"
fi
if [ -z "$CMAKE_IGNORE_PREFIX_PATH" ]; then
export CMAKE_IGNORE_PREFIX_PATH="/opt/local:/usr/local:/opt/homebrew"
fi
CMAKE_VERSION=$(cmake --version | head -1 | sed 's/[^0-9]*\([0-9]*\).*/\1/')
if [ "$CMAKE_VERSION" -ge 4 ] 2>/dev/null; then
export CMAKE_POLICY_VERSION_MINIMUM=3.5
export CMAKE_POLICY_COMPAT="-DCMAKE_POLICY_VERSION_MINIMUM=3.5"
echo "Detected CMake 4.x, adding compatibility flag (env + cmake arg)"
else
export CMAKE_POLICY_COMPAT=""
fi
echo "Build params:"
echo " - ARCH: $ARCH"
echo " - BUILD_CONFIG: $BUILD_CONFIG"
echo " - BUILD_TARGET: $BUILD_TARGET"
echo " - CMAKE_GENERATOR: $SLICER_CMAKE_GENERATOR for Slicer, $DEPS_CMAKE_GENERATOR for deps"
echo " - OSX_DEPLOYMENT_TARGET: $OSX_DEPLOYMENT_TARGET"
echo " - CMAKE_IGNORE_PREFIX_PATH: $CMAKE_IGNORE_PREFIX_PATH"
echo
# if which -s brew; then
# brew --prefix libiconv
# brew --prefix zstd
# export LIBRARY_PATH=$LIBRARY_PATH:$(brew --prefix zstd)/lib/
# elif which -s port; then
# port install libiconv
# port install zstd
# export LIBRARY_PATH=$LIBRARY_PATH:/opt/local/lib
# else
# echo "Need either brew or macports to successfully build deps"
# exit 1
# fi
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_BUILD_DIR="$PROJECT_DIR/build/$ARCH"
DEPS_DIR="$PROJECT_DIR/deps"
# For Multi-config generators like Ninja and Xcode
export BUILD_DIR_CONFIG_SUBDIR="/$BUILD_CONFIG"
function build_deps() {
# iterate over two architectures: x86_64 and arm64
for _ARCH in x86_64 arm64; do
# if ARCH is universal or equal to _ARCH
if [ "$ARCH" == "universal" ] || [ "$ARCH" == "$_ARCH" ]; then
PROJECT_BUILD_DIR="$PROJECT_DIR/build/$_ARCH"
DEPS_BUILD_DIR="$DEPS_DIR/build/$_ARCH"
DEPS="$DEPS_BUILD_DIR/OrcaSlicer_dep"
echo "Building deps..."
(
set -x
mkdir -p "$DEPS"
cd "$DEPS_BUILD_DIR"
if [ "1." != "$BUILD_ONLY". ]; then
cmake "${DEPS_DIR}" \
-G "${DEPS_CMAKE_GENERATOR}" \
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
-DCMAKE_OSX_ARCHITECTURES:STRING="${_ARCH}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
-DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \
${CMAKE_POLICY_COMPAT}
fi
cmake --build . --config "$BUILD_CONFIG" --target deps
)
fi
done
}
function pack_deps() {
echo "Packing deps..."
(
set -x
cd "$DEPS_DIR"
tar -zcvf "OrcaSlicer_dep_mac_${ARCH}_$(date +"%Y%m%d").tar.gz" "build"
)
}
function build_slicer() {
# iterate over two architectures: x86_64 and arm64
for _ARCH in x86_64 arm64; do
# if ARCH is universal or equal to _ARCH
if [ "$ARCH" == "universal" ] || [ "$ARCH" == "$_ARCH" ]; then
PROJECT_BUILD_DIR="$PROJECT_DIR/build/$_ARCH"
DEPS_BUILD_DIR="$DEPS_DIR/build/$_ARCH"
DEPS="$DEPS_BUILD_DIR/OrcaSlicer_dep"
echo "Building slicer for $_ARCH..."
(
set -x
mkdir -p "$PROJECT_BUILD_DIR"
cd "$PROJECT_BUILD_DIR"
if [ "1." != "$BUILD_ONLY". ]; then
cmake "${PROJECT_DIR}" \
-G "${SLICER_CMAKE_GENERATOR}" \
-DORCA_TOOLS=ON \
${ORCA_UPDATER_SIG_KEY:+-DORCA_UPDATER_SIG_KEY="$ORCA_UPDATER_SIG_KEY"} \
${BUILD_TESTS:+-DBUILD_TESTS=ON} \
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
-DCMAKE_OSX_ARCHITECTURES="${_ARCH}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
-DCMAKE_IGNORE_PREFIX_PATH="${CMAKE_IGNORE_PREFIX_PATH}" \
${CMAKE_POLICY_COMPAT}
fi
cmake --build . --config "$BUILD_CONFIG" --target "$SLICER_BUILD_TARGET"
)
if [ "1." == "$BUILD_TESTS". ]; then
echo "Running tests for $_ARCH..."
(
set -x
cd "$PROJECT_BUILD_DIR"
ctest --build-config "$BUILD_CONFIG" --output-on-failure
)
fi
echo "Verify localization with gettext..."
(
cd "$PROJECT_DIR"
./scripts/run_gettext.sh
)
echo "Fix macOS app package..."
(
cd "$PROJECT_BUILD_DIR"
mkdir -p OrcaSlicer
cd OrcaSlicer
# remove previously built app
rm -rf ./OrcaSlicer.app
# fully copy newly built app
cp -pR "../src$BUILD_DIR_CONFIG_SUBDIR/OrcaSlicer.app" ./OrcaSlicer.app
# fix resources
resources_path=$(readlink ./OrcaSlicer.app/Contents/Resources)
rm ./OrcaSlicer.app/Contents/Resources
cp -R "$resources_path" ./OrcaSlicer.app/Contents/Resources
# delete .DS_Store file
find ./OrcaSlicer.app/ -name '.DS_Store' -delete
# Copy OrcaSlicer_profile_validator.app if it exists
if [ -f "../src$BUILD_DIR_CONFIG_SUBDIR/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
echo "Copying OrcaSlicer_profile_validator.app..."
rm -rf ./OrcaSlicer_profile_validator.app
cp -pR "../src$BUILD_DIR_CONFIG_SUBDIR/OrcaSlicer_profile_validator.app" ./OrcaSlicer_profile_validator.app
# delete .DS_Store file
find ./OrcaSlicer_profile_validator.app/ -name '.DS_Store' -delete
fi
)
# extract version
# export ver=$(grep '^#define SoftFever_VERSION' ../src/libslic3r/libslic3r_version.h | cut -d ' ' -f3)
# ver="_V${ver//\"}"
# echo $PWD
# if [ "1." != "$NIGHTLY_BUILD". ];
# then
# ver=${ver}_dev
# fi
# zip -FSr OrcaSlicer${ver}_Mac_${_ARCH}.zip OrcaSlicer.app
fi
done
}
function lipo_dir() {
local universal_dir="$1"
local x86_64_dir="$2"
# Find all Mach-O files in the universal (arm64-based) copy and lipo them
while IFS= read -r -d '' f; do
local rel="${f#"$universal_dir"/}"
local x86="$x86_64_dir/$rel"
if [ -f "$x86" ]; then
echo " lipo: $rel"
lipo -create "$f" "$x86" -output "$f.tmp"
mv "$f.tmp" "$f"
else
echo " warning: no x86_64 counterpart for $rel, keeping arm64 only"
fi
done < <(find "$universal_dir" -type f -print0 | while IFS= read -r -d '' candidate; do
if file "$candidate" | grep -q "Mach-O"; then
printf '%s\0' "$candidate"
fi
done)
}
function build_universal() {
echo "Building universal binary..."
PROJECT_BUILD_DIR="$PROJECT_DIR/build/$ARCH"
ARM64_APP="$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer.app"
X86_64_APP="$PROJECT_DIR/build/x86_64/OrcaSlicer/OrcaSlicer.app"
mkdir -p "$PROJECT_BUILD_DIR/OrcaSlicer"
UNIVERSAL_APP="$PROJECT_BUILD_DIR/OrcaSlicer/OrcaSlicer.app"
rm -rf "$UNIVERSAL_APP"
cp -R "$ARM64_APP" "$UNIVERSAL_APP"
echo "Creating universal binaries for OrcaSlicer.app..."
lipo_dir "$UNIVERSAL_APP" "$X86_64_APP"
echo "Universal OrcaSlicer.app created at $UNIVERSAL_APP"
# Create universal binary for profile validator if it exists
ARM64_VALIDATOR="$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app"
X86_64_VALIDATOR="$PROJECT_DIR/build/x86_64/OrcaSlicer/OrcaSlicer_profile_validator.app"
if [ -d "$ARM64_VALIDATOR" ] && [ -d "$X86_64_VALIDATOR" ]; then
echo "Creating universal binaries for OrcaSlicer_profile_validator.app..."
UNIVERSAL_VALIDATOR_APP="$PROJECT_BUILD_DIR/OrcaSlicer/OrcaSlicer_profile_validator.app"
rm -rf "$UNIVERSAL_VALIDATOR_APP"
cp -R "$ARM64_VALIDATOR" "$UNIVERSAL_VALIDATOR_APP"
lipo_dir "$UNIVERSAL_VALIDATOR_APP" "$X86_64_VALIDATOR"
echo "Universal OrcaSlicer_profile_validator.app created at $UNIVERSAL_VALIDATOR_APP"
fi
}
case "${BUILD_TARGET}" in
all)
build_deps
build_slicer
;;
deps)
build_deps
;;
slicer)
build_slicer
;;
universal)
build_universal
;;
*)
echo "Unknown target: $BUILD_TARGET. Available targets: deps, slicer, universal, all."
exit 1
;;
esac
if [ "$ARCH" = "universal" ] && { [ "$BUILD_TARGET" = "all" ] || [ "$BUILD_TARGET" = "slicer" ]; }; then
build_universal
fi
if [ "1." == "$PACK_DEPS". ]; then
pack_deps
fi
elapsed=$SECONDS
printf "\nBuild completed in %dh %dm %ds\n" $((elapsed/3600)) $((elapsed%3600/60)) $((elapsed%60))

View File

@@ -1,158 +0,0 @@
@REM OrcaSlicer build script for Windows with VS auto-detect
@echo off
set WP=%CD%
set _START_TIME=%TIME%
@REM Check for Ninja Multi-Config option (-x)
set USE_NINJA=0
for %%a in (%*) do (
if "%%a"=="-x" set USE_NINJA=1
)
if "%USE_NINJA%"=="1" (
echo Using Ninja Multi-Config generator
set CMAKE_GENERATOR="Ninja Multi-Config"
set VS_VERSION=Ninja
goto :generator_ready
)
@REM Detect Visual Studio version using msbuild
echo Detecting Visual Studio version using msbuild...
@REM Try to get MSBuild version - the output format varies by VS version
set VS_MAJOR=
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
@REM Alternative method for newer MSBuild versions
if "%VS_MAJOR%"=="" (
for /f "tokens=*" %%i in ('msbuild -version 2^>^&1 ^| findstr /r "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*"') do (
for /f "tokens=1 delims=." %%a in ("%%i") do set VS_MAJOR=%%a
set MSBUILD_OUTPUT=%%i
goto :version_found
)
)
:version_found
echo MSBuild version detected: %MSBUILD_OUTPUT%
echo Major version: %VS_MAJOR%
if "%VS_MAJOR%"=="" (
echo Error: Could not determine Visual Studio version from msbuild
echo Please ensure Visual Studio and MSBuild are properly installed
exit /b 1
)
if "%VS_MAJOR%"=="16" (
set VS_VERSION=2019
set CMAKE_GENERATOR="Visual Studio 16 2019"
) else if "%VS_MAJOR%"=="17" (
set VS_VERSION=2022
set CMAKE_GENERATOR="Visual Studio 17 2022"
) else if "%VS_MAJOR%"=="18" (
set VS_VERSION=2026
set CMAKE_GENERATOR="Visual Studio 18 2026"
) else (
echo Error: Unsupported Visual Studio version: %VS_MAJOR%
echo Supported versions: VS2019 (16.x^), VS2022 (17.x^), VS2026 (18.x^)
exit /b 1
)
echo Detected Visual Studio %VS_VERSION% (version %VS_MAJOR%)
echo Using CMake generator: %CMAKE_GENERATOR%
:generator_ready
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs!VS_VERSION!.zip OrcaSlicer_dep
goto :done
)
set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%
setlocal DISABLEDELAYEDEXPANSION
cd deps
mkdir %build_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake ../ -G %CMAKE_GENERATOR% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps
) else (
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
)
@echo off
if "%1"=="deps" goto :done
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
if "%USE_NINJA%"=="1" (
cmake .. -G %CMAKE_GENERATOR% -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD
) else (
cmake .. -G %CMAKE_GENERATOR% -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
)
@echo off
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%
:done
@echo off
for /f "tokens=1-3 delims=:.," %%a in ("%_START_TIME: =0%") do set /a "_start_s=%%a*3600+%%b*60+%%c"
for /f "tokens=1-3 delims=:.," %%a in ("%TIME: =0%") do set /a "_end_s=%%a*3600+%%b*60+%%c"
set /a "_elapsed=_end_s - _start_s"
if %_elapsed% lss 0 set /a "_elapsed+=86400"
set /a "_hours=_elapsed / 3600"
set /a "_remainder=_elapsed - _hours * 3600"
set /a "_mins=_remainder / 60"
set /a "_secs=_remainder - _mins * 60"
echo.
echo Build completed in %_hours%h %_mins%m %_secs%s

View File

@@ -1,71 +0,0 @@
@REM OrcaSlicer build script for Windows
@echo off
set WP=%CD%
@REM Pack deps
if "%1"=="pack" (
setlocal ENABLEDELAYEDEXPANSION
cd %WP%/deps/build
for /f "tokens=2-4 delims=/ " %%a in ('date /t') do set build_date=%%c%%b%%a
echo packing deps: OrcaSlicer_dep_win64_!build_date!_vs2022.zip
%WP%/tools/7z.exe a OrcaSlicer_dep_win64_!build_date!_vs2022.zip OrcaSlicer_dep
exit /b 0
)
set debug=OFF
set debuginfo=OFF
if "%1"=="debug" set debug=ON
if "%2"=="debug" set debug=ON
if "%1"=="debuginfo" set debuginfo=ON
if "%2"=="debuginfo" set debuginfo=ON
if "%debug%"=="ON" (
set build_type=Debug
set build_dir=build-dbg
) else (
if "%debuginfo%"=="ON" (
set build_type=RelWithDebInfo
set build_dir=build-dbginfo
) else (
set build_type=Release
set build_dir=build
)
)
echo build type set to %build_type%
setlocal DISABLEDELAYEDEXPANSION
cd deps
mkdir %build_dir%
cd %build_dir%
set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
if "%1"=="slicer" (
GOTO :slicer
)
echo "building deps.."
echo on
REM Set minimum CMake policy to avoid <3.5 errors
set CMAKE_POLICY_VERSION_MINIMUM=3.5
cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m
@echo off
if "%1"=="deps" exit /b 0
:slicer
echo "building Orca Slicer..."
cd %WP%
mkdir %build_dir%
cd %build_dir%
echo on
set CMAKE_POLICY_VERSION_MINIMUM=3.5
cmake .. -G "Visual Studio 17 2022" -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m
@echo off
cd ..
call scripts/run_gettext.bat
cd %build_dir%
cmake --build . --target install --config %build_type%

495
build_win.bat Normal file
View File

@@ -0,0 +1,495 @@
@setlocal disableDelayedExpansion enableExtensions
@IF "%PS_ECHO_ON%" NEQ "" (echo on) ELSE (echo off)
@GOTO :MAIN
:HELP
@ECHO.
@ECHO Performs initial build or rebuild of the app (build) and deps (build/deps).
@ECHO Default options are determined from build directories and system state.
@ECHO.
@ECHO Usage: build_win [-ARCH ^<arch^>] [-CONFIG ^<config^>] [-VERSION ^<version^>]
@ECHO [-PRODUCT ^<product^>] [-DESTDIR ^<directory^>]
@ECHO [-STEPS ^<all^|all-dirty^|app^|app-dirty^|deps^|deps-dirty^>]
@ECHO [-RUN ^<console^|custom^|none^|viewer^|window^>]
@ECHO.
@ECHO -a -ARCH Target processor architecture
@ECHO Default: %PS_ARCH_HOST%
@ECHO -c -CONFIG MSVC project config
@ECHO Default: %PS_CONFIG_DEFAULT%
@ECHO -v -VERSION Major version number of MSVC installation to use for build
@ECHO Default: %PS_VERSION_SUPPORTED%
@ECHO -p -PRODUCT Product ID of MSVC installation to use for build
@ECHO Default: %PS_PRODUCT_DEFAULT%
@ECHO -s -STEPS Performs only the specified build steps:
@ECHO all - clean and build deps and app
@ECHO all-dirty - build deps and app without cleaning
@ECHO app - clean and build main applications
@ECHO app-dirty - build main applications without cleaning
@ECHO deps - clean and build deps
@ECHO deps-dirty - build deps without cleaning
@ECHO Default: %PS_STEPS_DEFAULT%
@ECHO -r -RUN Specifies what to perform at the run step:
@ECHO console - run and wait on bambu-studio-console.exe
@ECHO custom - run and wait on your custom build/%PS_CUSTOM_RUN_FILE%
@ECHO ide - open project in Visual Studio if not open (no wait)
@ECHO none - run step does nothing
@ECHO viewer - run bambu-gcodeviewer.exe (no wait)
@ECHO window - run bambu-studio.exe (no wait)
@ECHO Default: none
@ECHO -d -DESTDIR Deps destination directory
@ECHO Warning: Changing destdir path will not delete the old destdir.
@ECHO Default: %PS_DESTDIR_DEFAULT_MSG%
@ECHO.
@ECHO Examples:
@ECHO.
@ECHO Initial build: build_win -d "c:\src\BambuSlicer-deps"
@ECHO Build post deps change: build_win -s all
@ECHO App dirty build: build_win
@ECHO App dirty build ^& run: build_win -r console
@ECHO All clean build ^& run: build_win -s all -r console -d "deps\build\out_deps"
@ECHO.
GOTO :END
:MAIN
REM Script constants
SET START_TIME=%TIME%
SET PS_START_DIR=%CD%
SET PS_SOLUTION_NAME=BambuStudio
SET PS_CHOICE_TIMEOUT=30
SET PS_CUSTOM_RUN_FILE=custom_run.bat
SET PS_DEPS_PATH_FILE_NAME=.DEPS_PATH.txt
SET PS_DEPS_PATH_FILE=%~dp0deps\build\%PS_DEPS_PATH_FILE_NAME%
SET PS_CONFIG_LIST="Debug;MinSizeRel;Release;RelWithDebInfo"
REM The officially supported toolchain version is 16 (Visual Studio 2019)
REM TODO: Update versions after Boost gets rolled to 1.78 or later
SET PS_VERSION_SUPPORTED=16
SET PS_VERSION_EXCEEDED=17
SET VSWHERE=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe
IF NOT EXIST "%VSWHERE%" SET VSWHERE=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe
FOR /F "tokens=4 USEBACKQ delims=." %%I IN (`"%VSWHERE%" -nologo -property productId`) DO SET PS_PRODUCT_DEFAULT=%%I
IF "%PS_PRODUCT_DEFAULT%" EQU "" (
SET EXIT_STATUS=-1
@ECHO ERROR: No Visual Studio installation found. 1>&2
GOTO :HELP
)
REM Default to the latest supported version if multiple are available
FOR /F "tokens=1 USEBACKQ delims=." %%I IN (
`^""%VSWHERE%" -version "[%PS_VERSION_SUPPORTED%,%PS_VERSION_EXCEEDED%)" -latest -nologo -property catalog_buildVersion^"`
) DO SET PS_VERSION_SUPPORTED=%%I
REM Probe build directories and system state for reasonable default arguments
pushd %~dp0
SET PS_CONFIG=RelWithDebInfo
SET PS_ARCH=%PROCESSOR_ARCHITECTURE:amd64=x64%
CALL :TOLOWER PS_ARCH
SET PS_RUN=none
SET PS_DESTDIR=
SET PS_VERSION=
SET PS_PRODUCT=%PS_PRODUCT_DEFAULT%
CALL :RESOLVE_DESTDIR_CACHE
REM Set up parameters used by help menu
SET EXIT_STATUS=0
SET PS_CONFIG_DEFAULT=%PS_CONFIG%
SET PS_ARCH_HOST=%PS_ARCH%
(echo " -help /help -h /h -? /? ")| findstr /I /C:" %~1 ">nul && GOTO :HELP
REM Parse arguments
SET EXIT_STATUS=1
SET PS_CURRENT_STEP=arguments
SET PARSER_STATE=
SET PARSER_FAIL=
FOR %%I in (%*) DO CALL :PARSE_OPTION "ARCH CONFIG DESTDIR STEPS RUN VERSION PRODUCT" PARSER_STATE "%%~I"
IF "%PARSER_FAIL%" NEQ "" (
@ECHO ERROR: Invalid switch: %PARSER_FAIL% 1>&2
GOTO :HELP
)ELSE IF "%PARSER_STATE%" NEQ "" (
@ECHO ERROR: Missing parameter for: %PARSER_STATE% 1>&2
GOTO :HELP
)
REM Validate arguments
SET PS_ASK_TO_CONTINUE=
CALL :TOLOWER PS_ARCH
SET PS_ARCH=%PS_ARCH:amd64=x64%
CALL :PARSE_OPTION_VALUE %PS_CONFIG_LIST:;= % PS_CONFIG
IF "%PS_CONFIG%" EQU "" GOTO :HELP
REM RESOLVE_DESTDIR_CACHE must go after PS_ARCH and PS_CONFIG, but before PS STEPS
CALL :RESOLVE_DESTDIR_CACHE
IF "%PS_STEPS%" EQU "" SET PS_STEPS=%PS_STEPS_DEFAULT%
CALL :PARSE_OPTION_VALUE "all all-dirty deps-dirty deps app-dirty app app-cmake" PS_STEPS
IF "%PS_STEPS%" EQU "" GOTO :HELP
(echo %PS_STEPS%)| findstr /I /C:"dirty">nul && SET PS_STEPS_DIRTY=1 || SET PS_STEPS_DIRTY=
IF "%PS_STEPS%" EQU "app-cmake" SET PS_STEPS_DIRTY=1
IF "%PS_DESTDIR%" EQU "" SET PS_DESTDIR=%PS_DESTDIR_CACHED%
IF "%PS_DESTDIR%" EQU "" (
@ECHO ERROR: Parameter required: -DESTDIR 1>&2
GOTO :HELP
)
CALL :CANONICALIZE_PATH PS_DESTDIR "%PS_START_DIR%"
IF "%PS_DESTDIR%" NEQ "%PS_DESTDIR_CACHED%" (
(echo "all deps all-dirty deps-dirty")| findstr /I /C:"%PS_STEPS%">nul || (
IF EXIST "%PS_DESTDIR%" (
@ECHO WARNING: DESTDIR does not match cache: 1>&2
@ECHO WARNING: new: %PS_DESTDIR% 1>&2
@ECHO WARNING: old: %PS_DESTDIR_CACHED% 1>&2
SET PS_ASK_TO_CONTINUE=1
) ELSE (
@ECHO ERROR: Invalid parameter: DESTDIR=%PS_DESTDIR% 1>&2
GOTO :HELP
)
)
)
SET PS_DESTDIR_DEFAULT_MSG=
CALL :PARSE_OPTION_VALUE "console custom ide none viewer window" PS_RUN
IF "%PS_RUN%" EQU "" GOTO :HELP
IF "%PS_RUN%" NEQ "none" IF "%PS_STEPS:~0,4%" EQU "deps" (
@ECHO ERROR: RUN=%PS_RUN% specified with STEPS=%PS_STEPS%
@ECHO ERROR: RUN=none is the only valid option for STEPS "deps" or "deps-dirty"
GOTO :HELP
)
IF DEFINED PS_VERSION (
SET /A PS_VERSION_EXCEEDED=%PS_VERSION% + 1
) ELSE SET PS_VERSION=%PS_VERSION_SUPPORTED%
SET MSVC_FILTER=-products Microsoft.VisualStudio.Product.%PS_PRODUCT% -version "[%PS_VERSION%,%PS_VERSION_EXCEEDED%)"
FOR /F "tokens=* USEBACKQ" %%I IN (`^""%VSWHERE%" %MSVC_FILTER% -nologo -property installationPath^"`) DO SET MSVC_DIR=%%I
IF NOT EXIST "%MSVC_DIR%" (
@ECHO ERROR: Compatible Visual Studio installation not found. 1>&2
GOTO :HELP
)
REM Give the user a chance to cancel if we found something odd.
IF "%PS_ASK_TO_CONTINUE%" EQU "" GOTO :BUILD_ENV
@ECHO.
@ECHO Unexpected parameters detected. Build paused for %PS_CHOICE_TIMEOUT% seconds.
choice /T %PS_CHOICE_TIMEOUT% /C YN /D N /M "Continue"
IF %ERRORLEVEL% NEQ 1 GOTO :HELP
REM Set up MSVC environment
:BUILD_ENV
SET EXIT_STATUS=2
SET PS_CURRENT_STEP=environment
@ECHO **********************************************************************
@ECHO ** Build Config: %PS_CONFIG%
@ECHO ** Target Arch: %PS_ARCH%
@ECHO ** Build Steps: %PS_STEPS%
@ECHO ** Run App: %PS_RUN%
@ECHO ** Deps path: %PS_DESTDIR%
@ECHO ** Using Microsoft Visual Studio installation found at:
@ECHO ** %MSVC_DIR%
CALL "%MSVC_DIR%\Common7\Tools\vsdevcmd.bat" -arch=%PS_ARCH% -host_arch=%PS_ARCH_HOST% -app_platform=Desktop
IF %ERRORLEVEL% NEQ 0 GOTO :END
REM Need to reset the echo state after vsdevcmd.bat clobbers it.
@IF "%PS_ECHO_ON%" NEQ "" (echo on) ELSE (echo off)
IF "%PS_DRY_RUN_ONLY%" NEQ "" (
@ECHO Script terminated early because PS_DRY_RUN_ONLY is set. 1>&2
GOTO :END
)
IF /I "%PS_STEPS:~0,3%" EQU "app" GOTO :BUILD_APP
REM Build deps
:BUILD_DEPS
SET EXIT_STATUS=3
SET PS_CURRENT_STEP=deps
IF "%PS_STEPS_DIRTY%" EQU "" (
CALL :MAKE_OR_CLEAN_DIRECTORY deps\build "%PS_DEPS_PATH_FILE_NAME%" .vs
CALL :MAKE_OR_CLEAN_DIRECTORY "%PS_DESTDIR%"
)
cd deps\build || GOTO :END
cmake.exe .. -DDESTDIR="%PS_DESTDIR%"
IF %ERRORLEVEL% NEQ 0 IF "%PS_STEPS_DIRTY%" NEQ "" (
(del CMakeCache.txt && cmake.exe .. -DDESTDIR="%PS_DESTDIR%") || GOTO :END
) ELSE GOTO :END
(echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE%"
msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet || GOTO :END
cd ..\..
IF /I "%PS_STEPS:~0,4%" EQU "deps" GOTO :RUN_APP
REM Build app
:BUILD_APP
SET EXIT_STATUS=4
SET PS_CURRENT_STEP=app
IF "%PS_STEPS_DIRTY%" EQU "" CALL :MAKE_OR_CLEAN_DIRECTORY build "%PS_CUSTOM_RUN_FILE%" .vs
cd build || GOTO :END
REM Make sure we have a custom batch file skeleton for the run stage
set PS_CUSTOM_BAT=%PS_CUSTOM_RUN_FILE%
CALL :CANONICALIZE_PATH PS_CUSTOM_BAT
IF NOT EXIST %PS_CUSTOM_BAT% CALL :WRITE_CUSTOM_SCRIPT_SKELETON %PS_CUSTOM_BAT%
SET PS_PROJECT_IS_OPEN=
FOR /F "tokens=2 delims=," %%I in (
'tasklist /V /FI "IMAGENAME eq devenv.exe " /NH /FO CSV ^| find "%PS_SOLUTION_NAME%"'
) do SET PS_PROJECT_IS_OPEN=%%~I
cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST%
IF %ERRORLEVEL% NEQ 0 IF "%PS_STEPS_DIRTY%" NEQ "" (
(del CMakeCache.txt && cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST%) || GOTO :END
) ELSE GOTO :END
REM Skip the build step if we're using the undocumented app-cmake to regenerate the full config from inside devenv
IF "%PS_STEPS%" NEQ "app-cmake" msbuild /m ALL_BUILD.vcxproj /p:Configuration=%PS_CONFIG% /v:quiet || GOTO :END
(echo %PS_DESTDIR%)> "%PS_DEPS_PATH_FILE_FOR_CONFIG%"
REM Run app
:RUN_APP
REM All build steps complete.
CALL :DIFF_TIME ELAPSED_TIME %START_TIME% %TIME%
IF "%PS_CURRENT_STEP%" NEQ "arguments" (
@ECHO.
@ECHO Total Build Time Elapsed %ELAPSED_TIME%
)
SET EXIT_STATUS=5
SET PS_CURRENT_STEP=run
IF "%PS_RUN%" EQU "none" GOTO :PROLOGUE
cd src\%PS_CONFIG% || GOTO :END
SET PS_PROJECT_IS_OPEN=
FOR /F "tokens=2 delims=," %%I in (
'tasklist /V /FI "IMAGENAME eq devenv.exe " /NH /FO CSV ^| find "%PS_SOLUTION_NAME%"'
) do SET PS_PROJECT_IS_OPEN=%%~I
@ECHO.
@ECHO Running %PS_RUN% application...
@REM icacls below is just a hack for file-not-found error handling
IF "%PS_RUN%" EQU "console" (
icacls bambu-studio-console.exe >nul || GOTO :END
start /wait /b bambu-studio-console.exe
) ELSE IF "%PS_RUN%" EQU "window" (
icacls bambu-studio.exe >nul || GOTO :END
start bambu-studio.exe
) ELSE IF "%PS_RUN%" EQU "viewer" (
icacls bambu-gcodeviewer.exe >nul || GOTO :END
start bambu-gcodeviewer.exe
) ELSE IF "%PS_RUN%" EQU "custom" (
icacls %PS_CUSTOM_BAT% >nul || GOTO :END
CALL %PS_CUSTOM_BAT%
) ELSE IF "%PS_RUN%" EQU "ide" (
IF "%PS_PROJECT_IS_OPEN%" NEQ "" (
@ECHO WARNING: Solution is already open in Visual Studio. Skipping ide run step. 1>&2
) ELSE (
@ECHO Preparing to run Visual Studio...
cd ..\.. || GOTO :END
REM This hack generates a single config for MSVS, guaranteeing it gets set as the active config.
cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG% > nul 2> nul || GOTO :END
REM Now launch devenv with the single config (setting it active) and a /command switch to re-run cmake and generate the full config list
start devenv.exe %PS_SOLUTION_NAME%.sln /command ^"shell /o ^^^"%~f0^^^" -d ^^^"%PS_DESTDIR%^^^" -c %PS_CONFIG% -a %PS_ARCH% -r none -s app-cmake^"
REM If devenv fails to launch just directly regenerate the full config list.
IF %ERRORLEVEL% NEQ 0 (
cmake.exe .. -DCMAKE_PREFIX_PATH="%PS_DESTDIR%\usr\local" -DCMAKE_CONFIGURATION_TYPES=%PS_CONFIG_LIST% 2> nul 1> nul || GOTO :END
)
)
)
@REM ********** DON'T ADD ANY CODE BETWEEN THESE TWO SECTIONS **********
@REM RUN_APP may hand off control, so let exit codes fall through to PROLOGUE.
:PROLOGUE
SET EXIT_STATUS=%ERRORLEVEL%
:END
@IF "%PS_ECHO_ON%%PS_DRY_RUN_ONLY%" NEQ "" (
@ECHO **********************************************************************
@ECHO ** Script Parameters:
@ECHO **********************************************************************
@SET PS_
)
IF "%EXIT_STATUS%" NEQ "0" (
IF "%PS_CURRENT_STEP%" NEQ "arguments" (
@ECHO.
@ECHO ERROR: *** Build process failed at %PS_CURRENT_STEP% step. *** 1>&2
)
) ELSE (
@ECHO All steps completed successfully.
)
popd
exit /B %EXIT_STATUS%
GOTO :EOF
REM Functions and stubs start here.
:RESOLVE_DESTDIR_CACHE
@REM Resolves all DESTDIR cache values and sets PS_STEPS_DEFAULT
@REM Note: This just sets global variables, so it doesn't use setlocal.
SET PS_DEPS_PATH_FILE_FOR_CONFIG=%~dp0build\.vs\%PS_ARCH%\%PS_CONFIG%\%PS_DEPS_PATH_FILE_NAME%
mkdir "%~dp0build\.vs\%PS_ARCH%\%PS_CONFIG%" > nul 2> nul
REM Copy a legacy file if we don't have one in the proper location.
echo f|xcopy /D "%~dp0build\%PS_ARCH%\%PS_CONFIG%\%PS_DEPS_PATH_FILE_NAME%" "%PS_DEPS_PATH_FILE_FOR_CONFIG%" > nul 2> nul
CALL :CANONICALIZE_PATH PS_DEPS_PATH_FILE_FOR_CONFIG
IF EXIST "%PS_DEPS_PATH_FILE_FOR_CONFIG%" (
FOR /F "tokens=* USEBACKQ" %%I IN ("%PS_DEPS_PATH_FILE_FOR_CONFIG%") DO (
SET PS_DESTDIR_CACHED=%%I
SET PS_DESTDIR_DEFAULT_MSG=%%I
)
SET PS_STEPS_DEFAULT=app-dirty
) ELSE IF EXIST "%PS_DEPS_PATH_FILE%" (
FOR /F "tokens=* USEBACKQ" %%I IN ("%PS_DEPS_PATH_FILE%") DO (
SET PS_DESTDIR_CACHED=%%I
SET PS_DESTDIR_DEFAULT_MSG=%%I
)
SET PS_STEPS_DEFAULT=app
) ELSE (
SET PS_DESTDIR_CACHED=
SET PS_DESTDIR_DEFAULT_MSG=Cache missing. Argument required.
SET PS_STEPS_DEFAULT=all
)
GOTO :EOF
:PARSE_OPTION
@REM Argument parser called for each argument
@REM %1 - Valid option list
@REM %2 - Variable name for parser state; must be unset when parsing finished
@REM %3 - Current argument value
@REM PARSER_FAIL will be set on an error
@REM Note: Must avoid delayed expansion since filenames may contain ! character
setlocal disableDelayedExpansion
IF "%PARSER_FAIL%" NEQ "" GOTO :EOF
CALL SET LAST_ARG=%%%2%%
IF "%LAST_ARG%" EQU "" (
CALL :PARSE_OPTION_NAME %1 %~2 %~3 1
SET ARG_TYPE=NAME
) ELSE (
SET PS_SET_COMMAND=SET PS_%LAST_ARG%=%~3
SET ARG_TYPE=LAST_ARG
SET %~2=
)
CALL SET LAST_ARG=%%%2%%
IF "%LAST_ARG%%ARG_TYPE%" EQU "NAME" SET PARSER_FAIL=%~3
(
endlocal
SET PARSER_FAIL=%PARSER_FAIL%
SET %~2=%LAST_ARG%
%PS_SET_COMMAND%
)
GOTO :EOF
:PARSE_OPTION_VALUE
setlocal disableDelayedExpansion
@REM Parses value and verifies it is within the supplied list
@REM %1 - Valid option list
@REM %2 - In/out variable name; unset on error
CALL SET NAME=%~2
CALL SET SAVED_VALUE=%%%NAME%%%
CALL :PARSE_OPTION_NAME %1 %NAME% -%SAVED_VALUE%
CALL SET NEW_VALUE=%%%NAME%%%
IF "%NEW_VALUE%" EQU "" (
@ECHO ERROR: Invalid parameter: %NAME:~3%=%SAVED_VALUE% 1>&2
)
endlocal & SET %NAME%=%NEW_VALUE%
GOTO :EOF
:PARSE_OPTION_NAME
@REM Parses an option name
@REM %1 - Valid option list
@REM %2 - Out variable name; unset on error
@REM %3 - Current argument value
@REM %4 - Boolean indicating single character switches are valid
@REM Note: Delayed expansion safe because ! character is invalid in option name
setlocal enableDelayedExpansion
IF "%4" NEQ "" FOR %%I IN (%~1) DO @(
SET SHORT_NAME=%%~I
SET SHORT_ARG_!SHORT_NAME:~0,1!=%%~I
)
@SET OPTION_NAME=%~3
@(echo %OPTION_NAME%)| findstr /R /C:"[-/]..*">nul || GOTO :PARSE_OPTION_NAME_FAIL
@SET OPTION_NAME=%OPTION_NAME:~1%
IF "%4" NEQ "" (
IF "%OPTION_NAME%" EQU "%OPTION_NAME:~0,1%" (
IF "!SHORT_ARG_%OPTION_NAME:~0,1%!" NEQ "" SET OPTION_NAME=!SHORT_ARG_%OPTION_NAME:~0,1%!
)
)
@(echo %OPTION_NAME%)| findstr /R /C:".[ ][ ]*.">nul && GOTO :PARSE_OPTION_NAME_FAIL
@(echo %~1 )| findstr /I /C:" %OPTION_NAME% ">nul || GOTO :PARSE_OPTION_NAME_FAIL
FOR %%I IN (%~1) DO SET OPTION_NAME=!OPTION_NAME:%%~I=%%~I!
endlocal & SET %~2=%OPTION_NAME%
GOTO :EOF
:PARSE_OPTION_NAME_FAIL
endlocal & SET %~2=
GOTO :EOF
:MAKE_OR_CLEAN_DIRECTORY
@REM Create directory if it doesn't exist or clean it if it does
@REM %1 - Directory path to clean or create
@REM %* - Optional list of files/dirs to keep (in the base directory only)
setlocal disableDelayedExpansion
IF NOT EXIST "%~1" (
@ECHO Creating %~1
mkdir "%~1" && (
endlocal
GOTO :EOF
)
)
@ECHO Cleaning %~1 ...
SET KEEP_LIST=
:MAKE_OR_CLEAN_DIRECTORY_ARG_LOOP
IF "%~2" NEQ "" (
SET KEEP_LIST=%KEEP_LIST% "%~2"
SHIFT /2
GOTO :MAKE_OR_CLEAN_DIRECTORY_ARG_LOOP
)
for /F "usebackq delims=" %%I in (`dir /a /b "%~1"`) do (
(echo %KEEP_LIST%)| findstr /I /L /C:"\"%%I\"">nul || (
rmdir /s /q "%~1\%%I" 2>nul ) || del /q /f "%~1\%%I"
)
endlocal
GOTO :EOF
:TOLOWER
@REM Converts supplied environment variable to lowercase
@REM %1 - Input/output variable name
@REM Note: This is slow on very long strings, but is used only on very short ones
setlocal disableDelayedExpansion
@FOR %%b IN (a b c d e f g h i j k l m n o p q r s t u v w x y z) DO @CALL set %~1=%%%1:%%b=%%b%%
@CALL SET OUTPUT=%%%~1%%
endlocal & SET %~1=%OUTPUT%
GOTO :EOF
:CANONICALIZE_PATH
@REM Canonicalizes the path in the supplied variable
@REM %1 - Input/output variable containing path to canonicalize
@REM %2 - Optional base directory
setlocal
CALL :CANONICALIZE_PATH_INNER %1 %%%~1%% %2
endlocal & SET %~1=%OUTPUT%
GOTO :EOF
:CANONICALIZE_PATH_INNER
if "%~3" NEQ "" (pushd %3 || GOTO :EOF)
SET OUTPUT=%~f2
if "%~3" NEQ "" popd
GOTO :EOF
:DIFF_TIME
@REM Calculates elapsed time between two timestamps (TIME environment variable format)
@REM %1 - Output variable
@REM %2 - Start time
@REM %3 - End time
setlocal EnableDelayedExpansion
set START_ARG=%2
set END_ARG=%3
set END=!END_ARG:%TIME:~8,1%=%%100)*100+1!
set START=!START_ARG:%TIME:~8,1%=%%100)*100+1!
set /A DIFF=((((10!END:%TIME:~2,1%=%%100)*60+1!%%100)-((((10!START:%TIME:~2,1%=%%100)*60+1!%%100), DIFF-=(DIFF^>^>31)*24*60*60*100
set /A CC=DIFF%%100+100,DIFF/=100,SS=DIFF%%60+100,DIFF/=60,MM=DIFF%%60+100,HH=DIFF/60+100
@endlocal & set %1=%HH:~1%%TIME:~2,1%%MM:~1%%TIME:~2,1%%SS:~1%%TIME:~8,1%%CC:~1%
@GOTO :EOF
:WRITE_CUSTOM_SCRIPT_SKELETON
@REM Writes the following text to the supplied file
@REM %1 - Output filename
setlocal
@(
ECHO @ECHO.
ECHO @ECHO ********************************************************************************
ECHO @ECHO ** This is a custom run script skeleton.
ECHO @ECHO ********************************************************************************
ECHO @ECHO.
ECHO @ECHO ********************************************************************************
ECHO @ECHO ** The working directory is:
ECHO @ECHO ********************************************************************************
ECHO dir
ECHO @ECHO.
ECHO @ECHO ********************************************************************************
ECHO @ECHO ** The environment is:
ECHO @ECHO ********************************************************************************
ECHO set
ECHO @ECHO.
ECHO @ECHO ********************************************************************************
ECHO @ECHO ** Edit or replace this script to run custom steps after a successful build:
ECHO @ECHO ** %~1
ECHO @ECHO ********************************************************************************
ECHO @ECHO.
) > "%~1"
endlocal
GOTO :EOF

View File

@@ -0,0 +1,175 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
Catch
-----
This module defines a function to help use the Catch test framework.
The :command:`catch_discover_tests` discovers tests by asking the compiled test
executable to enumerate its tests. This does not require CMake to be re-run
when tests change. However, it may not work in a cross-compiling environment,
and setting test properties is less convenient.
This command is intended to replace use of :command:`add_test` to register
tests, and will create a separate CTest test for each Catch test case. Note
that this is in some cases less efficient, as common set-up and tear-down logic
cannot be shared by multiple test cases executing in the same instance.
However, it provides more fine-grained pass/fail information to CTest, which is
usually considered as more beneficial. By default, the CTest test name is the
same as the Catch name; see also ``TEST_PREFIX`` and ``TEST_SUFFIX``.
.. command:: catch_discover_tests
Automatically add tests with CTest by querying the compiled test executable
for available tests::
catch_discover_tests(target
[TEST_SPEC arg1...]
[EXTRA_ARGS arg1...]
[WORKING_DIRECTORY dir]
[TEST_PREFIX prefix]
[TEST_SUFFIX suffix]
[PROPERTIES name1 value1...]
[TEST_LIST var]
)
``catch_discover_tests`` sets up a post-build command on the test executable
that generates the list of tests by parsing the output from running the test
with the ``--list-test-names-only`` argument. This ensures that the full
list of tests is obtained. Since test discovery occurs at build time, it is
not necessary to re-run CMake when the list of tests changes.
However, it requires that :prop_tgt:`CROSSCOMPILING_EMULATOR` is properly set
in order to function in a cross-compiling environment.
Additionally, setting properties on tests is somewhat less convenient, since
the tests are not available at CMake time. Additional test properties may be
assigned to the set of tests as a whole using the ``PROPERTIES`` option. If
more fine-grained test control is needed, custom content may be provided
through an external CTest script using the :prop_dir:`TEST_INCLUDE_FILES`
directory property. The set of discovered tests is made accessible to such a
script via the ``<target>_TESTS`` variable.
The options are:
``target``
Specifies the Catch executable, which must be a known CMake executable
target. CMake will substitute the location of the built executable when
running the test.
``TEST_SPEC arg1...``
Specifies test cases, wildcarded test cases, tags and tag expressions to
pass to the Catch executable with the ``--list-test-names-only`` argument.
``EXTRA_ARGS arg1...``
Any extra arguments to pass on the command line to each test case.
``WORKING_DIRECTORY dir``
Specifies the directory in which to run the discovered test cases. If this
option is not provided, the current binary directory is used.
``TEST_PREFIX prefix``
Specifies a ``prefix`` to be prepended to the name of each discovered test
case. This can be useful when the same test executable is being used in
multiple calls to ``catch_discover_tests()`` but with different
``TEST_SPEC`` or ``EXTRA_ARGS``.
``TEST_SUFFIX suffix``
Similar to ``TEST_PREFIX`` except the ``suffix`` is appended to the name of
every discovered test case. Both ``TEST_PREFIX`` and ``TEST_SUFFIX`` may
be specified.
``PROPERTIES name1 value1...``
Specifies additional properties to be set on all tests discovered by this
invocation of ``catch_discover_tests``.
``TEST_LIST var``
Make the list of tests available in the variable ``var``, rather than the
default ``<target>_TESTS``. This can be useful when the same test
executable is being used in multiple calls to ``catch_discover_tests()``.
Note that this variable is only available in CTest.
#]=======================================================================]
#------------------------------------------------------------------------------
function(catch_discover_tests TARGET)
cmake_parse_arguments(
""
""
"TEST_PREFIX;TEST_SUFFIX;WORKING_DIRECTORY;TEST_LIST"
"TEST_SPEC;EXTRA_ARGS;PROPERTIES"
${ARGN}
)
if(NOT _WORKING_DIRECTORY)
set(_WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
endif()
if(NOT _TEST_LIST)
set(_TEST_LIST ${TARGET}_TESTS)
endif()
## Generate a unique name based on the extra arguments
string(SHA1 args_hash "${_TEST_SPEC} ${_EXTRA_ARGS}")
string(SUBSTRING ${args_hash} 0 7 args_hash)
# Define rule to generate test list for aforementioned test executable
set(ctest_include_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_include-${args_hash}.cmake")
set(ctest_tests_file "${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_tests-${args_hash}.cmake")
get_property(crosscompiling_emulator
TARGET ${TARGET}
PROPERTY CROSSCOMPILING_EMULATOR
)
add_custom_command(
TARGET ${TARGET} POST_BUILD
BYPRODUCTS "${ctest_tests_file}"
COMMAND "${CMAKE_COMMAND}"
-D "TEST_TARGET=${TARGET}"
-D "TEST_EXECUTABLE=$<TARGET_FILE:${TARGET}>"
-D "TEST_EXECUTOR=${crosscompiling_emulator}"
-D "TEST_WORKING_DIR=${_WORKING_DIRECTORY}"
-D "TEST_SPEC=${_TEST_SPEC}"
-D "TEST_EXTRA_ARGS=${_EXTRA_ARGS}"
-D "TEST_PROPERTIES=${_PROPERTIES}"
-D "TEST_PREFIX='${_TEST_PREFIX}'"
-D "TEST_SUFFIX='${_TEST_SUFFIX}'"
-D "TEST_LIST=${_TEST_LIST}"
-D "CTEST_FILE=${ctest_tests_file}"
-P "${_CATCH_DISCOVER_TESTS_SCRIPT}"
VERBATIM
)
file(WRITE "${ctest_include_file}"
"if(EXISTS \"${ctest_tests_file}\")\n"
" include(\"${ctest_tests_file}\")\n"
"else()\n"
" add_test(${TARGET}_NOT_BUILT-${args_hash} ${TARGET}_NOT_BUILT-${args_hash})\n"
"endif()\n"
)
if(NOT ${CMAKE_VERSION} VERSION_LESS "3.10.0")
# Add discovered tests to directory TEST_INCLUDE_FILES
set_property(DIRECTORY
APPEND PROPERTY TEST_INCLUDE_FILES "${ctest_include_file}"
)
else()
# Add discovered tests as directory TEST_INCLUDE_FILE if possible
get_property(test_include_file_set DIRECTORY PROPERTY TEST_INCLUDE_FILE SET)
if (NOT ${test_include_file_set})
set_property(DIRECTORY
PROPERTY TEST_INCLUDE_FILE "${ctest_include_file}"
)
else()
message(FATAL_ERROR
"Cannot set more than one TEST_INCLUDE_FILE"
)
endif()
endif()
endfunction()
###############################################################################
set(_CATCH_DISCOVER_TESTS_SCRIPT
${CMAKE_CURRENT_LIST_DIR}/CatchAddTests.cmake
)

Some files were not shown because too many files have changed in this diff Show More