diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 8fcceac2..d442ba25 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -114,7 +114,7 @@ jobs: export CPPFLAGS="-I$CURL_PATH/include -I$BOOST_PATH/include -I$ICU_PATH/include -I$ZLIB_PATH/include -I$ZSTD_PATH/include" export PKG_CONFIG_PATH="$CURL_PATH/lib/pkgconfig:$BOOST_PATH/lib/pkgconfig:$ICU_PATH/lib/pkgconfig:$ZLIB_PATH/lib/pkgconfig:$ZSTD_PATH/lib/pkgconfig" export CMAKE_PREFIX_PATH="$BOOST_PATH;$CURL_PATH;$ICU_PATH" - sed -i '' -e 's/-DCMAKE_PREFIX_PATH="$DEPS/-DCMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH;$DEPS/' BuildMac.sh + sed -i '' -e 's/-DCMAKE_PREFIX_PATH="$DEPS\/usr\/local"/-DCMAKE_PREFIX_PATH="$DEPS\/usr\/local;$CMAKE_PREFIX_PATH"/' BuildMac.sh sed -i '' -e 's/-DQDT_INTERNAL_TESTING=0/-DQDT_INTERNAL_TESTING=1/' BuildMac.sh sed -i '' -e 's/-DQDT_RELEASE_TO_PUBLIC=1/-DQDT_RELEASE_TO_PUBLIC=0/' BuildMac.sh chmod +x BuildMac.sh diff --git a/BuildFedora.sh b/BuildFedora.sh index 6c145b61..7af0416b 100755 --- a/BuildFedora.sh +++ b/BuildFedora.sh @@ -4,6 +4,22 @@ export ROOT=`pwd` export NCORES=`nproc --all` export CMAKE_BUILD_PARALLEL_LEVEL=${NCORES} +# An active conda/miniforge environment prepends its own bin/ to PATH, and +# CMake's find_package(... CONFIG) search treats PATH entries as candidate +# install prefixes -- so a conda env can silently shadow a perfectly good +# Fedora system library (e.g. zstd, used transitively by Boost::iostreams) +# with an older/incompatible copy, baking that path into the built binary's +# RPATH. Strip any active conda environment's bin dirs from PATH so the +# Fedora system toolchain and libraries are used consistently. +if [[ -n "$CONDA_PREFIX" ]]; then + PATH=$(echo "$PATH" | tr ':' '\n' | grep -vF "$CONDA_PREFIX" | paste -sd:) +fi +# Several bundled/third-party dependencies (and their own nested try_compile() +# checks) declare cmake_minimum_required() below 3.5, which newer CMake +# (>=4.0) refuses to configure at all. Setting this env var (rather than only +# passing -DCMAKE_POLICY_VERSION_MINIMUM on the command line) makes CMake +# auto-apply it to every nested build tree it creates, not just the top level. +export CMAKE_POLICY_VERSION_MINIMUM=3.5 #FOUND_GTK2=$(dnf list installed | grep gtk2) #FOUND_GTK3=$(dnf list installed | grep gtk3) FOUND_GTK3=1 @@ -52,7 +68,7 @@ while getopts ":dsiuhgbr" opt; do r ) SKIP_RAM_CHECK="1" ;; - h ) echo "Usage: ./BuildLinux.sh [-i][-u][-d][-s][-b][-g]" + h ) echo "Usage: ./BuildFedora.sh [-i][-u][-d][-s][-b][-g]" echo " -i: Generate appimage (optional)" echo " -g: force gtk2 build" echo " -b: build in debug mode" @@ -60,8 +76,8 @@ while getopts ":dsiuhgbr" opt; do echo " -s: build qidi-studio (optional)" echo " -u: only update clock & dependency packets (optional and need sudo)" echo " -r: skip free ram check (low ram compiling)" - echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'" - echo " and then './BuildLinux.sh -dsi'" + echo "For a first use, you want to 'sudo ./BuildFedora.sh -u'" + echo " and then './BuildFedora.sh -dsi'" exit 0 ;; esac @@ -69,7 +85,7 @@ done if [ $OPTIND -eq 1 ] then - echo "Usage: ./BuildLinux.sh [-i][-u][-d][-s][-b][-g]" + echo "Usage: ./BuildFedora.sh [-i][-u][-d][-s][-b][-g]" echo " -i: Generate appimage (optional)" echo " -g: force gtk2 build" echo " -b: build in debug mode" @@ -77,8 +93,8 @@ then echo " -s: build qidi-studio (optional)" echo " -u: only update clock & dependency packets (optional and need sudo)" echo " -r: skip free ram check (low ram compiling)" - echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'" - echo " and then './BuildLinux.sh -dsi'" + echo "For a first use, you want to 'sudo ./BuildFedora.sh -u'" + echo " and then './BuildFedora.sh -dsi'" exit 0 fi @@ -101,25 +117,28 @@ if [[ -n "$UPDATE_LIB" ]] then echo -n -e "Updating linux ...\n" # hwclock -s # DeftDawg: Why does SuperSlicer want to do this? - apt update + dnf makecache + # NOTE: cereal is intentionally NOT installed from Fedora's cereal-devel here. + # deps/CMakeLists.txt always builds its own bundled cereal (no toggle to skip + # it, unlike GLFW), and it exports an imported target literally named + # `cereal`. Fedora's cereal-devel instead exports the namespaced + # `cereal::cereal`, which this project's target_link_libraries(... cereal) + # calls don't match -- if cereal_DIR resolves to the system package, CMake + # silently treats the unmatched "cereal" as a raw "-lcereal" linker flag, + # which fails since there is no such standalone library. Only the + # deps-built cereal-config.cmake is compatible with this codebase. if [[ -z "$FOUND_GTK3" ]] then - echo -e "\nInstalling: libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git\n" - apt install -y libgtk2.0-dev libglew-dev libudev-dev libdbus-1-dev cmake git + echo -e "\nInstalling: gtk2-devel glew-devel systemd-devel dbus-devel cmake git glfw-devel NLopt-devel openvdb-devel imath-devel openexr-devel nasm webkit2gtk4.1-devel boost-static mesa-compat-libOSMesa-devel\n" + dnf install -y gtk2-devel glew-devel systemd-devel dbus-devel cmake git glfw-devel NLopt-devel openvdb-devel imath-devel openexr-devel nasm webkit2gtk4.1-devel boost-static mesa-compat-libOSMesa-devel else - echo -e "\nFind libgtk-3, installing: libgtk-3-dev libglew-dev libudev-dev libdbus-1-dev cmake git\n" - apt install -y libgtk-3-dev libglew-dev libudev-dev libdbus-1-dev cmake git - fi - # for ubuntu 22.04: - ubu_version="$(cat /etc/issue)" - if [[ $ubu_version == "Ubuntu 22.04"* ]] - then - apt install -y curl libssl-dev libcurl4-openssl-dev m4 + echo -e "\nFind gtk3-devel, installing: gtk3-devel glew-devel systemd-devel dbus-devel cmake git glfw-devel NLopt-devel openvdb-devel imath-devel openexr-devel nasm webkit2gtk4.1-devel boost-static mesa-compat-libOSMesa-devel\n" + dnf install -y gtk3-devel glew-devel systemd-devel dbus-devel cmake git glfw-devel NLopt-devel openvdb-devel imath-devel openexr-devel nasm webkit2gtk4.1-devel boost-static mesa-compat-libOSMesa-devel fi if [[ -n "$BUILD_DEBUG" ]] then - echo -e "\nInstalling: libssl-dev libcurl4-openssl-dev\n" - apt install -y libssl-dev libcurl4-openssl-dev + echo -e "\nInstalling: openssl-devel libcurl-devel\n" + dnf install -y openssl-devel libcurl-devel fi echo -e "done\n" exit 0 @@ -168,10 +187,28 @@ fi if [[ -n "$BUILD_DEPS" ]] then echo "[3/9] Configuring dependencies..." - BUILD_ARGS="" + # Use Fedora's glfw-devel (ships a proper glfw3Config.cmake) instead of + # building GLFW from source, which on Linux additionally requires KDE's + # extra-cmake-modules (ECM) for Wayland support that we don't otherwise need. + # + # Also skip building OpenVDB (and its OpenEXR/Imath dependency) here: the + # main app build is configured to use Fedora's system openvdb-devel + # instead (see SLIC3R_STATIC_EXCLUDE_OPENVDB below), since Fedora's + # openvdb-devel has no static .a to link against. But all deps share one + # install prefix/include root, so if deps ALSO installed its own (older, + # ABI-incompatible) OpenVDB headers here, the compiler would pick those up + # instead of Fedora's system headers regardless of any CMake variable + # override, causing undefined-symbol link errors from an ABI mismatch. + # + # Also skip building expat here: the final QIDIStudio link pulls in + # Fedora's system libwebkit2gtk-4.1.so (for wxWebView), which itself + # needs a matching dynamic libexpat.so to resolve its own XML_* symbols. + # If the app instead links deps' own static libexpat.a, those symbols + # go unresolved and the final link fails. + BUILD_ARGS="-DDEP_BUILD_GLFW=OFF -DDEP_BUILD_OPENVDB=OFF -DDEP_BUILD_EXPAT=OFF" if [[ -n "$FOUND_GTK3_DEV" ]] then - BUILD_ARGS="-DDEP_WX_GTK3=ON" + BUILD_ARGS="${BUILD_ARGS} -DDEP_WX_GTK3=ON" fi if [[ -n "$BUILD_DEBUG" ]] then @@ -216,10 +253,19 @@ fi if [[ -n "$BUILD_QIDI_STUDIO" ]] then echo "[7/9] Configuring Slic3r..." - BUILD_ARGS="" + # Fedora's glew-devel/openvdb-devel packages only ship shared .so libs, no + # static .a, so linking them statically (the SLIC3R_STATIC default) always + # fails to find them. + BUILD_ARGS="-DSLIC3R_STATIC_EXCLUDE_GLEW=1 -DSLIC3R_STATIC_EXCLUDE_OPENVDB=1" + # wx-config (generated by the bundled wxWidgets build) hardcodes "-L.../lib" + # for its own dependencies, e.g. "-Wl,-Bstatic -lzlibstatic". But zlib's own + # CMakeLists installs via GNUInstallDirs, which resolves to "lib64" on + # Fedora, so that -lzlibstatic can't otherwise be found. Add lib64 as an + # extra linker search path to cover this dep-install-layout mismatch. + BUILD_ARGS="${BUILD_ARGS} -DCMAKE_EXE_LINKER_FLAGS=-L$PWD/deps/build/destdir/usr/local/lib64" if [[ -n "$FOUND_GTK3_DEV" ]] then - BUILD_ARGS="-DSLIC3R_GTK=3" + BUILD_ARGS="${BUILD_ARGS} -DSLIC3R_GTK=3" fi if [[ -n "$BUILD_DEBUG" ]] then @@ -235,7 +281,7 @@ then # make Slic3r echo "[8/9] Building Slic3r..." - make -j4 QIDIStudio + make -j$NCORES QIDIStudio # make .mo # make gettext_po_to_mo # FIXME: DeftDawg: complains about msgfmt not existing even in SuperSlicer, did this ever work? diff --git a/CMakeLists.txt b/CMakeLists.txt index 74e6d759..70afc935 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -604,7 +604,7 @@ endforeach() find_package(NLopt 1.4 REQUIRED) -if(SLIC3R_STATIC) +if(SLIC3R_STATIC AND NOT SLIC3R_STATIC_EXCLUDE_OPENVDB) set(OPENVDB_USE_STATIC_LIBS ON) set(USE_BLOSC TRUE) endif () diff --git a/deps/Assimp/Assimp.cmake b/deps/Assimp/Assimp.cmake index 85a1c326..5e4c3789 100644 --- a/deps/Assimp/Assimp.cmake +++ b/deps/Assimp/Assimp.cmake @@ -9,6 +9,7 @@ endif() qidistudio_add_cmake_project(Assimp URL ${_assimp_url} URL_HASH ${_assimp_hash} + DEPENDS ${ZLIB_PKG} CMAKE_ARGS -DASSIMP_BUILD_TESTS=OFF -DASSIMP_BUILD_SAMPLES=OFF @@ -19,7 +20,7 @@ qidistudio_add_cmake_project(Assimp -DASSIMP_BUILD_GLTF_IMPORTER=ON -DASSIMP_BUILD_OBJ_IMPORTER=ON -DASSIMP_BUILD_FBX_IMPORTER=ON - -DASSIMP_BUILD_ZLIB=ON + -DASSIMP_BUILD_ZLIB=OFF -DASSIMP_WARNINGS_AS_ERRORS=OFF -DBUILD_WITH_STATIC_CRT=OFF ) diff --git a/deps/CMakeLists.txt b/deps/CMakeLists.txt index 356f136c..685a3365 100644 --- a/deps/CMakeLists.txt +++ b/deps/CMakeLists.txt @@ -20,8 +20,8 @@ # therefore, unfortunately, the installation cannot be copied/moved elsewhere without re-installing wxWidgets. # +cmake_minimum_required(VERSION 3.5) project(QIDIStudio-deps) -cmake_minimum_required(VERSION 3.2) include(ExternalProject) include(ProcessorCount) @@ -40,6 +40,8 @@ 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_OPENVDB "Compile OpenVDB" ON) +option(DEP_BUILD_EXPAT "Compile expat" ON) option(DEP_BUILD_BLOSC "Compile Blosc" ON) option(DEP_BUILD_FREETYPE "Compile freetype" ON) option(DEP_BUILD_WXWIDGETS "Compile wxWidgets" ON) @@ -145,6 +147,9 @@ function(qidistudio_add_cmake_project projectname) -DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} -DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} -DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} + # Several bundled dependencies declare cmake_minimum_required() below + # 3.5, which newer CMake (>=4.0) refuses to configure at all. + -DCMAKE_POLICY_VERSION_MINIMUM:STRING=3.5 -DBUILD_SHARED_LIBS:BOOL=OFF ${_cmake_osx_arch} "${_configs_line}" @@ -218,7 +223,7 @@ if (DEP_BUILD_TIFF AND NOT TIFF_FOUND) set(TIFF_PKG dep_TIFF) endif() set(EXPAT_PKG "") -if (NOT EXPAT_FOUND) +if (DEP_BUILD_EXPAT AND NOT EXPAT_FOUND) include(EXPAT/EXPAT.cmake) set(EXPAT_PKG dep_EXPAT) endif () @@ -248,8 +253,10 @@ if (DEP_BUILD_BLOSC) include(Blosc/Blosc.cmake) set(BLOSC_PKG dep_Blosc) endif () -include(OpenEXR/OpenEXR.cmake) -include(OpenVDB/OpenVDB.cmake) +if (DEP_BUILD_OPENVDB) + include(OpenEXR/OpenEXR.cmake) + include(OpenVDB/OpenVDB.cmake) +endif () include(GMP/GMP.cmake) include(MPFR/MPFR.cmake) @@ -294,6 +301,11 @@ if (DEP_BUILD_WEBSOCKET) set(WEBSOCKETPP_PKG dep_WebSocketPP) endif() +set(OPENVDB_PKG "") +if (DEP_BUILD_OPENVDB) + set(OPENVDB_PKG dep_OpenVDB) +endif () + set(_dep_list ${BOOST_PKG} dep_TBB @@ -302,7 +314,7 @@ set(_dep_list dep_Cereal dep_NLopt dep_libnoise - dep_OpenVDB + ${OPENVDB_PKG} dep_OpenCSG dep_OpenCV dep_CGAL diff --git a/deps/FFMPEG/FFMPEG.cmake b/deps/FFMPEG/FFMPEG.cmake index aa1300be..0207356c 100644 --- a/deps/FFMPEG/FFMPEG.cmake +++ b/deps/FFMPEG/FFMPEG.cmake @@ -46,10 +46,7 @@ else () endif() endif() - set(_build_j -j) - if(DEFINED ENV{CMAKE_BUILD_PARALLEL_LEVEL}) - set(_build_j "-j$ENV{CMAKE_BUILD_PARALLEL_LEVEL}") - endif() + set(_build_j "-j${NPROC}") ExternalProject_Add(dep_FFMPEG URL https://github.com/FFmpeg/FFmpeg/archive/refs/tags/n7.0.2.tar.gz diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index f1f5aba1..c97d191d 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -241,8 +241,6 @@ set(SLIC3R_GUI_SOURCES GUI/DownloadManager.hpp GUI/QDSDeviceManager.cpp GUI/QDSDeviceManager.hpp - QIDI/UserPresetSyncManager.cpp - QIDI/UserPresetSyncManager.hpp GUI/BedShapeDialog.cpp GUI/BedShapeDialog.hpp GUI/Plater.cpp @@ -683,6 +681,8 @@ if(QDT_RELEASE_TO_PUBLIC) QIDI/QIDISSEClientV2.hpp QIDI/P2PManager.cpp QIDI/P2PManager.hpp + QIDI/UserPresetSyncManager.cpp + QIDI/UserPresetSyncManager.hpp ) endif () diff --git a/version.inc b/version.inc index 6d955696..fd54c822 100644 --- a/version.inc +++ b/version.inc @@ -7,6 +7,10 @@ set(SLIC3R_APP_KEY "QIDIStudio") if(NOT DEFINED QDT_RELEASE_TO_PUBLIC) set(QDT_RELEASE_TO_PUBLIC "1") endif() +if(QDT_RELEASE_TO_PUBLIC AND NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/src/slic3r/QIDI/QIDINetwork.cpp") + message(WARNING "src/slic3r/QIDI/ is missing: building without QIDI cloud/account features.") + set(QDT_RELEASE_TO_PUBLIC "0") +endif() if(NOT DEFINED QDT_INTERNAL_TESTING) set(QDT_INTERNAL_TESTING "0") endif()