mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-18 11:02:08 +00:00
Compare commits
404 Commits
feature/au
...
v2.3.2-rc2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6187063190 | ||
|
|
b9f93ffd99 | ||
|
|
d6761fedc6 | ||
|
|
0f92dec77d | ||
|
|
01a2193ad9 | ||
|
|
586118a875 | ||
|
|
624a55ec98 | ||
|
|
7952721931 | ||
|
|
5ac382a9cd | ||
|
|
57aac709e9 | ||
|
|
570043509f | ||
|
|
089073b292 | ||
|
|
a0f1f3db73 | ||
|
|
1205903eec | ||
|
|
a5b8f4608f | ||
|
|
28649f498d | ||
|
|
2ed249a81b | ||
|
|
52a2c033d3 | ||
|
|
1218711adb | ||
|
|
008cfd1f86 | ||
|
|
d50b4cbf3d | ||
|
|
47ab79041b | ||
|
|
29addf5ca1 | ||
|
|
d390524db0 | ||
|
|
0a84934639 | ||
|
|
ee52b83217 | ||
|
|
d8f3950059 | ||
|
|
6d6f7451d4 | ||
|
|
d54adafdaa | ||
|
|
17e534cac4 | ||
|
|
90646276f8 | ||
|
|
b7033a4c92 | ||
|
|
1f19ff67a3 | ||
|
|
d017250d9c | ||
|
|
dba8a6d88b | ||
|
|
49d2a326db | ||
|
|
abd3bce88a | ||
|
|
b908bab904 | ||
|
|
ca1f360b83 | ||
|
|
4c73ac2fea | ||
|
|
36b764f735 | ||
|
|
ce1d91024b | ||
|
|
2f3bfd03d5 | ||
|
|
f03c34024d | ||
|
|
6b3f554732 | ||
|
|
325ced958e | ||
|
|
bbbc044e92 | ||
|
|
0c666da430 | ||
|
|
c924b8ed25 | ||
|
|
c8dde0f8ca | ||
|
|
401fb935bc | ||
|
|
7747a6e7a1 | ||
|
|
545cdc74ca | ||
|
|
b0e19d5577 | ||
|
|
df216c5105 | ||
|
|
e5d037c044 | ||
|
|
6e01d38a5c | ||
|
|
37790f2a3d | ||
|
|
6437fb57e8 | ||
|
|
a46c8970bf | ||
|
|
03bc0af038 | ||
|
|
c03fdb4ca0 | ||
|
|
1162b101b8 | ||
|
|
f91971baf9 | ||
|
|
937b356725 | ||
|
|
721ee0ab00 | ||
|
|
f054e3ad9b | ||
|
|
1a57ec13a5 | ||
|
|
c7b65ef498 | ||
|
|
31cb77116c | ||
|
|
74f75bb90d | ||
|
|
a3c067cd3b | ||
|
|
90cd00382a | ||
|
|
deef8b107d | ||
|
|
478f1fa117 | ||
|
|
3f82902ebe | ||
|
|
1c42f67000 | ||
|
|
b45c7a8112 | ||
|
|
da8be684dc | ||
|
|
dc27345b05 | ||
|
|
10cfab0501 | ||
|
|
4146066f76 | ||
|
|
8aa43d1ef7 | ||
|
|
04bf8b6bb9 | ||
|
|
84b5906ffa | ||
|
|
318b7742cc | ||
|
|
b68fd2dc21 | ||
|
|
f2cc134a8f | ||
|
|
31d9c9d087 | ||
|
|
c9ffc5a699 | ||
|
|
d37be2f4f5 | ||
|
|
4cc4da8868 | ||
|
|
9f5214d14d | ||
|
|
04018980e1 | ||
|
|
899bcf2e5f | ||
|
|
0ef8a79cd2 | ||
|
|
a38af4d85a | ||
|
|
7cabde6ca6 | ||
|
|
6725e657ab | ||
|
|
095b5116ac | ||
|
|
60a63c63eb | ||
|
|
5e30783dcf | ||
|
|
5c07cb5c39 | ||
|
|
a2528fee10 | ||
|
|
ae828cbde3 | ||
|
|
3f819005cc | ||
|
|
25d07eac8f | ||
|
|
e57733a5ff | ||
|
|
8a2a778557 | ||
|
|
72a4597107 | ||
|
|
2806398e79 | ||
|
|
1d24470918 | ||
|
|
f2c8b46af6 | ||
|
|
c3bb4347da | ||
|
|
72db7fa4df | ||
|
|
c3365e0478 | ||
|
|
479fbc85cd | ||
|
|
76436bb29a | ||
|
|
3a61fefa3a | ||
|
|
d604cc9697 | ||
|
|
db1fe73e85 | ||
|
|
ce56ad5590 | ||
|
|
ad57020139 | ||
|
|
96be9f94ef | ||
|
|
6a831c5e78 | ||
|
|
ec7a5f5140 | ||
|
|
eeb2ec7871 | ||
|
|
1f4fce974f | ||
|
|
3b350a93f0 | ||
|
|
ea5db3aae8 | ||
|
|
b89f67e433 | ||
|
|
e7d2bbd6a9 | ||
|
|
872d184860 | ||
|
|
4343ddf823 | ||
|
|
5e6a8e4daf | ||
|
|
386aab9f94 | ||
|
|
b2399ac909 | ||
|
|
c085eb845c | ||
|
|
859f401df5 | ||
|
|
7e1b2d99d3 | ||
|
|
528e7c6780 | ||
|
|
1827a03d17 | ||
|
|
a717597003 | ||
|
|
a5a5cad09b | ||
|
|
1745e8b910 | ||
|
|
a81537f43d | ||
|
|
29325e3561 | ||
|
|
7e63fce706 | ||
|
|
0604aa5c76 | ||
|
|
380f4b4a18 | ||
|
|
bf59fe458f | ||
|
|
240cf9ab5d | ||
|
|
05cb8b4d89 | ||
|
|
055f24ca7a | ||
|
|
897a3e915f | ||
|
|
586e96479a | ||
|
|
0879b2079b | ||
|
|
c4801250ea | ||
|
|
06cee7ffe7 | ||
|
|
5ec4874b33 | ||
|
|
783f9926e3 | ||
|
|
f0386d981f | ||
|
|
2fae370e52 | ||
|
|
cef69307e7 | ||
|
|
cd5c8f2ad0 | ||
|
|
769fc137c7 | ||
|
|
2d0a0568e7 | ||
|
|
1952442e18 | ||
|
|
5093a3dab3 | ||
|
|
dfbdcad766 | ||
|
|
4692661631 | ||
|
|
f681f7a2c0 | ||
|
|
f38324d521 | ||
|
|
6c900535e5 | ||
|
|
e090ec0e63 | ||
|
|
1421d03394 | ||
|
|
d0f5b64428 | ||
|
|
a0a84f7e2d | ||
|
|
346361d634 | ||
|
|
652f180945 | ||
|
|
68fdfcf0eb | ||
|
|
aa8b8620da | ||
|
|
8e84d21b7f | ||
|
|
5c9f6a82fc | ||
|
|
b02a50add0 | ||
|
|
89eb0b26d1 | ||
|
|
08afbefa56 | ||
|
|
49413e7990 | ||
|
|
d06159a0c4 | ||
|
|
0683013a7e | ||
|
|
cf31d05d26 | ||
|
|
9950662ddf | ||
|
|
55883bdb76 | ||
|
|
38e67ff090 | ||
|
|
abefb0e698 | ||
|
|
ed3f0e2898 | ||
|
|
039a693b25 | ||
|
|
ffc8a3e307 | ||
|
|
cae1567726 | ||
|
|
e14e186bb7 | ||
|
|
9604b01656 | ||
|
|
084c58f365 | ||
|
|
ed1b03fe6d | ||
|
|
2f2f0df6af | ||
|
|
1663dab6ff | ||
|
|
506ab3ed14 | ||
|
|
cca8dc9790 | ||
|
|
8fd556e4b0 | ||
|
|
8a77b4269d | ||
|
|
d46cd65d7c | ||
|
|
48b8edc2bb | ||
|
|
e025860b2c | ||
|
|
bb30999673 | ||
|
|
dffaa5c0a9 | ||
|
|
78a5caf83b | ||
|
|
e6e6210120 | ||
|
|
9e2cf00f0c | ||
|
|
5d121b12ee | ||
|
|
98cb91110e | ||
|
|
1a156e419c | ||
|
|
aa4eb9de13 | ||
|
|
1aee0cf526 | ||
|
|
bab3c72e4f | ||
|
|
f9101a18f0 | ||
|
|
d608d7dffe | ||
|
|
ea3685aacb | ||
|
|
72a2eaf82e | ||
|
|
b954749310 | ||
|
|
7c598841b8 | ||
|
|
c302355467 | ||
|
|
c12912e0df | ||
|
|
9b4af7ca1a | ||
|
|
d9edc4ba75 | ||
|
|
56f1f05f12 | ||
|
|
86d54863f7 | ||
|
|
cf3d9118ab | ||
|
|
b9d4b782c2 | ||
|
|
84faac2dd4 | ||
|
|
431943408b | ||
|
|
d817a4d5d4 | ||
|
|
86421c6378 | ||
|
|
3da6f3bf77 | ||
|
|
977a66be39 | ||
|
|
3a056f2aa3 | ||
|
|
1e1ffe72f6 | ||
|
|
c37132768a | ||
|
|
d782141ca5 | ||
|
|
5935832143 | ||
|
|
8d22fad30b | ||
|
|
7059789578 | ||
|
|
01eed59ee2 | ||
|
|
a6719041a5 | ||
|
|
7494c6da7d | ||
|
|
95ea712f3c | ||
|
|
006e7d6c28 | ||
|
|
0bf531ace8 | ||
|
|
f27605eac1 | ||
|
|
9c21744cd1 | ||
|
|
da9f3fdf80 | ||
|
|
eb56cf1ce1 | ||
|
|
570d0ec7b6 | ||
|
|
9233005725 | ||
|
|
b9ada2542a | ||
|
|
a5f3656463 | ||
|
|
c7d157514d | ||
|
|
722d5f8aa7 | ||
|
|
a254bec6b2 | ||
|
|
997b2154c8 | ||
|
|
e0192ae437 | ||
|
|
e93f50702e | ||
|
|
3ed07d5f9b | ||
|
|
978e3b79b5 | ||
|
|
8abf0f761d | ||
|
|
1a696173c0 | ||
|
|
3da2bf1bd8 | ||
|
|
9c6b8edcb1 | ||
|
|
9703a6b4d7 | ||
|
|
e81e7b9a23 | ||
|
|
12f51f906e | ||
|
|
6419d0ebd9 | ||
|
|
f1212be6bb | ||
|
|
f3f752d0be | ||
|
|
27f2f2be62 | ||
|
|
ecc2c91e32 | ||
|
|
d9c48c3d53 | ||
|
|
5ce5e8df37 | ||
|
|
a036de042b | ||
|
|
4c90144b98 | ||
|
|
9ed8848c9d | ||
|
|
c906075148 | ||
|
|
d3d161235d | ||
|
|
b64f29b233 | ||
|
|
97c8da4d03 | ||
|
|
eac352f95d | ||
|
|
9abe42c503 | ||
|
|
d69620a716 | ||
|
|
cf54ad58ed | ||
|
|
95c6cd05fa | ||
|
|
304ea7867e | ||
|
|
0c3055fd13 | ||
|
|
cc585a646b | ||
|
|
e6b93f9b90 | ||
|
|
a5f00c4138 | ||
|
|
01596888c7 | ||
|
|
b37f68d778 | ||
|
|
5c05e036c4 | ||
|
|
9b8f3e2662 | ||
|
|
8225d642d0 | ||
|
|
6d926c80cb | ||
|
|
f18854fb14 | ||
|
|
3410d38475 | ||
|
|
9561b9e8c0 | ||
|
|
8c2f3290f2 | ||
|
|
f47f7a6288 | ||
|
|
e173ad8df1 | ||
|
|
ccb7416a6d | ||
|
|
7bab2c2785 | ||
|
|
a83b005f8b | ||
|
|
b74335e15e | ||
|
|
c400640197 | ||
|
|
0a9cab3991 | ||
|
|
779f4a890d | ||
|
|
7ac84b1f17 | ||
|
|
4af168bac7 | ||
|
|
6d3e0de4d9 | ||
|
|
1d6595597d | ||
|
|
2486bdfbce | ||
|
|
2ca3a85d15 | ||
|
|
fe227b93bb | ||
|
|
99aef17723 | ||
|
|
cb786d95a6 | ||
|
|
eef9794d92 | ||
|
|
6d7f32d03b | ||
|
|
3fecf916c1 | ||
|
|
e175f8582c | ||
|
|
71c1e741ee | ||
|
|
ba5f0e707d | ||
|
|
3b4600d65b | ||
|
|
eb72dce9aa | ||
|
|
39df09be8b | ||
|
|
98f6467942 | ||
|
|
128ef60bf3 | ||
|
|
1b355be432 | ||
|
|
57dd572427 | ||
|
|
89c58a7429 | ||
|
|
eab86797dd | ||
|
|
03d9dea12c | ||
|
|
883c095a53 | ||
|
|
b908c33eea | ||
|
|
01f5c4caaa | ||
|
|
ac482935ea | ||
|
|
044a1d5ba4 | ||
|
|
ef876fe577 | ||
|
|
8670bb65f2 | ||
|
|
541f3bb93b | ||
|
|
1b782d82bc | ||
|
|
04dfbc3e39 | ||
|
|
0e5a816318 | ||
|
|
5f18efa9e2 | ||
|
|
11c9794faa | ||
|
|
8d8ab5911d | ||
|
|
d6815653f4 | ||
|
|
f232c9cf08 | ||
|
|
0df673b0d3 | ||
|
|
a4d4bfff27 | ||
|
|
e38013c7f6 | ||
|
|
1165c5632d | ||
|
|
9a30704194 | ||
|
|
8d3b3645e7 | ||
|
|
daf3038f2f | ||
|
|
964408a7fa | ||
|
|
6d70fdd150 | ||
|
|
e4d354b673 | ||
|
|
a87df7f0b5 | ||
|
|
2440d669f0 | ||
|
|
c9e6c51213 | ||
|
|
7408f333a6 | ||
|
|
32ce7494c0 | ||
|
|
8a1e0ee9bb | ||
|
|
7de779a0e0 | ||
|
|
fcdd3d3b2a | ||
|
|
e0cdae0cb4 | ||
|
|
6e9fbc90e7 | ||
|
|
bdbeb34158 | ||
|
|
bec883e667 | ||
|
|
acd3c94955 | ||
|
|
7814605906 | ||
|
|
fd22fc9131 | ||
|
|
cad887553a | ||
|
|
2cb5b02708 | ||
|
|
9bee05744d | ||
|
|
f8a7589354 | ||
|
|
8ed12a8023 | ||
|
|
8552f2efbf | ||
|
|
72711231fd | ||
|
|
1394a3ccf2 | ||
|
|
20f132e09a | ||
|
|
25c19c94b5 | ||
|
|
d539540a65 | ||
|
|
9359aa8607 | ||
|
|
f696d19181 | ||
|
|
2c342875c2 | ||
|
|
c92328c9cc | ||
|
|
cf23cf831a |
4
.github/workflows/assign.yml
vendored
4
.github/workflows/assign.yml
vendored
@@ -14,7 +14,9 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Assign the user or unassign stale assignments
|
||||
uses: takanome-dev/assign-issue-action@v2.3
|
||||
# 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'
|
||||
|
||||
288
.github/workflows/build_all.yml
vendored
288
.github/workflows/build_all.yml
vendored
@@ -5,7 +5,6 @@ on:
|
||||
branches:
|
||||
- main
|
||||
- release/*
|
||||
- feature/auto-update # TODO: Remove after auto-update testing is complete
|
||||
paths:
|
||||
- 'deps/**'
|
||||
- 'src/**'
|
||||
@@ -49,139 +48,174 @@ concurrency:
|
||||
|
||||
|
||||
jobs:
|
||||
# build_linux:
|
||||
# name: 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: ubuntu-24.04
|
||||
# build-deps-only: ${{ inputs.build-deps-only || false }}
|
||||
# secrets: inherit
|
||||
build_all:
|
||||
name: Build macOS (testing auto-update)
|
||||
build_linux:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
# TODO: Re-enable Windows after auto-update testing is complete
|
||||
# - os: windows-latest
|
||||
- os: macos-14
|
||||
arch: arm64
|
||||
# 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: ${{ matrix.os }}
|
||||
os: 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: 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
|
||||
# unit_tests:
|
||||
# name: Unit Tests
|
||||
# runs-on: 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
|
||||
# uses: ./.github/actions/apt-install-deps
|
||||
# - name: Restore Test Artifact
|
||||
# uses: actions/download-artifact@v7
|
||||
# with:
|
||||
# name: ${{ github.sha }}-tests
|
||||
# - uses: lukka/get-cmake@latest
|
||||
# with:
|
||||
# cmakeVersion: "~3.28.0" # use most recent 3.28.x version
|
||||
# - 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@v6
|
||||
# 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"
|
||||
# flatpak:
|
||||
# name: "Flatpak"
|
||||
# container:
|
||||
# image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
|
||||
# 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:
|
||||
# if: ${{ !cancelled() && (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=""
|
||||
# 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
|
||||
# - uses: flatpak/flatpak-github-actions/flatpak-builder@master
|
||||
# with:
|
||||
# bundle: OrcaSlicer-Linux-flatpak_${{ env.ver }}_${{ matrix.variant.arch }}.flatpak
|
||||
# manifest-path: scripts/flatpak/io.github.softfever.OrcaSlicer.yml
|
||||
# cache: true
|
||||
# arch: ${{ matrix.variant.arch }}
|
||||
# upload-artifact: false
|
||||
# - name: Upload artifacts Flatpak
|
||||
# uses: actions/upload-artifact@v6
|
||||
# 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
|
||||
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: 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
|
||||
uses: ./.github/actions/apt-install-deps
|
||||
- name: Restore Test Artifact
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: ${{ github.sha }}-tests
|
||||
- uses: lukka/get-cmake@latest
|
||||
with:
|
||||
cmakeVersion: "~3.28.0" # use most recent 3.28.x version
|
||||
- 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@v6
|
||||
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"
|
||||
flatpak:
|
||||
name: "Flatpak"
|
||||
container:
|
||||
image: ghcr.io/flathub-infra/flatpak-github-actions:gnome-48
|
||||
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:
|
||||
if: ${{ !cancelled() && (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=""
|
||||
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@v4
|
||||
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@v4
|
||||
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 '0,/^finish-args:/s//build-options:\n no-debuginfo: true\n strip: true\nfinish-args:/' \
|
||||
scripts/flatpak/io.github.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/io.github.orcaslicer.OrcaSlicer.yml
|
||||
cache: false
|
||||
arch: ${{ matrix.variant.arch }}
|
||||
upload-artifact: false
|
||||
- name: Upload artifacts Flatpak
|
||||
uses: actions/upload-artifact@v6
|
||||
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
|
||||
|
||||
18
.github/workflows/build_check_cache.yml
vendored
18
.github/workflows/build_check_cache.yml
vendored
@@ -30,14 +30,16 @@ jobs:
|
||||
with:
|
||||
lfs: 'true'
|
||||
|
||||
- name: set outputs
|
||||
id: set_outputs
|
||||
env:
|
||||
dep-folder-name: ${{ inputs.os != 'macos-14' && '/OrcaSlicer_dep' || '' }}
|
||||
output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
|
||||
run: |
|
||||
echo cache-key=${{ inputs.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: set outputs
|
||||
id: set_outputs
|
||||
env:
|
||||
# Keep macOS cache keys and paths architecture-specific.
|
||||
cache-os: ${{ contains(inputs.os, 'macos') && format('macos-{0}', inputs.arch) || inputs.os }}
|
||||
dep-folder-name: ${{ contains(inputs.os, 'macos') && format('/{0}', inputs.arch) || '/OrcaSlicer_dep' }}
|
||||
output-cmd: ${{ inputs.os == 'windows-latest' && '$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
|
||||
|
||||
19
.github/workflows/build_deps.yml
vendored
19
.github/workflows/build_deps.yml
vendored
@@ -74,18 +74,15 @@ jobs:
|
||||
cd ${{ github.workspace }}/deps/build
|
||||
|
||||
- name: Build on Mac ${{ inputs.arch }}
|
||||
if: inputs.os == 'macos-14'
|
||||
if: contains(inputs.os, 'macos')
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
brew install automake texinfo libtool
|
||||
brew list
|
||||
brew uninstall --ignore-dependencies zstd
|
||||
./build_release_macos.sh -dx -a universal -t 10.15 -1
|
||||
for arch in arm64 x86_64; do
|
||||
(cd "${{ github.workspace }}/deps/build/${arch}" && \
|
||||
find . -mindepth 1 -maxdepth 1 ! -name 'OrcaSlicer_dep' -exec rm -rf {} +)
|
||||
done
|
||||
brew install zstd
|
||||
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
|
||||
@@ -104,7 +101,7 @@ jobs:
|
||||
|
||||
# Upload Artifacts
|
||||
# - name: Upload Mac ${{ inputs.arch }} artifacts
|
||||
# if: inputs.os == 'macos-14'
|
||||
# if: contains(inputs.os, 'macos')
|
||||
# uses: actions/upload-artifact@v6
|
||||
# with:
|
||||
# name: OrcaSlicer_dep_mac_${{ env.date }}
|
||||
|
||||
206
.github/workflows/build_orca.yml
vendored
206
.github/workflows/build_orca.yml
vendored
@@ -2,10 +2,10 @@ on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
cache-key:
|
||||
required: true
|
||||
required: false
|
||||
type: string
|
||||
cache-path:
|
||||
required: true
|
||||
required: false
|
||||
type: string
|
||||
os:
|
||||
required: true
|
||||
@@ -13,6 +13,10 @@ on:
|
||||
arch:
|
||||
required: false
|
||||
type: string
|
||||
macos-combine-only:
|
||||
required: false
|
||||
type: boolean
|
||||
default: false
|
||||
|
||||
jobs:
|
||||
build_orca:
|
||||
@@ -31,6 +35,7 @@ jobs:
|
||||
lfs: 'true'
|
||||
|
||||
- name: load cached deps
|
||||
if: ${{ !(contains(inputs.os, 'macos') && inputs.macos-combine-only) }}
|
||||
uses: actions/cache@v5
|
||||
with:
|
||||
path: ${{ inputs.cache-path }}
|
||||
@@ -86,14 +91,16 @@ jobs:
|
||||
|
||||
# Mac
|
||||
- name: Install tools mac
|
||||
if: inputs.os == 'macos-14'
|
||||
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only
|
||||
run: |
|
||||
brew install libtool
|
||||
brew list
|
||||
mkdir -p ${{ github.workspace }}/deps/build
|
||||
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: inputs.os == 'macos-14'
|
||||
if: contains(inputs.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 {} +
|
||||
@@ -101,16 +108,65 @@ jobs:
|
||||
df -hI /dev/disk3s1s1
|
||||
|
||||
- name: Build slicer mac
|
||||
if: inputs.os == 'macos-14'
|
||||
if: contains(inputs.os, 'macos') && !inputs.macos-combine-only
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
# TODO: Change back to -a universal after auto-update testing is complete
|
||||
./build_release_macos.sh -s -n -x -a arm64 -t 10.15 -1
|
||||
./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: contains(inputs.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: contains(inputs.os, 'macos') && !inputs.macos-combine-only
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}
|
||||
path: ${{ github.workspace }}/OrcaSlicer_Mac_bundle_${{ inputs.arch }}_${{ github.sha }}.tar.gz
|
||||
|
||||
- name: Download macOS arm64 app bundle
|
||||
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: OrcaSlicer_Mac_bundle_arm64_${{ github.sha }}
|
||||
path: ${{ github.workspace }}/mac_bundles/arm64
|
||||
|
||||
- name: Download macOS x86_64 app bundle
|
||||
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
uses: actions/download-artifact@v7
|
||||
with:
|
||||
name: OrcaSlicer_Mac_bundle_x86_64_${{ github.sha }}
|
||||
path: ${{ github.workspace }}/mac_bundles/x86_64
|
||||
|
||||
- name: Extract macOS app bundles
|
||||
if: contains(inputs.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/arm64" -name '*.tar.gz' -print -quit)
|
||||
x86_bundle=$(find "${{ github.workspace }}/mac_bundles/x86_64" -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: contains(inputs.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: contains(inputs.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
|
||||
# TODO: Remove feature/auto-update after testing is complete
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/feature/auto-update') && inputs.os == 'macos-14'
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/')) && contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
|
||||
@@ -124,123 +180,73 @@ jobs:
|
||||
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
|
||||
# TODO: Change build/arm64 back to build/universal after auto-update testing is complete
|
||||
codesign --deep --force --verbose --options runtime --timestamp --entitlements ${{ github.workspace }}/scripts/disable_validation.entitlements --sign "$CERTIFICATE_ID" ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app
|
||||
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/arm64/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/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app
|
||||
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/arm64/OrcaSlicer_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
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/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
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 store-credentials "notarytool-profile" --apple-id "${{ secrets.APPLE_DEV_ACCOUNT }}" --team-id "${{ secrets.TEAM_ID }}" --password "${{ secrets.APP_PWD }}"
|
||||
xcrun notarytool submit "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" --keychain-profile "notarytool-profile" --wait
|
||||
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" --keychain-profile "notarytool-profile" --wait
|
||||
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: Sign DMG for Sparkle auto-update
|
||||
# TODO: Remove feature/auto-update after testing is complete
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || github.ref == 'refs/heads/feature/auto-update') && inputs.os == 'macos-14'
|
||||
working-directory: ${{ github.workspace }}
|
||||
env:
|
||||
SPARKLE_PRIVATE_KEY: ${{ secrets.SPARKLE_PRIVATE_KEY }}
|
||||
run: |
|
||||
# Get the Sparkle sign_update tool from deps (installed to OrcaSlicer_dep/bin)
|
||||
SIGN_UPDATE="${{ github.workspace }}/deps/build/arm64/OrcaSlicer_dep/bin/sign_update"
|
||||
|
||||
# Fallback to x86_64 if arm64 not found
|
||||
if [ ! -f "$SIGN_UPDATE" ]; then
|
||||
SIGN_UPDATE="${{ github.workspace }}/deps/build/x86_64/OrcaSlicer_dep/bin/sign_update"
|
||||
fi
|
||||
|
||||
if [ -f "$SIGN_UPDATE" ] && [ -n "$SPARKLE_PRIVATE_KEY" ]; then
|
||||
# Write the private key to a temp file
|
||||
echo "$SPARKLE_PRIVATE_KEY" > /tmp/sparkle_private_key
|
||||
chmod 600 /tmp/sparkle_private_key
|
||||
|
||||
# Sign the DMG and capture the signature
|
||||
SIGNATURE=$("$SIGN_UPDATE" "OrcaSlicer_Mac_universal_${{ env.ver }}.dmg" -f /tmp/sparkle_private_key)
|
||||
|
||||
# Clean up the key file
|
||||
rm -f /tmp/sparkle_private_key
|
||||
|
||||
# Save signature to a file for later use in appcast generation
|
||||
echo "$SIGNATURE" > OrcaSlicer_Mac_universal_${{ env.ver }}.dmg.sig
|
||||
echo "Sparkle signature generated: $SIGNATURE"
|
||||
|
||||
# Also output as GitHub Actions output
|
||||
echo "sparkle_signature=$SIGNATURE" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "Warning: Sparkle sign_update tool not found at $SIGN_UPDATE or private key not set, skipping signature generation"
|
||||
if [ ! -f "$SIGN_UPDATE" ]; then
|
||||
echo "sign_update not found. Available files:"
|
||||
ls -la "${{ github.workspace }}/deps/build/arm64/OrcaSlicer_dep/" || true
|
||||
fi
|
||||
fi
|
||||
|
||||
- name: Create DMG without notary
|
||||
# TODO: Remove feature/auto-update exclusion after testing is complete
|
||||
if: github.ref != 'refs/heads/main' && github.ref != 'refs/heads/feature/auto-update' && !startsWith(github.ref, 'refs/heads/release/') && inputs.os == 'macos-14'
|
||||
if: github.ref != 'refs/heads/main' && contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
# TODO: Change build/arm64 back to build/universal after auto-update testing is complete
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer.app ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_dmg -ov -format UDZO OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
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/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
mkdir -p ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg
|
||||
rm -rf ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/*
|
||||
cp -R ${{ github.workspace }}/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/
|
||||
ln -sfn /Applications ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg/Applications
|
||||
hdiutil create -volname "OrcaSlicer Profile Validator" -srcfolder ${{ github.workspace }}/build/arm64/OrcaSlicer_profile_validator_dmg -ov -format UDZO OrcaSlicer_profile_validator_Mac_universal_${{ env.ver }}.dmg
|
||||
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: inputs.os == 'macos-14'
|
||||
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: OrcaSlicer_Mac_universal_${{ env.ver }}
|
||||
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg
|
||||
|
||||
- name: Upload Sparkle signature mac
|
||||
if: inputs.os == 'macos-14'
|
||||
uses: actions/upload-artifact@v5
|
||||
with:
|
||||
name: OrcaSlicer_Mac_universal_${{ env.ver }}_sig
|
||||
path: ${{ github.workspace }}/OrcaSlicer_Mac_universal_${{ env.ver }}.dmg.sig
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Upload OrcaSlicer_profile_validator DMG mac
|
||||
if: inputs.os == 'macos-14'
|
||||
if: contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
uses: actions/upload-artifact@v6
|
||||
with:
|
||||
name: OrcaSlicer_profile_validator_Mac_universal_DMG_${{ env.ver }}
|
||||
@@ -248,7 +254,7 @@ jobs:
|
||||
if-no-files-found: ignore
|
||||
|
||||
- name: Deploy Mac release
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && inputs.os == 'macos-14'
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
uses: WebFreak001/deploy-nightly@v3.2.0
|
||||
with:
|
||||
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
||||
@@ -259,7 +265,7 @@ jobs:
|
||||
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' && inputs.os == 'macos-14'
|
||||
if: github.repository == 'OrcaSlicer/OrcaSlicer' && github.ref == 'refs/heads/main' && contains(inputs.os, 'macos') && inputs.macos-combine-only
|
||||
uses: WebFreak001/deploy-nightly@v3.2.0
|
||||
with:
|
||||
upload_url: https://uploads.github.com/repos/OrcaSlicer/OrcaSlicer/releases/137995723/assets{?name,label}
|
||||
|
||||
84
.github/workflows/check_profiles.yml
vendored
84
.github/workflows/check_profiles.yml
vendored
@@ -1,8 +1,8 @@
|
||||
name: Check profiles
|
||||
on:
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- 'resources/profiles/**'
|
||||
- ".github/workflows/check_profiles.yml"
|
||||
@@ -10,25 +10,33 @@ on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
logLevel:
|
||||
description: 'Log level'
|
||||
description: 'Log level'
|
||||
required: true
|
||||
default: 'warning'
|
||||
|
||||
permissions:
|
||||
pull-requests: write
|
||||
contents: read
|
||||
|
||||
|
||||
jobs:
|
||||
check_translation:
|
||||
name: Check profiles
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v6
|
||||
|
||||
- name: Run extra JSON check
|
||||
id: extra_json_check
|
||||
continue-on-error: true
|
||||
run: |
|
||||
python3 ./scripts/orca_extra_profile_check.py
|
||||
set +e
|
||||
python3 ./scripts/orca_extra_profile_check.py 2>&1 | tee ${{ runner.temp }}/extra_json_check.log
|
||||
exit ${PIPESTATUS[0]}
|
||||
|
||||
# download
|
||||
- name: Download
|
||||
- name: Download
|
||||
working-directory: ${{ github.workspace }}
|
||||
run: |
|
||||
curl -LJO https://github.com/SoftFever/Orca_tools/releases/download/1/OrcaSlicer_profile_validator
|
||||
@@ -36,15 +44,71 @@ jobs:
|
||||
|
||||
# validate profiles
|
||||
- name: validate system profiles
|
||||
id: validate_system
|
||||
continue-on-error: true
|
||||
run: |
|
||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2
|
||||
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 ./orca_custom_preset_tests.zip -d ${{ github.workspace }}/resources/profiles
|
||||
./OrcaSlicer_profile_validator -p ${{ github.workspace }}/resources/profiles -l 2
|
||||
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: Post error comment on PR
|
||||
if: ${{ always() && github.event_name == 'pull_request' && (steps.extra_json_check.outcome == 'failure' || steps.validate_system.outcome == 'failure' || steps.validate_custom.outcome == 'failure') }}
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
{
|
||||
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 }}/pr_comment.md
|
||||
|
||||
gh pr comment ${{ github.event.pull_request.number }} --body-file ${{ runner.temp }}/pr_comment.md
|
||||
|
||||
- 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
|
||||
|
||||
|
||||
|
||||
|
||||
138
.github/workflows/generate_appcast.yml
vendored
138
.github/workflows/generate_appcast.yml
vendored
@@ -1,138 +0,0 @@
|
||||
name: Generate Appcast
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version to generate appcast for (e.g., 2.3.2)'
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
generate_appcast:
|
||||
name: Generate and Deploy Appcast
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Get version from release or input
|
||||
id: version
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" == "release" ]; then
|
||||
VERSION="${{ github.event.release.tag_name }}"
|
||||
VERSION="${VERSION#v}" # Remove 'v' prefix if present
|
||||
else
|
||||
VERSION="${{ github.event.inputs.version }}"
|
||||
fi
|
||||
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
||||
echo "Version: $VERSION"
|
||||
|
||||
- name: Download release assets info
|
||||
id: assets
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TAG="v$VERSION"
|
||||
|
||||
# Get release info
|
||||
RELEASE_URL="https://github.com/${{ github.repository }}/releases/tag/$TAG"
|
||||
echo "release_url=$RELEASE_URL" >> $GITHUB_OUTPUT
|
||||
|
||||
# Get macOS DMG URL and size
|
||||
# Use browser_download_url for public access (not .url which is the API endpoint)
|
||||
MAC_ASSET=$(gh release view "$TAG" --json assets -q '.assets[] | select(.name | contains("Mac_universal")) | select(.name | endswith(".dmg"))')
|
||||
if [ -n "$MAC_ASSET" ]; then
|
||||
MAC_URL=$(echo "$MAC_ASSET" | jq -r '.browser_download_url // .url')
|
||||
MAC_SIZE=$(echo "$MAC_ASSET" | jq -r '.size')
|
||||
echo "mac_url=$MAC_URL" >> $GITHUB_OUTPUT
|
||||
echo "mac_size=$MAC_SIZE" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
# Get Windows installer URL and size
|
||||
# Use browser_download_url for public access (not .url which is the API endpoint)
|
||||
WIN_ASSET=$(gh release view "$TAG" --json assets -q '.assets[] | select(.name | contains("Windows_Installer")) | select(.name | endswith(".exe"))')
|
||||
if [ -n "$WIN_ASSET" ]; then
|
||||
WIN_URL=$(echo "$WIN_ASSET" | jq -r '.browser_download_url // .url')
|
||||
WIN_SIZE=$(echo "$WIN_ASSET" | jq -r '.size')
|
||||
echo "win_url=$WIN_URL" >> $GITHUB_OUTPUT
|
||||
echo "win_size=$WIN_SIZE" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- name: Download signatures
|
||||
id: signatures
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
VERSION="${{ steps.version.outputs.version }}"
|
||||
TAG="v$VERSION"
|
||||
|
||||
# Try to download macOS signature artifact
|
||||
MAC_SIG_ARTIFACT="OrcaSlicer_Mac_universal_V${VERSION}_sig"
|
||||
if gh run download --name "$MAC_SIG_ARTIFACT" -D /tmp/mac_sig 2>/dev/null; then
|
||||
MAC_SIG=$(cat /tmp/mac_sig/*.sig)
|
||||
echo "mac_signature=$MAC_SIG" >> $GITHUB_OUTPUT
|
||||
echo "Found macOS signature: $MAC_SIG"
|
||||
else
|
||||
echo "No macOS signature artifact found"
|
||||
fi
|
||||
|
||||
# For Windows, signature would come from WinSparkle signing (if implemented)
|
||||
# echo "win_signature=$WIN_SIG" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Generate appcast.xml
|
||||
run: |
|
||||
python scripts/generate_appcast.py \
|
||||
--version "${{ steps.version.outputs.version }}" \
|
||||
--release-notes-url "${{ steps.assets.outputs.release_url }}" \
|
||||
--mac-url "${{ steps.assets.outputs.mac_url }}" \
|
||||
--mac-signature "${{ steps.signatures.outputs.mac_signature }}" \
|
||||
--mac-length "${{ steps.assets.outputs.mac_size }}" \
|
||||
--output appcast.xml
|
||||
|
||||
echo "Generated appcast.xml:"
|
||||
cat appcast.xml
|
||||
|
||||
- name: Upload appcast artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: appcast
|
||||
path: appcast.xml
|
||||
|
||||
# Deploy to Cloudflare KV (for check-version.orcaslicer.com Worker)
|
||||
- name: Deploy appcast to Cloudflare KV
|
||||
if: github.event_name == 'release'
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
KV_NAMESPACE_ID: ${{ secrets.CLOUDFLARE_KV_APPCAST_ID }}
|
||||
run: |
|
||||
if [ -n "$CLOUDFLARE_API_TOKEN" ] && [ -n "$CLOUDFLARE_ACCOUNT_ID" ] && [ -n "$KV_NAMESPACE_ID" ]; then
|
||||
# Deploy appcast.xml
|
||||
curl -X PUT \
|
||||
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/storage/kv/namespaces/$KV_NAMESPACE_ID/values/appcast.xml" \
|
||||
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
|
||||
-H "Content-Type: text/plain" \
|
||||
--data-binary @appcast.xml
|
||||
echo "Appcast deployed to Cloudflare KV"
|
||||
|
||||
# Deploy macOS signature file (for verification/auditing)
|
||||
if [ -n "${{ steps.signatures.outputs.mac_signature }}" ]; then
|
||||
echo "${{ steps.signatures.outputs.mac_signature }}" > mac_signature.txt
|
||||
curl -X PUT \
|
||||
"https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/storage/kv/namespaces/$KV_NAMESPACE_ID/values/signatures/${{ steps.version.outputs.version }}/mac.sig" \
|
||||
-H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
|
||||
-H "Content-Type: text/plain" \
|
||||
--data-binary @mac_signature.txt
|
||||
echo "macOS signature deployed to Cloudflare KV"
|
||||
fi
|
||||
else
|
||||
echo "Cloudflare credentials not configured, skipping deployment"
|
||||
fi
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -36,6 +36,7 @@ src/OrcaSlicer-doc/
|
||||
/deps/DL_CACHE/
|
||||
/deps/DL_CACHE
|
||||
**/.flatpak-builder/
|
||||
*.no-debug.yml
|
||||
resources/profiles/user/default
|
||||
*.code-workspace
|
||||
deps_src/build/
|
||||
@@ -43,5 +44,3 @@ test.js
|
||||
/.cache/
|
||||
.clangd
|
||||
internal_docs/
|
||||
# Sparkle auto-update test artifacts
|
||||
/.sparkle-test/
|
||||
|
||||
77
CLAUDE.md
77
CLAUDE.md
@@ -9,68 +9,43 @@ OrcaSlicer is an open-source 3D slicer application forked from Bambu Studio, bui
|
||||
## Build Commands
|
||||
|
||||
### Building on Windows
|
||||
**Always use this command to build the project when testing build issues on Windows.**
|
||||
```bash
|
||||
# Build everything
|
||||
build_release_vs2022.bat
|
||||
|
||||
# Build with debug symbols
|
||||
build_release_vs2022.bat debug
|
||||
|
||||
# Build only dependencies
|
||||
build_release_vs2022.bat deps
|
||||
|
||||
# Build only slicer (after deps are built)
|
||||
build_release_vs2022.bat slicer
|
||||
|
||||
|
||||
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
|
||||
# Build everything (dependencies and slicer)
|
||||
./build_release_macos.sh
|
||||
|
||||
# Build only dependencies
|
||||
./build_release_macos.sh -d
|
||||
|
||||
# Build only slicer (after deps are built)
|
||||
./build_release_macos.sh -s
|
||||
|
||||
# Use Ninja generator for faster builds
|
||||
./build_release_macos.sh -x
|
||||
|
||||
# Build for specific architecture
|
||||
./build_release_macos.sh -a arm64 # or x86_64 or universal
|
||||
|
||||
# Build for specific macOS version target
|
||||
./build_release_macos.sh -t 11.3
|
||||
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
|
||||
# First time setup - install system dependencies
|
||||
./build_linux.sh -u
|
||||
cmake --build build/arm64 --config RelWithDebInfo --target all --
|
||||
|
||||
# Build dependencies and slicer
|
||||
./build_linux.sh -dsi
|
||||
|
||||
# Build everything (alternative)
|
||||
./build_linux.sh -dsi
|
||||
|
||||
# Individual options:
|
||||
./build_linux.sh -d # dependencies only
|
||||
./build_linux.sh -s # slicer only
|
||||
./build_linux.sh -i # build AppImage
|
||||
|
||||
# Performance and debug options:
|
||||
./build_linux.sh -j N # limit to N cores
|
||||
./build_linux.sh -1 # single core build
|
||||
./build_linux.sh -b # Debug build
|
||||
./build_linux.sh -e # RelWithDebInfo build
|
||||
./build_linux.sh -c # clean build
|
||||
./build_linux.sh -r # skip RAM/disk checks
|
||||
./build_linux.sh -l # use Clang instead of GCC
|
||||
```
|
||||
### 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/arm64 --config RelWithDebInfo --target all --
|
||||
|
||||
```
|
||||
|
||||
|
||||
### Build System
|
||||
- Uses CMake with minimum version 3.13 (maximum 3.31.x on Windows)
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
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
|
||||
@@ -125,7 +129,7 @@ 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_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 perfoming desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
|
||||
CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow performing desktop integration during runtime" 1 "NOT SLIC3R_FHS" 0)
|
||||
|
||||
set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
|
||||
|
||||
@@ -432,7 +436,11 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
|
||||
endif()
|
||||
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "AppleClang") AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_GREATER 15)
|
||||
add_compile_options(-Wno-error=enum-constexpr-conversion)
|
||||
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
|
||||
@@ -571,6 +579,7 @@ endif()
|
||||
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)
|
||||
|
||||
add_library(boost_libs INTERFACE)
|
||||
@@ -688,6 +697,10 @@ 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
|
||||
@@ -722,7 +735,7 @@ add_custom_target(gettext_make_pot
|
||||
)
|
||||
add_custom_target(gettext_merge_po_with_pot
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||
COMMENT "Merge localization po with new generted pot file"
|
||||
COMMENT "Merge localization po with new generated pot file"
|
||||
)
|
||||
file(GLOB BBL_L10N_PO_FILES "${BBL_L18N_DIR}/*/OrcaSlicer*.po")
|
||||
foreach(po_file ${BBL_L10N_PO_FILES})
|
||||
@@ -811,11 +824,6 @@ function(orcaslicer_copy_dlls target config postfix output_dlls)
|
||||
${TOP_LEVEL_PROJECT_DIR}/deps/WebView2/lib/win-${_arch}/WebView2Loader.dll
|
||||
DESTINATION ${_out_dir})
|
||||
|
||||
# WinSparkle for auto-updates
|
||||
if(EXISTS "${CMAKE_PREFIX_PATH}/bin/WinSparkle.dll")
|
||||
file(COPY ${CMAKE_PREFIX_PATH}/bin/WinSparkle.dll DESTINATION ${_out_dir})
|
||||
endif()
|
||||
|
||||
file(COPY ${CMAKE_PREFIX_PATH}/bin/occt/TKBO.dll
|
||||
${CMAKE_PREFIX_PATH}/bin/occt/TKBRep.dll
|
||||
${CMAKE_PREFIX_PATH}/bin/occt/TKCAF.dll
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<img alt="OrcaSlicer logo" src="resources/images/OrcaSlicer.png" width="15%" height="15%">
|
||||
</picture>
|
||||
|
||||
<a href="https://trendshift.io/repositories/952" target="_blank"><img src="https://trendshift.io/api/badge/repositories/952" alt="SoftFever%2FOrcaSlicer | Trendshift" style="width: 250px; height: 55px;" width="250" height="55"/></a>
|
||||
<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>
|
||||
|
||||
[](https://github.com/OrcaSlicer/OrcaSlicer/stargazers) [](https://github.com/OrcaSlicer/OrcaSlicer/actions/workflows/build_all.yml)
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@ INSTALL_RUNTIME=false
|
||||
JOBS=$(nproc)
|
||||
FORCE_CLEAN=false
|
||||
ENABLE_CCACHE=false
|
||||
DISABLE_ROFILES_FUSE=false
|
||||
NO_DEBUGINFO=true
|
||||
CACHE_DIR=".flatpak-builder"
|
||||
|
||||
# Help function
|
||||
@@ -36,6 +38,8 @@ show_help() {
|
||||
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"
|
||||
@@ -75,6 +79,14 @@ while [[ $# -gt 0 ]]; do
|
||||
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
|
||||
@@ -242,8 +254,8 @@ mkdir -p "$BUILD_DIR"
|
||||
rm -rf "$BUILD_DIR/build-dir"
|
||||
|
||||
# Check if flatpak manifest exists
|
||||
if [[ ! -f "./scripts/flatpak/io.github.softfever.OrcaSlicer.yml" ]]; then
|
||||
echo -e "${RED}Error: Flatpak manifest not found at scripts/flatpak/io.github.softfever.OrcaSlicer.yml${NC}"
|
||||
if [[ ! -f "./scripts/flatpak/io.github.orcaslicer.OrcaSlicer.yml" ]]; then
|
||||
echo -e "${RED}Error: Flatpak manifest not found at scripts/flatpak/io.github.orcaslicer.OrcaSlicer.yml${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@@ -279,6 +291,7 @@ BUILDER_ARGS=(
|
||||
--verbose
|
||||
--state-dir="$CACHE_DIR"
|
||||
--jobs="$JOBS"
|
||||
--mirror-screenshots-url=https://dl.flathub.org/media/
|
||||
)
|
||||
|
||||
# Add force-clean only if explicitly requested (disables caching)
|
||||
@@ -295,21 +308,40 @@ if [[ "$ENABLE_CCACHE" == true ]]; then
|
||||
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/io.github.orcaslicer.OrcaSlicer.yml"
|
||||
if [[ "$NO_DEBUGINFO" == true ]]; then
|
||||
MANIFEST="scripts/flatpak/io.github.orcaslicer.OrcaSlicer.no-debug.yml"
|
||||
sed '0,/^finish-args:/s//build-options:\n no-debuginfo: true\n strip: true\nfinish-args:/' \
|
||||
scripts/flatpak/io.github.orcaslicer.OrcaSlicer.yml > "$MANIFEST"
|
||||
echo -e "${YELLOW}Debug info disabled (using temp manifest)${NC}"
|
||||
fi
|
||||
|
||||
if ! flatpak-builder \
|
||||
"${BUILDER_ARGS[@]}" \
|
||||
"$BUILD_DIR/build-dir" \
|
||||
scripts/flatpak/io.github.softfever.OrcaSlicer.yml; then
|
||||
"$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/io.github.orcaslicer.OrcaSlicer.no-debug.yml"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Clean up temp manifest
|
||||
rm -f "scripts/flatpak/io.github.orcaslicer.OrcaSlicer.no-debug.yml"
|
||||
|
||||
# Create bundle
|
||||
echo -e "${YELLOW}Creating Flatpak bundle...${NC}"
|
||||
if ! flatpak build-bundle \
|
||||
"$BUILD_DIR/repo" \
|
||||
"$BUNDLE_NAME" \
|
||||
io.github.softfever.OrcaSlicer \
|
||||
io.github.orcaslicer.OrcaSlicer \
|
||||
--arch="$ARCH"; then
|
||||
echo -e "${RED}Error: Failed to create Flatpak bundle${NC}"
|
||||
exit 1
|
||||
@@ -328,10 +360,10 @@ 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 io.github.softfever.OrcaSlicer"
|
||||
echo -e "flatpak run io.github.orcaslicer.OrcaSlicer"
|
||||
echo ""
|
||||
echo -e "${BLUE}To uninstall:${NC}"
|
||||
echo -e "flatpak uninstall --user io.github.softfever.OrcaSlicer"
|
||||
echo -e "flatpak uninstall --user io.github.orcaslicer.OrcaSlicer"
|
||||
echo ""
|
||||
if [[ "$FORCE_CLEAN" != true ]]; then
|
||||
echo -e "${BLUE}Cache Management:${NC}"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
while getopts ":dpa:snt:xbc:1h" opt; do
|
||||
while getopts ":dpa:snt:xbc:1Tuh" opt; do
|
||||
case "${opt}" in
|
||||
d )
|
||||
export BUILD_TARGET="deps"
|
||||
@@ -37,16 +37,24 @@ while getopts ":dpa:snt:xbc:1h" opt; do
|
||||
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 " -1: Use single job for building"
|
||||
echo " -T: Build and run tests"
|
||||
exit 0
|
||||
;;
|
||||
* )
|
||||
@@ -85,6 +93,15 @@ if [ -z "$OSX_DEPLOYMENT_TARGET" ]; then
|
||||
export OSX_DEPLOYMENT_TARGET="11.3"
|
||||
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"
|
||||
@@ -133,7 +150,8 @@ function build_deps() {
|
||||
-G "${DEPS_CMAKE_GENERATOR}" \
|
||||
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
|
||||
-DCMAKE_OSX_ARCHITECTURES:STRING="${_ARCH}" \
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}"
|
||||
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
|
||||
${CMAKE_POLICY_COMPAT}
|
||||
fi
|
||||
cmake --build . --config "$BUILD_CONFIG" --target deps
|
||||
)
|
||||
@@ -170,13 +188,24 @@ function build_slicer() {
|
||||
-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_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" \
|
||||
${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"
|
||||
@@ -224,48 +253,54 @@ function build_slicer() {
|
||||
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"
|
||||
|
||||
# Create universal binary
|
||||
echo "Creating universal binary..."
|
||||
# PROJECT_BUILD_DIR="$PROJECT_DIR/build_Universal"
|
||||
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 "$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer.app" "$UNIVERSAL_APP"
|
||||
|
||||
# Get the binary path inside the .app bundle
|
||||
BINARY_PATH="Contents/MacOS/OrcaSlicer"
|
||||
|
||||
# Create universal binary using lipo
|
||||
lipo -create \
|
||||
"$PROJECT_DIR/build/x86_64/OrcaSlicer/OrcaSlicer.app/$BINARY_PATH" \
|
||||
"$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer.app/$BINARY_PATH" \
|
||||
-output "$UNIVERSAL_APP/$BINARY_PATH"
|
||||
|
||||
echo "Universal binary created at $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
|
||||
if [ -f "$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ] && \
|
||||
[ -f "$PROJECT_DIR/build/x86_64/OrcaSlicer/OrcaSlicer_profile_validator.app/Contents/MacOS/OrcaSlicer_profile_validator" ]; then
|
||||
echo "Creating universal binary for OrcaSlicer_profile_validator..."
|
||||
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 "$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app" "$UNIVERSAL_VALIDATOR_APP"
|
||||
|
||||
# Get the binary path inside the profile validator .app bundle
|
||||
VALIDATOR_BINARY_PATH="Contents/MacOS/OrcaSlicer_profile_validator"
|
||||
|
||||
# Create universal binary using lipo
|
||||
lipo -create \
|
||||
"$PROJECT_DIR/build/x86_64/OrcaSlicer/OrcaSlicer_profile_validator.app/$VALIDATOR_BINARY_PATH" \
|
||||
"$PROJECT_DIR/build/arm64/OrcaSlicer/OrcaSlicer_profile_validator.app/$VALIDATOR_BINARY_PATH" \
|
||||
-output "$UNIVERSAL_VALIDATOR_APP/$VALIDATOR_BINARY_PATH"
|
||||
|
||||
echo "Universal binary for OrcaSlicer_profile_validator created at $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
|
||||
}
|
||||
|
||||
@@ -280,13 +315,16 @@ case "${BUILD_TARGET}" in
|
||||
slicer)
|
||||
build_slicer
|
||||
;;
|
||||
universal)
|
||||
build_universal
|
||||
;;
|
||||
*)
|
||||
echo "Unknown target: $BUILD_TARGET. Available targets: deps, slicer, all."
|
||||
echo "Unknown target: $BUILD_TARGET. Available targets: deps, slicer, universal, all."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$ARCH" = "universal" ] && [ "$BUILD_TARGET" != "deps" ]; then
|
||||
if [ "$ARCH" = "universal" ] && { [ "$BUILD_TARGET" = "all" ] || [ "$BUILD_TARGET" = "slicer" ]; }; then
|
||||
build_universal
|
||||
fi
|
||||
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
@echo off
|
||||
set WP=%CD%
|
||||
|
||||
@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...
|
||||
|
||||
@@ -50,6 +63,8 @@ if "%VS_MAJOR%"=="16" (
|
||||
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
|
||||
@@ -96,8 +111,13 @@ echo "building deps.."
|
||||
echo on
|
||||
REM Set minimum CMake policy to avoid <3.5 errors
|
||||
set CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
cmake ../ -G %CMAKE_GENERATOR% -A x64 -DCMAKE_BUILD_TYPE=%build_type%
|
||||
cmake --build . --config %build_type% --target deps -- -m
|
||||
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" exit /b 0
|
||||
@@ -110,8 +130,13 @@ cd %build_dir%
|
||||
|
||||
echo on
|
||||
set CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
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
|
||||
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
|
||||
|
||||
26
cmake/modules/FindDraco.cmake
Normal file
26
cmake/modules/FindDraco.cmake
Normal file
@@ -0,0 +1,26 @@
|
||||
set(_q "")
|
||||
if(${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||
set(_q QUIET)
|
||||
set(_quietly TRUE)
|
||||
endif()
|
||||
find_package(${CMAKE_FIND_PACKAGE_NAME} ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG ${_q})
|
||||
|
||||
if (NOT ${CMAKE_FIND_PACKAGE_NAME}_FOUND)
|
||||
include(CheckIncludeFileCXX)
|
||||
add_library(draco INTERFACE)
|
||||
target_include_directories(draco INTERFACE include)
|
||||
|
||||
if (_quietly)
|
||||
set(CMAKE_REQUIRED_QUIET ON)
|
||||
endif()
|
||||
CHECK_INCLUDE_FILE_CXX("draco/draco_features.h" HAVE_DRACO_H)
|
||||
|
||||
if (NOT HAVE_DRACO_H)
|
||||
if (${CMAKE_FIND_PACKAGE_NAME}_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Draco library not found. Please install the dependency.")
|
||||
elseif(NOT _quietly)
|
||||
message(WARNING "Draco library not found.")
|
||||
endif()
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
# PrusaSlicer specifics:
|
||||
# This file is backported from CMake 3.15 distribution to behave uniformly
|
||||
# across all versions of CMake. It explicitly adds GLEW_STATIC complile
|
||||
# across all versions of CMake. It explicitly adds GLEW_STATIC compile
|
||||
# definition to static targets which is needed to prevent link errors.
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
@@ -223,8 +223,13 @@ if(NOT TARGET GLEW::glew AND NOT GLEW_USE_STATIC_LIBS)
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(GLEW::glew
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set_target_properties(GLEW::glew
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "-framework OpenGL")
|
||||
else()
|
||||
set_target_properties(GLEW::glew
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GLEW_SHARED_LIBRARY_RELEASE)
|
||||
@@ -258,8 +263,13 @@ elseif(NOT TARGET GLEW::glew_s AND GLEW_USE_STATIC_LIBS)
|
||||
set_target_properties(GLEW::glew_s PROPERTIES INTERFACE_COMPILE_DEFINITIONS GLEW_STATIC)
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(GLEW::glew_s
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set_target_properties(GLEW::glew_s
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "-framework OpenGL")
|
||||
else()
|
||||
set_target_properties(GLEW::glew_s
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(GLEW_STATIC_LIBRARY_RELEASE)
|
||||
@@ -292,8 +302,13 @@ if(NOT TARGET GLEW::GLEW)
|
||||
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${GLEW_INCLUDE_DIRS}")
|
||||
|
||||
if(APPLE)
|
||||
set_target_properties(GLEW::GLEW
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set_target_properties(GLEW::GLEW
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES "-framework OpenGL")
|
||||
else()
|
||||
set_target_properties(GLEW::GLEW
|
||||
PROPERTIES INTERFACE_LINK_LIBRARIES OpenGL::GL)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(TARGET GLEW::glew)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
#
|
||||
# * TBB_FOUND - Set to false, or undefined, if we haven’t found, or
|
||||
# don’t want to use TBB.
|
||||
# * TBB_<component>_FOUND - If False, optional <component> part of TBB sytem is
|
||||
# * TBB_<component>_FOUND - If False, optional <component> part of TBB system is
|
||||
# not available.
|
||||
# * TBB_VERSION - The full version string
|
||||
# * TBB_VERSION_MAJOR - The major version
|
||||
@@ -77,7 +77,7 @@
|
||||
# tbbmalloc, tbbmalloc_debug, tbb_preview, or
|
||||
# tbb_preview_debug.
|
||||
#
|
||||
# The following varibles should be used to build and link with TBB:
|
||||
# The following variables should be used to build and link with TBB:
|
||||
#
|
||||
# * TBB_INCLUDE_DIRS - The include directory for TBB.
|
||||
# * TBB_LIBRARIES - The libraries to link against to use TBB.
|
||||
|
||||
@@ -131,22 +131,13 @@
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<key>NSAppTransportSecurity</key>
|
||||
<dict>
|
||||
<!-- Disable App Transport Security. Resolves https://github.com/OrcaSlicer/OrcaSlicer/issues/791 -->
|
||||
<key>NSAllowsArbitraryLoads</key>
|
||||
<true/>
|
||||
<true/>
|
||||
<key>NSAllowsArbitraryLoadsInWebContent</key>
|
||||
<true/>
|
||||
</dict>
|
||||
<!-- Sparkle 2 Auto-Update Configuration -->
|
||||
<key>SUFeedURL</key>
|
||||
<string>https://check-version.orcaslicer.com/appcast.xml</string>
|
||||
<key>SUPublicEDKey</key>
|
||||
<string>eLFARgt9i0VZQR4FtXiTL6jdwjkGr2RMPjfYCCfBWeM=</string>
|
||||
<key>SUEnableAutomaticChecks</key>
|
||||
<true/>
|
||||
<key>SUAllowsAutomaticUpdates</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
1
deps/Boost/Boost.cmake
vendored
1
deps/Boost/Boost.cmake
vendored
@@ -18,6 +18,7 @@ orcaslicer_add_cmake_project(Boost
|
||||
-DBOOST_EXCLUDE_LIBRARIES:STRING=contract|fiber|numpy|stacktrace|wave|test
|
||||
-DBOOST_LOCALE_ENABLE_ICU:BOOL=OFF # do not link to libicu, breaks compatibility between distros
|
||||
-DBUILD_TESTING:BOOL=OFF
|
||||
-DBOOST_IOSTREAMS_ENABLE_ZSTD:BOOL=OFF
|
||||
"${_context_abi_line}"
|
||||
"${_context_arch_line}"
|
||||
)
|
||||
|
||||
30
deps/CMakeLists.txt
vendored
30
deps/CMakeLists.txt
vendored
@@ -1,3 +1,7 @@
|
||||
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.0")
|
||||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "" FORCE)
|
||||
endif()
|
||||
|
||||
#
|
||||
# This CMake project downloads, configures and builds OrcaSlicer dependencies on Unix and Windows.
|
||||
#
|
||||
@@ -16,8 +20,8 @@
|
||||
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
||||
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
||||
#
|
||||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-conffig` utility,
|
||||
# therefore, unfortunatelly, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-config` utility,
|
||||
# therefore, unfortunately, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||||
#
|
||||
|
||||
cmake_minimum_required(VERSION 3.2)
|
||||
@@ -177,6 +181,7 @@ if (NOT IS_CROSS_COMPILE OR NOT APPLE)
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||||
${_gen}
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
|
||||
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
|
||||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
|
||||
@@ -221,6 +226,7 @@ else()
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||||
${_gen}
|
||||
CMAKE_ARGS
|
||||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
|
||||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
|
||||
-DBUILD_SHARED_LIBS:BOOL=OFF
|
||||
@@ -330,6 +336,8 @@ include(CGAL/CGAL.cmake)
|
||||
include(NLopt/NLopt.cmake)
|
||||
include(libnoise/libnoise.cmake)
|
||||
|
||||
include(Draco/Draco.cmake)
|
||||
|
||||
|
||||
# I *think* 1.1 is used for *just* md5 hashing?
|
||||
# 3.1 has everything in the right place, but the md5 funcs used are deprecated
|
||||
@@ -386,16 +394,6 @@ endif ()
|
||||
include(OCCT/OCCT.cmake)
|
||||
include(OpenCV/OpenCV.cmake)
|
||||
|
||||
# WinSparkle for Windows auto-updates
|
||||
if(WIN32)
|
||||
include(WinSparkle/WinSparkle.cmake)
|
||||
endif()
|
||||
|
||||
# Sparkle 2 for macOS auto-updates
|
||||
if(APPLE)
|
||||
include(Sparkle/Sparkle.cmake)
|
||||
endif()
|
||||
|
||||
set(_dep_list
|
||||
dep_Boost
|
||||
dep_TBB
|
||||
@@ -403,6 +401,7 @@ set(_dep_list
|
||||
${CURL_PKG}
|
||||
${WXWIDGETS_PKG}
|
||||
dep_Cereal
|
||||
dep_Draco
|
||||
dep_NLopt
|
||||
dep_OpenVDB
|
||||
dep_OpenCSG
|
||||
@@ -420,19 +419,12 @@ set(_dep_list
|
||||
if (MSVC)
|
||||
# Experimental
|
||||
#list(APPEND _dep_list "dep_qhull")
|
||||
# WinSparkle for auto-updates
|
||||
list(APPEND _dep_list "dep_WinSparkle")
|
||||
else()
|
||||
list(APPEND _dep_list "dep_Qhull")
|
||||
# Not working, static build has different Eigen
|
||||
#list(APPEND _dep_list "dep_libigl")
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
# Sparkle 2 for auto-updates
|
||||
list(APPEND _dep_list "dep_Sparkle")
|
||||
endif()
|
||||
|
||||
add_custom_target(deps ALL DEPENDS ${_dep_list})
|
||||
|
||||
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
|
||||
|
||||
4
deps/Draco/Draco.cmake
vendored
Normal file
4
deps/Draco/Draco.cmake
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
orcaslicer_add_cmake_project(Draco
|
||||
URL https://github.com/google/draco/archive/refs/tags/1.5.7.zip
|
||||
URL_HASH SHA256=27b72ba2d5ff3d0a9814ad40d4cb88f8dc89a35491c0866d952473f8f9416b77
|
||||
)
|
||||
2
deps/GLEW/GLEW.cmake
vendored
2
deps/GLEW/GLEW.cmake
vendored
@@ -5,6 +5,8 @@ find_package(OpenGL QUIET REQUIRED)
|
||||
orcaslicer_add_cmake_project(
|
||||
GLEW
|
||||
SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/glew
|
||||
CMAKE_ARGS
|
||||
-DGLEW_USE_EGL=OFF
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
|
||||
12
deps/GLEW/glew/CMakeLists.txt
vendored
12
deps/GLEW/glew/CMakeLists.txt
vendored
@@ -3,9 +3,17 @@ project(GLEW)
|
||||
|
||||
find_package(OpenGL REQUIRED)
|
||||
|
||||
if(OpenGL_EGL_FOUND)
|
||||
message(STATUS "building GLEW for EGL (hope that wxWidgets agrees, otherwise you won't have any output!)")
|
||||
# Allow parent project to control EGL usage.
|
||||
# Default to OFF since OrcaSlicer forces GDK_BACKEND=x11 (using GLX contexts).
|
||||
# GLEW must use glXGetProcAddressARB (GLX) to match wxWidgets GL canvas.
|
||||
# Using EGL function loading with GLX contexts causes rendering failures.
|
||||
option(GLEW_USE_EGL "Use EGL instead of GLX for OpenGL function loading" OFF)
|
||||
|
||||
if(GLEW_USE_EGL)
|
||||
message(STATUS "Building GLEW with EGL support")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DGLEW_EGL")
|
||||
else()
|
||||
message(STATUS "Building GLEW with GLX support")
|
||||
endif()
|
||||
|
||||
add_library(GLEW src/glew.c)
|
||||
|
||||
27
deps/Sparkle/Sparkle.cmake
vendored
27
deps/Sparkle/Sparkle.cmake
vendored
@@ -1,27 +0,0 @@
|
||||
# Sparkle 2 - Auto-update framework for macOS
|
||||
# https://sparkle-project.org/
|
||||
# https://github.com/sparkle-project/Sparkle
|
||||
#
|
||||
# Sparkle is distributed as a pre-built framework, so we just download and extract.
|
||||
|
||||
if(APPLE)
|
||||
set(SPARKLE_VERSION "2.8.1")
|
||||
|
||||
ExternalProject_Add(
|
||||
dep_Sparkle
|
||||
EXCLUDE_FROM_ALL ON
|
||||
URL "https://github.com/sparkle-project/Sparkle/releases/download/${SPARKLE_VERSION}/Sparkle-${SPARKLE_VERSION}.tar.xz"
|
||||
URL_HASH SHA256=5cddb7695674ef7704268f38eccaee80e3accbf19e61c1689efff5b6116d85be
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/Sparkle
|
||||
# No build step needed - just install pre-built framework and tools
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/Frameworks
|
||||
# Use ditto to preserve symlinks in framework bundle (cmake -E copy_directory breaks symlinks)
|
||||
COMMAND ditto <SOURCE_DIR>/Sparkle.framework ${DESTDIR}/Frameworks/Sparkle.framework
|
||||
# Also install the Sparkle CLI tools (sign_update, generate_appcast) for CI/CD signing
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${DESTDIR}/bin
|
||||
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/bin/sign_update ${DESTDIR}/bin/sign_update
|
||||
COMMAND ${CMAKE_COMMAND} -E copy <SOURCE_DIR>/bin/generate_appcast ${DESTDIR}/bin/generate_appcast
|
||||
)
|
||||
endif()
|
||||
33
deps/WinSparkle/WinSparkle.cmake
vendored
33
deps/WinSparkle/WinSparkle.cmake
vendored
@@ -1,33 +0,0 @@
|
||||
# WinSparkle - Auto-update framework for Windows
|
||||
# https://winsparkle.org/
|
||||
# https://github.com/vslavik/winsparkle
|
||||
#
|
||||
# WinSparkle is distributed as pre-built binaries, so we just download and extract.
|
||||
|
||||
if(WIN32)
|
||||
set(WINSPARKLE_VERSION "0.8.3")
|
||||
|
||||
# Determine architecture
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(WINSPARKLE_ARCH "x64")
|
||||
else()
|
||||
set(WINSPARKLE_ARCH "x86")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
dep_WinSparkle
|
||||
EXCLUDE_FROM_ALL ON
|
||||
URL "https://github.com/vslavik/winsparkle/releases/download/v${WINSPARKLE_VERSION}/WinSparkle-${WINSPARKLE_VERSION}.zip"
|
||||
URL_HASH SHA256=5ff4a4604c78d57e01d83e22f79f5ffea0c4969defd48b45c69ccbd6b1a71e94
|
||||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/WinSparkle
|
||||
# No build step needed - just install pre-built binaries
|
||||
CONFIGURE_COMMAND ""
|
||||
BUILD_COMMAND ""
|
||||
INSTALL_COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
<SOURCE_DIR>/include ${DESTDIR}/include
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/${WINSPARKLE_ARCH}/Release/WinSparkle.dll ${DESTDIR}/bin/WinSparkle.dll
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
<SOURCE_DIR>/${WINSPARKLE_ARCH}/Release/WinSparkle.lib ${DESTDIR}/lib/WinSparkle.lib
|
||||
)
|
||||
endif()
|
||||
14
deps/wxWidgets/wxWidgets.cmake
vendored
14
deps/wxWidgets/wxWidgets.cmake
vendored
@@ -1,8 +1,6 @@
|
||||
set(_wx_toolkit "")
|
||||
set(_wx_debug_postfix "")
|
||||
set(_wx_shared -DwxBUILD_SHARED=OFF)
|
||||
set(_wx_flatpak_patch "")
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
set(_gtk_ver 2)
|
||||
|
||||
@@ -14,7 +12,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
if (FLATPAK)
|
||||
set(_wx_debug_postfix "d")
|
||||
set(_wx_shared -DwxBUILD_SHARED=ON -DBUILD_SHARED_LIBS:BOOL=ON)
|
||||
set(_wx_flatpak_patch PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-flatpak.patch)
|
||||
endif ()
|
||||
endif()
|
||||
|
||||
@@ -24,13 +21,21 @@ else ()
|
||||
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
|
||||
endif ()
|
||||
|
||||
set(_wx_opengl_override "")
|
||||
if(APPLE AND CMAKE_VERSION VERSION_GREATER_EQUAL "4.0")
|
||||
set(_wx_opengl_override
|
||||
-DOPENGL_gl_LIBRARY="-framework OpenGL"
|
||||
-DOPENGL_glu_LIBRARY="-framework OpenGL"
|
||||
)
|
||||
endif()
|
||||
|
||||
orcaslicer_add_cmake_project(
|
||||
wxWidgets
|
||||
GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets"
|
||||
GIT_SHALLOW ON
|
||||
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG}
|
||||
${_wx_flatpak_patch}
|
||||
CMAKE_ARGS
|
||||
${_wx_opengl_override}
|
||||
-DwxBUILD_PRECOMP=ON
|
||||
${_wx_toolkit}
|
||||
"-DCMAKE_DEBUG_POSTFIX:STRING=${_wx_debug_postfix}"
|
||||
@@ -42,6 +47,7 @@ orcaslicer_add_cmake_project(
|
||||
-DwxUSE_UNICODE=ON
|
||||
-DwxUSE_PRIVATE_FONTS=ON
|
||||
-DwxUSE_OPENGL=ON
|
||||
-DwxUSE_GLCANVAS_EGL=OFF
|
||||
-DwxUSE_WEBREQUEST=ON
|
||||
-DwxUSE_WEBVIEW=ON
|
||||
${_wx_edge}
|
||||
|
||||
@@ -26,6 +26,7 @@ add_subdirectory(imguizmo)
|
||||
add_subdirectory(libigl)
|
||||
add_subdirectory(libnest2d)
|
||||
add_subdirectory(mcut)
|
||||
add_subdirectory(md4c)
|
||||
add_subdirectory(miniz)
|
||||
add_subdirectory(minilzo)
|
||||
add_subdirectory(qhull)
|
||||
|
||||
@@ -153,6 +153,8 @@ namespace ImGui
|
||||
// const wchar_t CustomSupportsMarker = 0x1D;
|
||||
// const wchar_t CustomSeamMarker = 0x1E;
|
||||
// const wchar_t MmuSegmentationMarker = 0x1F;
|
||||
//const wchar_t HorizontalHide = 0xB1; // ORCA use FoldButtonIcon / UnfoldButtonIcon
|
||||
//const wchar_t HorizontalShow = 0xB2;
|
||||
|
||||
// Do not forget use following letters only in wstring
|
||||
//BBS use 08xx to avoid unicode character which may be used
|
||||
|
||||
@@ -18,7 +18,7 @@ template <
|
||||
typename DerivedF,
|
||||
typename SType,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE void igl::loop(
|
||||
IGL_INLINE bool igl::loop(
|
||||
const int n_verts,
|
||||
const Eigen::PlainObjectBase<DerivedF> & F,
|
||||
Eigen::SparseMatrix<SType>& S,
|
||||
@@ -26,15 +26,15 @@ IGL_INLINE void igl::loop(
|
||||
{
|
||||
typedef Eigen::SparseMatrix<SType> SparseMat;
|
||||
typedef Eigen::Triplet<SType> Triplet_t;
|
||||
|
||||
|
||||
//Ref. https://graphics.stanford.edu/~mdfisher/subdivision.html
|
||||
//Heavily borrowing from igl::upsample
|
||||
|
||||
|
||||
DerivedF FF, FFi;
|
||||
triangle_triangle_adjacency(F, FF, FFi);
|
||||
std::vector<std::vector<typename DerivedF::Scalar>> adjacencyList;
|
||||
adjacency_list(F, adjacencyList, true);
|
||||
|
||||
|
||||
//Compute the number and positions of the vertices to insert (on edges)
|
||||
Eigen::MatrixXi NI = Eigen::MatrixXi::Constant(FF.rows(), FF.cols(), -1);
|
||||
Eigen::MatrixXi NIdoubles = Eigen::MatrixXi::Zero(FF.rows(), FF.cols());
|
||||
@@ -48,12 +48,18 @@ IGL_INLINE void igl::loop(
|
||||
{
|
||||
NI(i,j) = counter;
|
||||
NIdoubles(i,j) = 0;
|
||||
if (FF(i,j) != -1)
|
||||
if (FF(i,j) != -1)
|
||||
{
|
||||
//If it is not a boundary
|
||||
NI(FF(i,j), FFi(i,j)) = counter;
|
||||
NIdoubles(i,j) = 1;
|
||||
} else
|
||||
int adj_triangle = FF(i, j);
|
||||
int adj_edge = FFi(i, j);
|
||||
if (adj_triangle >= 0 && adj_triangle < NI.rows() && adj_edge >= 0 && adj_edge < NI.cols()) {
|
||||
NI(adj_triangle, adj_edge) = counter;
|
||||
NIdoubles(i, j) = 1;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
{
|
||||
//Mark boundary vertices for later
|
||||
vertIsOnBdry(F(i,j)) = 1;
|
||||
@@ -63,24 +69,24 @@ IGL_INLINE void igl::loop(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const int& n_odd = n_verts;
|
||||
const int& n_even = counter;
|
||||
const int n_newverts = n_odd + n_even;
|
||||
|
||||
|
||||
//Construct vertex positions
|
||||
std::vector<Triplet_t> tripletList;
|
||||
for(int i=0; i<n_odd; ++i)
|
||||
for(int i=0; i<n_odd; ++i)
|
||||
{
|
||||
//Old vertices
|
||||
const std::vector<int>& localAdjList = adjacencyList[i];
|
||||
if(vertIsOnBdry(i)==1)
|
||||
if(vertIsOnBdry(i)==1)
|
||||
{
|
||||
//Boundary vertex
|
||||
tripletList.emplace_back(i, localAdjList.front(), 1./8.);
|
||||
tripletList.emplace_back(i, localAdjList.back(), 1./8.);
|
||||
tripletList.emplace_back(i, i, 3./4.);
|
||||
} else
|
||||
} else
|
||||
{
|
||||
const int n = localAdjList.size();
|
||||
const SType dn = n;
|
||||
@@ -99,19 +105,19 @@ IGL_INLINE void igl::loop(
|
||||
tripletList.emplace_back(i, i, 1.-dn*beta);
|
||||
}
|
||||
}
|
||||
for(int i=0; i<FF.rows(); ++i)
|
||||
for(int i=0; i<FF.rows(); ++i)
|
||||
{
|
||||
//New vertices
|
||||
for(int j=0; j<3; ++j)
|
||||
for(int j=0; j<3; ++j)
|
||||
{
|
||||
if(NIdoubles(i,j)==0)
|
||||
if(NIdoubles(i,j)==0)
|
||||
{
|
||||
if(FF(i,j)==-1)
|
||||
if(FF(i,j)==-1)
|
||||
{
|
||||
//Boundary vertex
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i,j), 1./2.);
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i, (j+1)%3), 1./2.);
|
||||
} else
|
||||
} else
|
||||
{
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i,j), 3./8.);
|
||||
tripletList.emplace_back(NI(i,j) + n_odd, F(i, (j+1)%3), 3./8.);
|
||||
@@ -123,33 +129,34 @@ IGL_INLINE void igl::loop(
|
||||
}
|
||||
S.resize(n_newverts, n_verts);
|
||||
S.setFromTriplets(tripletList.begin(), tripletList.end());
|
||||
|
||||
|
||||
// Build the new topology (Every face is replaced by four)
|
||||
NF.resize(F.rows()*4, 3);
|
||||
for(int i=0; i<F.rows();++i)
|
||||
{
|
||||
Eigen::VectorXi VI(6);
|
||||
VI << F(i,0), F(i,1), F(i,2), NI(i,0) + n_odd, NI(i,1) + n_odd, NI(i,2) + n_odd;
|
||||
|
||||
|
||||
Eigen::VectorXi f0(3), f1(3), f2(3), f3(3);
|
||||
f0 << VI(0), VI(3), VI(5);
|
||||
f1 << VI(1), VI(4), VI(3);
|
||||
f2 << VI(3), VI(4), VI(5);
|
||||
f3 << VI(4), VI(2), VI(5);
|
||||
|
||||
|
||||
NF.row((i*4)+0) = f0;
|
||||
NF.row((i*4)+1) = f1;
|
||||
NF.row((i*4)+2) = f2;
|
||||
NF.row((i*4)+3) = f3;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
template <
|
||||
typename DerivedV,
|
||||
typename DerivedV,
|
||||
typename DerivedF,
|
||||
typename DerivedNV,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE void igl::loop(
|
||||
IGL_INLINE bool igl::loop(
|
||||
const Eigen::PlainObjectBase<DerivedV>& V,
|
||||
const Eigen::PlainObjectBase<DerivedF>& F,
|
||||
Eigen::PlainObjectBase<DerivedNV>& NV,
|
||||
@@ -158,16 +165,19 @@ IGL_INLINE void igl::loop(
|
||||
{
|
||||
NV = V;
|
||||
NF = F;
|
||||
for(int i=0; i<number_of_subdivs; ++i)
|
||||
for(int i=0; i<number_of_subdivs; ++i)
|
||||
{
|
||||
DerivedNF tempF = NF;
|
||||
Eigen::SparseMatrix<typename DerivedV::Scalar> S;
|
||||
loop(NV.rows(), tempF, S, NF);
|
||||
if (!loop(NV.rows(), tempF, S, NF)) {
|
||||
return false;
|
||||
}
|
||||
// This .eval is super important
|
||||
NV = (S*NV).eval();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef IGL_STATIC_LIBRARY
|
||||
template void igl::loop<Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1>, Eigen::Matrix<double, -1, -1, 0, -1, -1>, Eigen::Matrix<int, -1, -1, 0, -1, -1> >(Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> > const&, Eigen::PlainObjectBase<Eigen::Matrix<double, -1, -1, 0, -1, -1> >&, Eigen::PlainObjectBase<Eigen::Matrix<int, -1, -1, 0, -1, -1> >&, int);
|
||||
#endif
|
||||
#endif
|
||||
@@ -29,7 +29,7 @@ namespace igl
|
||||
typename DerivedF,
|
||||
typename SType,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE void loop(
|
||||
IGL_INLINE bool loop(
|
||||
const int n_verts,
|
||||
const Eigen::PlainObjectBase<DerivedF> & F,
|
||||
Eigen::SparseMatrix<SType>& S,
|
||||
@@ -44,11 +44,11 @@ namespace igl
|
||||
// NV a matrix containing the new vertices
|
||||
// NF a matrix containing the new faces
|
||||
template <
|
||||
typename DerivedV,
|
||||
typename DerivedV,
|
||||
typename DerivedF,
|
||||
typename DerivedNV,
|
||||
typename DerivedNF>
|
||||
IGL_INLINE void loop(
|
||||
IGL_INLINE bool loop(
|
||||
const Eigen::PlainObjectBase<DerivedV>& V,
|
||||
const Eigen::PlainObjectBase<DerivedF>& F,
|
||||
Eigen::PlainObjectBase<DerivedNV>& NV,
|
||||
|
||||
71
deps_src/md4c/CMakeLists.txt
Normal file
71
deps_src/md4c/CMakeLists.txt
Normal file
@@ -0,0 +1,71 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(MD4C C)
|
||||
|
||||
set(MD_VERSION_MAJOR 0)
|
||||
set(MD_VERSION_MINOR 5)
|
||||
set(MD_VERSION_RELEASE 2)
|
||||
set(MD_VERSION "${MD_VERSION_MAJOR}.${MD_VERSION_MINOR}.${MD_VERSION_RELEASE}")
|
||||
|
||||
set(PROJECT_VERSION "${MD_VERSION}")
|
||||
set(PROJECT_URL "https://github.com/mity/md4c")
|
||||
|
||||
|
||||
#option(BUILD_MD2HTML_EXECUTABLE "Whether to compile the md2html executable" ON)
|
||||
|
||||
|
||||
#if(WIN32)
|
||||
# # On Windows, given there is no standard lib install dir etc., we rather
|
||||
# # by default build static lib.
|
||||
# option(BUILD_SHARED_LIBS "help string describing option" OFF)
|
||||
#else()
|
||||
# # On Linux, MD4C is slowly being adding into some distros which prefer
|
||||
# # shared lib.
|
||||
# option(BUILD_SHARED_LIBS "help string describing option" ON)
|
||||
#endif()
|
||||
|
||||
add_definitions(
|
||||
-DMD_VERSION_MAJOR=${MD_VERSION_MAJOR}
|
||||
-DMD_VERSION_MINOR=${MD_VERSION_MINOR}
|
||||
-DMD_VERSION_RELEASE=${MD_VERSION_RELEASE}
|
||||
)
|
||||
|
||||
#set(CMAKE_CONFIGURATION_TYPES Debug Release RelWithDebInfo MinSizeRel)
|
||||
#if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
# set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
|
||||
#
|
||||
# if("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
||||
# set(CMAKE_BUILD_TYPE "Release")
|
||||
# endif()
|
||||
#endif()
|
||||
|
||||
|
||||
if(${CMAKE_C_COMPILER_ID} MATCHES GNU|Clang)
|
||||
add_compile_options(-Wall -Wextra -Wshadow)
|
||||
|
||||
# We enforce -Wdeclaration-after-statement because Qt project needs to
|
||||
# build MD4C with Integrity compiler which chokes whenever a declaration
|
||||
# is not at the beginning of a block.
|
||||
add_compile_options(-Wdeclaration-after-statement)
|
||||
elseif(MSVC)
|
||||
# Disable warnings about the so-called unsecured functions:
|
||||
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
||||
add_compile_options(/W3)
|
||||
|
||||
# Specify proper C runtime library:
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELWITHDEBINFO "{$CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
||||
string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /MT")
|
||||
endif()
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
||||
add_subdirectory(src)
|
||||
#if (BUILD_MD2HTML_EXECUTABLE)
|
||||
# add_subdirectory(md2html)
|
||||
#endif ()
|
||||
22
deps_src/md4c/LICENSE.md
Normal file
22
deps_src/md4c/LICENSE.md
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
# The MIT License (MIT)
|
||||
|
||||
Copyright © 2016-2024 Martin Mitáš
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the “Software”),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
297
deps_src/md4c/README.md
Normal file
297
deps_src/md4c/README.md
Normal file
@@ -0,0 +1,297 @@
|
||||
|
||||
# MD4C Readme
|
||||
|
||||
* Home: http://github.com/mity/md4c
|
||||
* Wiki: http://github.com/mity/md4c/wiki
|
||||
* Issue tracker: http://github.com/mity/md4c/issues
|
||||
|
||||
MD4C stands for "Markdown for C" and that's exactly what this project is about.
|
||||
|
||||
|
||||
## What is Markdown
|
||||
|
||||
In short, Markdown is the markup language this `README.md` file is written in.
|
||||
|
||||
The following resources can explain more if you are unfamiliar with it:
|
||||
* [Wikipedia article](http://en.wikipedia.org/wiki/Markdown)
|
||||
* [CommonMark site](http://commonmark.org)
|
||||
|
||||
|
||||
## What is MD4C
|
||||
|
||||
MD4C is Markdown parser implementation in C, with the following features:
|
||||
|
||||
* **Compliance:** Generally, MD4C aims to be compliant to the latest version of
|
||||
[CommonMark specification](http://spec.commonmark.org/). Currently, we are
|
||||
fully compliant to CommonMark 0.31.
|
||||
|
||||
* **Extensions:** MD4C supports some commonly requested and accepted extensions.
|
||||
See below.
|
||||
|
||||
* **Performance:** MD4C is [very fast](https://talk.commonmark.org/t/2520).
|
||||
|
||||
* **Compactness:** MD4C parser is implemented in one source file and one header
|
||||
file. There are no dependencies other than standard C library.
|
||||
|
||||
* **Embedding:** MD4C parser is easy to reuse in other projects, its API is
|
||||
very straightforward: There is actually just one function, `md_parse()`.
|
||||
|
||||
* **Push model:** MD4C parses the complete document and calls few callback
|
||||
functions provided by the application to inform it about a start/end of
|
||||
every block, a start/end of every span, and with any textual contents.
|
||||
|
||||
* **Portability:** MD4C builds and works on Windows and POSIX-compliant OSes.
|
||||
(It should be simple to make it run also on most other platforms, at least as
|
||||
long as the platform provides C standard library, including a heap memory
|
||||
management.)
|
||||
|
||||
* **Encoding:** MD4C by default expects UTF-8 encoding of the input document.
|
||||
But it can be compiled to recognize ASCII-only control characters (i.e. to
|
||||
disable all Unicode-specific code), or (on Windows) to expect UTF-16 (i.e.
|
||||
what is on Windows commonly called just "Unicode"). See more details below.
|
||||
|
||||
* **Permissive license:** MD4C is available under the [MIT license](LICENSE.md).
|
||||
|
||||
|
||||
## Using MD4C
|
||||
|
||||
### Parsing Markdown
|
||||
|
||||
If you need just to parse a Markdown document, you need to include `md4c.h`
|
||||
and link against MD4C library (`-lmd4c`); or alternatively add `md4c.[hc]`
|
||||
directly to your code base as the parser is only implemented in the single C
|
||||
source file.
|
||||
|
||||
The main provided function is `md_parse()`. It takes a text in the Markdown
|
||||
syntax and a pointer to a structure which provides pointers to several callback
|
||||
functions.
|
||||
|
||||
As `md_parse()` processes the input, it calls the callbacks (when entering or
|
||||
leaving any Markdown block or span; and when outputting any textual content of
|
||||
the document), allowing application to convert it into another format or render
|
||||
it onto the screen.
|
||||
|
||||
|
||||
### Converting to HTML
|
||||
|
||||
If you need to convert Markdown to HTML, include `md4c-html.h` and link against
|
||||
MD4C-HTML library (`-lmd4c-html`); or alternatively add the sources `md4c.[hc]`,
|
||||
`md4c-html.[hc]` and `entity.[hc]` into your code base.
|
||||
|
||||
To convert a Markdown input, call `md_html()` function. It takes the Markdown
|
||||
input and calls the provided callback function. The callback is fed with
|
||||
chunks of the HTML output. Typical callback implementation just appends the
|
||||
chunks into a buffer or writes them to a file.
|
||||
|
||||
|
||||
## Markdown Extensions
|
||||
|
||||
The default behavior is to recognize only Markdown syntax defined by the
|
||||
[CommonMark specification](http://spec.commonmark.org/).
|
||||
|
||||
However, with appropriate flags, the behavior can be tuned to enable some
|
||||
extensions:
|
||||
|
||||
* With the flag `MD_FLAG_COLLAPSEWHITESPACE`, a non-trivial whitespace is
|
||||
collapsed into a single space.
|
||||
|
||||
* With the flag `MD_FLAG_TABLES`, GitHub-style tables are supported.
|
||||
|
||||
* With the flag `MD_FLAG_TASKLISTS`, GitHub-style task lists are supported.
|
||||
|
||||
* With the flag `MD_FLAG_STRIKETHROUGH`, strike-through spans are enabled
|
||||
(text enclosed in tilde marks, e.g. `~foo bar~`).
|
||||
|
||||
* With the flag `MD_FLAG_PERMISSIVEURLAUTOLINKS` permissive URL autolinks
|
||||
(not enclosed in `<` and `>`) are supported.
|
||||
|
||||
* With the flag `MD_FLAG_PERMISSIVEEMAILAUTOLINKS`, permissive e-mail
|
||||
autolinks (not enclosed in `<` and `>`) are supported.
|
||||
|
||||
* With the flag `MD_FLAG_PERMISSIVEWWWAUTOLINKS` permissive WWW autolinks
|
||||
without any scheme specified (e.g. `www.example.com`) are supported. MD4C
|
||||
then assumes `http:` scheme.
|
||||
|
||||
* With the flag `MD_FLAG_LATEXMATHSPANS` LaTeX math spans (`$...$`) and
|
||||
LaTeX display math spans (`$$...$$`) are supported. (Note though that the
|
||||
HTML renderer outputs them verbatim in a custom tag `<x-equation>`.)
|
||||
|
||||
* With the flag `MD_FLAG_WIKILINKS`, wiki-style links (`[[link label]]` and
|
||||
`[[target article|link label]]`) are supported. (Note that the HTML renderer
|
||||
outputs them in a custom tag `<x-wikilink>`.)
|
||||
|
||||
* With the flag `MD_FLAG_UNDERLINE`, underscore (`_`) denotes an underline
|
||||
instead of an ordinary emphasis or strong emphasis.
|
||||
|
||||
Few features of CommonMark (those some people see as mis-features) may be
|
||||
disabled with the following flags:
|
||||
|
||||
* With the flag `MD_FLAG_NOHTMLSPANS` or `MD_FLAG_NOHTMLBLOCKS`, raw inline
|
||||
HTML or raw HTML blocks respectively are disabled.
|
||||
|
||||
* With the flag `MD_FLAG_NOINDENTEDCODEBLOCKS`, indented code blocks are
|
||||
disabled.
|
||||
|
||||
|
||||
## Input/Output Encoding
|
||||
|
||||
The CommonMark specification declares that any sequence of Unicode code points
|
||||
is a valid CommonMark document.
|
||||
|
||||
But, under a closer inspection, Unicode plays any role in few very specific
|
||||
situations when parsing Markdown documents:
|
||||
|
||||
1. For detection of word boundaries when processing emphasis and strong
|
||||
emphasis, some classification of Unicode characters (whether it is
|
||||
a whitespace or a punctuation) is needed.
|
||||
|
||||
2. For (case-insensitive) matching of a link reference label with the
|
||||
corresponding link reference definition, Unicode case folding is used.
|
||||
|
||||
3. For translating HTML entities (e.g. `&`) and numeric character
|
||||
references (e.g. `#` or `ಫ`) into their Unicode equivalents.
|
||||
|
||||
However note MD4C leaves this translation on the renderer/application; as
|
||||
the renderer is supposed to really know output encoding and whether it
|
||||
really needs to perform this kind of translation. (For example, when the
|
||||
renderer outputs HTML, it may leave the entities untranslated and defer the
|
||||
work to a web browser.)
|
||||
|
||||
MD4C relies on this property of the CommonMark and the implementation is, to
|
||||
a large degree, encoding-agnostic. Most of MD4C code only assumes that the
|
||||
encoding of your choice is compatible with ASCII. I.e. that the codepoints
|
||||
below 128 have the same numeric values as ASCII.
|
||||
|
||||
Any input MD4C does not understand is simply seen as part of the document text
|
||||
and sent to the renderer's callback functions unchanged.
|
||||
|
||||
The two situations (word boundary detection and link reference matching) where
|
||||
MD4C has to understand Unicode are handled as specified by the following
|
||||
preprocessor macros (as specified at the time MD4C is being built):
|
||||
|
||||
* If preprocessor macro `MD4C_USE_UTF8` is defined, MD4C assumes UTF-8 for the
|
||||
word boundary detection and for the case-insensitive matching of link labels.
|
||||
|
||||
When none of these macros is explicitly used, this is the default behavior.
|
||||
|
||||
* On Windows, if preprocessor macro `MD4C_USE_UTF16` is defined, MD4C uses
|
||||
`WCHAR` instead of `char` and assumes UTF-16 encoding in those situations.
|
||||
(UTF-16 is what Windows developers usually call just "Unicode" and what
|
||||
Win32API generally works with.)
|
||||
|
||||
Note that because this macro affects also the types in `md4c.h`, you have
|
||||
to define the macro both when building MD4C as well as when including
|
||||
`md4c.h`.
|
||||
|
||||
Also note this is only supported in the parser (`md4c.[hc]`). The HTML
|
||||
renderer does not support this and you will have to write your own custom
|
||||
renderer to use this feature.
|
||||
|
||||
* If preprocessor macro `MD4C_USE_ASCII` is defined, MD4C assumes nothing but
|
||||
an ASCII input.
|
||||
|
||||
That effectively means that non-ASCII whitespace or punctuation characters
|
||||
won't be recognized as such and that link reference matching will work in
|
||||
a case-insensitive way only for ASCII letters (`[a-zA-Z]`).
|
||||
|
||||
|
||||
## Documentation
|
||||
|
||||
The API of the parser is quite well documented in the comments in the `md4c.h`.
|
||||
Similarly, the markdown-to-html API is described in its header `md4c-html.h`.
|
||||
|
||||
There is also [project wiki](http://github.com/mity/md4c/wiki) which provides
|
||||
some more comprehensive documentation. However note it is incomplete and some
|
||||
details may be somewhat outdated.
|
||||
|
||||
|
||||
## FAQ
|
||||
|
||||
**Q: How does MD4C compare to other Markdown parsers?**
|
||||
|
||||
**A:** Some other implementations combine Markdown parser and HTML generator
|
||||
into a single entangled code hidden behind an interface which just allows the
|
||||
conversion from Markdown to HTML. They are often unusable if you want to
|
||||
process the input in any other way.
|
||||
|
||||
Second, most parsers (if not all of them; at least within the scope of C/C++
|
||||
language) are full DOM-like parsers: They construct abstract syntax tree (AST)
|
||||
representation of the whole Markdown document. That takes time and it leads to
|
||||
bigger memory footprint.
|
||||
|
||||
Building AST is completely fine as long as you need it. If you don't, there is
|
||||
a very high chance that using MD4C will be substantially faster and less hungry
|
||||
in terms of memory consumption.
|
||||
|
||||
Last but not least, some Markdown parsers are implemented in a naive way. When
|
||||
fed with a [smartly crafted input pattern](test/pathological_tests.py), they
|
||||
may exhibit quadratic (or even worse) parsing times. What MD4C can still parse
|
||||
in a fraction of second may turn into long minutes or possibly hours with them.
|
||||
Hence, when such a naive parser is used to process an input from an untrusted
|
||||
source, the possibility of denial-of-service attacks becomes a real danger.
|
||||
|
||||
A lot of our effort went into providing linear parsing times no matter what
|
||||
kind of crazy input MD4C parser is fed with. (If you encounter an input pattern
|
||||
which leads to a sub-linear parsing times, please do not hesitate and report it
|
||||
as a bug.)
|
||||
|
||||
**Q: Does MD4C perform any input validation?**
|
||||
|
||||
**A:** No. And we are proud of it. :-)
|
||||
|
||||
CommonMark specification states that any sequence of Unicode characters is
|
||||
a valid Markdown document. (In practice, this more or less always means UTF-8
|
||||
encoding.)
|
||||
|
||||
In other words, according to the specification, it does not matter whether some
|
||||
Markdown syntax construction is in some way broken or not. If it's broken, it
|
||||
won't be recognized and the parser should see it just as a verbatim text.
|
||||
|
||||
MD4C takes this a step further: It sees any sequence of bytes as a valid input,
|
||||
following completely the GIGO philosophy (garbage in, garbage out). I.e. any
|
||||
ill-formed UTF-8 byte sequence will propagate to the respective callback as
|
||||
a part of the text.
|
||||
|
||||
If you need to validate that the input is, say, a well-formed UTF-8 document,
|
||||
you have to do it on your own. The easiest way how to do this is to simply
|
||||
validate the whole document before passing it to the MD4C parser.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MD4C is covered with MIT license, see the file `LICENSE.md`.
|
||||
|
||||
|
||||
## Links to Related Projects
|
||||
|
||||
Ports and bindings to other languages:
|
||||
|
||||
* [commonmark-d](https://github.com/AuburnSounds/commonmark-d):
|
||||
Port of MD4C to D language.
|
||||
|
||||
* [markdown-wasm](https://github.com/rsms/markdown-wasm):
|
||||
Port of MD4C to WebAssembly.
|
||||
|
||||
* [PyMD4C](https://github.com/dominickpastore/pymd4c):
|
||||
Python bindings for MD4C
|
||||
|
||||
Software using MD4C:
|
||||
|
||||
* [imgui_md](https://github.com/mekhontsev/imgui_md):
|
||||
Markdown renderer for [Dear ImGui](https://github.com/ocornut/imgui)
|
||||
|
||||
* [MarkDown Monolith Assembler](https://github.com/1Hyena/mdma):
|
||||
A command line tool for building browser-based books.
|
||||
|
||||
* [QOwnNotes](https://www.qownnotes.org/):
|
||||
A plain-text file notepad and todo-list manager with markdown support and
|
||||
ownCloud / Nextcloud integration.
|
||||
|
||||
* [Qt](https://www.qt.io/):
|
||||
Cross-platform C++ GUI framework.
|
||||
|
||||
* [Textosaurus](https://github.com/martinrotter/textosaurus):
|
||||
Cross-platform text editor based on Qt and Scintilla.
|
||||
|
||||
* [8th](https://8th-dev.com/):
|
||||
Cross-platform concatenative programming language.
|
||||
53
deps_src/md4c/src/CMakeLists.txt
Normal file
53
deps_src/md4c/src/CMakeLists.txt
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS 1)
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DDEBUG")
|
||||
|
||||
|
||||
# Build rules for MD4C parser library
|
||||
|
||||
configure_file(md4c.pc.in md4c.pc @ONLY)
|
||||
add_library(md4c md4c.c md4c.h)
|
||||
set_target_properties(md4c PROPERTIES
|
||||
COMPILE_FLAGS "-DMD4C_USE_UTF8"
|
||||
VERSION ${MD_VERSION}
|
||||
SOVERSION ${MD_VERSION_MAJOR}
|
||||
PUBLIC_HEADER md4c.h
|
||||
)
|
||||
|
||||
# Build rules for HTML renderer library
|
||||
|
||||
configure_file(md4c-html.pc.in md4c-html.pc @ONLY)
|
||||
add_library(md4c-html md4c-html.c md4c-html.h entity.c entity.h)
|
||||
set_target_properties(md4c-html PROPERTIES
|
||||
VERSION ${MD_VERSION}
|
||||
SOVERSION ${MD_VERSION_MAJOR}
|
||||
PUBLIC_HEADER md4c-html.h
|
||||
)
|
||||
target_link_libraries(md4c-html md4c)
|
||||
|
||||
|
||||
# Install rules
|
||||
|
||||
#install(
|
||||
# TARGETS md4c
|
||||
# EXPORT md4cConfig
|
||||
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
# INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
#)
|
||||
#install(FILES ${CMAKE_BINARY_DIR}/src/md4c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
#
|
||||
#install(
|
||||
# TARGETS md4c-html
|
||||
# EXPORT md4cConfig
|
||||
# ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
# PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
|
||||
#)
|
||||
#install(FILES ${CMAKE_BINARY_DIR}/src/md4c-html.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
||||
#
|
||||
#install(EXPORT md4cConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c/ NAMESPACE md4c::)
|
||||
#
|
||||
2185
deps_src/md4c/src/entity.c
Normal file
2185
deps_src/md4c/src/entity.c
Normal file
File diff suppressed because it is too large
Load Diff
43
deps_src/md4c/src/entity.h
Normal file
43
deps_src/md4c/src/entity.h
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MD4C_ENTITY_H
|
||||
#define MD4C_ENTITY_H
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
/* Most entities are formed by single Unicode codepoint, few by two codepoints.
|
||||
* Single-codepoint entities have codepoints[1] set to zero. */
|
||||
typedef struct ENTITY_tag ENTITY;
|
||||
struct ENTITY_tag {
|
||||
const char* name;
|
||||
unsigned codepoints[2];
|
||||
};
|
||||
|
||||
const ENTITY* entity_lookup(const char* name, size_t name_size);
|
||||
|
||||
|
||||
#endif /* MD4C_ENTITY_H */
|
||||
567
deps_src/md4c/src/md4c-html.c
Normal file
567
deps_src/md4c/src/md4c-html.c
Normal file
@@ -0,0 +1,567 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "md4c-html.h"
|
||||
#include "entity.h"
|
||||
|
||||
|
||||
#if !defined(__STDC_VERSION__) || __STDC_VERSION__ < 199409L
|
||||
/* C89/90 or old compilers in general may not understand "inline". */
|
||||
#if defined __GNUC__
|
||||
#define inline __inline__
|
||||
#elif defined _MSC_VER
|
||||
#define inline __inline
|
||||
#else
|
||||
#define inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
typedef struct MD_HTML_tag MD_HTML;
|
||||
struct MD_HTML_tag {
|
||||
void (*process_output)(const MD_CHAR*, MD_SIZE, void*);
|
||||
void* userdata;
|
||||
unsigned flags;
|
||||
int image_nesting_level;
|
||||
char escape_map[256];
|
||||
};
|
||||
|
||||
#define NEED_HTML_ESC_FLAG 0x1
|
||||
#define NEED_URL_ESC_FLAG 0x2
|
||||
|
||||
|
||||
/*****************************************
|
||||
*** HTML rendering helper functions ***
|
||||
*****************************************/
|
||||
|
||||
#define ISDIGIT(ch) ('0' <= (ch) && (ch) <= '9')
|
||||
#define ISLOWER(ch) ('a' <= (ch) && (ch) <= 'z')
|
||||
#define ISUPPER(ch) ('A' <= (ch) && (ch) <= 'Z')
|
||||
#define ISALNUM(ch) (ISLOWER(ch) || ISUPPER(ch) || ISDIGIT(ch))
|
||||
|
||||
|
||||
static inline void
|
||||
render_verbatim(MD_HTML* r, const MD_CHAR* text, MD_SIZE size)
|
||||
{
|
||||
r->process_output(text, size, r->userdata);
|
||||
}
|
||||
|
||||
/* Keep this as a macro. Most compiler should then be smart enough to replace
|
||||
* the strlen() call with a compile-time constant if the string is a C literal. */
|
||||
#define RENDER_VERBATIM(r, verbatim) \
|
||||
render_verbatim((r), (verbatim), (MD_SIZE) (strlen(verbatim)))
|
||||
|
||||
|
||||
static void
|
||||
render_html_escaped(MD_HTML* r, const MD_CHAR* data, MD_SIZE size)
|
||||
{
|
||||
MD_OFFSET beg = 0;
|
||||
MD_OFFSET off = 0;
|
||||
|
||||
/* Some characters need to be escaped in normal HTML text. */
|
||||
#define NEED_HTML_ESC(ch) (r->escape_map[(unsigned char)(ch)] & NEED_HTML_ESC_FLAG)
|
||||
|
||||
while(1) {
|
||||
/* Optimization: Use some loop unrolling. */
|
||||
while(off + 3 < size && !NEED_HTML_ESC(data[off+0]) && !NEED_HTML_ESC(data[off+1])
|
||||
&& !NEED_HTML_ESC(data[off+2]) && !NEED_HTML_ESC(data[off+3]))
|
||||
off += 4;
|
||||
while(off < size && !NEED_HTML_ESC(data[off]))
|
||||
off++;
|
||||
|
||||
if(off > beg)
|
||||
render_verbatim(r, data + beg, off - beg);
|
||||
|
||||
if(off < size) {
|
||||
switch(data[off]) {
|
||||
case '&': RENDER_VERBATIM(r, "&"); break;
|
||||
case '<': RENDER_VERBATIM(r, "<"); break;
|
||||
case '>': RENDER_VERBATIM(r, ">"); break;
|
||||
case '"': RENDER_VERBATIM(r, """); break;
|
||||
}
|
||||
off++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
beg = off;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render_url_escaped(MD_HTML* r, const MD_CHAR* data, MD_SIZE size)
|
||||
{
|
||||
static const MD_CHAR hex_chars[] = "0123456789ABCDEF";
|
||||
MD_OFFSET beg = 0;
|
||||
MD_OFFSET off = 0;
|
||||
|
||||
/* Some characters need to be escaped in URL attributes. */
|
||||
#define NEED_URL_ESC(ch) (r->escape_map[(unsigned char)(ch)] & NEED_URL_ESC_FLAG)
|
||||
|
||||
while(1) {
|
||||
while(off < size && !NEED_URL_ESC(data[off]))
|
||||
off++;
|
||||
if(off > beg)
|
||||
render_verbatim(r, data + beg, off - beg);
|
||||
|
||||
if(off < size) {
|
||||
char hex[3];
|
||||
|
||||
switch(data[off]) {
|
||||
case '&': RENDER_VERBATIM(r, "&"); break;
|
||||
default:
|
||||
hex[0] = '%';
|
||||
hex[1] = hex_chars[((unsigned)data[off] >> 4) & 0xf];
|
||||
hex[2] = hex_chars[((unsigned)data[off] >> 0) & 0xf];
|
||||
render_verbatim(r, hex, 3);
|
||||
break;
|
||||
}
|
||||
off++;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
|
||||
beg = off;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned
|
||||
hex_val(char ch)
|
||||
{
|
||||
if('0' <= ch && ch <= '9')
|
||||
return ch - '0';
|
||||
if('A' <= ch && ch <= 'Z')
|
||||
return ch - 'A' + 10;
|
||||
else
|
||||
return ch - 'a' + 10;
|
||||
}
|
||||
|
||||
static void
|
||||
render_utf8_codepoint(MD_HTML* r, unsigned codepoint,
|
||||
void (*fn_append)(MD_HTML*, const MD_CHAR*, MD_SIZE))
|
||||
{
|
||||
static const MD_CHAR utf8_replacement_char[] = { (char)0xef, (char)0xbf, (char)0xbd };
|
||||
|
||||
unsigned char utf8[4];
|
||||
size_t n;
|
||||
|
||||
if(codepoint <= 0x7f) {
|
||||
n = 1;
|
||||
utf8[0] = codepoint;
|
||||
} else if(codepoint <= 0x7ff) {
|
||||
n = 2;
|
||||
utf8[0] = 0xc0 | ((codepoint >> 6) & 0x1f);
|
||||
utf8[1] = 0x80 + ((codepoint >> 0) & 0x3f);
|
||||
} else if(codepoint <= 0xffff) {
|
||||
n = 3;
|
||||
utf8[0] = 0xe0 | ((codepoint >> 12) & 0xf);
|
||||
utf8[1] = 0x80 + ((codepoint >> 6) & 0x3f);
|
||||
utf8[2] = 0x80 + ((codepoint >> 0) & 0x3f);
|
||||
} else {
|
||||
n = 4;
|
||||
utf8[0] = 0xf0 | ((codepoint >> 18) & 0x7);
|
||||
utf8[1] = 0x80 + ((codepoint >> 12) & 0x3f);
|
||||
utf8[2] = 0x80 + ((codepoint >> 6) & 0x3f);
|
||||
utf8[3] = 0x80 + ((codepoint >> 0) & 0x3f);
|
||||
}
|
||||
|
||||
if(0 < codepoint && codepoint <= 0x10ffff)
|
||||
fn_append(r, (char*)utf8, (MD_SIZE)n);
|
||||
else
|
||||
fn_append(r, utf8_replacement_char, 3);
|
||||
}
|
||||
|
||||
/* Translate entity to its UTF-8 equivalent, or output the verbatim one
|
||||
* if such entity is unknown (or if the translation is disabled). */
|
||||
static void
|
||||
render_entity(MD_HTML* r, const MD_CHAR* text, MD_SIZE size,
|
||||
void (*fn_append)(MD_HTML*, const MD_CHAR*, MD_SIZE))
|
||||
{
|
||||
if(r->flags & MD_HTML_FLAG_VERBATIM_ENTITIES) {
|
||||
render_verbatim(r, text, size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We assume UTF-8 output is what is desired. */
|
||||
if(size > 3 && text[1] == '#') {
|
||||
unsigned codepoint = 0;
|
||||
|
||||
if(text[2] == 'x' || text[2] == 'X') {
|
||||
/* Hexadecimal entity (e.g. "�")). */
|
||||
MD_SIZE i;
|
||||
for(i = 3; i < size-1; i++)
|
||||
codepoint = 16 * codepoint + hex_val(text[i]);
|
||||
} else {
|
||||
/* Decimal entity (e.g. "&1234;") */
|
||||
MD_SIZE i;
|
||||
for(i = 2; i < size-1; i++)
|
||||
codepoint = 10 * codepoint + (text[i] - '0');
|
||||
}
|
||||
|
||||
render_utf8_codepoint(r, codepoint, fn_append);
|
||||
return;
|
||||
} else {
|
||||
/* Named entity (e.g. " "). */
|
||||
const ENTITY* ent;
|
||||
|
||||
ent = entity_lookup(text, size);
|
||||
if(ent != NULL) {
|
||||
render_utf8_codepoint(r, ent->codepoints[0], fn_append);
|
||||
if(ent->codepoints[1])
|
||||
render_utf8_codepoint(r, ent->codepoints[1], fn_append);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
fn_append(r, text, size);
|
||||
}
|
||||
|
||||
static void
|
||||
render_attribute(MD_HTML* r, const MD_ATTRIBUTE* attr,
|
||||
void (*fn_append)(MD_HTML*, const MD_CHAR*, MD_SIZE))
|
||||
{
|
||||
int i;
|
||||
|
||||
for(i = 0; attr->substr_offsets[i] < attr->size; i++) {
|
||||
MD_TEXTTYPE type = attr->substr_types[i];
|
||||
MD_OFFSET off = attr->substr_offsets[i];
|
||||
MD_SIZE size = attr->substr_offsets[i+1] - off;
|
||||
const MD_CHAR* text = attr->text + off;
|
||||
|
||||
switch(type) {
|
||||
case MD_TEXT_NULLCHAR: render_utf8_codepoint(r, 0x0000, render_verbatim); break;
|
||||
case MD_TEXT_ENTITY: render_entity(r, text, size, fn_append); break;
|
||||
default: fn_append(r, text, size); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
render_open_ol_block(MD_HTML* r, const MD_BLOCK_OL_DETAIL* det)
|
||||
{
|
||||
char buf[64];
|
||||
|
||||
if(det->start == 1) {
|
||||
RENDER_VERBATIM(r, "<ol>\n");
|
||||
return;
|
||||
}
|
||||
|
||||
snprintf(buf, sizeof(buf), "<ol start=\"%u\">\n", det->start);
|
||||
RENDER_VERBATIM(r, buf);
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_li_block(MD_HTML* r, const MD_BLOCK_LI_DETAIL* det)
|
||||
{
|
||||
if(det->is_task) {
|
||||
RENDER_VERBATIM(r, "<li class=\"task-list-item\">"
|
||||
"<input type=\"checkbox\" class=\"task-list-item-checkbox\" disabled");
|
||||
if(det->task_mark == 'x' || det->task_mark == 'X')
|
||||
RENDER_VERBATIM(r, " checked");
|
||||
RENDER_VERBATIM(r, ">");
|
||||
} else {
|
||||
RENDER_VERBATIM(r, "<li>");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_code_block(MD_HTML* r, const MD_BLOCK_CODE_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<pre><code");
|
||||
|
||||
/* If known, output the HTML 5 attribute class="language-LANGNAME". */
|
||||
if(det->lang.text != NULL) {
|
||||
RENDER_VERBATIM(r, " class=\"language-");
|
||||
render_attribute(r, &det->lang, render_html_escaped);
|
||||
RENDER_VERBATIM(r, "\"");
|
||||
}
|
||||
|
||||
RENDER_VERBATIM(r, ">");
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_td_block(MD_HTML* r, const MD_CHAR* cell_type, const MD_BLOCK_TD_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<");
|
||||
RENDER_VERBATIM(r, cell_type);
|
||||
|
||||
switch(det->align) {
|
||||
case MD_ALIGN_LEFT: RENDER_VERBATIM(r, " align=\"left\">"); break;
|
||||
case MD_ALIGN_CENTER: RENDER_VERBATIM(r, " align=\"center\">"); break;
|
||||
case MD_ALIGN_RIGHT: RENDER_VERBATIM(r, " align=\"right\">"); break;
|
||||
default: RENDER_VERBATIM(r, ">"); break;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_a_span(MD_HTML* r, const MD_SPAN_A_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<a href=\"");
|
||||
render_attribute(r, &det->href, render_url_escaped);
|
||||
|
||||
if(det->title.text != NULL) {
|
||||
RENDER_VERBATIM(r, "\" title=\"");
|
||||
render_attribute(r, &det->title, render_html_escaped);
|
||||
}
|
||||
|
||||
RENDER_VERBATIM(r, "\">");
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_img_span(MD_HTML* r, const MD_SPAN_IMG_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<img src=\"");
|
||||
render_attribute(r, &det->src, render_url_escaped);
|
||||
|
||||
RENDER_VERBATIM(r, "\" alt=\"");
|
||||
}
|
||||
|
||||
static void
|
||||
render_close_img_span(MD_HTML* r, const MD_SPAN_IMG_DETAIL* det)
|
||||
{
|
||||
if(det->title.text != NULL) {
|
||||
RENDER_VERBATIM(r, "\" title=\"");
|
||||
render_attribute(r, &det->title, render_html_escaped);
|
||||
}
|
||||
|
||||
RENDER_VERBATIM(r, (r->flags & MD_HTML_FLAG_XHTML) ? "\" />" : "\">");
|
||||
}
|
||||
|
||||
static void
|
||||
render_open_wikilink_span(MD_HTML* r, const MD_SPAN_WIKILINK_DETAIL* det)
|
||||
{
|
||||
RENDER_VERBATIM(r, "<x-wikilink data-target=\"");
|
||||
render_attribute(r, &det->target, render_html_escaped);
|
||||
|
||||
RENDER_VERBATIM(r, "\">");
|
||||
}
|
||||
|
||||
|
||||
/**************************************
|
||||
*** HTML renderer implementation ***
|
||||
**************************************/
|
||||
|
||||
static int
|
||||
enter_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
static const MD_CHAR* head[6] = { "<h1>", "<h2>", "<h3>", "<h4>", "<h5>", "<h6>" };
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
switch(type) {
|
||||
case MD_BLOCK_DOC: /* noop */ break;
|
||||
case MD_BLOCK_QUOTE: RENDER_VERBATIM(r, "<blockquote>\n"); break;
|
||||
case MD_BLOCK_UL: RENDER_VERBATIM(r, "<ul>\n"); break;
|
||||
case MD_BLOCK_OL: render_open_ol_block(r, (const MD_BLOCK_OL_DETAIL*)detail); break;
|
||||
case MD_BLOCK_LI: render_open_li_block(r, (const MD_BLOCK_LI_DETAIL*)detail); break;
|
||||
case MD_BLOCK_HR: RENDER_VERBATIM(r, (r->flags & MD_HTML_FLAG_XHTML) ? "<hr />\n" : "<hr>\n"); break;
|
||||
case MD_BLOCK_H: RENDER_VERBATIM(r, head[((MD_BLOCK_H_DETAIL*)detail)->level - 1]); break;
|
||||
case MD_BLOCK_CODE: render_open_code_block(r, (const MD_BLOCK_CODE_DETAIL*) detail); break;
|
||||
case MD_BLOCK_HTML: /* noop */ break;
|
||||
case MD_BLOCK_P: RENDER_VERBATIM(r, "<p>"); break;
|
||||
case MD_BLOCK_TABLE: RENDER_VERBATIM(r, "<table>\n"); break;
|
||||
case MD_BLOCK_THEAD: RENDER_VERBATIM(r, "<thead>\n"); break;
|
||||
case MD_BLOCK_TBODY: RENDER_VERBATIM(r, "<tbody>\n"); break;
|
||||
case MD_BLOCK_TR: RENDER_VERBATIM(r, "<tr>\n"); break;
|
||||
case MD_BLOCK_TH: render_open_td_block(r, "th", (MD_BLOCK_TD_DETAIL*)detail); break;
|
||||
case MD_BLOCK_TD: render_open_td_block(r, "td", (MD_BLOCK_TD_DETAIL*)detail); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
leave_block_callback(MD_BLOCKTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
static const MD_CHAR* head[6] = { "</h1>\n", "</h2>\n", "</h3>\n", "</h4>\n", "</h5>\n", "</h6>\n" };
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
switch(type) {
|
||||
case MD_BLOCK_DOC: /*noop*/ break;
|
||||
case MD_BLOCK_QUOTE: RENDER_VERBATIM(r, "</blockquote>\n"); break;
|
||||
case MD_BLOCK_UL: RENDER_VERBATIM(r, "</ul>\n"); break;
|
||||
case MD_BLOCK_OL: RENDER_VERBATIM(r, "</ol>\n"); break;
|
||||
case MD_BLOCK_LI: RENDER_VERBATIM(r, "</li>\n"); break;
|
||||
case MD_BLOCK_HR: /*noop*/ break;
|
||||
case MD_BLOCK_H: RENDER_VERBATIM(r, head[((MD_BLOCK_H_DETAIL*)detail)->level - 1]); break;
|
||||
case MD_BLOCK_CODE: RENDER_VERBATIM(r, "</code></pre>\n"); break;
|
||||
case MD_BLOCK_HTML: /* noop */ break;
|
||||
case MD_BLOCK_P: RENDER_VERBATIM(r, "</p>\n"); break;
|
||||
case MD_BLOCK_TABLE: RENDER_VERBATIM(r, "</table>\n"); break;
|
||||
case MD_BLOCK_THEAD: RENDER_VERBATIM(r, "</thead>\n"); break;
|
||||
case MD_BLOCK_TBODY: RENDER_VERBATIM(r, "</tbody>\n"); break;
|
||||
case MD_BLOCK_TR: RENDER_VERBATIM(r, "</tr>\n"); break;
|
||||
case MD_BLOCK_TH: RENDER_VERBATIM(r, "</th>\n"); break;
|
||||
case MD_BLOCK_TD: RENDER_VERBATIM(r, "</td>\n"); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
enter_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
int inside_img = (r->image_nesting_level > 0);
|
||||
|
||||
/* We are inside a Markdown image label. Markdown allows to use any emphasis
|
||||
* and other rich contents in that context similarly as in any link label.
|
||||
*
|
||||
* However, unlike in the case of links (where that contents becomescontents
|
||||
* of the <a>...</a> tag), in the case of images the contents is supposed to
|
||||
* fall into the attribute alt: <img alt="...">.
|
||||
*
|
||||
* In that context we naturally cannot output nested HTML tags. So lets
|
||||
* suppress them and only output the plain text (i.e. what falls into text()
|
||||
* callback).
|
||||
*
|
||||
* CommonMark specification declares this a recommended practice for HTML
|
||||
* output.
|
||||
*/
|
||||
if(type == MD_SPAN_IMG)
|
||||
r->image_nesting_level++;
|
||||
if(inside_img)
|
||||
return 0;
|
||||
|
||||
switch(type) {
|
||||
case MD_SPAN_EM: RENDER_VERBATIM(r, "<em>"); break;
|
||||
case MD_SPAN_STRONG: RENDER_VERBATIM(r, "<strong>"); break;
|
||||
case MD_SPAN_U: RENDER_VERBATIM(r, "<u>"); break;
|
||||
case MD_SPAN_A: render_open_a_span(r, (MD_SPAN_A_DETAIL*) detail); break;
|
||||
case MD_SPAN_IMG: render_open_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
|
||||
case MD_SPAN_CODE: RENDER_VERBATIM(r, "<code>"); break;
|
||||
case MD_SPAN_DEL: RENDER_VERBATIM(r, "<del>"); break;
|
||||
case MD_SPAN_LATEXMATH: RENDER_VERBATIM(r, "<x-equation>"); break;
|
||||
case MD_SPAN_LATEXMATH_DISPLAY: RENDER_VERBATIM(r, "<x-equation type=\"display\">"); break;
|
||||
case MD_SPAN_WIKILINK: render_open_wikilink_span(r, (MD_SPAN_WIKILINK_DETAIL*) detail); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
leave_span_callback(MD_SPANTYPE type, void* detail, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
if(type == MD_SPAN_IMG)
|
||||
r->image_nesting_level--;
|
||||
if(r->image_nesting_level > 0)
|
||||
return 0;
|
||||
|
||||
switch(type) {
|
||||
case MD_SPAN_EM: RENDER_VERBATIM(r, "</em>"); break;
|
||||
case MD_SPAN_STRONG: RENDER_VERBATIM(r, "</strong>"); break;
|
||||
case MD_SPAN_U: RENDER_VERBATIM(r, "</u>"); break;
|
||||
case MD_SPAN_A: RENDER_VERBATIM(r, "</a>"); break;
|
||||
case MD_SPAN_IMG: render_close_img_span(r, (MD_SPAN_IMG_DETAIL*) detail); break;
|
||||
case MD_SPAN_CODE: RENDER_VERBATIM(r, "</code>"); break;
|
||||
case MD_SPAN_DEL: RENDER_VERBATIM(r, "</del>"); break;
|
||||
case MD_SPAN_LATEXMATH: /*fall through*/
|
||||
case MD_SPAN_LATEXMATH_DISPLAY: RENDER_VERBATIM(r, "</x-equation>"); break;
|
||||
case MD_SPAN_WIKILINK: RENDER_VERBATIM(r, "</x-wikilink>"); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
text_callback(MD_TEXTTYPE type, const MD_CHAR* text, MD_SIZE size, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
|
||||
switch(type) {
|
||||
case MD_TEXT_NULLCHAR: render_utf8_codepoint(r, 0x0000, render_verbatim); break;
|
||||
case MD_TEXT_BR: RENDER_VERBATIM(r, (r->image_nesting_level == 0
|
||||
? ((r->flags & MD_HTML_FLAG_XHTML) ? "<br />\n" : "<br>\n")
|
||||
: " "));
|
||||
break;
|
||||
case MD_TEXT_SOFTBR: RENDER_VERBATIM(r, (r->image_nesting_level == 0 ? "\n" : " ")); break;
|
||||
case MD_TEXT_HTML: render_verbatim(r, text, size); break;
|
||||
case MD_TEXT_ENTITY: render_entity(r, text, size, render_html_escaped); break;
|
||||
default: render_html_escaped(r, text, size); break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void
|
||||
debug_log_callback(const char* msg, void* userdata)
|
||||
{
|
||||
MD_HTML* r = (MD_HTML*) userdata;
|
||||
if(r->flags & MD_HTML_FLAG_DEBUG)
|
||||
fprintf(stderr, "MD4C: %s\n", msg);
|
||||
}
|
||||
|
||||
int
|
||||
md_html(const MD_CHAR* input, MD_SIZE input_size,
|
||||
void (*process_output)(const MD_CHAR*, MD_SIZE, void*),
|
||||
void* userdata, unsigned parser_flags, unsigned renderer_flags)
|
||||
{
|
||||
MD_HTML render = { process_output, userdata, renderer_flags, 0, { 0 } };
|
||||
int i;
|
||||
|
||||
MD_PARSER parser = {
|
||||
0,
|
||||
parser_flags,
|
||||
enter_block_callback,
|
||||
leave_block_callback,
|
||||
enter_span_callback,
|
||||
leave_span_callback,
|
||||
text_callback,
|
||||
debug_log_callback,
|
||||
NULL
|
||||
};
|
||||
|
||||
/* Build map of characters which need escaping. */
|
||||
for(i = 0; i < 256; i++) {
|
||||
unsigned char ch = (unsigned char) i;
|
||||
|
||||
if(strchr("\"&<>", ch) != NULL)
|
||||
render.escape_map[i] |= NEED_HTML_ESC_FLAG;
|
||||
|
||||
if(!ISALNUM(ch) && strchr("~-_.+!*(),%#@?=;:/,+$", ch) == NULL)
|
||||
render.escape_map[i] |= NEED_URL_ESC_FLAG;
|
||||
}
|
||||
|
||||
/* Consider skipping UTF-8 byte order mark (BOM). */
|
||||
if(renderer_flags & MD_HTML_FLAG_SKIP_UTF8_BOM && sizeof(MD_CHAR) == 1) {
|
||||
static const MD_CHAR bom[3] = { (char)0xef, (char)0xbb, (char)0xbf };
|
||||
if(input_size >= sizeof(bom) && memcmp(input, bom, sizeof(bom)) == 0) {
|
||||
input += sizeof(bom);
|
||||
input_size -= sizeof(bom);
|
||||
}
|
||||
}
|
||||
|
||||
return md_parse(input, input_size, &parser, (void*) &render);
|
||||
}
|
||||
|
||||
68
deps_src/md4c/src/md4c-html.h
Normal file
68
deps_src/md4c/src/md4c-html.h
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MD4C_HTML_H
|
||||
#define MD4C_HTML_H
|
||||
|
||||
#include "md4c.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* If set, debug output from md_parse() is sent to stderr. */
|
||||
#define MD_HTML_FLAG_DEBUG 0x0001
|
||||
#define MD_HTML_FLAG_VERBATIM_ENTITIES 0x0002
|
||||
#define MD_HTML_FLAG_SKIP_UTF8_BOM 0x0004
|
||||
#define MD_HTML_FLAG_XHTML 0x0008
|
||||
|
||||
|
||||
/* Render Markdown into HTML.
|
||||
*
|
||||
* Note only contents of <body> tag is generated. Caller must generate
|
||||
* HTML header/footer manually before/after calling md_html().
|
||||
*
|
||||
* Params input and input_size specify the Markdown input.
|
||||
* Callback process_output() gets called with chunks of HTML output.
|
||||
* (Typical implementation may just output the bytes to a file or append to
|
||||
* some buffer).
|
||||
* Param userdata is just propagated back to process_output() callback.
|
||||
* Param parser_flags are flags from md4c.h propagated to md_parse().
|
||||
* Param render_flags is bitmask of MD_HTML_FLAG_xxxx.
|
||||
*
|
||||
* Returns -1 on error (if md_parse() fails.)
|
||||
* Returns 0 on success.
|
||||
*/
|
||||
int md_html(const MD_CHAR* input, MD_SIZE input_size,
|
||||
void (*process_output)(const MD_CHAR*, MD_SIZE, void*),
|
||||
void* userdata, unsigned parser_flags, unsigned renderer_flags);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* MD4C_HTML_H */
|
||||
13
deps_src/md4c/src/md4c-html.pc.in
Normal file
13
deps_src/md4c/src/md4c-html.pc.in
Normal file
@@ -0,0 +1,13 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@ HTML renderer
|
||||
Description: Markdown to HTML converter library.
|
||||
Version: @PROJECT_VERSION@
|
||||
URL: @PROJECT_URL@
|
||||
|
||||
Requires: md4c = @PROJECT_VERSION@
|
||||
Libs: -L${libdir} -lmd4c-html
|
||||
Cflags: -I${includedir}
|
||||
6492
deps_src/md4c/src/md4c.c
Normal file
6492
deps_src/md4c/src/md4c.c
Normal file
File diff suppressed because it is too large
Load Diff
407
deps_src/md4c/src/md4c.h
Normal file
407
deps_src/md4c/src/md4c.h
Normal file
@@ -0,0 +1,407 @@
|
||||
/*
|
||||
* MD4C: Markdown parser for C
|
||||
* (http://github.com/mity/md4c)
|
||||
*
|
||||
* Copyright (c) 2016-2024 Martin Mitáš
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef MD4C_H
|
||||
#define MD4C_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if defined MD4C_USE_UTF16
|
||||
/* Magic to support UTF-16. Note that in order to use it, you have to define
|
||||
* the macro MD4C_USE_UTF16 both when building MD4C as well as when
|
||||
* including this header in your code. */
|
||||
#ifdef _WIN32
|
||||
#include <windows.h>
|
||||
typedef WCHAR MD_CHAR;
|
||||
#else
|
||||
#error MD4C_USE_UTF16 is only supported on Windows.
|
||||
#endif
|
||||
#else
|
||||
typedef char MD_CHAR;
|
||||
#endif
|
||||
|
||||
typedef unsigned MD_SIZE;
|
||||
typedef unsigned MD_OFFSET;
|
||||
|
||||
|
||||
/* Block represents a part of document hierarchy structure like a paragraph
|
||||
* or list item.
|
||||
*/
|
||||
typedef enum MD_BLOCKTYPE {
|
||||
/* <body>...</body> */
|
||||
MD_BLOCK_DOC = 0,
|
||||
|
||||
/* <blockquote>...</blockquote> */
|
||||
MD_BLOCK_QUOTE,
|
||||
|
||||
/* <ul>...</ul>
|
||||
* Detail: Structure MD_BLOCK_UL_DETAIL. */
|
||||
MD_BLOCK_UL,
|
||||
|
||||
/* <ol>...</ol>
|
||||
* Detail: Structure MD_BLOCK_OL_DETAIL. */
|
||||
MD_BLOCK_OL,
|
||||
|
||||
/* <li>...</li>
|
||||
* Detail: Structure MD_BLOCK_LI_DETAIL. */
|
||||
MD_BLOCK_LI,
|
||||
|
||||
/* <hr> */
|
||||
MD_BLOCK_HR,
|
||||
|
||||
/* <h1>...</h1> (for levels up to 6)
|
||||
* Detail: Structure MD_BLOCK_H_DETAIL. */
|
||||
MD_BLOCK_H,
|
||||
|
||||
/* <pre><code>...</code></pre>
|
||||
* Note the text lines within code blocks are terminated with '\n'
|
||||
* instead of explicit MD_TEXT_BR. */
|
||||
MD_BLOCK_CODE,
|
||||
|
||||
/* Raw HTML block. This itself does not correspond to any particular HTML
|
||||
* tag. The contents of it _is_ raw HTML source intended to be put
|
||||
* in verbatim form to the HTML output. */
|
||||
MD_BLOCK_HTML,
|
||||
|
||||
/* <p>...</p> */
|
||||
MD_BLOCK_P,
|
||||
|
||||
/* <table>...</table> and its contents.
|
||||
* Detail: Structure MD_BLOCK_TABLE_DETAIL (for MD_BLOCK_TABLE),
|
||||
* structure MD_BLOCK_TD_DETAIL (for MD_BLOCK_TH and MD_BLOCK_TD)
|
||||
* Note all of these are used only if extension MD_FLAG_TABLES is enabled. */
|
||||
MD_BLOCK_TABLE,
|
||||
MD_BLOCK_THEAD,
|
||||
MD_BLOCK_TBODY,
|
||||
MD_BLOCK_TR,
|
||||
MD_BLOCK_TH,
|
||||
MD_BLOCK_TD
|
||||
} MD_BLOCKTYPE;
|
||||
|
||||
/* Span represents an in-line piece of a document which should be rendered with
|
||||
* the same font, color and other attributes. A sequence of spans forms a block
|
||||
* like paragraph or list item. */
|
||||
typedef enum MD_SPANTYPE {
|
||||
/* <em>...</em> */
|
||||
MD_SPAN_EM,
|
||||
|
||||
/* <strong>...</strong> */
|
||||
MD_SPAN_STRONG,
|
||||
|
||||
/* <a href="xxx">...</a>
|
||||
* Detail: Structure MD_SPAN_A_DETAIL. */
|
||||
MD_SPAN_A,
|
||||
|
||||
/* <img src="xxx">...</a>
|
||||
* Detail: Structure MD_SPAN_IMG_DETAIL.
|
||||
* Note: Image text can contain nested spans and even nested images.
|
||||
* If rendered into ALT attribute of HTML <IMG> tag, it's responsibility
|
||||
* of the parser to deal with it.
|
||||
*/
|
||||
MD_SPAN_IMG,
|
||||
|
||||
/* <code>...</code> */
|
||||
MD_SPAN_CODE,
|
||||
|
||||
/* <del>...</del>
|
||||
* Note: Recognized only when MD_FLAG_STRIKETHROUGH is enabled.
|
||||
*/
|
||||
MD_SPAN_DEL,
|
||||
|
||||
/* For recognizing inline ($) and display ($$) equations
|
||||
* Note: Recognized only when MD_FLAG_LATEXMATHSPANS is enabled.
|
||||
*/
|
||||
MD_SPAN_LATEXMATH,
|
||||
MD_SPAN_LATEXMATH_DISPLAY,
|
||||
|
||||
/* Wiki links
|
||||
* Note: Recognized only when MD_FLAG_WIKILINKS is enabled.
|
||||
*/
|
||||
MD_SPAN_WIKILINK,
|
||||
|
||||
/* <u>...</u>
|
||||
* Note: Recognized only when MD_FLAG_UNDERLINE is enabled. */
|
||||
MD_SPAN_U
|
||||
} MD_SPANTYPE;
|
||||
|
||||
/* Text is the actual textual contents of span. */
|
||||
typedef enum MD_TEXTTYPE {
|
||||
/* Normal text. */
|
||||
MD_TEXT_NORMAL = 0,
|
||||
|
||||
/* NULL character. CommonMark requires replacing NULL character with
|
||||
* the replacement char U+FFFD, so this allows caller to do that easily. */
|
||||
MD_TEXT_NULLCHAR,
|
||||
|
||||
/* Line breaks.
|
||||
* Note these are not sent from blocks with verbatim output (MD_BLOCK_CODE
|
||||
* or MD_BLOCK_HTML). In such cases, '\n' is part of the text itself. */
|
||||
MD_TEXT_BR, /* <br> (hard break) */
|
||||
MD_TEXT_SOFTBR, /* '\n' in source text where it is not semantically meaningful (soft break) */
|
||||
|
||||
/* Entity.
|
||||
* (a) Named entity, e.g.
|
||||
* (Note MD4C does not have a list of known entities.
|
||||
* Anything matching the regexp /&[A-Za-z][A-Za-z0-9]{1,47};/ is
|
||||
* treated as a named entity.)
|
||||
* (b) Numerical entity, e.g. Ӓ
|
||||
* (c) Hexadecimal entity, e.g. ካ
|
||||
*
|
||||
* As MD4C is mostly encoding agnostic, application gets the verbatim
|
||||
* entity text into the MD_PARSER::text_callback(). */
|
||||
MD_TEXT_ENTITY,
|
||||
|
||||
/* Text in a code block (inside MD_BLOCK_CODE) or inlined code (`code`).
|
||||
* If it is inside MD_BLOCK_CODE, it includes spaces for indentation and
|
||||
* '\n' for new lines. MD_TEXT_BR and MD_TEXT_SOFTBR are not sent for this
|
||||
* kind of text. */
|
||||
MD_TEXT_CODE,
|
||||
|
||||
/* Text is a raw HTML. If it is contents of a raw HTML block (i.e. not
|
||||
* an inline raw HTML), then MD_TEXT_BR and MD_TEXT_SOFTBR are not used.
|
||||
* The text contains verbatim '\n' for the new lines. */
|
||||
MD_TEXT_HTML,
|
||||
|
||||
/* Text is inside an equation. This is processed the same way as inlined code
|
||||
* spans (`code`). */
|
||||
MD_TEXT_LATEXMATH
|
||||
} MD_TEXTTYPE;
|
||||
|
||||
|
||||
/* Alignment enumeration. */
|
||||
typedef enum MD_ALIGN {
|
||||
MD_ALIGN_DEFAULT = 0, /* When unspecified. */
|
||||
MD_ALIGN_LEFT,
|
||||
MD_ALIGN_CENTER,
|
||||
MD_ALIGN_RIGHT
|
||||
} MD_ALIGN;
|
||||
|
||||
|
||||
/* String attribute.
|
||||
*
|
||||
* This wraps strings which are outside of a normal text flow and which are
|
||||
* propagated within various detailed structures, but which still may contain
|
||||
* string portions of different types like e.g. entities.
|
||||
*
|
||||
* So, for example, lets consider this image:
|
||||
*
|
||||
* 
|
||||
*
|
||||
* The image alt text is propagated as a normal text via the MD_PARSER::text()
|
||||
* callback. However, the image title ('foo " bar') is propagated as
|
||||
* MD_ATTRIBUTE in MD_SPAN_IMG_DETAIL::title.
|
||||
*
|
||||
* Then the attribute MD_SPAN_IMG_DETAIL::title shall provide the following:
|
||||
* -- [0]: "foo " (substr_types[0] == MD_TEXT_NORMAL; substr_offsets[0] == 0)
|
||||
* -- [1]: """ (substr_types[1] == MD_TEXT_ENTITY; substr_offsets[1] == 4)
|
||||
* -- [2]: " bar" (substr_types[2] == MD_TEXT_NORMAL; substr_offsets[2] == 10)
|
||||
* -- [3]: (n/a) (n/a ; substr_offsets[3] == 14)
|
||||
*
|
||||
* Note that these invariants are always guaranteed:
|
||||
* -- substr_offsets[0] == 0
|
||||
* -- substr_offsets[LAST+1] == size
|
||||
* -- Currently, only MD_TEXT_NORMAL, MD_TEXT_ENTITY, MD_TEXT_NULLCHAR
|
||||
* substrings can appear. This could change only of the specification
|
||||
* changes.
|
||||
*/
|
||||
typedef struct MD_ATTRIBUTE {
|
||||
const MD_CHAR* text;
|
||||
MD_SIZE size;
|
||||
const MD_TEXTTYPE* substr_types;
|
||||
const MD_OFFSET* substr_offsets;
|
||||
} MD_ATTRIBUTE;
|
||||
|
||||
|
||||
/* Detailed info for MD_BLOCK_UL. */
|
||||
typedef struct MD_BLOCK_UL_DETAIL {
|
||||
int is_tight; /* Non-zero if tight list, zero if loose. */
|
||||
MD_CHAR mark; /* Item bullet character in MarkDown source of the list, e.g. '-', '+', '*'. */
|
||||
} MD_BLOCK_UL_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_OL. */
|
||||
typedef struct MD_BLOCK_OL_DETAIL {
|
||||
unsigned start; /* Start index of the ordered list. */
|
||||
int is_tight; /* Non-zero if tight list, zero if loose. */
|
||||
MD_CHAR mark_delimiter; /* Character delimiting the item marks in MarkDown source, e.g. '.' or ')' */
|
||||
} MD_BLOCK_OL_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_LI. */
|
||||
typedef struct MD_BLOCK_LI_DETAIL {
|
||||
int is_task; /* Can be non-zero only with MD_FLAG_TASKLISTS */
|
||||
MD_CHAR task_mark; /* If is_task, then one of 'x', 'X' or ' '. Undefined otherwise. */
|
||||
MD_OFFSET task_mark_offset; /* If is_task, then offset in the input of the char between '[' and ']'. */
|
||||
} MD_BLOCK_LI_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_H. */
|
||||
typedef struct MD_BLOCK_H_DETAIL {
|
||||
unsigned level; /* Header level (1 - 6) */
|
||||
} MD_BLOCK_H_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_CODE. */
|
||||
typedef struct MD_BLOCK_CODE_DETAIL {
|
||||
MD_ATTRIBUTE info;
|
||||
MD_ATTRIBUTE lang;
|
||||
MD_CHAR fence_char; /* The character used for fenced code block; or zero for indented code block. */
|
||||
} MD_BLOCK_CODE_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_TABLE. */
|
||||
typedef struct MD_BLOCK_TABLE_DETAIL {
|
||||
unsigned col_count; /* Count of columns in the table. */
|
||||
unsigned head_row_count; /* Count of rows in the table header (currently always 1) */
|
||||
unsigned body_row_count; /* Count of rows in the table body */
|
||||
} MD_BLOCK_TABLE_DETAIL;
|
||||
|
||||
/* Detailed info for MD_BLOCK_TH and MD_BLOCK_TD. */
|
||||
typedef struct MD_BLOCK_TD_DETAIL {
|
||||
MD_ALIGN align;
|
||||
} MD_BLOCK_TD_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_A. */
|
||||
typedef struct MD_SPAN_A_DETAIL {
|
||||
MD_ATTRIBUTE href;
|
||||
MD_ATTRIBUTE title;
|
||||
int is_autolink; /* nonzero if this is an autolink */
|
||||
} MD_SPAN_A_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_IMG. */
|
||||
typedef struct MD_SPAN_IMG_DETAIL {
|
||||
MD_ATTRIBUTE src;
|
||||
MD_ATTRIBUTE title;
|
||||
} MD_SPAN_IMG_DETAIL;
|
||||
|
||||
/* Detailed info for MD_SPAN_WIKILINK. */
|
||||
typedef struct MD_SPAN_WIKILINK {
|
||||
MD_ATTRIBUTE target;
|
||||
} MD_SPAN_WIKILINK_DETAIL;
|
||||
|
||||
/* Flags specifying extensions/deviations from CommonMark specification.
|
||||
*
|
||||
* By default (when MD_PARSER::flags == 0), we follow CommonMark specification.
|
||||
* The following flags may allow some extensions or deviations from it.
|
||||
*/
|
||||
#define MD_FLAG_COLLAPSEWHITESPACE 0x0001 /* In MD_TEXT_NORMAL, collapse non-trivial whitespace into single ' ' */
|
||||
#define MD_FLAG_PERMISSIVEATXHEADERS 0x0002 /* Do not require space in ATX headers ( ###header ) */
|
||||
#define MD_FLAG_PERMISSIVEURLAUTOLINKS 0x0004 /* Recognize URLs as autolinks even without '<', '>' */
|
||||
#define MD_FLAG_PERMISSIVEEMAILAUTOLINKS 0x0008 /* Recognize e-mails as autolinks even without '<', '>' and 'mailto:' */
|
||||
#define MD_FLAG_NOINDENTEDCODEBLOCKS 0x0010 /* Disable indented code blocks. (Only fenced code works.) */
|
||||
#define MD_FLAG_NOHTMLBLOCKS 0x0020 /* Disable raw HTML blocks. */
|
||||
#define MD_FLAG_NOHTMLSPANS 0x0040 /* Disable raw HTML (inline). */
|
||||
#define MD_FLAG_TABLES 0x0100 /* Enable tables extension. */
|
||||
#define MD_FLAG_STRIKETHROUGH 0x0200 /* Enable strikethrough extension. */
|
||||
#define MD_FLAG_PERMISSIVEWWWAUTOLINKS 0x0400 /* Enable WWW autolinks (even without any scheme prefix, if they begin with 'www.') */
|
||||
#define MD_FLAG_TASKLISTS 0x0800 /* Enable task list extension. */
|
||||
#define MD_FLAG_LATEXMATHSPANS 0x1000 /* Enable $ and $$ containing LaTeX equations. */
|
||||
#define MD_FLAG_WIKILINKS 0x2000 /* Enable wiki links extension. */
|
||||
#define MD_FLAG_UNDERLINE 0x4000 /* Enable underline extension (and disables '_' for normal emphasis). */
|
||||
#define MD_FLAG_HARD_SOFT_BREAKS 0x8000 /* Force all soft breaks to act as hard breaks. */
|
||||
|
||||
#define MD_FLAG_PERMISSIVEAUTOLINKS (MD_FLAG_PERMISSIVEEMAILAUTOLINKS | MD_FLAG_PERMISSIVEURLAUTOLINKS | MD_FLAG_PERMISSIVEWWWAUTOLINKS)
|
||||
#define MD_FLAG_NOHTML (MD_FLAG_NOHTMLBLOCKS | MD_FLAG_NOHTMLSPANS)
|
||||
|
||||
/* Convenient sets of flags corresponding to well-known Markdown dialects.
|
||||
*
|
||||
* Note we may only support subset of features of the referred dialect.
|
||||
* The constant just enables those extensions which bring us as close as
|
||||
* possible given what features we implement.
|
||||
*
|
||||
* ABI compatibility note: Meaning of these can change in time as new
|
||||
* extensions, bringing the dialect closer to the original, are implemented.
|
||||
*/
|
||||
#define MD_DIALECT_COMMONMARK 0
|
||||
#define MD_DIALECT_GITHUB (MD_FLAG_PERMISSIVEAUTOLINKS | MD_FLAG_TABLES | MD_FLAG_STRIKETHROUGH | MD_FLAG_TASKLISTS)
|
||||
|
||||
/* Parser structure.
|
||||
*/
|
||||
typedef struct MD_PARSER {
|
||||
/* Reserved. Set to zero.
|
||||
*/
|
||||
unsigned abi_version;
|
||||
|
||||
/* Dialect options. Bitmask of MD_FLAG_xxxx values.
|
||||
*/
|
||||
unsigned flags;
|
||||
|
||||
/* Caller-provided rendering callbacks.
|
||||
*
|
||||
* For some block/span types, more detailed information is provided in a
|
||||
* type-specific structure pointed by the argument 'detail'.
|
||||
*
|
||||
* The last argument of all callbacks, 'userdata', is just propagated from
|
||||
* md_parse() and is available for any use by the application.
|
||||
*
|
||||
* Note any strings provided to the callbacks as their arguments or as
|
||||
* members of any detail structure are generally not zero-terminated.
|
||||
* Application has to take the respective size information into account.
|
||||
*
|
||||
* Any rendering callback may abort further parsing of the document by
|
||||
* returning non-zero.
|
||||
*/
|
||||
int (*enter_block)(MD_BLOCKTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
int (*leave_block)(MD_BLOCKTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
|
||||
int (*enter_span)(MD_SPANTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
int (*leave_span)(MD_SPANTYPE /*type*/, void* /*detail*/, void* /*userdata*/);
|
||||
|
||||
int (*text)(MD_TEXTTYPE /*type*/, const MD_CHAR* /*text*/, MD_SIZE /*size*/, void* /*userdata*/);
|
||||
|
||||
/* Debug callback. Optional (may be NULL).
|
||||
*
|
||||
* If provided and something goes wrong, this function gets called.
|
||||
* This is intended for debugging and problem diagnosis for developers;
|
||||
* it is not intended to provide any errors suitable for displaying to an
|
||||
* end user.
|
||||
*/
|
||||
void (*debug_log)(const char* /*msg*/, void* /*userdata*/);
|
||||
|
||||
/* Reserved. Set to NULL.
|
||||
*/
|
||||
void (*syntax)(void);
|
||||
} MD_PARSER;
|
||||
|
||||
|
||||
/* For backward compatibility. Do not use in new code.
|
||||
*/
|
||||
typedef MD_PARSER MD_RENDERER;
|
||||
|
||||
|
||||
/* Parse the Markdown document stored in the string 'text' of size 'size'.
|
||||
* The parser provides callbacks to be called during the parsing so the
|
||||
* caller can render the document on the screen or convert the Markdown
|
||||
* to another format.
|
||||
*
|
||||
* Zero is returned on success. If a runtime error occurs (e.g. a memory
|
||||
* fails), -1 is returned. If the processing is aborted due any callback
|
||||
* returning non-zero, the return value of the callback is returned.
|
||||
*/
|
||||
int md_parse(const MD_CHAR* text, MD_SIZE size, const MD_PARSER* parser, void* userdata);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" { */
|
||||
#endif
|
||||
|
||||
#endif /* MD4C_H */
|
||||
13
deps_src/md4c/src/md4c.pc.in
Normal file
13
deps_src/md4c/src/md4c.pc.in
Normal file
@@ -0,0 +1,13 @@
|
||||
prefix=@CMAKE_INSTALL_PREFIX@
|
||||
exec_prefix=@CMAKE_INSTALL_PREFIX@
|
||||
libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@
|
||||
includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@
|
||||
|
||||
Name: @PROJECT_NAME@
|
||||
Description: Markdown parser library with a SAX-like callback-based interface.
|
||||
Version: @PROJECT_VERSION@
|
||||
URL: @PROJECT_URL@
|
||||
|
||||
Requires:
|
||||
Libs: -L${libdir} -lmd4c
|
||||
Cflags: -I${includedir}
|
||||
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
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
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,3 @@
|
||||
src/libslic3r/PresetBundle.cpp
|
||||
src/slic3r/GUI/DeviceCore/DevBed.cpp
|
||||
src/slic3r/GUI/DeviceCore/DevBed.h
|
||||
src/slic3r/GUI/DeviceCore/DevConfig.h
|
||||
@@ -68,6 +67,7 @@ src/slic3r/GUI/Gizmos/GLGizmoText.hpp
|
||||
src/slic3r/GUI/Gizmos/GLGizmoEmboss.cpp
|
||||
src/slic3r/GUI/Gizmos/GLGizmoSVG.cpp
|
||||
src/slic3r/GUI/Gizmos/GLGizmoMeasure.cpp
|
||||
src/slic3r/GUI/Gizmos/GLGizmoAssembly.cpp
|
||||
src/slic3r/GUI/GUI.cpp
|
||||
src/slic3r/GUI/GUI_App.cpp
|
||||
src/slic3r/GUI/GUI_AuxiliaryList.cpp
|
||||
@@ -81,6 +81,7 @@ 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/2DBed.cpp
|
||||
src/slic3r/GUI/HintNotification.cpp
|
||||
src/slic3r/GUI/IMSlider.cpp
|
||||
src/slic3r/GUI/Widgets/SideTools.cpp
|
||||
@@ -96,6 +97,7 @@ src/slic3r/GUI/Jobs/RotoptimizeJob.cpp
|
||||
src/slic3r/GUI/Jobs/BindJob.cpp
|
||||
src/slic3r/GUI/Jobs/PrintJob.cpp
|
||||
src/slic3r/GUI/Jobs/SendJob.cpp
|
||||
src/slic3r/GUI/Jobs/EmbossJob.cpp
|
||||
src/slic3r/GUI/ThermalPreconditioningDialog.cpp
|
||||
src/slic3r/GUI/ThermalPreconditioningDialog.hpp
|
||||
src/slic3r/GUI/Jobs/SLAImportJob.cpp
|
||||
@@ -165,7 +167,6 @@ src/slic3r/GUI/Tab.hpp
|
||||
src/slic3r/GUI/UnsavedChangesDialog.cpp
|
||||
src/slic3r/GUI/Auxiliary.cpp
|
||||
src/slic3r/GUI/UpdateDialogs.cpp
|
||||
src/slic3r/GUI/UnsavedChangesDialog.cpp
|
||||
src/slic3r/GUI/ObjColorDialog.cpp
|
||||
src/slic3r/GUI/SyncAmsInfoDialog.cpp
|
||||
src/slic3r/GUI/WipeTowerDialog.cpp
|
||||
@@ -178,12 +179,10 @@ src/slic3r/GUI/KBShortcutsDialog.cpp
|
||||
src/slic3r/GUI/ReleaseNote.cpp
|
||||
src/slic3r/GUI/ReleaseNote.hpp
|
||||
src/slic3r/GUI/UpgradePanel.cpp
|
||||
src/slic3r/GUI/UnsavedChangesDialog.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/GCode/ToolOrdering.cpp
|
||||
src/libslic3r/ExtrusionEntity.cpp
|
||||
@@ -237,7 +236,6 @@ src/slic3r/Utils/Obico.cpp
|
||||
src/slic3r/Utils/SimplyPrint.cpp
|
||||
src/slic3r/Utils/Flashforge.cpp
|
||||
src/slic3r/GUI/Jobs/OAuthJob.cpp
|
||||
src/slic3r/GUI/BackgroundSlicingProcess.cpp
|
||||
src/slic3r/GUI/Gizmos/GLGizmoBrimEars.cpp
|
||||
src/slic3r/GUI/PartSkipDialog.cpp
|
||||
src/slic3r/GUI/PartSkipDialog.hpp
|
||||
@@ -246,4 +244,8 @@ src/slic3r/GUI/SkipPartCanvas.hpp
|
||||
src/slic3r/GUI/FilamentBitmapUtils.cpp
|
||||
src/slic3r/GUI/FilamentBitmapUtils.hpp
|
||||
src/slic3r/GUI/FilamentPickerDialog.cpp
|
||||
src/slic3r/GUI/NetworkPluginDialog.cpp
|
||||
src/slic3r/GUI/RammingChart.cpp
|
||||
src/slic3r/GUI/StepMeshDialog.cpp
|
||||
src/slic3r/GUI/FilamentPickerDialog.hpp
|
||||
src/libslic3r/PresetBundle.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
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
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
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
BIN
resources/calib/cornering/SCV-V2.drc
Normal file
BIN
resources/calib/cornering/SCV-V2.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/calib/input_shaping/fast_tower_test.drc
Normal file
BIN
resources/calib/input_shaping/fast_tower_test.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/calib/input_shaping/ringing_tower.drc
Normal file
BIN
resources/calib/input_shaping/ringing_tower.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/calib/pressure_advance/pressure_advance_test.drc
Normal file
BIN
resources/calib/pressure_advance/pressure_advance_test.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/calib/pressure_advance/tower_with_seam.drc
Normal file
BIN
resources/calib/pressure_advance/tower_with_seam.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/calib/retraction/retraction_tower.drc
Normal file
BIN
resources/calib/retraction/retraction_tower.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/calib/temperature_tower/temperature_tower.drc
Normal file
BIN
resources/calib/temperature_tower/temperature_tower.drc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/calib/vfa/vfa.drc
Normal file
BIN
resources/calib/vfa/vfa.drc
Normal file
Binary file not shown.
BIN
resources/calib/volumetric_speed/SpeedTestStructure.drc
Normal file
BIN
resources/calib/volumetric_speed/SpeedTestStructure.drc
Normal file
Binary file not shown.
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -64,26 +64,26 @@
|
||||
|
||||
[hint:Precise wall]
|
||||
text = Precise wall\nDid you know that turning on precise wall can improve precision and layer consistency?
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/quality_settings_precision
|
||||
documentation_link = https://www.orcaslicer.com/wiki/quality_settings_precision#precise-wall
|
||||
|
||||
[hint:Sandwich mode]
|
||||
text = Sandwich mode\nDid you know that you can use sandwich mode (inner-outer-inner) to improve precision and layer consistency if your model doesn't have very steep overhangs?
|
||||
|
||||
[hint:Chamber temperature]
|
||||
text = Chamber temperature\nDid you know that OrcaSlicer supports chamber temperature?
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/Chamber-temperature
|
||||
documentation_link = https://www.orcaslicer.com/wiki/material_temperatures#print-chamber-temperature
|
||||
|
||||
[hint:Calibration]
|
||||
text = Calibration\nDid you know that calibrating your printer can do wonders? Check out our beloved calibration solution in OrcaSlicer.
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/Calibration
|
||||
documentation_link = https://www.orcaslicer.com/wiki/calibration
|
||||
|
||||
[hint:Auxiliary fan]
|
||||
text = Auxiliary fan\nDid you know that OrcaSlicer supports Auxiliary part cooling fan?
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/Auxiliary-fan
|
||||
documentation_link = https://www.orcaslicer.com/wiki/material_cooling#auxiliary-part-cooling-fan
|
||||
|
||||
[hint:Air filtration]
|
||||
text = Air filtration/Exhaust Fan\nDid you know that OrcaSlicer can support Air filtration/Exhaust Fan?
|
||||
documentation_link = https://github.com/OrcaSlicer/OrcaSlicer/wiki/air-filtration
|
||||
documentation_link = https://www.orcaslicer.com/wiki/material_cooling#activate-air-filtration
|
||||
|
||||
[hint:G-code window]
|
||||
text = G-code window\nYou can turn on/off the G-code window by pressing the <b>C</b> key.
|
||||
|
||||
Binary file not shown.
BIN
resources/handy_models/3DBenchy.drc
Normal file
BIN
resources/handy_models/3DBenchy.drc
Normal file
Binary file not shown.
BIN
resources/handy_models/OrcaToleranceTest.drc
Normal file
BIN
resources/handy_models/OrcaToleranceTest.drc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/handy_models/Orca_stringhell.drc
Normal file
BIN
resources/handy_models/Orca_stringhell.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/handy_models/Stanford_Bunny.drc
Normal file
BIN
resources/handy_models/Stanford_Bunny.drc
Normal file
Binary file not shown.
Binary file not shown.
BIN
resources/handy_models/Voron_Design_Cube_v7.drc
Normal file
BIN
resources/handy_models/Voron_Design_Cube_v7.drc
Normal file
Binary file not shown.
BIN
resources/handy_models/calicat.drc
Normal file
BIN
resources/handy_models/calicat.drc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
resources/handy_models/ksr_fdmtest_v4.drc
Normal file
BIN
resources/handy_models/ksr_fdmtest_v4.drc
Normal file
Binary file not shown.
@@ -1,4 +1 @@
|
||||
<svg width="35" height="25" viewBox="0 0 35 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M26.7876 10.739L29.899 13.8505C30.0943 14.0458 30.4109 14.0458 30.6061 13.8505L33.7177 10.739" stroke="#ACACAC" stroke-linecap="round"/>
|
||||
<path d="M12 4.34668C14.1549 4.34668 16.2215 5.2027 17.7452 6.72644C19.269 8.25017 20.125 10.3168 20.125 12.4717C20.125 14.6266 19.269 16.6932 17.7452 18.2169C16.2215 19.7407 14.1549 20.5967 12 20.5967C9.84512 20.5967 7.77849 19.7407 6.25476 18.2169C4.73102 16.6932 3.875 14.6266 3.875 12.4717C3.875 10.3168 4.73102 8.25017 6.25476 6.72644C7.77849 5.2027 9.84512 4.34668 12 4.34668ZM12 22.4717C14.6522 22.4717 17.1957 21.4181 19.0711 19.5427C20.9464 17.6674 22 15.1238 22 12.4717C22 9.81951 20.9464 7.27598 19.0711 5.40061C17.1957 3.52525 14.6522 2.47168 12 2.47168C9.34784 2.47168 6.8043 3.52525 4.92893 5.40061C3.05357 7.27598 2 9.81951 2 12.4717C2 15.1238 3.05357 17.6674 4.92893 19.5427C6.8043 21.4181 9.34784 22.4717 12 22.4717ZM12 7.47168C11.4805 7.47168 11.0625 7.88965 11.0625 8.40918V12.7842C11.0625 13.3037 11.4805 13.7217 12 13.7217C12.5195 13.7217 12.9375 13.3037 12.9375 12.7842V8.40918C12.9375 7.88965 12.5195 7.47168 12 7.47168ZM13.25 16.2217C13.25 15.8902 13.1183 15.5722 12.8839 15.3378C12.6495 15.1034 12.3315 14.9717 12 14.9717C11.6685 14.9717 11.3505 15.1034 11.1161 15.3378C10.8817 15.5722 10.75 15.8902 10.75 16.2217C10.75 16.5532 10.8817 16.8711 11.1161 17.1056C11.3505 17.34 11.6685 17.4717 12 17.4717C12.3315 17.4717 12.6495 17.34 12.8839 17.1056C13.1183 16.8711 13.25 16.5532 13.25 16.2217Z" fill="#D01B1B"/>
|
||||
</svg>
|
||||
<?xml version="1.0" encoding="UTF-8"?><svg id="a" xmlns="http://www.w3.org/2000/svg" width="35" height="25" viewBox="0 0 35 25"><path d="M12,21c4.97,0,9-4.03,9-9S16.97,3,12,3,3,7.03,3,12s4.03,9,9,9Z" style="fill:#ed1c24;"/><path d="M13,14h-2v-7h2v7ZM13,15h-2v2h2v-2Z" style="fill:#e6e6e6;"/><path d="M25.5,10.5l4,3,4-3" style="fill:none; stroke:#949494; stroke-linecap:round; stroke-linejoin:round;"/></svg>
|
||||
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 407 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user