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

CMake and Build System Overhaul #5045

Open
wants to merge 105 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
105 commits
Select commit Hold shift + click to select a range
29e962b
CMake Presets for Slicer
Ocraftyone Apr 3, 2024
f68f060
Organize Main CMakeLists.txt
Ocraftyone Apr 4, 2024
d68e0d4
Organize Main CMakeLists.txt More
Ocraftyone Apr 4, 2024
cbeed6d
Create Compiler Flags in CMake
Ocraftyone Apr 4, 2024
4488ff8
undo move of prefix_path_check
Ocraftyone Apr 4, 2024
f151d6f
Automatic CMAKE_PREFIX_PATH generation
Ocraftyone Apr 5, 2024
bfea86a
Automatically set CMAKE_INSTALL_RPATH on macOS
Ocraftyone Apr 6, 2024
9e55359
Add Deps Build via main CMake
Ocraftyone Apr 7, 2024
c0864f7
Don't show compile commands on OpenSSL build
Ocraftyone Apr 7, 2024
990df62
Fix linux deps builds via CMake BUILD_DEPS
Ocraftyone Apr 8, 2024
d6fca81
remove redundant arg
Ocraftyone Apr 9, 2024
0e0ad8b
Update devcontainer.json
Ocraftyone Apr 9, 2024
8e16b40
Add linux definition for old CMake compatability
Ocraftyone Apr 10, 2024
090ec87
Update messages to specify STATUS
Ocraftyone Apr 10, 2024
8bf3928
Update .gitignore
Ocraftyone Apr 10, 2024
b13306c
Remove GTK2 Support
Ocraftyone Apr 10, 2024
ec6be42
Use LINUX def in src CMake dirs
Ocraftyone Apr 10, 2024
81ef367
Default deps to gtk3
Ocraftyone Apr 10, 2024
2b51749
Merge remote-tracking branch 'refs/remotes/SoftFever/main' into enh-b…
Ocraftyone Apr 14, 2024
53e9ad1
add LINUX definition to deps cmake
Ocraftyone Apr 14, 2024
ea723cc
Improve Linux Debug Build
Ocraftyone Apr 15, 2024
56535b6
Add Linux Debug Preset
Ocraftyone Apr 15, 2024
2215652
Move BBL_RELEASE_TO_PUBLIC to autobuild script
Ocraftyone Apr 15, 2024
7f64a25
Update BuildLinuxImage.sh.in for better readability
Ocraftyone Apr 15, 2024
0483564
Convert BuildLinux.sh to use CMake deps build
Ocraftyone Apr 15, 2024
72f06aa
Suppress CMake depreciation warnings
Ocraftyone Apr 16, 2024
bd70606
Improve dependency auto-build system
Ocraftyone Apr 16, 2024
8a345fb
Remove comment
Ocraftyone Apr 16, 2024
14173dc
Add FORCE_DEPS
Ocraftyone Apr 16, 2024
e68a06d
Fix -f option in BuildLinux.sh
Ocraftyone Apr 16, 2024
a6b44a9
Fix silent OpenSSL output on Linux
Ocraftyone Apr 16, 2024
dca97e6
Silence Compile output for GMP and MPFR
Ocraftyone Apr 16, 2024
324e92f
Re-enable patch test for wxWidgets
Ocraftyone Apr 16, 2024
eba08ed
Print CMake version during configuration
Ocraftyone Apr 16, 2024
a3dd217
Update GH Actions to refer to new Linux Destdir
Ocraftyone Apr 16, 2024
9cf7ba6
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Apr 16, 2024
0fb609c
Fix other parts of GH Actions
Ocraftyone Apr 16, 2024
468538f
Fix BuildLinux.sh Error
Ocraftyone Apr 17, 2024
aa04d16
Merge remote-tracking branch 'refs/remotes/SoftFever/main' into enh-b…
Ocraftyone Jul 1, 2024
e490027
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Jul 2, 2024
6984ec6
Fix CGAL_DATA_DIR CMake warning
Ocraftyone Jul 2, 2024
c0b66f2
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Jul 13, 2024
347a915
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Jul 13, 2024
231bf17
Merge branch 'main' into enh-build-system-improvments
SoftFever Jul 16, 2024
75a9b18
Merge branch 'main' into enh-build-system-improvments
SoftFever Jul 23, 2024
5c9f44a
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Jul 29, 2024
a0c6fc4
Merge remote-tracking branch 'upstream/main' into enh-build-system-im…
Ocraftyone Sep 10, 2024
03153d2
Disable printing "Installing" or "Up-to-date" when running the instal…
Ocraftyone Sep 11, 2024
15caa83
Always set DEP_DESTDIR based off the CMAKE_PREFIX_PATH unless explici…
Ocraftyone Sep 11, 2024
d1da72d
Rework legacy destdir code
Ocraftyone Sep 12, 2024
543e0d6
Revert Qhull changes
Ocraftyone Sep 12, 2024
2eadc21
Update SLIC3R_STATIC default
Ocraftyone Sep 12, 2024
182288e
Improve getting the Win10SDK path in CMake
Ocraftyone Sep 12, 2024
5d29761
Remove redundant Netfabb messages
Ocraftyone Sep 12, 2024
e57d5ab
Add minimum cmake version to CMakePresets
Ocraftyone Sep 12, 2024
4a3c690
Fix CMake warning
Ocraftyone Sep 12, 2024
af118e4
Revert all BuildLinux.sh changes
Ocraftyone Sep 12, 2024
8f62cfc
Move BBL_RELEASE_TO_PUBLIC and BBL_INTERNAL_TESTING to main CMake file
Ocraftyone Sep 12, 2024
2115869
Automatically set BBL_RELEASE_TO_PUBLIC and BBL_INTERNAL_TESTING base…
Ocraftyone Sep 12, 2024
8205a91
Indicate language in linux modules
Ocraftyone Sep 12, 2024
b470499
Update Linux Buildscript
Ocraftyone Sep 13, 2024
8511d9d
Only print DEP_DEBUG on multi config generators
Ocraftyone Sep 13, 2024
14f93ae
Log BUILD_DEPS_QUIET
Ocraftyone Sep 13, 2024
122656e
Update autobuild.cmake
Ocraftyone Sep 13, 2024
1cc239b
Automatically generate DESTDIR for deps CMake
Ocraftyone Sep 13, 2024
14ed103
Set DEP_DOWNLOAD_DIR based on source directory
Ocraftyone Sep 13, 2024
a8e2617
Explicitly set policy CMP0135 to suppress warnings during configuration
Ocraftyone Sep 13, 2024
b923403
Update minimum CMake version for deps
Ocraftyone Sep 13, 2024
7b411af
Update auto generation of DESTDIR/CMAKE_PREFIX_PATH
Ocraftyone Sep 16, 2024
5429433
Regenerate CMAKE_PREFIX_PATH if DEP_BUILD_DIR is updated
Ocraftyone Sep 16, 2024
1dfde21
Make is so regeneration works on platforms other than Linux
Ocraftyone Sep 16, 2024
919240d
Fix WIN10SDK_INCLUDE_PATH generation
Ocraftyone Sep 16, 2024
70937fb
Refactor TIFF.cmake
Ocraftyone Sep 18, 2024
325a3a4
Refactor OpenEXR.cmake
Ocraftyone Sep 18, 2024
5017522
Update windows build scripts
Ocraftyone Sep 18, 2024
8f77d1c
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Sep 18, 2024
c88f652
Fix windows buildscript
Ocraftyone Sep 18, 2024
3de535f
ACTUALLY fix windows buildscript
Ocraftyone Sep 18, 2024
5e583a2
Fix build dir on macos
Ocraftyone Sep 18, 2024
dcc7a42
but really, fixing windows buildscript
Ocraftyone Sep 18, 2024
eb157ba
Add "killbuild" option to windows buildscript
Ocraftyone Sep 19, 2024
3e2e648
Set OPENSSL_ARCH automatically based on CMAKE_OSX_ARCHITECTURE
Ocraftyone Sep 19, 2024
054e20a
Update build_release_macos.sh
Ocraftyone Sep 19, 2024
a6b687d
Set CMAKE_INSTALL_PREFIX automatically
Ocraftyone Sep 19, 2024
4613cc8
Add packing deps to BuildLinux.sh
Ocraftyone Sep 19, 2024
7c01508
Remove unnecessary mkdirs
Ocraftyone Sep 19, 2024
9a58d6e
Update build_release_vs2022.bat
Ocraftyone Sep 19, 2024
5027a0e
Fix build_release_macos.sh
Ocraftyone Sep 19, 2024
10cb8a1
Update build_release_vs2022.bat
Ocraftyone Sep 19, 2024
90a76b4
Fix build_release_macos.sh
Ocraftyone Sep 20, 2024
ebb2ea5
Indicate when automatically setting CMAKE_INSTALL_PREFIX
Ocraftyone Sep 20, 2024
4105d73
Suppress CMake policy CMP0167 (FindBoost deprecated)
Ocraftyone Sep 20, 2024
d13c8e2
Remove auto setting BBL_INTERNAL_TESTING
Ocraftyone Sep 20, 2024
da24e0e
Always set CMAKE_BUILD_TYPE if not set
Ocraftyone Sep 20, 2024
5951a76
Update autobuild.cmake
Ocraftyone Sep 20, 2024
46b786a
Invert Apple crosscompile check to make it more readable
Ocraftyone Sep 20, 2024
fef212f
Rework flatpak space freeing mechanic
Ocraftyone Sep 20, 2024
046a7c3
Give credit to stackoverflow answer
Ocraftyone Sep 20, 2024
b71e21e
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Sep 20, 2024
0732e26
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Sep 21, 2024
569de06
Remove CMAKE_INSTALL_PATH from cmake preset
Ocraftyone Sep 21, 2024
a9e1e31
Print CMake Generator
Ocraftyone Sep 21, 2024
124a74f
Fix usr/local not being added when manually specifying destdir
Ocraftyone Sep 21, 2024
1e61ea7
Update deps/CMakeLists.txt
Ocraftyone Sep 21, 2024
d8af203
Merge branch 'main' into enh-build-system-improvments
Ocraftyone Sep 22, 2024
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
13 changes: 1 addition & 12 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"name": "OrcaSlicer",
"image": "mcr.microsoft.com/devcontainers/cpp:ubuntu-20.04",
"runArgs": ["--env-file", "/tmp/devcontainer.env"],
"features": {
"ghcr.io/devcontainers/features/desktop-lite:1": {
"password": "orca"
Expand All @@ -11,14 +10,7 @@
"vscode": {
"settings": {
"cmake.configureArgs": [
"-DSLIC3R_GTK=3",
"-DBBL_RELEASE_TO_PUBLIC=1",
"-DBBL_INTERNAL_TESTING=0",
"-DSLIC3R_STATIC=1",
"-DCMAKE_PREFIX_PATH=${workspaceFolder}/deps/build/destdir/usr/local"
],
"cmake.buildToolArgs": [
"-l${containerEnv:CORES}"
"-DBUILD_DEPS=ON"
]
},

Expand All @@ -41,9 +33,6 @@
"onAutoForward": "ignore"
},

"initializeCommand": {
"Setup Temporary Env File": "echo \"CORES=`nproc --all`\" > /tmp/devcontainer.env"
},
"onCreateCommand": {
"Set postCreate executable flag": "chmod +x .devcontainer/postCreate.sh"
},
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/build_check_cache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,10 @@ jobs:
env:
underscore-arch: ${{ inputs.os == 'macos-14' && '_' || ''}}${{ inputs.os == 'macos-14' && inputs.arch || '' }} # if is macos, make a string that does "_{arch}", else output nothing
dash-arch: ${{ inputs.os == 'macos-14' && '-' || ''}}${{ inputs.os == 'macos-14' && inputs.arch || '' }} # if is macos, make a string that does "-{arch}", else output nothing
dep-folder-name: ${{ (inputs.os == 'windows-latest' || inputs.os == 'macos-14') && 'OrcaSlicer_dep' || 'destdir' }}
output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
run: |
echo cache-key=${{ inputs.os }}${{ env.dash-arch }}-cache-orcaslicer_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }}
echo cache-path=${{ github.workspace }}/deps/build${{ env.underscore-arch }}/${{ env.dep-folder-name }}${{ env.underscore-arch }} >> ${{ env.output-cmd }}
echo cache-path=${{ github.workspace }}/deps/build${{ env.underscore-arch }}/OrcaSlicer_dep${{ env.underscore-arch }} >> ${{ env.output-cmd }}

- name: load cache
id: cache_deps
Expand Down
12 changes: 1 addition & 11 deletions .github/workflows/build_deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,15 @@ jobs:
working-directory: ${{ github.workspace }}
run: |
choco install strawberryperl
mkdir ${{ github.workspace }}/deps/build
mkdir ${{ github.workspace }}/deps/build/OrcaSlicer_dep
.\build_release_vs2022.bat deps
.\build_release_vs2022.bat pack
cd ${{ github.workspace }}/deps/build

- name: Build on Mac ${{ inputs.arch }}
if: inputs.os == 'macos-14'
working-directory: ${{ github.workspace }}
run: |
brew install automake texinfo ninja libtool
brew list
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}
mkdir -p ${{ github.workspace }}/deps/build_${{ inputs.arch }}/OrcaSlicer_dep_${{ inputs.arch }}
brew uninstall --ignore-dependencies zstd
./build_release_macos.sh -dpx -a ${{ inputs.arch }} -t 10.15 -1
brew install zstd
Expand All @@ -103,14 +98,9 @@ jobs:
if: inputs.os == 'ubuntu-20.04' || inputs.os == 'ubuntu-24.04'
working-directory: ${{ github.workspace }}
run: |
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 OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz destdir

./BuildLinux.sh -drp

# Upload Artifacts
- name: Upload Mac ${{ inputs.arch }} artifacts
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/build_orca.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,6 @@ jobs:
run: |
brew install tree ninja libtool
brew list
mkdir -p ${{ github.workspace }}/deps/build_${{inputs.arch}}
mkdir -p ${{ github.workspace }}/deps/build_${{inputs.arch}}/OrcaSlicer_dep_${{inputs.arch}}
tree ${{ github.workspace }}/deps/build_${{inputs.arch}}/OrcaSlicer_dep_${{inputs.arch}}

- name: Build slicer mac
Expand Down
10 changes: 3 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Build
Build.bat
/build*/
deps/build*
/deps/build*/
MYMETA.json
MYMETA.yml
_build
Expand All @@ -13,15 +13,12 @@ MANIFEST.bak
xs/MANIFEST.bak
xs/assertlib*
.init_bundle.ini
.vs/*
.vs/
local-lib
/src/TAGS
/.vscode/
build-linux/*
deps/build*/*
**/.DS_Store
install_*
build_*/
SVG
src/OrcaSlicer-doc/
.idea/
Expand All @@ -30,8 +27,7 @@ src/OrcaSlicer-doc/
**/process_full/
**/machine_full/
**/filament_full/
/deps/DL_CACHE/
/deps/DL_CACHE
DL_CACHE
**/.flatpak-builder/
resources/profiles/user/default
*.code-workspace
109 changes: 52 additions & 57 deletions BuildLinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,47 +27,62 @@ function check_available_memory_and_disk() {
function usage() {
echo "Usage: ./BuildLinux.sh [-1][-b][-c][-d][-i][-r][-s][-u]"
echo " -1: limit builds to 1 core (where possible)"
echo " -b: build in debug mode"
echo " -b: build in Debug mode"
echo " -B: build in RelWithDebInfo mode"
echo " -c: force a clean build"
echo " -d: build deps (optional)"
echo " -h: this help output"
echo " -i: Generate appimage (optional)"
echo " -p: Pack dependencies (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'"
}

BUILD_DIR="build"
BUILD_TYPE="Release"
unset name
while getopts ":1bcdghirsu" opt; do
while getopts ":1bBcdhiprsu" opt; do
case ${opt} in
1 )
export CMAKE_BUILD_PARALLEL_LEVEL=1
;;
b )
BUILD_DEBUG="1"
BUILD_DIR="build-debug"
BUILD_TYPE="Debug"
;;
B )
BUILD_DIR="build-debinfo"
BUILD_TYPE="RelWithDebInfo"
;;
c )
CLEAN_BUILD=1
CLEAN_BUILD="1"
;;
d )
BUILD_DEPS="1"
;;
h ) usage
h )
usage
exit 0
;;
i )
BUILD_IMAGE="1"
;;
p )
PACK_DEPS="1"
;;
r )
SKIP_RAM_CHECK="1"
;;
;;
s )
BUILD_ORCA="1"
;;
u )
UPDATE_LIB="1"
export UPDATE_LIB="1"
;;
* )
;;
esac
done
Expand Down Expand Up @@ -104,7 +119,6 @@ echo "Changing date in version..."
# change date in version
sed -i "s/+UNKNOWN/_$(date '+%F')/" version.inc
}
echo "done"


if ! [[ -n "${SKIP_RAM_CHECK}" ]]
Expand All @@ -115,30 +129,14 @@ fi
if [[ -n "${BUILD_DEPS}" ]]
then
echo "Configuring dependencies..."
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"
rm -fr deps/${BUILD_DIR}
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
echo "cmake -S deps -B deps/${BUILD_DIR} -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
cmake -S deps -B deps/${BUILD_DIR} -G Ninja -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
cmake --build deps/${BUILD_DIR}
fi


Expand All @@ -147,46 +145,43 @@ then
echo "Configuring OrcaSlicer..."
if [[ -n "${CLEAN_BUILD}" ]]
then
rm -fr build
fi
BUILD_ARGS=""
if [[ -n "${FOUND_GTK3_DEV}" ]]
then
BUILD_ARGS="-DSLIC3R_GTK=3"
rm -fr ${BUILD_DIR}
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 ${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 -e "cmake -S . -B ${BUILD_DIR} -G Ninja -DORCA_TOOLS=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE}"
cmake -S . -B ${BUILD_DIR} -G Ninja -DORCA_TOOLS=ON -DCMAKE_BUILD_TYPE=${BUILD_TYPE}

echo "Building OrcaSlicer ..."
cmake --build build --target OrcaSlicer
cmake --build ${BUILD_DIR} --target OrcaSlicer

echo "Building OrcaSlicer_profile_validator .."
cmake --build build --target OrcaSlicer_profile_validator
cmake --build ${BUILD_DIR} --target OrcaSlicer_profile_validator

./run_gettext.sh
echo "done"
fi

if [[ -e ${ROOT}/build/src/BuildLinuxImage.sh ]]; then
if [[ -n "${PACK_DEPS}" ]]
then
echo "Packing dependencies..."
if [ -d "deps/${BUILD_DIR}/OrcaSlicer_dep" ]; then
cd deps/${BUILD_DIR}
tar -czvf OrcaSlicer_dep_ubuntu_$(date +"%Y%m%d").tar.gz OrcaSlicer_dep
else
echo "The deps destination directory does not exist"
echo "Targeted destination directory: $(pwd)/deps/${BUILD_DIR}/OrcaSlicer_dep"
fi
fi

if [[ -e ${ROOT}/${BUILD_DIR}/src/BuildLinuxImage.sh ]]; then
# Give proper permissions to script
chmod 755 ${ROOT}/build/src/BuildLinuxImage.sh
chmod 755 ${ROOT}/${BUILD_DIR}/src/BuildLinuxImage.sh

echo "[9/9] Generating Linux app..."
pushd build
echo "Generating Linux app..."
pushd ${BUILD_DIR}
if [[ -n "${BUILD_IMAGE}" ]]
then
${ROOT}/build/src/BuildLinuxImage.sh -i
${ROOT}/${BUILD_DIR}/src/BuildLinuxImage.sh -i
else
${ROOT}/build/src/BuildLinuxImage.sh
${ROOT}/${BUILD_DIR}/src/BuildLinuxImage.sh
fi
popd
echo "done"
fi
Loading
Loading