Flatpak build (#4175)

* Initial commit for the builder

* fix wx, use hack to install into /app

* add some workarounds for /usr/local

* fix up rest of paths

* attempt to fix wxwebview undef

* figure out why wxwidgets isnt getting its patches applied

* do "proper" patching of wxwidgets

* Flip the flag

* actually append the /usr/local

* restrict package finding to flatpak only

* Update the destdir stuff for mpfr, gmp

* Transfer over all the _destdir, again

* update patch command for all other plats

* initial ci check

* what even happened

* clear ci image

* I doubt this will do anything

* do cleanup after running each step

* remove build objects for flatpak ci

* compress debug info

* Fix MacOS build

* Try saving space after building deps

* No debug info for now

* Do debug info, use thin static archives

* use BSD flag, not --thin

* try building with lto

* Use release, no debug info

* remove lto

* Revert the last 5 commits

* It might require write perms

* Revert "It might require write perms"

This reverts commit 44cec58a5713cb5ebbc44e64e314b88b553b8f75.

* Import fixes for merge

* remove some patch stuff

* the worst hack!

* remove uneeded patches

* Initial commit for the builder

* note to self, go back to regular wx

* attempt to fix wxwebview undef

* do "proper" patching of wxwidgets

* update patch command for all other plats

* what even happened

* -ldep_name-NOTFOUND is still here

* concat patches

* Build wx with flatpak

* more wx shenatigans

* fix a missing import

* build wx with proper flags

* fix imports and libs

* trigger ci

* try fixing mac and windows ci

* remove duplicate definition of freetype

* curl may not have openssl for a dep

* has openssl been found?

* force building

* build images on apple

* cleanup for review

* cleanup cmake files

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Aidan 2024-05-24 20:11:19 -05:00 committed by GitHub
parent b1bd30fd5e
commit 17fec83e5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
33 changed files with 790 additions and 84 deletions

View file

@ -58,4 +58,21 @@ jobs:
os: ${{ matrix.os }} os: ${{ matrix.os }}
arch: ${{ matrix.arch }} arch: ${{ matrix.arch }}
build-deps-only: ${{ inputs.build-deps-only || false }} build-deps-only: ${{ inputs.build-deps-only || false }}
secrets: inherit secrets: inherit
flatpak:
name: "Flatpak"
runs-on: ubuntu-latest
container:
image: bilelmoussaoui/flatpak-github-actions:gnome-45
options: --privileged
steps:
# maybe i'm too dumb and fucked up to do CI. OH WELL :D -ppd
- name: "Remove unneeded stuff to free disk space"
run:
sudo rm -rf /usr/share/dotnet /opt/ghc "/usr/local/share/boost" "$AGENT_TOOLSDIRECTORY"
- uses: actions/checkout@v4
- uses: flatpak/flatpak-github-actions/flatpak-builder@v6
with:
bundle: orcaslicer.flatpak
manifest-path: flatpak/io.github.softfever.OrcaSlicer.yml
cache-key: flatpak-builder-${{ github.sha }}

3
.gitignore vendored
View file

@ -32,4 +32,5 @@ src/OrcaSlicer-doc/
**/filament_full/ **/filament_full/
/deps/DL_CACHE/ /deps/DL_CACHE/
/deps/DL_CACHE /deps/DL_CACHE
resources/profiles/user/default **/.flatpak-builder/
resources/profiles/user/default

View file

@ -271,9 +271,18 @@ if (NOT MSVC AND ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_CXX_COMP
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431 # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
# We will turn the warning of for GCC for now: # We will turn the warning of for GCC for now:
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# GCC generates loads of -Wunknown-pragmas when compiling igl. The fix is not easy due to a bug in gcc, see
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66943 or
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53431
# We will turn the warning of for GCC for now:
add_compile_options(-Wno-unknown-pragmas) add_compile_options(-Wno-unknown-pragmas)
endif() endif()
# Bit of a hack for flatpak building: compress the debug info with zstd to save space in CI
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 13.0)
add_compile_options(-gz=zstd)
endif()
endif() endif()
if (SLIC3R_ASAN) if (SLIC3R_ASAN)
@ -382,9 +391,7 @@ endif()
# set(Boost_COMPILER "-mgw81") # set(Boost_COMPILER "-mgw81")
# boost::process was introduced first in version 1.64.0, # boost::process was introduced first in version 1.64.0,
# boost::beast::detail::base64 was introduced first in version 1.66.0 # boost::beast::detail::base64 was introduced first in version 1.66.0
set(MINIMUM_BOOST_VERSION "1.66.0") find_package(Boost 1.66 REQUIRED COMPONENTS system filesystem thread log locale regex chrono atomic date_time iostreams program_options)
set(_boost_components "system;filesystem;thread;log;locale;regex;chrono;atomic;date_time;iostreams;program_options")
find_package(Boost ${MINIMUM_BOOST_VERSION} REQUIRED COMPONENTS ${_boost_components})
add_library(boost_libs INTERFACE) add_library(boost_libs INTERFACE)
add_library(boost_headeronly INTERFACE) add_library(boost_headeronly INTERFACE)
@ -410,28 +417,8 @@ function(slic3r_remap_configs targets from_Cfg to_Cfg)
endif() endif()
endfunction() endfunction()
if(TARGET Boost::system) target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
message(STATUS "Boost::boost exists") target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
target_link_libraries(boost_headeronly INTERFACE Boost::boost)
# Only from cmake 3.12
# list(TRANSFORM _boost_components PREPEND Boost:: OUTPUT_VARIABLE _boost_targets)
set(_boost_targets "")
foreach(comp ${_boost_components})
list(APPEND _boost_targets "Boost::${comp}")
endforeach()
target_link_libraries(boost_libs INTERFACE
boost_headeronly # includes the custom compile definitions as well
${_boost_targets}
)
slic3r_remap_configs("${_boost_targets}" RelWithDebInfo Release)
else()
target_include_directories(boost_headeronly INTERFACE ${Boost_INCLUDE_DIRS})
target_link_libraries(boost_libs INTERFACE boost_headeronly ${Boost_LIBRARIES})
endif()
# Find and configure intel-tbb # Find and configure intel-tbb
if(SLIC3R_STATIC) if(SLIC3R_STATIC)

121
deps/CMakeLists.txt vendored
View file

@ -42,6 +42,10 @@ endif ()
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}/../DL_CACHE CACHE PATH "Path for downloaded source packages.") set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/../DL_CACHE CACHE PATH "Path for downloaded source packages.")
set(FLATPAK FALSE CACHE BOOL "Toggles various build settings for flatpak, like /usr/local in DESTDIR or not building wxwidgets")
if (NOT FLATPAK)
set(DESTDIR "${DESTDIR}/usr/local/")
endif()
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
@ -120,13 +124,13 @@ if (NOT IS_CROSS_COMPILE OR NOT APPLE)
ExternalProject_Add( ExternalProject_Add(
dep_${projectname} dep_${projectname}
EXCLUDE_FROM_ALL ON EXCLUDE_FROM_ALL ON
INSTALL_DIR ${DESTDIR}/usr/local INSTALL_DIR ${DESTDIR}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname} DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
${_gen} ${_gen}
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local -DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules -DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}/usr/local -DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
-DCMAKE_DEBUG_POSTFIX:STRING=d -DCMAKE_DEBUG_POSTFIX:STRING=d
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
@ -140,16 +144,26 @@ if (NOT IS_CROSS_COMPILE OR NOT APPLE)
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j} BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
) )
else() elseif(FLATPAK)
# the only reason this is here is because of the HACK at the bottom for ci
#
# note for future devs: shared libs may actually create a size reduction
# but orcaslicer_deps tends to get really funny regarding linking after that (notably boost)
# so, as much as I would like to use that, it's not happening
ExternalProject_Add( ExternalProject_Add(
dep_${projectname} dep_${projectname}
EXCLUDE_FROM_ALL ON EXCLUDE_FROM_ALL ON
INSTALL_DIR ${DESTDIR}/usr/local INSTALL_DIR ${DESTDIR}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname} DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
${_gen} ${_gen}
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local -DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}/usr/local -DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
-DCMAKE_DEBUG_POSTFIX:STRING=d
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
-DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF
${_cmake_osx_arch} ${_cmake_osx_arch}
"${_configs_line}" "${_configs_line}"
@ -158,6 +172,29 @@ else()
${P_ARGS_UNPARSED_ARGUMENTS} ${P_ARGS_UNPARSED_ARGUMENTS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j} BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
# HACK: save space after each compile job, because CI
# reasoning: cmake changes directory after this command, so just keep only the folders
# so that it can navigate out
COMMAND find "${CMAKE_BINARY_DIR}/dep_${projectname}-prefix/" -type f -delete
)
else()
ExternalProject_Add(
dep_${projectname}
EXCLUDE_FROM_ALL ON
INSTALL_DIR ${DESTDIR}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
${_gen}
CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
-DBUILD_SHARED_LIBS:BOOL=OFF
${_cmake_osx_arch}
"${_configs_line}"
${DEP_CMAKE_OPTS}
${P_ARGS_CMAKE_ARGS}
${P_ARGS_UNPARSED_ARGUMENTS}
BUILD_COMMAND ${CMAKE_COMMAND} --build . --config Release -- ${_build_j}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config Release
) )
endif() endif()
@ -203,6 +240,20 @@ else()
include("deps-linux.cmake") include("deps-linux.cmake")
endif() endif()
if(FLATPAK)
# flatpak bundles some deps with the layer, so attempt to find them first
# also, yes, this reduces CI by not needing to vendor certain deps
find_package(ZLIB)
find_package(PNG)
find_package(EXPAT)
find_package(CURL)
find_package(JPEG)
find_package(TIFF)
find_package(Freetype)
find_package(OpenSSL 1.1...<3.2)
find_package(CURL)
endif()
set(ZLIB_PKG "") set(ZLIB_PKG "")
if (NOT ZLIB_FOUND) if (NOT ZLIB_FOUND)
include(ZLIB/ZLIB.cmake) include(ZLIB/ZLIB.cmake)
@ -214,6 +265,7 @@ if (NOT PNG_FOUND)
set(PNG_PKG dep_PNG) set(PNG_PKG dep_PNG)
endif () endif ()
set(EXPAT_PKG "") set(EXPAT_PKG "")
find_package(EXPAT)
if (NOT EXPAT_FOUND) if (NOT EXPAT_FOUND)
include(EXPAT/EXPAT.cmake) include(EXPAT/EXPAT.cmake)
set(EXPAT_PKG dep_EXPAT) set(EXPAT_PKG dep_EXPAT)
@ -226,6 +278,7 @@ include(Boost/Boost.cmake)
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) include(GLFW/GLFW.cmake)
include(OpenCSG/OpenCSG.cmake) include(OpenCSG/OpenCSG.cmake)
@ -241,34 +294,69 @@ include(CGAL/CGAL.cmake)
include(NLopt/NLopt.cmake) include(NLopt/NLopt.cmake)
include(OpenSSL/OpenSSL.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
# a grep across the repo shows it is used for other things
# TODO: update openssl and everything that uses <openssl/md5.h>
set(OPENSSL_PKG "")
if(NOT OPENSSL_FOUND)
include(OpenSSL/OpenSSL.cmake)
set(OPENSSL_PKG dep_OpenSSL)
endif()
# we don't want to load a "wrong" openssl when loading curl
# so, just don't even bother
# ...i think this is how it works? change if wrong
set(CURL_PKG "") set(CURL_PKG "")
if (NOT CURL_FOUND) if (NOT OPENSSL_FOUND OR NOT CURL_FOUND)
include(CURL/CURL.cmake) include(CURL/CURL.cmake)
set(CURL_PKG dep_CURL) set(CURL_PKG dep_CURL)
endif () endif ()
include(JPEG/JPEG.cmake) set(JPEG_PKG "")
include(TIFF/TIFF.cmake) if (NOT JPEG_FOUND)
include(wxWidgets/wxWidgets.cmake) include(JPEG/JPEG.cmake)
set(JPEG_PKG dep_JPEG)
endif()
set(TIFF_PKG "")
if (NOT TIFF_FOUND)
include(TIFF/TIFF.cmake)
set(TIFF_PKG "dep_TIFF")
endif()
# flatpak builds wxwidgets separately
set(WXWIDGETS_PKG "")
if (NOT FLATPAK)
include(wxWidgets/wxWidgets.cmake)
set(WXWIDGETS_PKG "dep_wxWidgets")
endif()
set(FREETYPE_PKG "")
if(NOT FREETYPE_FOUND)
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 dep_Boost
dep_TBB dep_TBB
${OPENSSL_PKG}
${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
dep_GLFW dep_GLFW
dep_OCCT
${FREETYPE_PKG}
${PNG_PKG} ${PNG_PKG}
${ZLIB_PKG} ${ZLIB_PKG}
${EXPAT_PKG} ${EXPAT_PKG}
@ -283,9 +371,6 @@ else()
#list(APPEND _dep_list "dep_libigl") #list(APPEND _dep_list "dep_libigl")
endif() endif()
list(APPEND _dep_list "dep_OCCT")
list(APPEND _dep_list "dep_FREETYPE")
add_custom_target(deps ALL DEPENDS ${_dep_list}) add_custom_target(deps ALL DEPENDS ${_dep_list})
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands # Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands

View file

@ -72,9 +72,10 @@ orcaslicer_add_cmake_project(CURL
${_curl_platform_flags} ${_curl_platform_flags}
) )
# if (APPLE OR (CMAKE_SYSTEM_NAME STREQUAL "Linux")) if(NOT OPENSSL_FOUND)
add_dependencies(dep_CURL dep_OpenSSL) # (openssl may or may not be built)
# endif () add_dependencies(dep_CURL ${OPENSSL_PKG})
endif()
if (MSVC) if (MSVC)
add_debug_dep(dep_CURL) add_debug_dep(dep_CURL)

17
deps/GMP/GMP.cmake vendored
View file

@ -1,17 +1,16 @@
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/gmp) set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/gmp)
set(_dstdir ${DESTDIR}/usr/local)
if (MSVC) if (MSVC)
set(_output ${_dstdir}/include/gmp.h set(_output ${DESTDIR}/include/gmp.h
${_dstdir}/lib/libgmp-10.lib ${DESTDIR}/lib/libgmp-10.lib
${_dstdir}/bin/libgmp-10.dll) ${DESTDIR}/bin/libgmp-10.dll)
add_custom_command( add_custom_command(
OUTPUT ${_output} OUTPUT ${_output}
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/gmp.h ${_dstdir}/include/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/gmp.h ${DESTDIR}/include/
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libgmp-10.lib ${_dstdir}/lib/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libgmp-10.lib ${DESTDIR}/lib/
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libgmp-10.dll ${_dstdir}/bin/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libgmp-10.dll ${DESTDIR}/bin/
) )
add_custom_target(dep_GMP SOURCES ${_output}) add_custom_target(dep_GMP SOURCES ${_output})
@ -61,8 +60,8 @@ else ()
URL_HASH SHA256=eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c URL_HASH SHA256=eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/GMP
BUILD_IN_SOURCE ON BUILD_IN_SOURCE ON
CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}/usr/local" ${_gmp_build_tgt} CONFIGURE_COMMAND env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --enable-shared=no --enable-cxx=yes --enable-static=yes "--prefix=${DESTDIR}" ${_gmp_build_tgt}
BUILD_COMMAND make -j BUILD_COMMAND make -j
INSTALL_COMMAND make install INSTALL_COMMAND make install
) )
endif () endif ()

19
deps/MPFR/MPFR.cmake vendored
View file

@ -1,18 +1,17 @@
set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/mpfr) set(_srcdir ${CMAKE_CURRENT_LIST_DIR}/mpfr)
set(_dstdir ${DESTDIR}/usr/local)
if (MSVC) if (MSVC)
set(_output ${_dstdir}/include/mpfr.h set(_output ${DESTDIR}/include/mpfr.h
${_dstdir}/include/mpf2mpfr.h ${DESTDIR}/include/mpf2mpfr.h
${_dstdir}/lib/libmpfr-4.lib ${DESTDIR}/lib/libmpfr-4.lib
${_dstdir}/bin/libmpfr-4.dll) ${DESTDIR}/bin/libmpfr-4.dll)
add_custom_command( add_custom_command(
OUTPUT ${_output} OUTPUT ${_output}
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpfr.h ${_dstdir}/include/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpfr.h ${DESTDIR}/include/
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpf2mpfr.h ${_dstdir}/include/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/include/mpf2mpfr.h ${DESTDIR}/include/
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.lib ${_dstdir}/lib/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.lib ${DESTDIR}/lib/
COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.dll ${_dstdir}/bin/ COMMAND ${CMAKE_COMMAND} -E copy ${_srcdir}/lib/win${DEPS_BITS}/libmpfr-4.dll ${DESTDIR}/bin/
) )
add_custom_target(dep_MPFR SOURCES ${_output}) add_custom_target(dep_MPFR SOURCES ${_output})
@ -31,7 +30,7 @@ else ()
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/MPFR DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/MPFR
BUILD_IN_SOURCE ON BUILD_IN_SOURCE ON
CONFIGURE_COMMAND autoreconf -f -i && CONFIGURE_COMMAND autoreconf -f -i &&
env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR}/usr/local --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR}/usr/local ${_gmp_build_tgt} env "CFLAGS=${_gmp_ccflags}" "CXXFLAGS=${_gmp_ccflags}" ./configure ${_cross_compile_arg} --prefix=${DESTDIR} --enable-shared=no --enable-static=yes --with-gmp=${DESTDIR} ${_gmp_build_tgt}
BUILD_COMMAND make -j BUILD_COMMAND make -j
INSTALL_COMMAND make install INSTALL_COMMAND make install
DEPENDS dep_GMP DEPENDS dep_GMP

View file

@ -14,7 +14,7 @@ orcaslicer_add_cmake_project(OCCT
#PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-OCCT-fix.patch #PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-OCCT-fix.patch
PATCH_COMMAND git apply --directory ${BINARY_DIR_REL}/dep_OCCT-prefix/src/dep_OCCT --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-OCCT-fix.patch PATCH_COMMAND git apply --directory ${BINARY_DIR_REL}/dep_OCCT-prefix/src/dep_OCCT --verbose --ignore-space-change --whitespace=fix ${CMAKE_CURRENT_LIST_DIR}/0001-OCCT-fix.patch
#DEPENDS dep_Boost #DEPENDS dep_Boost
#DEPENDS dep_FREETYPE DEPENDS ${FREETYPE_PKG}
CMAKE_ARGS CMAKE_ARGS
-DBUILD_LIBRARY_TYPE=${library_build_type} -DBUILD_LIBRARY_TYPE=${library_build_type}
-DUSE_TK=OFF -DUSE_TK=OFF
@ -31,4 +31,4 @@ orcaslicer_add_cmake_project(OCCT
-DBUILD_MODULE_Visualization=OFF -DBUILD_MODULE_Visualization=OFF
) )
add_dependencies(dep_OCCT dep_FREETYPE) # add_dependencies(dep_OCCT ${FREETYPE_PKG})

View file

@ -15,11 +15,11 @@ if (APPLE AND IS_CROSS_COMPILE)
EXCLUDE_FROM_ALL ON EXCLUDE_FROM_ALL ON
URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip URL https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de URL_HASH SHA256=0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
INSTALL_DIR ${DESTDIR}/usr/local INSTALL_DIR ${DESTDIR}
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenEXR DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenEXR
${_openxr_list_sep} ${_openxr_list_sep}
CMAKE_ARGS CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}/usr/local -DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
-DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_POSITION_INDEPENDENT_CODE=ON
-DBUILD_TESTING=OFF -DBUILD_TESTING=OFF
@ -54,4 +54,4 @@ endif()
if (MSVC) if (MSVC)
add_debug_dep(dep_OpenEXR) add_debug_dep(dep_OpenEXR)
endif () endif ()

View file

@ -46,8 +46,8 @@ ExternalProject_Add(dep_OpenSSL
# URL_HASH SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31 # URL_HASH SHA256=8c776993154652d0bb393f506d850b811517c8bd8d24b1008aef57fbe55d3f31
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenSSL DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/OpenSSL
CONFIGURE_COMMAND ${_conf_cmd} ${_cross_arch} CONFIGURE_COMMAND ${_conf_cmd} ${_cross_arch}
"--openssldir=${DESTDIR}/usr/local" "--openssldir=${DESTDIR}"
"--prefix=${DESTDIR}/usr/local" "--prefix=${DESTDIR}"
${_cross_comp_prefix_line} ${_cross_comp_prefix_line}
no-shared no-shared
no-asm no-asm
@ -61,6 +61,6 @@ ExternalProject_Add(dep_OpenSSL
ExternalProject_Add_Step(dep_OpenSSL install_cmake_files ExternalProject_Add_Step(dep_OpenSSL install_cmake_files
DEPENDEES install DEPENDEES install
COMMAND ${CMAKE_COMMAND} -E copy_directory openssl "${DESTDIR}/usr/local/${CMAKE_INSTALL_LIBDIR}/cmake/openssl" COMMAND ${CMAKE_COMMAND} -E copy_directory openssl "${DESTDIR}${CMAKE_INSTALL_LIBDIR}/cmake/openssl"
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}" WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
) )

79
deps/TBB/GNU.cmake vendored Normal file
View file

@ -0,0 +1,79 @@
# Copyright (c) 2020-2021 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
if (MINGW)
set(TBB_LINK_DEF_FILE_FLAG "")
set(TBB_DEF_FILE_PREFIX "")
elseif (APPLE)
set(TBB_LINK_DEF_FILE_FLAG -Wl,-exported_symbols_list,)
set(TBB_DEF_FILE_PREFIX mac${TBB_ARCH})
# For correct ucontext.h structures layout
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -D_XOPEN_SOURCE)
else()
set(TBB_LINK_DEF_FILE_FLAG -Wl,--version-script=)
set(TBB_DEF_FILE_PREFIX lin${TBB_ARCH})
endif()
# Add -Wno-error=stringop-overflow to fix GCC 12+ build as suggested on https://github.com/oneapi-src/oneTBB/issues/843#issuecomment-1152646035
set(TBB_WARNING_LEVEL -Wall -Wextra $<$<BOOL:${TBB_STRICT}>:-Werror> -Wfatal-errors -Wno-error=stringop-overflow)
set(TBB_TEST_WARNING_FLAGS -Wshadow -Wcast-qual -Woverloaded-virtual -Wnon-virtual-dtor)
# Depfile options (e.g. -MD) are inserted automatically in some cases.
# Don't add -MMD to avoid conflicts in such cases.
if (NOT CMAKE_GENERATOR MATCHES "Ninja" AND NOT CMAKE_CXX_DEPENDS_USE_COMPILER)
set(TBB_MMD_FLAG -MMD)
endif()
# Enable Intel(R) Transactional Synchronization Extensions (-mrtm) and WAITPKG instructions support (-mwaitpkg) on relevant processors
if (CMAKE_SYSTEM_PROCESSOR MATCHES "(x86|AMD64)")
set(TBB_COMMON_COMPILE_FLAGS ${TBB_COMMON_COMPILE_FLAGS} -mrtm $<$<AND:$<NOT:$<CXX_COMPILER_ID:Intel>>,$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},11.0>>>:-mwaitpkg>)
endif()
if (NOT MINGW)
set(TBB_COMMON_LINK_LIBS dl)
endif()
# Ignore -Werror set through add_compile_options() or added to CMAKE_CXX_FLAGS if TBB_STRICT is disabled.
if (NOT TBB_STRICT AND COMMAND tbb_remove_compile_flag)
tbb_remove_compile_flag(-Werror)
endif()
if (NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL Intel)
# gcc 6.0 and later have -flifetime-dse option that controls elimination of stores done outside the object lifetime
set(TBB_DSE_FLAG $<$<NOT:$<VERSION_LESS:${CMAKE_CXX_COMPILER_VERSION},6.0>>:-flifetime-dse=1>)
endif()
# Workaround for heavy tests and too many symbols in debug (rellocation truncated to fit: R_MIPS_CALL16)
if ("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
set(TBB_TEST_COMPILE_FLAGS ${TBB_TEST_COMPILE_FLAGS} -DTBB_TEST_LOW_WORKLOAD $<$<CONFIG:DEBUG>:-mxgot>)
endif()
if (MINGW)
list(APPEND TBB_COMMON_COMPILE_FLAGS -U__STRICT_ANSI__)
endif()
# For some reason GCC does not instrument code with Thread Sanitizer when lto is enabled and C linker is used.
if (NOT TBB_SANITIZE MATCHES "thread")
set(TBB_IPO_COMPILE_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
set(TBB_IPO_LINK_FLAGS $<$<NOT:$<CONFIG:Debug>>:-flto>)
endif()
# Disable lto flag
set(TBB_IPO_COMPILE_FLAGS "")
set(TBB_IPO_LINK_FLAGS "")
# TBB malloc settings
set(TBBMALLOC_LIB_COMPILE_FLAGS -fno-rtti -fno-exceptions)
set(TBB_OPENMP_FLAG -fopenmp)

8
deps/TBB/TBB.cmake vendored
View file

@ -1,8 +1,14 @@
if (FLATPAK)
set(_patch_command ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_LIST_DIR}/GNU.cmake ./cmake/compilers/GNU.cmake)
else()
set(_patch_command "")
endif()
orcaslicer_add_cmake_project( orcaslicer_add_cmake_project(
TBB TBB
URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip" URL "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip"
URL_HASH SHA256=83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47 URL_HASH SHA256=83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47
#PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-TBB-GCC13.patch PATCH_COMMAND ${_patch_command}
CMAKE_ARGS CMAKE_ARGS
-DTBB_BUILD_SHARED=OFF -DTBB_BUILD_SHARED=OFF
-DTBB_BUILD_TESTS=OFF -DTBB_BUILD_TESTS=OFF

View file

@ -17,11 +17,16 @@ else ()
set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF") set(_wx_edge "-DwxUSE_WEBVIEW_EDGE=OFF")
endif () endif ()
# Note: The flatpak build builds wxwidgets separately due to CI size constraints.
# ANY CHANGES MADE IN HERE MUST ALSO BE REFLECTED IN `flatpak/io.github.SoftFever.OrcaSlicer.yml`.
# ** THIS INCLUDES BUILD ARGS. **
# ...if you can find a way around this size limitation, be my guest.
orcaslicer_add_cmake_project( orcaslicer_add_cmake_project(
wxWidgets wxWidgets
GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets" GIT_REPOSITORY "https://github.com/SoftFever/Orca-deps-wxWidgets"
GIT_SHALLOW ON GIT_SHALLOW ON
DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} dep_TIFF dep_JPEG DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${TIFF_PKG} ${JPEG_PKG}
CMAKE_ARGS CMAKE_ARGS
-DwxBUILD_PRECOMP=ON -DwxBUILD_PRECOMP=ON
${_wx_toolkit} ${_wx_toolkit}
@ -34,6 +39,7 @@ orcaslicer_add_cmake_project(
-DwxUSE_UNICODE=ON -DwxUSE_UNICODE=ON
${_wx_private_font} ${_wx_private_font}
-DwxUSE_OPENGL=ON -DwxUSE_OPENGL=ON
-DwxUSE_WEBREQUEST=ON
-DwxUSE_WEBVIEW=ON -DwxUSE_WEBVIEW=ON
${_wx_edge} ${_wx_edge}
-DwxUSE_WEBVIEW_IE=OFF -DwxUSE_WEBVIEW_IE=OFF
@ -47,9 +53,10 @@ orcaslicer_add_cmake_project(
-DwxUSE_ZLIB=sys -DwxUSE_ZLIB=sys
-DwxUSE_LIBJPEG=sys -DwxUSE_LIBJPEG=sys
-DwxUSE_LIBTIFF=sys -DwxUSE_LIBTIFF=sys
-DwxUSE_NANOSVG=OFF
-DwxUSE_EXPAT=sys -DwxUSE_EXPAT=sys
) )
if (MSVC) if (MSVC)
add_debug_dep(dep_wxWidgets) add_debug_dep(dep_wxWidgets)
endif () endif ()

2
flatpak/.gitignore vendored Normal file
View file

@ -0,0 +1,2 @@
builddir
.flatpak-builder

3
flatpak/README.md Normal file
View file

@ -0,0 +1,3 @@
# OrcaSlicer
This is basically a copy of [com.bambulab.BambuStudio](https://github.com/flathub/com.bambulab.BambuStudio). As such, same rules apply here as does over there.

15
flatpak/entrypoint Normal file
View file

@ -0,0 +1,15 @@
#!/usr/bin/env sh
# Work-around https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/754
grep -q org.freedesktop.Platform.GL.nvidia /.flatpak-info && export WEBKIT_DISABLE_DMABUF_RENDERER=1
# Work-around https://github.com/bambulab/BambuStudio/issues/3440
export LC_ALL=C.UTF-8
if [ $BAMBU_STUDIO_DARK_THEME == true ]; then
export GTK_THEME='Adwaita:dark'
# echo "Message: $(date +%T): INFO: using dark theme variant"
fi
exec /app/bin/orca-slicer "$@" &
$(/app/bin/set-dark-theme-variant.py) &

BIN
flatpak/images/1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 280 KiB

BIN
flatpak/images/2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 976 KiB

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>io.github.softfever.OrcaSlicer</id>
<launchable type="desktop-id">io.github.softfever.OrcaSlicer.desktop</launchable>
<provides>
<id>io.github.softfever.OrcaSlicer.desktop</id>
</provides>
<name>OrcaSlicer</name>
<!-- hehe hadess @ppd
... seriously though, thanks -->
<summary>Get even more perfect prints!</summary>
<developer_name>SoftFever</developer_name>
<url type="homepage">https://github.com/SoftFever/OrcaSlicer</url>
<url type="help">https://github.com/SoftFever/OrcaSlicer/wiki</url>
<url type="bugtracker">https://github.com/SoftFever/OrcaSlicer/issues/</url>
<url type="donation">https://ko-fi.com/SoftFever</url>
<metadata_license>0BSD</metadata_license>
<project_license>AGPL-3.0-only</project_license>
<content_rating type="oars-1.1" />
<requires>
<display_length compare="gt">768</display_length>
</requires>
<recommends>
<control>keyboard</control>
<control>pointing</control>
</recommends>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/powpingdone/com.github.softfever.orcaslicer/master/images/1.png</image>
<caption>A model ready to be sliced on a buildplate.</caption>
</screenshot>
<screenshot>
<image>https://raw.githubusercontent.com/powpingdone/com.github.softfever.orcaslicer/master/images/2.png
</image>
<caption>A calibration test ready to be printed out.</caption>
</screenshot>
</screenshots>
<description>
<p>A 3D printer slicer forked from Bambu Studio, PrusaSlicer, and SuperSlicer with many more printer profiles, helpful calibration prints, and many more features to get your 3D printer printing perfectly!</p>
</description>
<branding>
<color type="primary" scheme_preference="light">#009688</color>
</branding>
<releases>
<release version="2.0.0-951fc8e" date="2024-01-30"> <url>https://github.com/SoftFever/OrcaSlicer/commit/951fc8e98a0d5ca0ccb254315646ce7889a44836</url>
</release>
</releases>
</component>

View file

@ -0,0 +1,344 @@
app-id: io.github.softfever.OrcaSlicer
runtime: org.gnome.Platform
runtime-version: "45"
sdk: org.gnome.Sdk
command: entrypoint
separate-locales: true
rename-icon: OrcaSlicer
finish-args:
- --share=ipc
- --socket=x11
- --share=network
- --device=all
- --filesystem=home
- --filesystem=xdg-run/gvfs
- --filesystem=/run/media
- --filesystem=/media
# Allow OrcaSlicer to talk to other instances
- --talk-name=io.github.softfever.OrcaSlicer.InstanceCheck.*
- --system-talk-name=org.freedesktop.UDisks2
# set dark theme
- --env=BAMBU_STUDIO_DARK_THEME=false
modules:
# JPEG codec for the liveview
- name: gst-plugins-good
buildsystem: meson
config-opts:
- -Dauto_features=disabled
- -Djpeg=enabled
- -Ddoc=disabled
- -Dexamples=disabled
- -Dtests=disabled
sources:
- type: archive
url: https://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-1.22.8.tar.xz
sha256: e305b9f07f52743ca481da0a4e0c76c35efd60adaf1b0694eb3bb021e2137e39
# xprop, xlib is needed to manipulate the X11 window and set _GTK_THEME_VARIANT dark on X11
# and paint the window dark when PRUSA_SLICER_DARK_THEME is true
# see: entrypoint & set-dark-theme-variant.py (originated from spotify client flatpak)
- name: xprop
sources:
- type: archive
url: http://mirrors.ircam.fr/pub/x.org/individual/app/xprop-1.2.5.tar.gz
sha256: b7bf6b6be6cf23e7966a153fc84d5901c14f01ee952fbd9d930aa48e2385d670
- name: python-setuptools_scm
buildsystem: simple
build-commands:
- pip3 install --no-deps --no-build-isolation --verbose --prefix=${FLATPAK_DEST} .
sources:
- type: archive
url: https://files.pythonhosted.org/packages/57/38/930b1241372a9f266a7df2b184fb9d4f497c2cef2e016b014f82f541fe7c/setuptools_scm-6.0.1.tar.gz
sha256: d1925a69cb07e9b29416a275b9fadb009a23c148ace905b2fb220649a6c18e92
- name: python-xlib
buildsystem: simple
build-commands:
- pip3 install --no-deps --no-build-isolation --verbose --prefix=${FLATPAK_DEST} .
sources:
- type: archive
url: https://files.pythonhosted.org/packages/86/f5/8c0653e5bb54e0cbdfe27bf32d41f27bc4e12faa8742778c17f2a71be2c0/python-xlib-0.33.tar.gz
sha256: 55af7906a2c75ce6cb280a584776080602444f75815a7aff4d287bb2d7018b32
# For libOSMesa
- name: mesa
buildsystem: meson
config-opts:
- -Dosmesa=classic
- -Ddri-drivers=[]
- -Dgallium-drivers=[]
- -Dvulkan-drivers=[]
- -Dplatforms=[]
build-options:
arch:
aarch64:
config-opts:
- -Dlibunwind=disabled
cleanup:
- /share/drirc.d
- /include
- "*.a"
sources:
- type: archive
url: https://archive.mesa3d.org/mesa-20.2.6.tar.xz
sha256: f12ca3c6c622f11cd79ad66b4220f04514fa96f795062fe92a37339ab19885db
- name: glu
config-opts:
- --disable-static
sources:
- type: archive
url: https://ftp.osuosl.org/pub/blfs/conglomeration/glu/glu-9.0.2.tar.xz
sha256: 6e7280ff585c6a1d9dfcdf2fca489251634b3377bfc33c29e4002466a38d02d4
cleanup:
- /include
- /lib/*.a
- /lib/*.la
- /lib/pkgconfig
- name: kde-extra-cmake-modules
buildsystem: cmake-ninja
sources:
- type: git
url: https://github.com/KDE/extra-cmake-modules
tag: v5.249.0
cleanup:
- /
- name: orca_wxwidgets
buildsystem: simple
build-commands:
- |
mkdir builddir && cd builddir
cmake ../ -GNinja \
-DwxBUILD_PRECOMP=ON \
-DwxBUILD_TOOLKIT=gtk3 \
-DwxBUILD_DEBUG_LEVEL=0 \
-DwxBUILD_SAMPLES=OFF \
-DwxBUILD_SHARED=ON \
-DwxUSE_MEDIACTRL=ON \
-DwxUSE_DETECT_SM=OFF \
-DwxUSE_UNICODE=ON \
-DwxUSE_PRIVATE_FONTS=ON \
-DwxUSE_OPENGL=ON \
-DwxUSE_WEBREQUEST=ON \
-DwxUSE_WEBVIEW=ON \
-DwxUSE_WEBVIEW_EDGE=OFF \
-DwxUSE_WEBVIEW_IE=OFF \
-DwxUSE_REGEX=builtin \
-DwxUSE_LIBSDL=OFF \
-DwxUSE_XTEST=OFF \
-DwxUSE_STC=OFF \
-DwxUSE_AUI=ON \
-DwxUSE_LIBPNG=sys \
-DwxUSE_ZLIB=sys \
-DwxUSE_LIBJPEG=sys \
-DwxUSE_LIBTIFF=sys \
-DwxUSE_EXPAT=sys \
-DBUILD_SHARED_LIBS:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:STRING=/app \
-DCMAKE_PREFIX_PATH=/app \
-DCMAKE_BUILD_TYPE=Release
cmake --build . --target install -j$FLATPAK_BUILDER_N_JOBS
sources:
- type: git
url: https://github.com/SoftFever/Orca-deps-wxWidgets
branch: master
path: ../
cleanup:
- "*.la"
- "*.a"
- "*.cmake"
- /include
- /app/bin/*
- name: orca_deps
buildsystem: simple
build-commands:
# start build
- |
mkdir deps/build && cd deps/build
cmake ../ \
-DDEP_WX_GTK3=ON \
-DDEP_DOWNLOAD_DIR=/run/build/orca_deps/external-packages \
-DCMAKE_PREFIX_PATH=/app \
-DDESTDIR=/app \
-DCMAKE_INSTALL_LIBDIR=/app/lib \
-DFLATPAK=ON \
-DCMAKE_INSTALL_PREFIX=/app
cmake --build .
rm -r /run/build/orca_deps/external-packages
cleanup:
- /app/include
- "*.a"
- "*.la"
- /app/lib/cmake
sources:
# -
# Section bellow fetches all OrcaSlicer dependencies before the build process and stores them in external-packages/*/* .
# -DDEP_DOWNLOAD_DIR is set in the build process which has to match with dest.
#
# NOTE: The url, dest folder name and sha256 must match from OrcaSlicer's cmake scripts and folder names in OrcaSlicer/deps/
# -
# OrcaSlicer Source Archive
- type: dir
path: ../
# Blosc
- type: file
url: https://github.com/tamasmeszaros/c-blosc/archive/refs/heads/v1.17.0_tm.zip
dest: external-packages/Blosc
sha256: dcb48bf43a672fa3de6a4b1de2c4c238709dad5893d1e097b8374ad84b1fc3b3
# Cereal
- type: file
url: https://github.com/USCiLab/cereal/archive/refs/tags/v1.3.0.zip
dest: external-packages/Cereal
sha256: 71642cb54658e98c8f07a0f0d08bf9766f1c3771496936f6014169d3726d9657
# CGAL
- type: file
url: https://github.com/CGAL/cgal/archive/refs/tags/v5.4.zip
dest: external-packages/CGAL
sha256: d7605e0a5a5ca17da7547592f6f6e4a59430a0bc861948974254d0de43eab4c0
# GMP
- type: file
url: https://github.com/SoftFever/OrcaSlicer_deps/releases/download/gmp-6.2.1/gmp-6.2.1.tar.bz2
dest: external-packages/GMP
sha256: eae9326beb4158c386e39a356818031bd28f3124cf915f8c5b1dc4c7a36b4d7c
# MPFR
- type: file
url: https://www.mpfr.org/mpfr-current/mpfr-4.2.1.tar.bz2
dest: external-packages/MPFR
sha256: b9df93635b20e4089c29623b19420c4ac848a1b29df1cfd59f26cab0d2666aa0
# NLopt
- type: file
url: https://github.com/stevengj/nlopt/archive/v2.5.0.tar.gz
dest: external-packages/NLopt
sha256: c6dd7a5701fff8ad5ebb45a3dc8e757e61d52658de3918e38bab233e7fd3b4ae
# OCCT
- type: file
url: https://github.com/Open-Cascade-SAS/OCCT/archive/refs/tags/V7_6_0.zip
dest: external-packages/OCCT
sha256: 28334f0e98f1b1629799783e9b4d21e05349d89e695809d7e6dfa45ea43e1dbc
# OpenCSG
- type: file
url: https://github.com/floriankirsch/OpenCSG/archive/refs/tags/opencsg-1-4-2-release.zip
dest: external-packages/OpenCSG
sha256: 51afe0db79af8386e2027d56d685177135581e0ee82ade9d7f2caff8deab5ec5
# OpenCV
- type: file
url: https://github.com/opencv/opencv/archive/refs/tags/4.6.0.tar.gz
dest: external-packages/OpenCV
sha256: 1ec1cba65f9f20fe5a41fda1586e01c70ea0c9a6d7b67c9e13edf0cfe2239277
# OpenEXR
- type: file
url: https://github.com/AcademySoftwareFoundation/openexr/archive/refs/tags/v2.5.5.zip
dest: external-packages/OpenEXR
sha256: 0307a3d7e1fa1e77e9d84d7e9a8694583fbbbfd50bdc6884e2c96b8ef6b902de
# OpenVDB
- type: file
url: https://github.com/tamasmeszaros/openvdb/archive/a68fd58d0e2b85f01adeb8b13d7555183ab10aa5.zip
dest: external-packages/OpenVDB
sha256: f353e7b99bd0cbfc27ac9082de51acf32a8bc0b3e21ff9661ecca6f205ec1d81
# Qhull
- type: file
url: https://github.com/qhull/qhull/archive/v8.0.1.zip
dest: external-packages/Qhull
sha256: 5287f5edd6a0372588f5d6640799086a4033d89d19711023ef8229dd9301d69b
# TBB
- type: file
url: https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.5.0.zip
dest: external-packages/TBB
sha256: 83ea786c964a384dd72534f9854b419716f412f9d43c0be88d41874763e7bb47
# Boost
- type: file
url: https://github.com/boostorg/boost/releases/download/boost-1.84.0/boost-1.84.0.tar.gz
dest: external-packages/Boost
sha256: 4d27e9efed0f6f152dc28db6430b9d3dfb40c0345da7342eaa5a987dde57bd95
# GLFW
- type: file
url: https://github.com/glfw/glfw/archive/refs/tags/3.3.7.zip
dest: external-packages/GLFW
sha256: e02d956935e5b9fb4abf90e2c2e07c9a0526d7eacae8ee5353484c69a2a76cd0
- name: OrcaSlicer
buildsystem: simple
build-commands:
- |
mkdir -p build && cd build
CXXFLAGS=-std=gnu++20 cmake ../ \
-DSLIC3R_PCH=OFF \
-DSLIC3R_FHS=ON \
-DSLIC3R_GTK=3 \
-DSLIC3R_STATIC=ON \
-DSLIC3R_BUILD_TESTS=OFF \
-DSLIC3R_DESKTOP_INTEGRATION=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DFLATPAK=ON \
-DBBL_RELEASE_TO_PUBLIC=1 \
-DCMAKE_PREFIX_PATH=/app \
-DCMAKE_INSTALL_PREFIX=/app
CXXFLAGS=-std=gnu++20 cmake --build . --target install -j$FLATPAK_BUILDER_N_JOBS
cleanup:
- /include
post-install:
- | # Desktop Integration files
install -Dm644 -t /app/share/icons/hicolor/scalable/apps/ resources/images/OrcaSlicer.svg
install -Dm644 ${FLATPAK_ID}.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml
mv /app/share/applications/OrcaSlicer.desktop /app/share/applications/${FLATPAK_ID}.desktop
desktop-file-edit --set-key=Exec --set-value="entrypoint %U" /app/share/applications/${FLATPAK_ID}.desktop
install -Dm755 set-dark-theme-variant.py /app/bin
install -Dm755 entrypoint /app/bin
install -Dm755 umount /app/bin
sources:
# -
# Section bellow fetches all OrcaSlicer dependencies before the build process and stores them in external-packages/*/* .
# -DDEP_DOWNLOAD_DIR is set in the build process which has to match with dest.
#
# NOTE: The url, dest folder name and sha256 must match from OrcaSlicer's cmake scripts and folder names in OrcaSlicer/deps/
# -
# OrcaSlicer Source Archive
- type: dir
path: ../
# AppData metainfo for Gnome Software & Co.
- type: file
path: io.github.softfever.OrcaSlicer.metainfo.xml
# script to set dark theme variant
- type: file
path: set-dark-theme-variant.py
# start-up script
# README: workaround for the following issues, also enables dark theme variant:
# SEE: https://github.com/flathub/com.bambulab.BambuStudio/issues/27
# SEE: https://github.com/flathub/com.bambulab.BambuStudio/issues/3
# SEE: https://github.com/prusa3d/PrusaSlicer/issues/2365
- type: file
path: entrypoint
# umount wrapper used to redirect umount calls to udisk2
- type: file
path: umount

View file

@ -0,0 +1,85 @@
#!/usr/bin/env python3
import Xlib
import Xlib.display
import time
import subprocess
import os
import sys
disp = Xlib.display.Display()
root = disp.screen().root
NET_CLIENT_LIST = disp.intern_atom('_NET_CLIENT_LIST')
def set_theme_variant_by_window_id(id, variant):
# Use subprocess to call
# xprop and set the variant from id.
try:
s = subprocess.call(['xprop', '-f', '_GTK_THEME_VARIANT', '8u', '-set', '_GTK_THEME_VARIANT', variant, '-id', str(id)],
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
if s == 0:
return True
return False
except Exception as ex:
return False
def set_theme_variant_from_win_id_collection(win_id_collection, variant):
# Loop though all of the collected
# window ids and set theme variant
for win_id in win_id_collection:
set_theme_variant_by_window_id(win_id, variant)
def collection_win_id_from_wm_class_name(win_class_name):
collect = []
# Loop though all of the windows
# and collect id's those that match
# win_class: prusa-slicer
for win_id in root.get_full_property(NET_CLIENT_LIST, Xlib.X.AnyPropertyType).value:
try:
win = disp.create_resource_object('window', win_id)
if not win.get_wm_transient_for():
win_class = win.get_wm_class()
if win_id and win_class_name in win_class:
collect.append(
win_id) if win_id not in collect else collect
except Xlib.error.BadWindow:
pass
return collect
if __name__ == '__main__':
if os.environ.get('PRUSA_SLICER_DARK_THEME', 'false') != 'true':
sys.exit(0)
# Listen for X Property Change events.
root.change_attributes(event_mask=Xlib.X.PropertyChangeMask)
# the class name of the slicer window
win_class_name = 'prusa-slicer'
# the variant to set
variant = 'dark'
start = time.time()
while True:
# collect all of the window ids
collect = collection_win_id_from_wm_class_name(win_class_name)
# give PrusaSlicer window 2 secs to
# collect the wanted window ids
# set the theme variant and exit
if time.time() - start <= 2:
# disp.next_event() blocks if no events are
# queued. In combination with while True
# it creates a very simple event loop.
disp.next_event()
set_theme_variant_from_win_id_collection(collect, variant)
else:
break

10
flatpak/umount Executable file
View file

@ -0,0 +1,10 @@
#!/usr/bin/env sh
if [ $# -eq 0 ]; then
echo "No arguments supplied"
exit 1
fi
DEVICE=$(basename $(findmnt -oSOURCE -n "$@") )
exec /usr/bin/gdbus call -y -d org.freedesktop.UDisks2 -o /org/freedesktop/UDisks2/block_devices/$DEVICE -m org.freedesktop.UDisks2.Filesystem.Unmount "{'b': <'false'>}" 1> /dev/null

View file

@ -1,4 +1,5 @@
#include "ParameterUtils.hpp" #include "ParameterUtils.hpp"
#include <cassert>
namespace Slic3r { namespace Slic3r {

View file

@ -622,7 +622,6 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES})
encoding_check(libslic3r_gui) encoding_check(libslic3r_gui)
target_link_libraries(libslic3r_gui libslic3r cereal::cereal imgui imguizmo minilzo GLEW::GLEW OpenGL::GL hidapi ${wxWidgets_LIBRARIES} glfw libcurl OpenSSL::SSL OpenSSL::Crypto) target_link_libraries(libslic3r_gui libslic3r cereal::cereal imgui imguizmo minilzo GLEW::GLEW OpenGL::GL hidapi ${wxWidgets_LIBRARIES} glfw libcurl OpenSSL::SSL OpenSSL::Crypto)
#target_link_libraries(libslic3r_gui libslic3r cereal imgui minilzo GLEW::GLEW OpenGL::GL hidapi libcurl OpenSSL::SSL OpenSSL::Crypto ${wxWidgets_LIBRARIES} glfw)
if (MSVC) if (MSVC)
target_link_libraries(libslic3r_gui Setupapi.lib) target_link_libraries(libslic3r_gui Setupapi.lib)
@ -666,9 +665,18 @@ endif ()
# link these libraries. # link these libraries.
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
find_package(GTK${SLIC3R_GTK} REQUIRED) find_package(GTK${SLIC3R_GTK} REQUIRED)
if (FLATPAK)
# I don't know why this is needed, but for whatever reason slic3r isn't
# linking to X11 and webkit2gtk. force it.
find_package(X11 REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(webkit2gtk REQUIRED webkit2gtk-4.1)
target_link_libraries (libslic3r_gui ${X11_LIBRARIES} ${webkit2gtk_LIBRARIES})
endif()
target_include_directories(libslic3r_gui PRIVATE ${GTK${SLIC3R_GTK}_INCLUDE_DIRS}) target_include_directories(libslic3r_gui PRIVATE ${GTK${SLIC3R_GTK}_INCLUDE_DIRS})
target_link_libraries(libslic3r_gui ${GTK${SLIC3R_GTK}_LIBRARIES} fontconfig) target_link_libraries(libslic3r_gui ${GTK${SLIC3R_GTK}_LIBRARIES} fontconfig)
# We add GStreamer for bambu:/// support. # We add GStreamer for bambu:/// support.
pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0) pkg_check_modules(GSTREAMER REQUIRED gstreamer-1.0)
pkg_check_modules(GST_BASE REQUIRED gstreamer-base-1.0) pkg_check_modules(GST_BASE REQUIRED gstreamer-base-1.0)
@ -677,4 +685,4 @@ if (UNIX AND NOT APPLE)
endif () endif ()
# Add a definition so that we can tell we are compiling slic3r. # Add a definition so that we can tell we are compiling slic3r.
target_compile_definitions(libslic3r_gui PRIVATE SLIC3R_CURRENTLY_COMPILING_GUI_MODULE) target_compile_definitions(libslic3r_gui PRIVATE SLIC3R_CURRENTLY_COMPILING_GUI_MODULE)

View file

@ -11,6 +11,7 @@
#include <functional> #include <functional>
#include <boost/any.hpp> #include <boost/any.hpp>
#include <wx/colourdata.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/bmpcbox.h> #include <wx/bmpcbox.h>
#include <wx/clrpicker.h> #include <wx/clrpicker.h>

View file

@ -14,6 +14,7 @@
#include "libslic3r/ObjectID.hpp" #include "libslic3r/ObjectID.hpp"
#include <wx/timer.h>
#include <map> #include <map>
//BBS: GUI refactor: to support top layout //BBS: GUI refactor: to support top layout

View file

@ -11,6 +11,7 @@
#include <boost/asio.hpp> #include <boost/asio.hpp>
#include <boost/thread.hpp> #include <boost/thread.hpp>
#include <string> #include <string>
#include <set>
#include <memory> #include <memory>
#define LOCALHOST_PORT 13618 #define LOCALHOST_PORT 13618

View file

@ -4,7 +4,8 @@
#include "ThreadSafeQueue.hpp" #include "ThreadSafeQueue.hpp"
#include "slic3r/GUI/I18N.hpp" #include "slic3r/GUI/I18N.hpp"
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include <boost/algorithm/string.hpp>
#include <thread>
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {

View file

@ -3,6 +3,9 @@
#include "Job.hpp" #include "Job.hpp"
#include "slic3r/GUI/HttpServer.hpp" #include "slic3r/GUI/HttpServer.hpp"
#include <boost/nowide/fstream.hpp>
#include <boost/nowide/cstdio.hpp>
#include <boost/log/trivial.hpp>
namespace Slic3r { namespace Slic3r {
namespace GUI { namespace GUI {

View file

@ -6,7 +6,7 @@
#include "wx/cmdline.h" #include "wx/cmdline.h"
#include "wx/notifmsg.h" #include "wx/notifmsg.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/webview.h" #include <wx/webview.h>
#include <wx/string.h> #include <wx/string.h>
#if wxUSE_WEBVIEW_EDGE #if wxUSE_WEBVIEW_EDGE

View file

@ -6,7 +6,7 @@
#include "wx/cmdline.h" #include "wx/cmdline.h"
#include "wx/notifmsg.h" #include "wx/notifmsg.h"
#include "wx/settings.h" #include "wx/settings.h"
#include "wx/webview.h" #include <wx/webview.h>
#if wxUSE_WEBVIEW_EDGE #if wxUSE_WEBVIEW_EDGE
#include "wx/msw/webview_edge.h" #include "wx/msw/webview_edge.h"

View file

@ -2,6 +2,8 @@
#include <openssl/sha.h> #include <openssl/sha.h>
#include <boost/beast/core/detail/base64.hpp> #include <boost/beast/core/detail/base64.hpp>
#include <boost/nowide/fstream.hpp>
#include <boost/filesystem.hpp>
#include "nlohmann/json.hpp" #include "nlohmann/json.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"

View file

@ -42,4 +42,4 @@ public:
}; };
} // namespace Slic3r } // namespace Slic3r
#endif #endif