Merge pull request #4316 from bambulab/github_master

sync codes for flathub building
This commit is contained in:
MackBambu 2024-06-18 16:17:50 +08:00 committed by GitHub
commit d19c965478
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
25 changed files with 236 additions and 75 deletions

View File

@ -44,6 +44,7 @@ jobs:
matrix: matrix:
include: include:
- os: ubuntu-20.04 - os: ubuntu-20.04
- os: ubuntu-24.04
- os: windows-latest - os: windows-latest
- os: macos-13 - os: macos-13
arch: x86_64 arch: x86_64

View File

@ -78,7 +78,7 @@ jobs:
if: inputs.os == 'macos-13' if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |
brew install cmake git gettext automake texinfo brew install automake texinfo
mkdir -p ${{ github.workspace }}/build_${{inputs.arch}} mkdir -p ${{ github.workspace }}/build_${{inputs.arch}}
cd ${{ github.workspace }}/build_${{inputs.arch}} cd ${{ github.workspace }}/build_${{inputs.arch}}
cmake .. -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}/usr/local" -DCMAKE_INSTALL_PREFIX="../install_dir" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH="${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}/usr/local" -DCMAKE_MACOSX_BUNDLE=on cmake .. -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}/usr/local" -DCMAKE_INSTALL_PREFIX="../install_dir" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MACOSX_RPATH=ON -DCMAKE_INSTALL_RPATH="${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}/usr/local" -DCMAKE_MACOSX_BUNDLE=on
@ -225,28 +225,28 @@ jobs:
# Ubuntu # Ubuntu
- name: Install dependencies - name: Install dependencies
if: inputs.os == 'ubuntu-20.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install -y autoconf build-essential cmake curl wget file git \ sudo apt-get install -y autoconf build-essential cmake curl wget file git \
libgl1-mesa-dev libgtk-3-dev libxkbcommon-dev libunwind-dev libfuse2 libgl1-mesa-dev libgtk-3-dev libxkbcommon-dev libunwind-dev libfuse2
- name: Install dependencies from BuildLinux.sh - name: Install dependencies from BuildLinux.sh
if: inputs.os == 'ubuntu-20.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash shell: bash
run: sudo ./BuildLinux.sh -ur run: sudo ./BuildLinux.sh -ur
- name: Fix permissions - name: Fix permissions
if: inputs.os == 'ubuntu-20.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash shell: bash
run: sudo chown $USER -R ./ run: sudo chown $USER -R ./
- name: Build slicer - name: Build slicer
if: inputs.os == 'ubuntu-20.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash shell: bash
run: | run: |
./BuildLinux.sh -isr ./BuildLinux.sh -isr
mv -n ./build/BambuStudio_ubu64.AppImage ./build/Bambu_Studio_linux_${{ env.ver }}.AppImage mv -n ./build/BambuStudio_ubu64.AppImage ./build/Bambu_Studio_${{inputs.os}}_${{ env.ver }}.AppImage
# - name: Build orca_custom_preset_tests # - name: Build orca_custom_preset_tests
# if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' # if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04'
@ -258,11 +258,11 @@ jobs:
# zip -r orca_custom_preset_tests.zip user/ # zip -r orca_custom_preset_tests.zip user/
- name: Upload artifacts Ubuntu - name: Upload artifacts Ubuntu
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' }} if: ${{ ! env.ACT && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: BambuStudio_Linux_${{ env.ver }} name: BambuStudio_${{inputs.os}}_${{ env.ver }}
path: './build/Bambu_Studio_linux_${{ env.ver }}.AppImage' path: './build/Bambu_Studio_${{inputs.os}}_${{ env.ver }}.AppImage'
# - name: Deploy Ubuntu release # - name: Deploy Ubuntu release
# if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }} # if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }}
@ -284,4 +284,4 @@ jobs:
# asset_path: ${{ github.workspace }}/resources/profiles/orca_custom_preset_tests.zip # asset_path: ${{ github.workspace }}/resources/profiles/orca_custom_preset_tests.zip
# asset_name: orca_custom_preset_tests.zip # asset_name: orca_custom_preset_tests.zip
# asset_content_type: application/octet-stream # asset_content_type: application/octet-stream
# max_releases: 1 # max_releases: 1

View File

@ -35,7 +35,7 @@ jobs:
dep-folder-name: ${{ (inputs.os == 'windows-latest' || inputs.os == 'macos-13') && 'BambuStudio_dep' || 'destdir' }} dep-folder-name: ${{ (inputs.os == 'windows-latest' || inputs.os == 'macos-13') && 'BambuStudio_dep' || 'destdir' }}
output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}} output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
run: | run: |
echo cache-key=${{ runner.os }}${{ env.dash-arch }}-cache-bambustudio_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }} echo cache-key=${{ inputs.os }}${{ env.dash-arch }}-cache-bambustudio_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }}
echo cache-path=${{ github.workspace }}/deps/build${{ env.underscore-arch }}/${{ env.dep-folder-name }}${{ env.underscore-arch }} >> ${{ env.output-cmd }} echo cache-path=${{ github.workspace }}/deps/build${{ env.underscore-arch }}/${{ env.dep-folder-name }}${{ env.underscore-arch }} >> ${{ env.output-cmd }}
- name: load cache - name: load cache

View File

@ -79,7 +79,7 @@ jobs:
if: inputs.os == 'macos-13' if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |
brew install cmake git gettext automake texinfo brew install automake texinfo
brew uninstall --ignore-dependencies zstd brew uninstall --ignore-dependencies zstd
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }} mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }} mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}
@ -88,20 +88,25 @@ jobs:
make -j4 make -j4
brew install zstd brew install zstd
- name: pack deps on Macos
if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }}
run: tar -zcvf "BambuStudio_dep_mac_${{ inputs.arch }}_$(date +"%Y%m%d").tar.gz" "${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}"
- name: Build on Ubuntu - name: Build on Ubuntu
if: inputs.os == 'ubuntu-20.04' if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }} working-directory: ${{ github.workspace }}
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install cmake libgl1-mesa-dev libgtk-3-dev libxkbcommon-dev libunwind-dev libfuse2 -y sudo apt-get install libgl1-mesa-dev libgtk-3-dev libxkbcommon-dev libunwind-dev libfuse2 -y
mkdir -p ${{ github.workspace }}/deps/build mkdir -p ${{ github.workspace }}/deps/build
mkdir -p ${{ github.workspace }}/deps/build/destdir mkdir -p ${{ github.workspace }}/deps/build/destdir
sudo ./BuildLinux.sh -ur sudo ./BuildLinux.sh -ur
sudo chown $USER -R ./ sudo chown $USER -R ./
./BuildLinux.sh -dr ./BuildLinux.sh -dr
cd deps/build cd deps/build
tar -czvf BambuStudio_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir tar -czvf BambuStudio_dep_${{ inputs.os }}_$(date +"%Y%m%d").tar.gz destdir
# Upload Artifacts # Upload Artifacts
@ -110,7 +115,7 @@ jobs:
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: BambuStudio_dep_mac_${{ inputs.arch }}_${{ env.date }} name: BambuStudio_dep_mac_${{ inputs.arch }}_${{ env.date }}
path: ${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep*.tar.gz path: ${{ github.workspace }}/BambuStudio_dep_mac_${{ inputs.arch }}*.tar.gz
- name: Upload Windows artifacts - name: Upload Windows artifacts
if: inputs.os == 'windows-latest' if: inputs.os == 'windows-latest'
@ -120,11 +125,11 @@ jobs:
path: ${{ github.workspace }}/deps/build/BambuStudio_dep*.zip path: ${{ github.workspace }}/deps/build/BambuStudio_dep*.zip
- name: Upload Ubuntu artifacts - name: Upload Ubuntu artifacts
if: ${{ ! env.ACT && inputs.os == 'ubuntu-20.04' }} if: ${{ ! env.ACT && (inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04') }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: BambuStudio_dep_ubuntu_${{ env.date }} name: BambuStudio_dep_${{ inputs.os }}_${{ env.date }}
path: ${{ github.workspace }}/deps/build/BambuStudio_dep_ubuntu_*.tar.gz path: ${{ github.workspace }}/deps/build/BambuStudio_dep_${{ inputs.os }}_*.tar.gz
build_Bambu: build_Bambu:
name: Build BambuStudio name: Build BambuStudio
@ -136,4 +141,4 @@ jobs:
cache-path: ${{ inputs.cache-path }} cache-path: ${{ inputs.cache-path }}
os: ${{ inputs.os }} os: ${{ inputs.os }}
arch: ${{ inputs.arch }} arch: ${{ inputs.arch }}
secrets: inherit secrets: inherit

View File

@ -87,14 +87,6 @@ then
mkdir build mkdir build
fi fi
# Addtional Dev packages for BambuStudio
export REQUIRED_DEV_PACKAGES="libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules"
# libwebkit2gtk-4.1-dev ??
export DEV_PACKAGES_COUNT=$(echo ${REQUIRED_DEV_PACKAGES} | wc -w)
if [ $(dpkg --get-selections | grep -E "$(echo ${REQUIRED_DEV_PACKAGES} | tr ' ' '|')" | wc -l) -lt ${DEV_PACKAGES_COUNT} ]; then
sudo apt install -y ${REQUIRED_DEV_PACKAGES} git cmake wget file
fi
#FIXME: require root for -u option #FIXME: require root for -u option
if [[ -n "$UPDATE_LIB" ]] if [[ -n "$UPDATE_LIB" ]]
then then
@ -114,12 +106,29 @@ then
if [[ $ubu_version == "Ubuntu 22.04"* ]] if [[ $ubu_version == "Ubuntu 22.04"* ]]
then then
apt install -y curl libssl-dev libcurl4-openssl-dev m4 apt install -y curl libssl-dev libcurl4-openssl-dev m4
elif [[ $ubu_version == "Ubuntu 24.04"* ]]
then
NEW_SOURCE="deb http://gb.archive.ubuntu.com/ubuntu jammy main"
if grep -qF -- "$NEW_SOURCE" /etc/apt/sources.list; then
echo "source exist: $NEW_SOURCE"
else
echo "$NEW_SOURCE" | sudo tee -a /etc/apt/sources.list > /dev/null
fi
apt update
fi fi
if [[ -n "$BUILD_DEBUG" ]] if [[ -n "$BUILD_DEBUG" ]]
then then
echo -e "\nInstalling: libssl-dev libcurl4-openssl-dev\n" echo -e "\nInstalling: libssl-dev libcurl4-openssl-dev\n"
apt install -y libssl-dev libcurl4-openssl-dev apt install -y libssl-dev libcurl4-openssl-dev
fi fi
# Addtional Dev packages for BambuStudio
export REQUIRED_DEV_PACKAGES="libgstreamerd-3-dev libsecret-1-dev libwebkit2gtk-4.0-dev libosmesa6-dev libssl-dev libcurl4-openssl-dev eglexternalplatform-dev libudev-dev libdbus-1-dev extra-cmake-modules"
# libwebkit2gtk-4.1-dev ??
export DEV_PACKAGES_COUNT=$(echo ${REQUIRED_DEV_PACKAGES} | wc -w)
if [ $(dpkg --get-selections | grep -E "$(echo ${REQUIRED_DEV_PACKAGES} | tr ' ' '|')" | wc -l) -lt ${DEV_PACKAGES_COUNT} ]; then
sudo apt install -y ${REQUIRED_DEV_PACKAGES} git cmake wget file
fi
echo -e "done\n" echo -e "done\n"
exit 0 exit 0
fi fi

View File

@ -26,8 +26,8 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
elseif (MSVC_VERSION LESS 1930) elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset) # 1920-1929 = VS 16.0 (v142 toolset)
set(_boost_toolset "msvc-14.2") set(_boost_toolset "msvc-14.2")
elseif (MSVC_VERSION LESS 1940) elseif (MSVC_VERSION LESS 1950)
# 1930-1939 = VS 17.0 (v143 toolset) # 1930-1949 = VS 17.0 (v143 toolset)
set(_boost_toolset "msvc-14.3") set(_boost_toolset "msvc-14.3")
else () else ()
message(FATAL_ERROR "Unsupported MSVC version") message(FATAL_ERROR "Unsupported MSVC version")

View File

@ -5,7 +5,7 @@ bambustudio_add_cmake_project(
# For whatever reason, this keeps downloading forever (repeats downloads if finished) # For whatever reason, this keeps downloading forever (repeats downloads if finished)
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0 URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
DEPENDS dep_Boost dep_GMP dep_MPFR DEPENDS ${BOOST_PKG} dep_GMP dep_MPFR
) )
include(GNUInstallDirs) include(GNUInstallDirs)

68
deps/CMakeLists.txt vendored
View File

@ -31,6 +31,15 @@ if (NPROC EQUAL 0)
set(NPROC 1) set(NPROC 1)
endif () endif ()
option(DEP_BUILD_PNG "Compile libpng" ON)
option(DEP_BUILD_JPEG "Compile libjpeg" ON)
option(DEP_BUILD_TIFF "Compile libtiff" ON)
option(DEP_BUILD_BOOST "Compile boost" ON)
option(DEP_BUILD_OPENSSL "Compile openssl" ON)
option(DEP_BUILD_GLFW "Compile GLFW" ON)
option(DEP_BUILD_FREETYPE "Compile freetype" ON)
option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON)
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory") set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.") set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.")
@ -148,10 +157,20 @@ if (NOT ZLIB_FOUND)
set(ZLIB_PKG dep_ZLIB) set(ZLIB_PKG dep_ZLIB)
endif () endif ()
set(PNG_PKG "") set(PNG_PKG "")
if (NOT PNG_FOUND) if (DEP_BUILD_PNG AND NOT PNG_FOUND)
include(PNG/PNG.cmake) include(PNG/PNG.cmake)
set(PNG_PKG dep_PNG) set(PNG_PKG dep_PNG)
endif () endif ()
set(JPEG_PKG "")
if (DEP_BUILD_JPEG AND NOT JPEG_FOUND)
include(JPEG/JPEG.cmake)
set(JPEG_PKG dep_JPEG)
endif()
set(TIFF_PKG "")
if (DEP_BUILD_TIFF AND NOT TIFF_FOUND)
include(TIFF/TIFF.cmake)
set(TIFF_PKG dep_TIFF)
endif()
set(EXPAT_PKG "") set(EXPAT_PKG "")
if (NOT EXPAT_FOUND) if (NOT EXPAT_FOUND)
include(EXPAT/EXPAT.cmake) include(EXPAT/EXPAT.cmake)
@ -159,13 +178,21 @@ if (NOT EXPAT_FOUND)
endif () endif ()
set(DEP_Boost_COMPONENTS system iostreams filesystem thread log locale regex date_time) set(DEP_Boost_COMPONENTS system iostreams filesystem thread log locale regex date_time)
include(Boost/Boost.cmake) set(BOOST_PKG "")
if (DEP_BUILD_BOOST)
include(Boost/Boost.cmake)
set(BOOST_PKG dep_Boost)
endif ()
# The order of includes respects the dependencies between libraries # The order of includes respects the dependencies between libraries
include(Cereal/Cereal.cmake) include(Cereal/Cereal.cmake)
include(Qhull/Qhull.cmake) include(Qhull/Qhull.cmake)
include(GLEW/GLEW.cmake) include(GLEW/GLEW.cmake)
include(GLFW/GLFW.cmake) set(GLFW_PKG "")
if (DEP_BUILD_GLFW)
include(GLFW/GLFW.cmake)
set(GLFW_PKG dep_GLFW)
endif ()
include(OpenCSG/OpenCSG.cmake) include(OpenCSG/OpenCSG.cmake)
include(TBB/TBB.cmake) include(TBB/TBB.cmake)
@ -180,37 +207,46 @@ include(CGAL/CGAL.cmake)
include(NLopt/NLopt.cmake) include(NLopt/NLopt.cmake)
include(OpenSSL/OpenSSL.cmake) set(OPENSSL_PKG "")
if (DEP_BUILD_OPENSSL)
include(OpenSSL/OpenSSL.cmake)
set(OPENSSL_PKG dep_OpenSSL)
endif ()
set(CURL_PKG "") set(CURL_PKG "")
if (NOT CURL_FOUND) if (NOT CURL_FOUND)
include(CURL/CURL.cmake) include(CURL/CURL.cmake)
set(CURL_PKG dep_CURL) set(CURL_PKG dep_CURL)
endif () endif ()
set(WXWIDGETS_PKG "")
include(JPEG/JPEG.cmake) if (DEP_BUILD_WXWIDGETS)
include(TIFF/TIFF.cmake) include(wxWidgets/wxWidgets.cmake)
include(wxWidgets/wxWidgets.cmake) set(WXWIDGETS_PKG dep_wxWidgets)
endif ()
set(FREETYPE_PKG "")
if (DEP_BUILD_FREETYPE)
include(FREETYPE/FREETYPE.cmake)
set(FREETYPE_PKG dep_FREETYPE)
endif ()
include(OCCT/OCCT.cmake) include(OCCT/OCCT.cmake)
include(OpenCV/OpenCV.cmake) include(OpenCV/OpenCV.cmake)
include(FREETYPE/FREETYPE.cmake)
set(_dep_list set(_dep_list
dep_Boost ${BOOST_PKG}
dep_TBB dep_TBB
${CURL_PKG} ${CURL_PKG}
dep_wxWidgets ${WXWIDGETS_PKG}
dep_Cereal dep_Cereal
dep_NLopt dep_NLopt
dep_OpenVDB dep_OpenVDB
dep_OpenCSG dep_OpenCSG
dep_OpenCV dep_OpenCV
dep_CGAL dep_CGAL
dep_OpenSSL ${OPENSSL_PKG}
dep_GLFW ${GLFW_PKG}
${PNG_PKG} ${PNG_PKG}
${ZLIB_PKG} ${ZLIB_PKG}
${EXPAT_PKG} ${EXPAT_PKG}
${FREETYPE_PKG}
) )
if (MSVC) if (MSVC)
@ -223,7 +259,9 @@ else()
endif() endif()
list(APPEND _dep_list "dep_OCCT") list(APPEND _dep_list "dep_OCCT")
list(APPEND _dep_list "dep_FREETYPE") # if (DEP_BUILD_FREETYPE)
# list(APPEND _dep_list "dep_FREETYPE")
# endif ()
add_custom_target(deps ALL DEPENDS ${_dep_list}) add_custom_target(deps ALL DEPENDS ${_dep_list})

View File

@ -72,7 +72,9 @@ bambustudio_add_cmake_project(CURL
${_curl_platform_flags} ${_curl_platform_flags}
) )
add_dependencies(dep_CURL dep_OpenSSL) if (DEP_BUILD_OPENSSL)
add_dependencies(dep_CURL ${OPENSSL_PKG})
endif ()
if (MSVC) if (MSVC)
add_debug_dep(dep_CURL) add_debug_dep(dep_CURL)

View File

@ -1,6 +1,8 @@
bambustudio_add_cmake_project(Cereal bambustudio_add_cmake_project(Cereal
URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz" URL "https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.0.zip"
URL_HASH SHA256=1921f26d2e1daf9132da3c432e2fd02093ecaedf846e65d7679ddf868c7289c4 URL_HASH SHA256=71642cb54658e98c8f07a0f0d08bf9766f1c3771496936f6014169d3726d9657
CMAKE_ARGS CMAKE_ARGS
-DJUST_INSTALL_CEREAL=on -DJUST_INSTALL_CEREAL=ON
-DSKIP_PERFORMANCE_COMPARISON=ON
-DBUILD_TESTS=OFF
) )

View File

@ -11,8 +11,8 @@ else()
endif() endif()
bambustudio_add_cmake_project(FREETYPE bambustudio_add_cmake_project(FREETYPE
URL https://mirror.ossplanet.net/nongnu/freetype/freetype-2.12.1.tar.gz URL https://github.com/freetype/freetype/archive/refs/tags/VER-2-12-1.tar.gz
URL_HASH SHA256=efe71fd4b8246f1b0b1b9bfca13cfff1c9ad85930340c27df469733bbb620938 URL_HASH SHA256=0E72CAE32751598D126CFD4BCEDA909F646B7231AB8C52E28ABB686C20A2BEA1
#DEPENDS ${ZLIB_PKG} #DEPENDS ${ZLIB_PKG}
#"${_patch_step}" #"${_patch_step}"
CMAKE_ARGS CMAKE_ARGS

View File

@ -18,6 +18,7 @@ bambustudio_add_cmake_project(OCCT
#-DUSE_FREETYPE=OFF #-DUSE_FREETYPE=OFF
-DUSE_FFMPEG=OFF -DUSE_FFMPEG=OFF
-DUSE_VTK=OFF -DUSE_VTK=OFF
-DBUILD_DOC_Overview=OFF
-DBUILD_MODULE_ApplicationFramework=OFF -DBUILD_MODULE_ApplicationFramework=OFF
#-DBUILD_MODULE_DataExchange=OFF #-DBUILD_MODULE_DataExchange=OFF
-DBUILD_MODULE_Draw=OFF -DBUILD_MODULE_Draw=OFF
@ -27,4 +28,6 @@ bambustudio_add_cmake_project(OCCT
-DBUILD_MODULE_Visualization=OFF -DBUILD_MODULE_Visualization=OFF
) )
add_dependencies(dep_OCCT dep_FREETYPE) if (DEP_BUILD_FREETYPE)
add_dependencies(dep_OCCT ${FREETYPE_PKG})
endif ()

52
deps/OpenCV/0001-OpenCV-fix.patch vendored Normal file
View File

@ -0,0 +1,52 @@
From 6fb3f6333150a777e835fc7c48e49750591bf7fe Mon Sep 17 00:00:00 2001
From: Benjamin Buch <bebuch@users.noreply.github.com>
Date: Thu, 23 May 2024 16:05:19 +0200
Subject: [PATCH] Support VS 2022 17.1x.y
With 17.10.0 the MSVC toolset was set to 19.40.x which breaks the compatibility test in the OpenCV's CMake Config files.
---
cmake/templates/OpenCVConfig.root-WIN32.cmake.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
index b0f254ebe8..62e36272f3 100644
--- a/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
+++ b/cmake/templates/OpenCVConfig.root-WIN32.cmake.in
@@ -137,7 +137,7 @@ elseif(MSVC)
set(OpenCV_RUNTIME vc14) # selecting previous compatible runtime version
endif()
endif()
- elseif(MSVC_VERSION MATCHES "^193[0-9]$")
+ elseif(MSVC_VERSION MATCHES "^19[34][0-9]$")
set(OpenCV_RUNTIME vc17)
check_one_config(has_VS2022)
if(NOT has_VS2022)
--
2.45.2.windows.1
From f85818ba6f9031c450475a7453dee0acce31a881 Mon Sep 17 00:00:00 2001
From: Benjamin Buch <bebuch@users.noreply.github.com>
Date: Fri, 24 May 2024 11:10:09 +0200
Subject: [PATCH] Support VS 2022 17.1x.y in OpenCVDetectCXXCompiler.cmake
With 17.10.0 the MSVC toolset was set to 19.40.x which breaks the compatibility test in the OpenCV's CMake Config files.
---
cmake/OpenCVDetectCXXCompiler.cmake | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cmake/OpenCVDetectCXXCompiler.cmake b/cmake/OpenCVDetectCXXCompiler.cmake
index 1743aca11f..448afd46ea 100644
--- a/cmake/OpenCVDetectCXXCompiler.cmake
+++ b/cmake/OpenCVDetectCXXCompiler.cmake
@@ -176,7 +176,7 @@ elseif(MSVC)
set(OpenCV_RUNTIME vc15)
elseif(MSVC_VERSION MATCHES "^192[0-9]$")
set(OpenCV_RUNTIME vc16)
- elseif(MSVC_VERSION MATCHES "^193[0-9]$")
+ elseif(MSVC_VERSION MATCHES "^19[34][0-9]$")
set(OpenCV_RUNTIME vc17)
else()
message(WARNING "OpenCV does not recognize MSVC_VERSION \"${MSVC_VERSION}\". Cannot set OpenCV_RUNTIME")
--
2.45.2.windows.1

View File

@ -7,6 +7,7 @@ endif ()
bambustudio_add_cmake_project(OpenCV bambustudio_add_cmake_project(OpenCV
URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz URL https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz
URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277 URL_HASH SHA256=1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277
PATCH_COMMAND git apply --directory deps/build/dep_OpenCV-prefix/src/dep_OpenCV --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-OpenCV-fix.patch
CMAKE_ARGS CMAKE_ARGS
-DBUILD_SHARED_LIBS=0 -DBUILD_SHARED_LIBS=0
-DBUILD_PERE_TESTS=OFF -DBUILD_PERE_TESTS=OFF

View File

@ -45,6 +45,8 @@ else()
set(url_str "https://github.com/openssl/openssl/archive/refs/tags/openssl-3.1.2.tar.gz") set(url_str "https://github.com/openssl/openssl/archive/refs/tags/openssl-3.1.2.tar.gz")
set(url_hash "SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31") set(url_hash "SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31")
endif() endif()
# set(url_str "https://github.com/openssl/openssl/archive/OpenSSL_1_1_1w.tar.gz")
# set(url_hash "SHA256=2130E8C2FB3B79D1086186F78E59E8BC8D1A6AEDF17AB3907F4CB9AE20918C41")
ExternalProject_Add(dep_OpenSSL ExternalProject_Add(dep_OpenSSL
#EXCLUDE_FROM_ALL ON #EXCLUDE_FROM_ALL ON
URL ${url_str} URL ${url_str}

View File

@ -17,7 +17,7 @@ bambustudio_add_cmake_project(OpenVDB
URL_HASH SHA256=f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81 URL_HASH SHA256=f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81
# URL https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v10.0.1.zip # URL https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v10.0.1.zip
# URL_HASH SHA256=48C2CFA9853B58FA86282DF1F83F0E99D07858CC03EB2BA8227DC447A830100A # URL_HASH SHA256=48C2CFA9853B58FA86282DF1F83F0E99D07858CC03EB2BA8227DC447A830100A
DEPENDS dep_TBB dep_Blosc dep_OpenEXR dep_Boost DEPENDS dep_TBB dep_Blosc dep_OpenEXR ${BOOST_PKG}
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DOPENVDB_BUILD_PYTHON_MODULE=OFF -DOPENVDB_BUILD_PYTHON_MODULE=OFF

View File

@ -3,7 +3,7 @@ find_package(OpenGL QUIET REQUIRED)
bambustudio_add_cmake_project(TIFF bambustudio_add_cmake_project(TIFF
URL https://gitlab.com/libtiff/libtiff/-/archive/v4.1.0/libtiff-v4.1.0.zip URL https://gitlab.com/libtiff/libtiff/-/archive/v4.1.0/libtiff-v4.1.0.zip
URL_HASH SHA256=c56edfacef0a60c0de3e6489194fcb2f24c03dbb550a8a7de5938642d045bd32 URL_HASH SHA256=c56edfacef0a60c0de3e6489194fcb2f24c03dbb550a8a7de5938642d045bd32
DEPENDS ${ZLIB_PKG} ${PNG_PKG} dep_JPEG DEPENDS ${ZLIB_PKG} ${PNG_PKG} ${JPEG_PKG}
CMAKE_ARGS CMAKE_ARGS
-Dlzma:BOOL=OFF -Dlzma:BOOL=OFF
-Dwebp:BOOL=OFF -Dwebp:BOOL=OFF

View File

@ -1,4 +1,5 @@
# https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html # https://cmake.org/cmake/help/latest/variable/MSVC_VERSION.html
message(STATUS "MSVC_VERSION: ${MSVC_VERSION}")
if (MSVC_VERSION EQUAL 1800) if (MSVC_VERSION EQUAL 1800)
# 1800 = VS 12.0 (v120 toolset) # 1800 = VS 12.0 (v120 toolset)
set(DEP_VS_VER "12") set(DEP_VS_VER "12")
@ -15,8 +16,8 @@ elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset) # 1920-1929 = VS 16.0 (v142 toolset)
set(DEP_VS_VER "16") set(DEP_VS_VER "16")
set(DEP_BOOST_TOOLSET "msvc-14.2") set(DEP_BOOST_TOOLSET "msvc-14.2")
elseif (MSVC_VERSION LESS 1940) elseif (MSVC_VERSION LESS 1950)
# 1930-1939 = VS 17.0 (v143 toolset) # 1930-1949 = VS 17.0 (v143 toolset)
set(DEP_VS_VER "17") set(DEP_VS_VER "17")
set(DEP_BOOST_TOOLSET "msvc-14.3") set(DEP_BOOST_TOOLSET "msvc-14.3")
else () else ()

View File

@ -1,5 +1,3 @@
set(_wx_git_tag v3.1.5)
set(_wx_toolkit "") set(_wx_toolkit "")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_gtk_ver 2) set(_gtk_ver 2)
@ -18,17 +16,16 @@ else ()
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF") set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
endif () endif ()
if (MSVC) # if (MSVC)
set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch) # set(_patch_cmd ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch)
else () # else ()
set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && touch WXWIDGETS_PATCHED) # set(_patch_cmd test -f WXWIDGETS_PATCHED || ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-wxWidget-fix.patch && touch WXWIDGETS_PATCHED)
endif () # endif ()
bambustudio_add_cmake_project(wxWidgets bambustudio_add_cmake_project(wxWidgets
GIT_REPOSITORY "https://github.com/wxWidgets/wxWidgets" GIT_REPOSITORY "https://github.com/bambulab/wxWidgets"
GIT_TAG ${_wx_git_tag} GIT_TAG master
PATCH_COMMAND ${_patch_cmd} DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${TIFF_PKG} ${JPEG_PKG}
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG
CMAKE_ARGS CMAKE_ARGS
-DwxBUILD_PRECOMP=ON -DwxBUILD_PRECOMP=ON
${_wx_toolkit} ${_wx_toolkit}

View File

@ -1223,6 +1223,15 @@ int CLI::run(int argc, char **argv)
DynamicPrintConfig load_process_config, load_machine_config; DynamicPrintConfig load_process_config, load_machine_config;
bool new_process_config_is_system = true, new_printer_config_is_system = true; bool new_process_config_is_system = true, new_printer_config_is_system = true;
std::string pipe_name, makerlab_name, makerlab_version, different_process_setting; std::string pipe_name, makerlab_name, makerlab_version, different_process_setting;
const std::vector<std::string> &metadata_name = m_config.option<ConfigOptionStrings>("metadata_name", true)->values;
const std::vector<std::string> &metadata_value = m_config.option<ConfigOptionStrings>("metadata_value", true)->values;
if (metadata_name.size() != metadata_value.size())
{
BOOST_LOG_TRIVIAL(error) << boost::format("metadata_name should be the same size with metadata_value");
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS);
}
// Read input file(s) if any. // Read input file(s) if any.
BOOST_LOG_TRIVIAL(info) << "Will start to read model file now, file count :" << m_input_files.size() << "\n"; BOOST_LOG_TRIVIAL(info) << "Will start to read model file now, file count :" << m_input_files.size() << "\n";
@ -5863,6 +5872,18 @@ int CLI::run(int argc, char **argv)
model.mk_version = makerlab_version; model.mk_version = makerlab_version;
BOOST_LOG_TRIVIAL(info) << boost::format("mk_name %1%, mk_version %2%")%makerlab_name %makerlab_version; BOOST_LOG_TRIVIAL(info) << boost::format("mk_name %1%, mk_version %2%")%makerlab_name %makerlab_version;
} }
if (!metadata_name.empty()) {
Model &model = m_models[0];
model.md_value = metadata_value;
model.md_name = metadata_name;
for (unsigned int i = 0; i < metadata_name.size(); i++)
{
BOOST_LOG_TRIVIAL(info) << boost::format("index %1% metadata_name %2%, metadata_value %3%")%i %metadata_name[i] %metadata_value[i];
}
}
if (!this->export_project(&m_models[0], export_3mf_file, plate_data_list, project_presets, thumbnails, no_light_thumbnails, top_thumbnails, pick_thumbnails, if (!this->export_project(&m_models[0], export_3mf_file, plate_data_list, project_presets, thumbnails, no_light_thumbnails, top_thumbnails, pick_thumbnails,
calibration_thumbnails, plate_bboxes, &m_print_config, minimum_save, plate_to_slice - 1)) calibration_thumbnails, plate_bboxes, &m_print_config, minimum_save, plate_to_slice - 1))
{ {

View File

@ -6250,6 +6250,13 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
metadata_item_map[BBL_MAKERLAB_VERSION_TAG] = xml_escape(model.mk_version); metadata_item_map[BBL_MAKERLAB_VERSION_TAG] = xml_escape(model.mk_version);
BOOST_LOG_TRIVIAL(info) << "saved mk_version " << model.mk_version; BOOST_LOG_TRIVIAL(info) << "saved mk_version " << model.mk_version;
} }
if (!model.md_name.empty()) {
for (unsigned int i = 0; i < model.md_name.size(); i++)
{
BOOST_LOG_TRIVIAL(info) << boost::format("saved metadata_name %1%, metadata_value %2%") %model.md_name[i] %model.md_value[i];
metadata_item_map[model.md_name[i]] = xml_escape(model.md_value[i]);
}
}
// store metadata info // store metadata info
for (auto item : metadata_item_map) { for (auto item : metadata_item_map) {

View File

@ -1,3 +1,4 @@
#include "libslic3r/ClipperUtils.hpp"
#include "../libslic3r.h" #include "../libslic3r.h"
#include "../Model.hpp" #include "../Model.hpp"
#include "../TriangleMesh.hpp" #include "../TriangleMesh.hpp"
@ -19,9 +20,8 @@
#include "TopExp_Explorer.hxx" #include "TopExp_Explorer.hxx"
#include "TopoDS.hxx" #include "TopoDS.hxx"
#include "BRepExtrema_SelfIntersection.hxx" #include "BRepExtrema_SelfIntersection.hxx"
#include "clipper/clipper.hpp" #include "libslic3r/clipper.hpp"
#include "libslic3r/Polygon.hpp"
using namespace ClipperLib;
namespace Slic3r { namespace Slic3r {
const double STEP_TRANS_CHORD_ERROR = 0.005; const double STEP_TRANS_CHORD_ERROR = 0.005;
@ -213,9 +213,9 @@ bool get_svg_profile(const char *path, std::vector<Element_Info> &element_infos,
for (int i = 0; i < path_line_points.size(); ++i) { for (int i = 0; i < path_line_points.size(); ++i) {
ClipperLib::Path pt_path; ClipperLib::Path pt_path;
for (auto line_point : path_line_points[i]) { for (auto line_point : path_line_points[i]) {
pt_path.push_back(IntPoint(line_point.first.X() * scale_size, line_point.first.Y() * scale_size)); pt_path.push_back(ClipperLib::IntPoint(line_point.first.X() * scale_size, line_point.first.Y() * scale_size));
} }
pt_path.push_back(IntPoint(path_line_points[i].back().second.X() * scale_size, path_line_points[i].back().second.Y() * scale_size)); pt_path.push_back(ClipperLib::IntPoint(path_line_points[i].back().second.X() * scale_size, path_line_points[i].back().second.Y() * scale_size));
ClipperLib::Paths out_paths; ClipperLib::Paths out_paths;
ClipperLib::ClipperOffset co; ClipperLib::ClipperOffset co;

View File

@ -92,6 +92,8 @@ Model& Model::assign_copy(const Model &rhs)
this->mk_name = rhs.mk_name; this->mk_name = rhs.mk_name;
this->mk_version = rhs.mk_version; this->mk_version = rhs.mk_version;
this->md_name = rhs.md_name;
this->md_value = rhs.md_value;
return *this; return *this;
} }
@ -124,6 +126,8 @@ Model& Model::assign_copy(Model &&rhs)
this->stl_design_country = rhs.stl_design_country; this->stl_design_country = rhs.stl_design_country;
this->mk_name = rhs.mk_name; this->mk_name = rhs.mk_name;
this->mk_version = rhs.mk_version; this->mk_version = rhs.mk_version;
this->md_name = rhs.md_name;
this->md_value = rhs.md_value;
this->backup_path = std::move(rhs.backup_path); this->backup_path = std::move(rhs.backup_path);
this->object_backup_id_map = std::move(rhs.object_backup_id_map); this->object_backup_id_map = std::move(rhs.object_backup_id_map);
this->next_object_backup_id = rhs.next_object_backup_id; this->next_object_backup_id = rhs.next_object_backup_id;
@ -962,6 +966,8 @@ void Model::load_from(Model& model)
profile_info = model.profile_info; profile_info = model.profile_info;
mk_name = model.mk_name; mk_name = model.mk_name;
mk_version = model.mk_version; mk_version = model.mk_version;
md_name = model.md_name;
md_value = model.md_value;
model.design_info.reset(); model.design_info.reset();
model.model_info.reset(); model.model_info.reset();
model.profile_info.reset(); model.profile_info.reset();
@ -3497,7 +3503,7 @@ bool Model::obj_import_vertex_color_deal(const std::vector<unsigned char> &verte
case _3_SAME_COLOR: { case _3_SAME_COLOR: {
std::string result; std::string result;
get_real_filament_id(filament_id0, result); get_real_filament_id(filament_id0, result);
volume->mmu_segmentation_facets.set_triangle_from_string(i, result); volume->mmu_segmentation_facets.set_triangle_from_string(i, result);
break; break;
} }
case _3_DIFF_COLOR: { case _3_DIFF_COLOR: {

View File

@ -413,7 +413,7 @@ public:
bool is_mm_painted() const; bool is_mm_painted() const;
// This object may have a varying layer height by painting or by a table. // This object may have a varying layer height by painting or by a table.
// Even if true is returned, the layer height profile may be "flat" with no difference to default layering. // Even if true is returned, the layer height profile may be "flat" with no difference to default layering.
bool has_custom_layering() const bool has_custom_layering() const
{ return ! this->layer_config_ranges.empty() || ! this->layer_height_profile.empty(); } { return ! this->layer_config_ranges.empty() || ! this->layer_height_profile.empty(); }
ModelInstance* add_instance(); ModelInstance* add_instance();
@ -1525,6 +1525,8 @@ public:
//makerlab information //makerlab information
std::string mk_name; std::string mk_name;
std::string mk_version; std::string mk_version;
std::vector<std::string> md_name;
std::vector<std::string> md_value;
void SetDesigner(std::string designer, std::string designer_user_id) { void SetDesigner(std::string designer, std::string designer_user_id) {
if (design_info == nullptr) { if (design_info == nullptr) {

View File

@ -5803,6 +5803,18 @@ CLIMiscConfigDef::CLIMiscConfigDef()
def->cli_params = "version"; def->cli_params = "version";
def->set_default_value(new ConfigOptionString()); def->set_default_value(new ConfigOptionString());
def = this->add("metadata_name", coStrings);
def->label = "metadata name list";
def->tooltip = "matadata name list added into 3mf";
def->cli_params = "\"name1;name2;...\"";
def->set_default_value(new ConfigOptionStrings());
def = this->add("metadata_value", coStrings);
def->label = "metadata value list";
def->tooltip = "matadata value list added into 3mf";
def->cli_params = "\"value1;value2;...\"";
def->set_default_value(new ConfigOptionStrings());
def = this->add("allow_newer_file", coBool); def = this->add("allow_newer_file", coBool);
def->label = "Allow 3mf with newer version to be sliced"; def->label = "Allow 3mf with newer version to be sliced";
def->tooltip = "Allow 3mf with newer version to be sliced"; def->tooltip = "Allow 3mf with newer version to be sliced";