Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync codes for flathub building #4316

Merged
merged 9 commits into from
Jun 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
matrix:
include:
- os: ubuntu-20.04
- os: ubuntu-24.04
- os: windows-latest
- os: macos-13
arch: x86_64
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/build_bambu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }}
run: |
brew install cmake git gettext automake texinfo
brew install automake texinfo
mkdir -p ${{ 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
Expand Down Expand Up @@ -225,28 +225,28 @@ jobs:

# Ubuntu
- name: Install dependencies
if: inputs.os == 'ubuntu-20.04'
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
run: |
sudo apt-get update
sudo apt-get install -y autoconf build-essential cmake curl wget file git \
libgl1-mesa-dev libgtk-3-dev libxkbcommon-dev libunwind-dev libfuse2

- 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
run: sudo ./BuildLinux.sh -ur

- name: Fix permissions
if: inputs.os == 'ubuntu-20.04'
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash
run: sudo chown $USER -R ./

- name: Build slicer
if: inputs.os == 'ubuntu-20.04'
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
shell: bash
run: |
./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
# if: github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04'
Expand All @@ -258,11 +258,11 @@ jobs:
# zip -r orca_custom_preset_tests.zip user/

- 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
with:
name: BambuStudio_Linux_${{ env.ver }}
path: './build/Bambu_Studio_linux_${{ env.ver }}.AppImage'
name: BambuStudio_${{inputs.os}}_${{ env.ver }}
path: './build/Bambu_Studio_${{inputs.os}}_${{ env.ver }}.AppImage'

# - name: Deploy Ubuntu release
# if: ${{ ! env.ACT && github.ref == 'refs/heads/main' && inputs.os == 'ubuntu-20.04' }}
Expand All @@ -284,4 +284,4 @@ jobs:
# asset_path: ${{ github.workspace }}/resources/profiles/orca_custom_preset_tests.zip
# asset_name: orca_custom_preset_tests.zip
# asset_content_type: application/octet-stream
# max_releases: 1
# max_releases: 1
2 changes: 1 addition & 1 deletion .github/workflows/build_check_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
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"'}}
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 }}

- name: load cache
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/build_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
if: inputs.os == 'macos-13'
working-directory: ${{ github.workspace }}
run: |
brew install cmake git gettext automake texinfo
brew install automake texinfo
brew uninstall --ignore-dependencies zstd
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/BambuStudio_dep_${{ inputs.arch }}
Expand All @@ -88,20 +88,25 @@ jobs:
make -j4
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
if: inputs.os == 'ubuntu-20.04'
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }}
run: |
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/destdir
sudo ./BuildLinux.sh -ur
sudo chown $USER -R ./
./BuildLinux.sh -dr
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
Expand All @@ -110,7 +115,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
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
if: inputs.os == 'windows-latest'
Expand All @@ -120,11 +125,11 @@ jobs:
path: ${{ github.workspace }}/deps/build/BambuStudio_dep*.zip

- 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
with:
name: BambuStudio_dep_ubuntu_${{ env.date }}
path: ${{ github.workspace }}/deps/build/BambuStudio_dep_ubuntu_*.tar.gz
name: BambuStudio_dep_${{ inputs.os }}_${{ env.date }}
path: ${{ github.workspace }}/deps/build/BambuStudio_dep_${{ inputs.os }}_*.tar.gz

build_Bambu:
name: Build BambuStudio
Expand All @@ -136,4 +141,4 @@ jobs:
cache-path: ${{ inputs.cache-path }}
os: ${{ inputs.os }}
arch: ${{ inputs.arch }}
secrets: inherit
secrets: inherit
25 changes: 17 additions & 8 deletions BuildLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,6 @@ then
mkdir build
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
if [[ -n "$UPDATE_LIB" ]]
then
Expand All @@ -114,12 +106,29 @@ then
if [[ $ubu_version == "Ubuntu 22.04"* ]]
then
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
if [[ -n "$BUILD_DEBUG" ]]
then
echo -e "\nInstalling: libssl-dev libcurl4-openssl-dev\n"
apt install -y libssl-dev libcurl4-openssl-dev
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"
exit 0
fi
Expand Down
4 changes: 2 additions & 2 deletions deps/Boost/Boost.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
elseif (MSVC_VERSION LESS 1930)
# 1920-1929 = VS 16.0 (v142 toolset)
set(_boost_toolset "msvc-14.2")
elseif (MSVC_VERSION LESS 1940)
# 1930-1939 = VS 17.0 (v143 toolset)
elseif (MSVC_VERSION LESS 1950)
# 1930-1949 = VS 17.0 (v143 toolset)
set(_boost_toolset "msvc-14.3")
else ()
message(FATAL_ERROR "Unsupported MSVC version")
Expand Down
2 changes: 1 addition & 1 deletion deps/CGAL/CGAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ bambustudio_add_cmake_project(
# For whatever reason, this keeps downloading forever (repeats downloads if finished)
URL https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
URL_HASH SHA256=d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
DEPENDS dep_Boost dep_GMP dep_MPFR
DEPENDS ${BOOST_PKG} dep_GMP dep_MPFR
)

include(GNUInstallDirs)
68 changes: 53 additions & 15 deletions deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,15 @@ if (NPROC EQUAL 0)
set(NPROC 1)
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(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR} CACHE PATH "Path for downloaded source packages.")

Expand Down Expand Up @@ -148,24 +157,42 @@ if (NOT ZLIB_FOUND)
set(ZLIB_PKG dep_ZLIB)
endif ()
set(PNG_PKG "")
if (NOT PNG_FOUND)
if (DEP_BUILD_PNG AND NOT PNG_FOUND)
include(PNG/PNG.cmake)
set(PNG_PKG dep_PNG)
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 "")
if (NOT EXPAT_FOUND)
include(EXPAT/EXPAT.cmake)
set(EXPAT_PKG dep_EXPAT)
endif ()

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
include(Cereal/Cereal.cmake)
include(Qhull/Qhull.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(TBB/TBB.cmake)
Expand All @@ -180,37 +207,46 @@ include(CGAL/CGAL.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 "")
if (NOT CURL_FOUND)
include(CURL/CURL.cmake)
set(CURL_PKG dep_CURL)
endif ()

include(JPEG/JPEG.cmake)
include(TIFF/TIFF.cmake)
include(wxWidgets/wxWidgets.cmake)
set(WXWIDGETS_PKG "")
if (DEP_BUILD_WXWIDGETS)
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(OpenCV/OpenCV.cmake)
include(FREETYPE/FREETYPE.cmake)

set(_dep_list
dep_Boost
${BOOST_PKG}
dep_TBB
${CURL_PKG}
dep_wxWidgets
${WXWIDGETS_PKG}
dep_Cereal
dep_NLopt
dep_OpenVDB
dep_OpenCSG
dep_OpenCV
dep_CGAL
dep_OpenSSL
dep_GLFW
${OPENSSL_PKG}
${GLFW_PKG}
${PNG_PKG}
${ZLIB_PKG}
${EXPAT_PKG}
${FREETYPE_PKG}
)

if (MSVC)
Expand All @@ -223,7 +259,9 @@ else()
endif()

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})

Expand Down
4 changes: 3 additions & 1 deletion deps/CURL/CURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ bambustudio_add_cmake_project(CURL
${_curl_platform_flags}
)

add_dependencies(dep_CURL dep_OpenSSL)
if (DEP_BUILD_OPENSSL)
add_dependencies(dep_CURL ${OPENSSL_PKG})
endif ()

if (MSVC)
add_debug_dep(dep_CURL)
Expand Down
8 changes: 5 additions & 3 deletions deps/Cereal/Cereal.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
bambustudio_add_cmake_project(Cereal
URL "https://github.com/USCiLab/cereal/archive/v1.2.2.tar.gz"
URL_HASH SHA256=1921f26d2e1daf9132da3c432e2fd02093ecaedf846e65d7679ddf868c7289c4
URL "https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.0.zip"
URL_HASH SHA256=71642cb54658e98c8f07a0f0d08bf9766f1c3771496936f6014169d3726d9657
CMAKE_ARGS
-DJUST_INSTALL_CEREAL=on
-DJUST_INSTALL_CEREAL=ON
-DSKIP_PERFORMANCE_COMPARISON=ON
-DBUILD_TESTS=OFF
)
4 changes: 2 additions & 2 deletions deps/FREETYPE/FREETYPE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ else()
endif()

bambustudio_add_cmake_project(FREETYPE
URL https://mirror.ossplanet.net/nongnu/freetype/freetype-2.12.1.tar.gz
URL_HASH SHA256=efe71fd4b8246f1b0b1b9bfca13cfff1c9ad85930340c27df469733bbb620938
URL https://github.com/freetype/freetype/archive/refs/tags/VER-2-12-1.tar.gz
URL_HASH SHA256=0E72CAE32751598D126CFD4BCEDA909F646B7231AB8C52E28ABB686C20A2BEA1
#DEPENDS ${ZLIB_PKG}
#"${_patch_step}"
CMAKE_ARGS
Expand Down
5 changes: 4 additions & 1 deletion deps/OCCT/OCCT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ bambustudio_add_cmake_project(OCCT
#-DUSE_FREETYPE=OFF
-DUSE_FFMPEG=OFF
-DUSE_VTK=OFF
-DBUILD_DOC_Overview=OFF
-DBUILD_MODULE_ApplicationFramework=OFF
#-DBUILD_MODULE_DataExchange=OFF
-DBUILD_MODULE_Draw=OFF
Expand All @@ -27,4 +28,6 @@ bambustudio_add_cmake_project(OCCT
-DBUILD_MODULE_Visualization=OFF
)

add_dependencies(dep_OCCT dep_FREETYPE)
if (DEP_BUILD_FREETYPE)
add_dependencies(dep_OCCT ${FREETYPE_PKG})
endif ()
Loading