mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-06-26 09:25:26 -06:00
Fixes, refactors and enhances Linux build-scripts (#8269)
* fixes and refactors linux build scripts
- build_linux.sh: fixes wrong AppImage build folder; refactors script; enhances help text
- harmonizes names: BuildLinux.sh and BuildLinuxImage.sh
- fixes file permissions: cmake inherits .in-file permission; removes chmod 755 in scripts
- linux.d/debian: removes false positive error message
- updates documentation
* enables ANSI-colored output for GNU or Clang
* build_linux.sh: adds -p flag to disable PCH for boosting ccache hit rate
* Allow compilation on distributions based on Ubuntu/Debian (#8625)
* build_linux.sh: takes over changes from BuildLinux.sh
* CMakeLists.txt: removes leftovers, enables ANSI-colored output
* CMakeLists.txt: fixes issue where FORCE_COLORED_OUTPUT was not respected form environment (introduces -C cli arg)
* merges 5df4275
: Make it easy to pass extra build args to deps and orca in BuildLinux.sh (#9648)
This commit is contained in:
parent
153c478c35
commit
6da7fe62a2
14 changed files with 252 additions and 233 deletions
|
@ -3,10 +3,11 @@
|
|||
apt update
|
||||
apt upgrade -y
|
||||
|
||||
build_linux="./build_linux.sh -u"
|
||||
echo "-----------------------------------------"
|
||||
echo "Running BuildLinux.sh with update flag..."
|
||||
echo "Running ${build_linux}..."
|
||||
echo "-----------------------------------------"
|
||||
./BuildLinux.sh -u
|
||||
${build_linux}
|
||||
|
||||
echo "------------------------------"
|
||||
echo "Installing missing packages..."
|
||||
|
|
2
.github/workflows/build_all.yml
vendored
2
.github/workflows/build_all.yml
vendored
|
@ -25,7 +25,7 @@ on:
|
|||
- '**/CMakeLists.txt'
|
||||
- 'version.inc'
|
||||
- ".github/workflows/build_*.yml"
|
||||
- 'BuildLinux.sh'
|
||||
- 'build_linux.sh'
|
||||
- 'build_release_vs2022.bat'
|
||||
- 'build_release_macos.sh'
|
||||
- 'flatpak/**'
|
||||
|
|
4
.github/workflows/build_deps.yml
vendored
4
.github/workflows/build_deps.yml
vendored
|
@ -105,9 +105,9 @@ jobs:
|
|||
run: |
|
||||
mkdir -p ${{ github.workspace }}/deps/build
|
||||
mkdir -p ${{ github.workspace }}/deps/build/destdir
|
||||
sudo ./BuildLinux.sh -ur
|
||||
sudo ./build_linux.sh -ur
|
||||
sudo chown $USER -R ./
|
||||
./BuildLinux.sh -dr
|
||||
./build_linux.sh -dr
|
||||
cd deps/build
|
||||
tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir
|
||||
|
||||
|
|
6
.github/workflows/build_orca.yml
vendored
6
.github/workflows/build_orca.yml
vendored
|
@ -246,10 +246,10 @@ jobs:
|
|||
libgtk-3-dev libgtk-3-dev libmspack-dev libosmesa6-dev libsecret-1-dev libsoup2.4-dev libssl-dev libudev-dev libwayland-dev \
|
||||
libwebkit2gtk-${{ env.webkit-ver }}-dev libxkbcommon-dev locales locales-all m4 pkgconf sudo wayland-protocols wget ${{ env.libfuse2-pkg }}
|
||||
|
||||
- name: Install dependencies from BuildLinux.sh
|
||||
- name: Install dependencies from build_linux.sh
|
||||
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
|
||||
shell: bash
|
||||
run: sudo ./BuildLinux.sh -ur
|
||||
run: sudo ./build_linux.sh -ur
|
||||
|
||||
- name: Fix permissions
|
||||
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
|
||||
|
@ -262,7 +262,7 @@ jobs:
|
|||
env:
|
||||
ubuntu-ver-str: ${{ (inputs.os == 'ubuntu-24.04' && '_Ubuntu2404') || '' }}
|
||||
run: |
|
||||
./BuildLinux.sh -isr
|
||||
./build_linux.sh -isr
|
||||
mv -n ./build/OrcaSlicer_Linux_V${{ env.ver_pure }}.AppImage ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
|
||||
chmod +x ./build/OrcaSlicer_Linux_AppImage${{ env.ubuntu-ver-str }}_${{ env.ver }}.AppImage
|
||||
|
||||
|
|
207
BuildLinux.sh
207
BuildLinux.sh
|
@ -1,207 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
export ROOT=$(dirname $(readlink -f ${0}))
|
||||
|
||||
set -e # exit on first error
|
||||
|
||||
function check_available_memory_and_disk() {
|
||||
FREE_MEM_GB=$(free -g -t | grep 'Mem' | rev | cut -d" " -f1 | rev)
|
||||
MIN_MEM_GB=10
|
||||
|
||||
FREE_DISK_KB=$(df -k . | tail -1 | awk '{print $4}')
|
||||
MIN_DISK_KB=$((10 * 1024 * 1024))
|
||||
|
||||
if [ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]; then
|
||||
echo -e "\nERROR: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (system has only ${FREE_MEM_GB}G available)"
|
||||
echo && free -h && echo
|
||||
echo "Invoke with -r to skip ram and disk checks."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]]; then
|
||||
echo -e "\nERROR: Orca Slicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (system has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
|
||||
echo && df -h . && echo
|
||||
echo "Invoke with -r to skip ram and disk checks."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-i][-r][-s][-u] [-j N]"
|
||||
echo " -1: limit builds to 1 core (where possible)"
|
||||
echo " -j N: limit builds to N cores (where possible)"
|
||||
echo " -b: build in debug mode"
|
||||
echo " -c: force a clean build"
|
||||
echo " -d: build deps (optional)"
|
||||
echo " -h: this help output"
|
||||
echo " -i: Generate appimage (optional)"
|
||||
echo " -r: skip ram and disk checks (low ram compiling)"
|
||||
echo " -s: build orca-slicer (optional)"
|
||||
echo " -u: update and build dependencies (optional and need sudo)"
|
||||
echo "For a first use, you want to 'sudo ./BuildLinux.sh -u'"
|
||||
echo " and then './BuildLinux.sh -dsi'"
|
||||
}
|
||||
|
||||
unset name
|
||||
while getopts ":1j:bcdghirsu" opt; do
|
||||
case ${opt} in
|
||||
1 )
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=1
|
||||
;;
|
||||
j )
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG
|
||||
;;
|
||||
b )
|
||||
BUILD_DEBUG="1"
|
||||
;;
|
||||
c )
|
||||
CLEAN_BUILD=1
|
||||
;;
|
||||
d )
|
||||
BUILD_DEPS="1"
|
||||
;;
|
||||
h ) usage
|
||||
exit 0
|
||||
;;
|
||||
i )
|
||||
BUILD_IMAGE="1"
|
||||
;;
|
||||
r )
|
||||
SKIP_RAM_CHECK="1"
|
||||
;;
|
||||
s )
|
||||
BUILD_ORCA="1"
|
||||
;;
|
||||
u )
|
||||
UPDATE_LIB="1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ${OPTIND} -eq 1 ]
|
||||
then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
# cmake 4.x compatibility workaround
|
||||
export CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
|
||||
DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '"')
|
||||
DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"')
|
||||
# Check for direct distribution match to Ubuntu/Debian
|
||||
if [ "${DISTRIBUTION}" == "ubuntu" ] || [ "${DISTRIBUTION}" == "linuxmint" ]; then
|
||||
DISTRIBUTION="debian"
|
||||
# Check if distribution is Debian/Ubuntu-like based on ID_LIKE
|
||||
elif [[ "${DISTRIBUTION_LIKE}" == *"debian"* ]] || [[ "${DISTRIBUTION_LIKE}" == *"ubuntu"* ]]; then
|
||||
DISTRIBUTION="debian"
|
||||
elif [[ "${DISTRIBUTION_LIKE}" == *"arch"* ]]; then
|
||||
DISTRIBUTION="arch"
|
||||
fi
|
||||
if [ ! -f ./linux.d/${DISTRIBUTION} ]
|
||||
then
|
||||
echo "Your distribution does not appear to be currently supported by these build scripts"
|
||||
exit 1
|
||||
fi
|
||||
source ./linux.d/${DISTRIBUTION}
|
||||
|
||||
echo "FOUND_GTK3=${FOUND_GTK3}"
|
||||
if [[ -z "${FOUND_GTK3_DEV}" ]]
|
||||
then
|
||||
echo "Error, you must install the dependencies before."
|
||||
echo "Use option -u with sudo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Changing date in version..."
|
||||
{
|
||||
# change date in version
|
||||
sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
|
||||
}
|
||||
echo "done"
|
||||
|
||||
|
||||
if ! [[ -n "${SKIP_RAM_CHECK}" ]]
|
||||
then
|
||||
check_available_memory_and_disk
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILD_DEPS}" ]]
|
||||
then
|
||||
echo "Configuring dependencies..."
|
||||
BUILD_ARGS="${DEPS_EXTRA_BUILD_ARGS} -DDEP_WX_GTK3=ON"
|
||||
if [[ -n "${CLEAN_BUILD}" ]]
|
||||
then
|
||||
rm -fr deps/build
|
||||
fi
|
||||
if [ ! -d "deps/build" ]
|
||||
then
|
||||
mkdir deps/build
|
||||
fi
|
||||
if [[ -n "${BUILD_DEBUG}" ]]
|
||||
then
|
||||
# have to build deps with debug & release or the cmake won't find everything it needs
|
||||
if [ ! -d "deps/build/release" ]
|
||||
then
|
||||
mkdir deps/build/release
|
||||
fi
|
||||
cmake -S deps -B deps/build/release -G Ninja -DDESTDIR="${PWD}/deps/build/destdir" -DDEP_DOWNLOAD_DIR="${PWD}/deps/DL_CACHE" ${BUILD_ARGS}
|
||||
cmake --build deps/build/release
|
||||
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
|
||||
fi
|
||||
|
||||
echo "cmake -S deps -B deps/build -G Ninja ${BUILD_ARGS}"
|
||||
cmake -S deps -B deps/build -G Ninja ${BUILD_ARGS}
|
||||
cmake --build deps/build
|
||||
fi
|
||||
|
||||
|
||||
if [[ -n "${BUILD_ORCA}" ]]
|
||||
then
|
||||
echo "Configuring OrcaSlicer..."
|
||||
if [[ -n "${CLEAN_BUILD}" ]]
|
||||
then
|
||||
rm -fr build
|
||||
fi
|
||||
BUILD_ARGS="${ORCA_EXTRA_BUILD_ARGS}"
|
||||
if [[ -n "${FOUND_GTK3_DEV}" ]]
|
||||
then
|
||||
BUILD_ARGS="${BUILD_ARGS} -DSLIC3R_GTK=3"
|
||||
fi
|
||||
if [[ -n "${BUILD_DEBUG}" ]]
|
||||
then
|
||||
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug -DBBL_INTERNAL_TESTING=1"
|
||||
else
|
||||
BUILD_ARGS="${BUILD_ARGS} -DBBL_RELEASE_TO_PUBLIC=1 -DBBL_INTERNAL_TESTING=0"
|
||||
fi
|
||||
echo -e "cmake -S . -B build -G Ninja -DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" -DSLIC3R_STATIC=1 -DORCA_TOOLS=ON ${BUILD_ARGS}"
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_PREFIX_PATH="${PWD}/deps/build/destdir/usr/local" \
|
||||
-DSLIC3R_STATIC=1 \
|
||||
-DORCA_TOOLS=ON \
|
||||
${BUILD_ARGS}
|
||||
echo "done"
|
||||
echo "Building OrcaSlicer ..."
|
||||
cmake --build build --target OrcaSlicer
|
||||
echo "Building OrcaSlicer_profile_validator .."
|
||||
cmake --build build --target OrcaSlicer_profile_validator
|
||||
./run_gettext.sh
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
if [[ -e ${ROOT}/build/src/BuildLinuxImage.sh ]]; then
|
||||
# Give proper permissions to script
|
||||
chmod 755 ${ROOT}/build/src/BuildLinuxImage.sh
|
||||
|
||||
echo "[9/9] Generating Linux app..."
|
||||
pushd build
|
||||
if [[ -n "${BUILD_IMAGE}" ]]
|
||||
then
|
||||
${ROOT}/build/src/BuildLinuxImage.sh -i
|
||||
else
|
||||
${ROOT}/build/src/BuildLinuxImage.sh
|
||||
fi
|
||||
popd
|
||||
echo "done"
|
||||
fi
|
|
@ -108,6 +108,15 @@ set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux")
|
|||
|
||||
set(IS_CROSS_COMPILE FALSE)
|
||||
|
||||
option (COLORED_OUTPUT "Always produce ANSI-colored output (GNU/Clang only)." OFF)
|
||||
if (${COLORED_OUTPUT})
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
add_compile_options (-fdiagnostics-color=always)
|
||||
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
|
||||
add_compile_options (-fcolor-diagnostics)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
if (APPLE)
|
||||
set(CMAKE_FIND_FRAMEWORK LAST)
|
||||
set(CMAKE_FIND_APPBUNDLE LAST)
|
||||
|
@ -806,7 +815,7 @@ endif()
|
|||
|
||||
if (NOT WIN32 AND NOT APPLE)
|
||||
set(SLIC3R_APP_CMD "orca-slicer")
|
||||
configure_file(${LIBDIR}/platform/unix/build_appimage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh @ONLY)
|
||||
configure_file(${LIBDIR}/platform/unix/build_appimage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_appimage.sh USE_SOURCE_PERMISSIONS @ONLY)
|
||||
endif()
|
||||
|
||||
option(BUILD_BBS_TEST_TOOLS "Build bbs test tools" OFF)
|
||||
|
|
|
@ -65,17 +65,17 @@ WORKDIR OrcaSlicer
|
|||
|
||||
# These can run together, but we run them seperate for podman caching
|
||||
# Update System dependencies
|
||||
RUN ./BuildLinux.sh -u
|
||||
RUN ./build_linux.sh -u
|
||||
|
||||
# Build dependencies in ./deps
|
||||
RUN ./BuildLinux.sh -dr
|
||||
RUN ./build_linux.sh -dr
|
||||
|
||||
# Build slic3r
|
||||
RUN ./BuildLinux.sh -sr
|
||||
RUN ./build_linux.sh -sr
|
||||
|
||||
# Build AppImage
|
||||
ENV container podman
|
||||
RUN ./BuildLinux.sh -ir
|
||||
RUN ./build_linux.sh -ir
|
||||
|
||||
# It's easier to run Orca Slicer as the same username,
|
||||
# UID and GID as your workstation. Since we bind mount
|
||||
|
|
|
@ -183,4 +183,3 @@ The GNU Affero General Public License, version 3 ensures that if you use any par
|
|||
Orca Slicer includes a pressure advance calibration pattern test adapted from Andrew Ellis' generator, which is licensed under GNU General Public License, version 3. Ellis' generator is itself adapted from a generator developed by Sineos for Marlin, which is licensed under GNU General Public License, version 3.
|
||||
|
||||
The Bambu networking plugin is based on non-free libraries from BambuLab. It is optional to the Orca Slicer and provides extended functionalities for Bambulab printer users.
|
||||
|
||||
|
|
217
build_linux.sh
Executable file
217
build_linux.sh
Executable file
|
@ -0,0 +1,217 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SCRIPT_NAME=$(basename "$0")
|
||||
SCRIPT_PATH=$(dirname $(readlink -f ${0}))
|
||||
|
||||
pushd ${SCRIPT_PATH} > /dev/null
|
||||
|
||||
set -e # Exit immediately if a command exits with a non-zero status.
|
||||
|
||||
function check_available_memory_and_disk() {
|
||||
FREE_MEM_GB=$(free --gibi --total | grep 'Mem' | rev | cut --delimiter=" " --fields=1 | rev)
|
||||
MIN_MEM_GB=10
|
||||
|
||||
FREE_DISK_KB=$(df --block-size=1K . | tail -1 | awk '{print $4}')
|
||||
MIN_DISK_KB=$((10 * 1024 * 1024))
|
||||
|
||||
if [[ ${FREE_MEM_GB} -le ${MIN_MEM_GB} ]] ; then
|
||||
echo -e "\nERROR: Orca Slicer Builder requires at least ${MIN_MEM_GB}G of 'available' mem (system has only ${FREE_MEM_GB}G available)"
|
||||
echo && free --human && echo
|
||||
echo "Invoke with -r to skip RAM and disk checks."
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ ${FREE_DISK_KB} -le ${MIN_DISK_KB} ]] ; then
|
||||
echo -e "\nERROR: Orca Slicer Builder requires at least $(echo ${MIN_DISK_KB} |awk '{ printf "%.1fG\n", $1/1024/1024; }') (system has only $(echo ${FREE_DISK_KB} | awk '{ printf "%.1fG\n", $1/1024/1024; }') disk free)"
|
||||
echo && df --human-readable . && echo
|
||||
echo "Invoke with -r to skip ram and disk checks."
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
function usage() {
|
||||
echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-h][-i][-j N][-p][-r][-s][-u]"
|
||||
echo " -1: limit builds to one core (where possible)"
|
||||
echo " -j N: limit builds to N cores (where possible)"
|
||||
echo " -b: build in debug mode"
|
||||
echo " -c: force a clean build"
|
||||
echo " -C: enable ANSI-colored compile output (GNU/Clang only)"
|
||||
echo " -d: download and build dependencies in ./deps/ (build prerequisite)"
|
||||
echo " -h: prints this help text"
|
||||
echo " -i: build the Orca Slicer AppImage (optional)"
|
||||
echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)"
|
||||
echo " -r: skip RAM and disk checks (low RAM compiling)"
|
||||
echo " -s: build the Orca Slicer (optional)"
|
||||
echo " -u: install system dependencies (asks for sudo password; build prerequisite)"
|
||||
echo "For a first use, you want to './${SCRIPT_NAME} -u'"
|
||||
echo " and then './${SCRIPT_NAME} -dsi'"
|
||||
}
|
||||
|
||||
SLIC3R_PRECOMPILED_HEADERS="ON"
|
||||
|
||||
unset name
|
||||
while getopts ":1j:bcCdhiprsu" opt ; do
|
||||
case ${opt} in
|
||||
1 )
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=1
|
||||
;;
|
||||
j )
|
||||
export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG
|
||||
;;
|
||||
b )
|
||||
BUILD_DEBUG="1"
|
||||
;;
|
||||
c )
|
||||
CLEAN_BUILD=1
|
||||
;;
|
||||
C )
|
||||
COLORED_OUTPUT="-DCOLORED_OUTPUT=ON"
|
||||
;;
|
||||
d )
|
||||
BUILD_DEPS="1"
|
||||
;;
|
||||
h ) usage
|
||||
exit 0
|
||||
;;
|
||||
i )
|
||||
BUILD_IMAGE="1"
|
||||
;;
|
||||
p )
|
||||
SLIC3R_PRECOMPILED_HEADERS="OFF"
|
||||
;;
|
||||
r )
|
||||
SKIP_RAM_CHECK="1"
|
||||
;;
|
||||
s )
|
||||
BUILD_ORCA="1"
|
||||
;;
|
||||
u )
|
||||
UPDATE_LIB="1"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ${OPTIND} -eq 1 ] ; then
|
||||
usage
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# cmake 4.x compatibility workaround
|
||||
export CMAKE_POLICY_VERSION_MINIMUM=3.5
|
||||
|
||||
DISTRIBUTION=$(awk -F= '/^ID=/ {print $2}' /etc/os-release | tr -d '"')
|
||||
DISTRIBUTION_LIKE=$(awk -F= '/^ID_LIKE=/ {print $2}' /etc/os-release | tr -d '"')
|
||||
# Check for direct distribution match to Ubuntu/Debian
|
||||
if [ "${DISTRIBUTION}" == "ubuntu" ] || [ "${DISTRIBUTION}" == "linuxmint" ] ; then
|
||||
DISTRIBUTION="debian"
|
||||
# Check if distribution is Debian/Ubuntu-like based on ID_LIKE
|
||||
elif [[ "${DISTRIBUTION_LIKE}" == *"debian"* ]] || [[ "${DISTRIBUTION_LIKE}" == *"ubuntu"* ]] ; then
|
||||
DISTRIBUTION="debian"
|
||||
elif [[ "${DISTRIBUTION_LIKE}" == *"arch"* ]] ; then
|
||||
DISTRIBUTION="arch"
|
||||
fi
|
||||
|
||||
if [ ! -f ./linux.d/${DISTRIBUTION} ] ; then
|
||||
echo "Your distribution \"${DISTRIBUTION}\" is not supported by system-dependency scripts in ./linux.d/"
|
||||
echo "Please resolve dependencies manually and contribute a script for your distribution to upstream."
|
||||
exit 1
|
||||
else
|
||||
echo "resolving system dependencies for distribution \"${DISTRIBUTION}\" ..."
|
||||
source ./linux.d/${DISTRIBUTION}
|
||||
fi
|
||||
|
||||
echo "FOUND_GTK3=${FOUND_GTK3}"
|
||||
if [[ -z "${FOUND_GTK3_DEV}" ]] ; then
|
||||
echo "Error, you must install the dependencies before."
|
||||
echo "Use option -u with sudo"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Changing date in version..."
|
||||
{
|
||||
# change date in version
|
||||
sed --in-place "s/+UNKNOWN/_$(date '+%F')/" version.inc
|
||||
}
|
||||
echo "done"
|
||||
|
||||
|
||||
if ! [[ -n "${SKIP_RAM_CHECK}" ]] ; then
|
||||
check_available_memory_and_disk
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILD_DEPS}" ]] ; then
|
||||
echo "Configuring dependencies..."
|
||||
BUILD_ARGS="${DEPS_EXTRA_BUILD_ARGS} -DDEP_WX_GTK3=ON"
|
||||
if [[ -n "${CLEAN_BUILD}" ]]
|
||||
then
|
||||
rm -fr deps/build
|
||||
fi
|
||||
if [ ! -d "deps/build" ]
|
||||
then
|
||||
mkdir deps/build
|
||||
fi
|
||||
if [[ -n "${BUILD_DEBUG}" ]] ; then
|
||||
# build deps with debug and release else cmake will not find required sources
|
||||
if [ ! -d "deps/build/release" ] ; then
|
||||
mkdir deps/build/release
|
||||
fi
|
||||
cmake -S deps -B deps/build/release -DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} -G Ninja -DDESTDIR="${SCRIPT_PATH}/deps/build/destdir" -DDEP_DOWNLOAD_DIR="${SCRIPT_PATH}/deps/DL_CACHE" ${COLORED_OUTPUT} ${BUILD_ARGS}
|
||||
cmake --build deps/build/release
|
||||
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug"
|
||||
fi
|
||||
|
||||
echo "cmake -S deps -B deps/build -G Ninja ${BUILD_ARGS}"
|
||||
cmake -S deps -B deps/build -G Ninja ${COLORED_OUTPUT} ${BUILD_ARGS}
|
||||
cmake --build deps/build
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILD_ORCA}" ]] ; then
|
||||
echo "Configuring OrcaSlicer..."
|
||||
if [[ -n "${CLEAN_BUILD}" ]] ; then
|
||||
rm --force --recursive build
|
||||
fi
|
||||
BUILD_ARGS="${ORCA_EXTRA_BUILD_ARGS}"
|
||||
if [[ -n "${FOUND_GTK3_DEV}" ]] ; then
|
||||
BUILD_ARGS="${BUILD_ARGS} -DSLIC3R_GTK=3"
|
||||
fi
|
||||
if [[ -n "${BUILD_DEBUG}" ]] ; then
|
||||
BUILD_ARGS="${BUILD_ARGS} -DCMAKE_BUILD_TYPE=Debug -DBBL_INTERNAL_TESTING=1"
|
||||
else
|
||||
BUILD_ARGS="${BUILD_ARGS} -DBBL_RELEASE_TO_PUBLIC=1 -DBBL_INTERNAL_TESTING=0"
|
||||
fi
|
||||
|
||||
CMAKE_CMD="cmake -S . -B build -G Ninja \
|
||||
-DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} \
|
||||
-DCMAKE_PREFIX_PATH="${SCRIPT_PATH}/deps/build/destdir/usr/local" \
|
||||
-DSLIC3R_STATIC=1 \
|
||||
-DORCA_TOOLS=ON \
|
||||
${COLORED_OUTPUT} \
|
||||
${BUILD_ARGS}"
|
||||
echo -e "${CMAKE_CMD}"
|
||||
${CMAKE_CMD}
|
||||
echo "done"
|
||||
echo "Building OrcaSlicer ..."
|
||||
cmake --build build --target OrcaSlicer
|
||||
echo "Building OrcaSlicer_profile_validator .."
|
||||
cmake --build build --target OrcaSlicer_profile_validator
|
||||
./run_gettext.sh
|
||||
echo "done"
|
||||
fi
|
||||
|
||||
if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then
|
||||
pushd build > /dev/null
|
||||
echo "[9/9] Generating Linux app..."
|
||||
build_linux_image="./src/build_linux_image.sh"
|
||||
if [[ -e ${build_linux_image} ]] ; then
|
||||
extra_script_args=""
|
||||
if [[ -n "${BUILD_IMAGE}" ]] ; then
|
||||
extra_script_args="-i"
|
||||
fi
|
||||
${build_linux_image} ${extra_script_args}
|
||||
|
||||
echo "done"
|
||||
fi
|
||||
popd > /dev/null # build
|
||||
fi
|
||||
|
||||
popd > /dev/null # ${SCRIPT_PATH}
|
|
@ -188,6 +188,6 @@ All required dependencies will be installed automatically by the provided shell
|
|||
### Instructions
|
||||
|
||||
```shell
|
||||
sudo ./BuildLinux.sh -u # Install dependencies
|
||||
./BuildLinux.sh -dsi # Build OrcaSlicer
|
||||
`./build_linux.sh -u` # install dependencies
|
||||
`./build_linux.sh -disr` # build OrcaSlicer
|
||||
```
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
Files in this directory are named for the **exact** output of `awk -F= '/^ID=/ {print $2}' /etc/os-release` for their respective distribution.
|
||||
|
||||
When `BuildLinux.sh` is executed, the respective file for the distribution will be sourced so the distribution specific instructions/logic are used.
|
||||
When `build_linux.sh` is executed, the respective file for the distribution will be sourced so the distribution specific instructions/logic are used.
|
||||
|
|
|
@ -44,7 +44,7 @@ then
|
|||
fi
|
||||
|
||||
# check which version of libwebkit2gtk is available
|
||||
if [ "$(apt show --quiet libwebkit2gtk-4.0-dev)" != "" ]
|
||||
if [ "$(apt show --quiet libwebkit2gtk-4.0-dev 2>/dev/null)" != "" ]
|
||||
then
|
||||
REQUIRED_DEV_PACKAGES+=(libwebkit2gtk-4.0-dev)
|
||||
else
|
||||
|
|
|
@ -123,7 +123,7 @@ if (NOT WIN32 AND NOT APPLE)
|
|||
# Binary name on unix like systems (Linux, Unix)
|
||||
set_target_properties(OrcaSlicer PROPERTIES OUTPUT_NAME "orca-slicer")
|
||||
set(SLIC3R_APP_CMD "orca-slicer")
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/BuildLinuxImage.sh.in ${CMAKE_CURRENT_BINARY_DIR}/BuildLinuxImage.sh @ONLY)
|
||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/platform/unix/build_linux_image.sh.in ${CMAKE_CURRENT_BINARY_DIR}/build_linux_image.sh USE_SOURCE_PERMISSIONS @ONLY)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(OrcaSlicer libslic3r cereal::cereal)
|
||||
|
|
12
src/platform/unix/BuildLinuxImage.sh.in → src/platform/unix/build_linux_image.sh.in
Normal file → Executable file
12
src/platform/unix/BuildLinuxImage.sh.in → src/platform/unix/build_linux_image.sh.in
Normal file → Executable file
|
@ -1,4 +1,4 @@
|
|||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
export ROOT=$(echo $ROOT | grep . || pwd)
|
||||
export NCORES=`nproc --all`
|
||||
|
@ -8,7 +8,7 @@ while getopts ":ih" opt; do
|
|||
i )
|
||||
export BUILD_IMAGE="1"
|
||||
;;
|
||||
h ) echo "Usage: ./BuildLinuxImage.sh [-i]"
|
||||
h ) echo "Usage: ./build_linux_image.sh [-i]"
|
||||
echo " -i: Generate Appimage (optional)"
|
||||
exit 0
|
||||
;;
|
||||
|
@ -67,9 +67,9 @@ EOF
|
|||
|
||||
chmod ug+x @SLIC3R_APP_CMD@
|
||||
cp -f @SLIC3R_APP_CMD@ package/@SLIC3R_APP_CMD@
|
||||
pushd package
|
||||
pushd package > /dev/null
|
||||
tar -cvf ../@SLIC3R_APP_KEY@.tar . &>/dev/null
|
||||
popd
|
||||
popd > /dev/null
|
||||
#} &> $ROOT/Build.log # Capture all command output
|
||||
echo "done"
|
||||
|
||||
|
@ -77,10 +77,10 @@ if [[ -n "$BUILD_IMAGE" ]]
|
|||
then
|
||||
echo -n "Creating Appimage for distribution..."
|
||||
#{
|
||||
pushd package
|
||||
pushd package > /dev/null
|
||||
chmod +x ../build_appimage.sh
|
||||
../build_appimage.sh
|
||||
popd
|
||||
popd > /dev/null
|
||||
mv package/"@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage" "@SLIC3R_APP_KEY@_Linux_V@SoftFever_VERSION@.AppImage"
|
||||
#} &> $ROOT/Build.log # Capture all command output
|
||||
echo "done"
|
Loading…
Add table
Add a link
Reference in a new issue