Better CMake Defaults (#10294)

* Auto generate CMAKE_PREFIX_PATH/DESTDIR

* Auto set CMAKE_INSTALL_PREFIX

* Always default SLIC3R_STATIC to on

* Only allow one value for CMAKE_OSX_ARCHITECTURES

* Set arch for OpenSSL from CMAKE_OSX_ARCHITECTURES

* Set CMAKE_INSTALL_RPATH from CMAKE_PREFIX_PATH

* Default CMAKE_MACOSX_RPATH and CMAKE_MACOSX_BUNDLE to on

* Auto set BBL_RELEASE_TO_PUBLIC based on build config

* Default to GTK 3

* Fix linux debug build

Update find modules to also look for the debug variant of the libraries

* Set DEP_DEBUG and ORCA_INCLUDE_DEBUG_INFO based on CMAKE_BUILD_TYPE

* Add a fallback value for Windows SDK if the env variables are not set

* Reflect CMake changes in the build scripts

* Add missing line

* Fix auto setting DEP_DEBUG and ORCA_INCLUDE_DEBUG_INFO

* Update dep folder name for linux in GH actions

* Invert dep-folder-name conditions

`''` is considered a falsy value, which was causing the value to always be set to 'OrcaSlicer_dep'

* Properly handle finding the debug version of libnoise

* Convert FindNLopt.cmake to a config mode wrapper

* Use separate build directory for debug builds on Linux

* Move find_package for libnoise

* Cleanup and improve linux build script

- Add dry run
- Add build in RelWithDebInfo
- Add function to print and run commands

* Remove linux destdir deprecation and cleanup

* Fix flatpak build

* Disable fail fast for flatpak builds

* Flatpak improvements

- Build wxWidgets using deps cmake
- Improve handling of space freeing commands while building deps
- Allow cmake to directly download deps
- Set needed flags within cmake instead of the build manifest

* Print clean build commands

* Implement shellcheck recommendations

* Cleanup

* Fix CMakeLists.txt syntax by replacing empty elseif with else statement

---------

Co-authored-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
Ocraftyone
2025-10-25 10:05:09 -04:00
committed by GitHub
parent ce854fa3de
commit 026499c5b7
24 changed files with 324 additions and 480 deletions

View File

@@ -17,13 +17,6 @@
"customizations": { "customizations": {
"vscode": { "vscode": {
"settings": { "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"
]
}, },
// Add the IDs of extensions you want installed when the container is created. // Add the IDs of extensions you want installed when the container is created.

View File

@@ -76,6 +76,7 @@ jobs:
- /opt/ghc:/opt/ghc1 - /opt/ghc:/opt/ghc1
- /usr/local/share/boost:/usr/local/share/boost1 - /usr/local/share/boost:/usr/local/share/boost1
strategy: strategy:
fail-fast: false
matrix: matrix:
variant: variant:
- arch: x86_64 - arch: x86_64

View File

@@ -33,8 +33,7 @@ jobs:
- name: set outputs - name: set outputs
id: set_outputs id: set_outputs
env: env:
# todo: this is mad! refactor other build scripts to use same name dep-folder-name: ${{ inputs.os != 'macos-14' && '/OrcaSlicer_dep' || '' }}
dep-folder-name: ${{ inputs.os == 'windows-latest' && '/OrcaSlicer_dep' || inputs.os == 'macos-14' && '' || inputs.os != 'macos-14' && '/destdir' || '' }}
output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}} output-cmd: ${{ inputs.os == 'windows-latest' && '$env:GITHUB_OUTPUT' || '"$GITHUB_OUTPUT"'}}
run: | run: |
echo cache-key=${{ inputs.os }}-cache-orcaslicer_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }} echo cache-key=${{ inputs.os }}-cache-orcaslicer_deps-build-${{ hashFiles('deps/**') }} >> ${{ env.output-cmd }}

View File

@@ -55,6 +55,11 @@ endif ()
project(OrcaSlicer) project(OrcaSlicer)
# Backward compatibility for old CMake versions
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_VERSION VERSION_LESS "3.25")
set(LINUX ON CACHE BOOL "" FORCE)
endif ()
include("version.inc") include("version.inc")
include(GNUInstallDirs) include(GNUInstallDirs)
include(CMakeDependentOption) include(CMakeDependentOption)
@@ -67,6 +72,12 @@ if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE) set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type (default Release)" FORCE)
endif() endif()
if (DEFINED BBL_RELEASE_TO_PUBLIC)
add_compile_definitions("BBL_RELEASE_TO_PUBLIC=${BBL_RELEASE_TO_PUBLIC}")
else ()
add_compile_definitions("BBL_RELEASE_TO_PUBLIC=$<CONFIG:Release>")
endif ()
find_package(Git) find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git") if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
if(DEFINED ENV{git_commit_hash} AND NOT "$ENV{git_commit_hash}" STREQUAL "") if(DEFINED ENV{git_commit_hash} AND NOT "$ENV{git_commit_hash}" STREQUAL "")
@@ -93,13 +104,9 @@ if(GIT_FOUND AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
endif() endif()
if(DEFINED ENV{SLIC3R_STATIC}) if(DEFINED ENV{SLIC3R_STATIC})
set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC}) set(SLIC3R_STATIC_INITIAL $ENV{SLIC3R_STATIC})
else() else()
if (MSVC OR MINGW OR APPLE) set(SLIC3R_STATIC_INITIAL 1)
set(SLIC3R_STATIC_INITIAL 1)
else()
set(SLIC3R_STATIC_INITIAL 0)
endif()
endif() endif()
option(SLIC3R_STATIC "Compile OrcaSlicer with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL}) option(SLIC3R_STATIC "Compile OrcaSlicer with static libraries (Boost, TBB, glew)" ${SLIC3R_STATIC_INITIAL})
@@ -117,7 +124,7 @@ CMAKE_DEPENDENT_OPTION(SLIC3R_DESKTOP_INTEGRATION "Allow perfoming desktop integ
set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.") set(OPENVDB_FIND_MODULE_PATH "" CACHE PATH "Path to OpenVDB installation's find modules.")
set(SLIC3R_GTK "2" CACHE STRING "GTK version to use with wxWidgets on Linux") set(SLIC3R_GTK "3" CACHE STRING "GTK version to use with wxWidgets on Linux")
set(IS_CROSS_COMPILE FALSE) set(IS_CROSS_COMPILE FALSE)
@@ -131,6 +138,10 @@ if (${COLORED_OUTPUT})
endif () endif ()
if (APPLE) if (APPLE)
list(LENGTH CMAKE_OSX_ARCHITECTURES _arch_len)
if (_arch_len GREATER 1)
message(FATAL_ERROR "OrcaSlicer only supports building for one architecture at a time. Please make sure only one architecture is specified in CMAKE_OSX_ARCHITECTURES")
endif ()
set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST) set(CMAKE_FIND_APPBUNDLE LAST)
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx) list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
@@ -150,6 +161,14 @@ option(SLIC3R_BUILD_SANDBOXES "Build development sandboxes" OFF)
option(BUILD_TESTS "Build unit tests" OFF) option(BUILD_TESTS "Build unit tests" OFF)
option(ORCA_TOOLS "Build Orca tools" OFF) option(ORCA_TOOLS "Build Orca tools" OFF)
if (FLATPAK)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++20")
set(SLIC3R_PCH OFF CACHE BOOL "" FORCE)
set(SLIC3R_FHS ON CACHE BOOL "" FORCE)
set(BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(SLIC3R_DESKTOP_INTEGRATION OFF CACHE BOOL "" FORCE)
endif ()
if (IS_CROSS_COMPILE) if (IS_CROSS_COMPILE)
message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!") message("Detected cross compilation setup. Tests and encoding checks will be forcedly disabled!")
set(SLIC3R_PERL_XS OFF CACHE BOOL "" FORCE) set(SLIC3R_PERL_XS OFF CACHE BOOL "" FORCE)
@@ -173,6 +192,13 @@ if(SLIC3R_DESKTOP_INTEGRATION)
add_definitions(-DSLIC3R_DESKTOP_INTEGRATION) add_definitions(-DSLIC3R_DESKTOP_INTEGRATION)
endif () endif ()
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
message(STATUS "Automatically setting CMAKE_INSTALL_PREFIX")
set_property(CACHE CMAKE_INSTALL_PREFIX PROPERTY VALUE "${CMAKE_BINARY_DIR}/OrcaSlicer")
endif()
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) if (MSVC AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(IS_CLANG_CL TRUE) set(IS_CLANG_CL TRUE)
@@ -218,24 +244,61 @@ if (NOT MSVC)
add_compile_options(-fsigned-char) add_compile_options(-fsigned-char)
endif () endif ()
# Display and check CMAKE_PREFIX_PATH if ("${DEP_BUILD_DIR}" STREQUAL "")
message(STATUS "SLIC3R_STATIC: ${SLIC3R_STATIC}") get_filename_component(BIN_DIR_NAME ${CMAKE_BINARY_DIR} NAME)
if (NOT "${CMAKE_PREFIX_PATH}" STREQUAL "") if (APPLE AND BIN_DIR_NAME STREQUAL "${CMAKE_OSX_ARCHITECTURES}")
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (from cache or command line)") file(RELATIVE_PATH BIN_DIR_NAME ${CMAKE_BINARY_DIR}/../.. ${CMAKE_BINARY_DIR})
set(PREFIX_PATH_CHECK ${CMAKE_PREFIX_PATH}) endif ()
elseif (NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "") set(DEP_BUILD_DIR "${CMAKE_SOURCE_DIR}/deps/${BIN_DIR_NAME}" CACHE PATH "Path to dependencies build directory" FORCE)
message(STATUS "CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH} (from environment)") message(STATUS "DEP_BUILD_DIR: ${DEP_BUILD_DIR} (generated automatically and saved to cache)")
set(PREFIX_PATH_CHECK $ENV{CMAKE_PREFIX_PATH}) set(AUTOGENERATED_DEP_BUILD_DIR ${DEP_BUILD_DIR} CACHE PATH "Provides the last autogenerated DEP_BUILD_DIR" FORCE)
else () else ()
message(STATUS "CMAKE_PREFIX_PATH: (default)") message(STATUS "DEP_BUILD_DIR: ${DEP_BUILD_DIR} (from cache or command line)")
endif () endif ()
if ("${CMAKE_PREFIX_PATH}" STREQUAL "" OR "${CMAKE_PREFIX_PATH}" STREQUAL "${AUTOGENERATED_PREFIX_PATH}")
if (DEFINED AUTOGENERATED_DEP_BUILD_DIR AND NOT "${DEP_BUILD_DIR}" STREQUAL "${AUTOGENERATED_DEP_BUILD_DIR}")
message(STATUS "CMAKE_PREFIX_PATH is being re-generated due to DEP_BUILD_DIR being manually updated")
set(REGEN_DESTDIR TRUE)
unset(AUTOGENERATED_DEP_BUILD_DIR CACHE)
endif ()
else ()
unset(AUTOGENERATED_PREFIX_PATH CACHE)
endif ()
# Display and check CMAKE_PREFIX_PATH
if ("${CMAKE_PREFIX_PATH}" STREQUAL "" OR REGEN_DESTDIR)
set(CMAKE_PREFIX_PATH "${DEP_BUILD_DIR}/OrcaSlicer_dep/usr/local" CACHE PATH "Path to dependencies install directory" FORCE)
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (generated automatically and saved to cache)")
set(AUTOGENERATED_PREFIX_PATH ${CMAKE_PREFIX_PATH} CACHE STRING "Provides the last autogenerated CMAKE_PREFIX_PATH" FORCE)
unset(REGEN_DESTDIR CACHE)
else ()
message(STATUS "CMAKE_PREFIX_PATH: ${CMAKE_PREFIX_PATH} (from cache or command line)")
endif ()
set(PREFIX_PATH_CHECK ${CMAKE_PREFIX_PATH})
# the CMAKE_PREFIX_PATH environment variable is separate from the CMAKE_PREFIX_PATH cache variable and provides additional paths to search for libraries.
if (NOT "$ENV{CMAKE_PREFIX_PATH}" STREQUAL "")
message(STATUS "CMAKE_PREFIX_PATH: $ENV{CMAKE_PREFIX_PATH} (from environment)")
list(APPEND PREFIX_PATH_CHECK $ENV{CMAKE_PREFIX_PATH})
endif ()
# Check all directories in CMAKE_PREFIX_PATH variables
foreach (DIR ${PREFIX_PATH_CHECK}) foreach (DIR ${PREFIX_PATH_CHECK})
if (NOT EXISTS "${DIR}") if (NOT EXISTS "${DIR}")
message(WARNING "CMAKE_PREFIX_PATH element doesn't exist: ${DIR}") message(WARNING "CMAKE_PREFIX_PATH element doesn't exist: ${DIR}")
endif () endif ()
endforeach () endforeach ()
if (APPLE)
set(CMAKE_MACOSX_RPATH ON CACHE BOOL "")
set(CMAKE_MACOSX_BUNDLE ON CACHE BOOL "")
endif ()
if (APPLE AND CMAKE_MACOSX_RPATH AND "${CMAKE_INSTALL_RPATH}" STREQUAL "")
set(CMAKE_INSTALL_RPATH ${CMAKE_PREFIX_PATH})
endif ()
# Add our own cmake module path. # Add our own cmake module path.
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/) list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules/)
message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}") message(STATUS "PROJECT_SOURCE_DIR: ${PROJECT_SOURCE_DIR}")
@@ -276,7 +339,11 @@ if(WIN32)
endif() endif()
else() else()
# Try to use the default Windows 10 SDK path. # Try to use the default Windows 10 SDK path.
set(WIN10SDK_INCLUDE_PATH "$ENV{WindowsSdkDir}/Include/$ENV{WindowsSDKVersion}") if (DEFINED ENV{WindowsSdkDir} AND DEFINED ENV{WindowsSDKVersion})
set(WIN10SDK_INCLUDE_PATH "$ENV{WindowsSdkDir}/Include/$ENV{WindowsSDKVersion}")
else ()
set(WIN10SDK_INCLUDE_PATH "C:/Program Files (x86)/Windows Kits/10/Include/10.0.22000.0")
endif ()
if (NOT EXISTS "${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h") if (NOT EXISTS "${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h")
message("${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h was not found") message("${WIN10SDK_INCLUDE_PATH}/winrt/windows.graphics.printing3d.h was not found")
message("STL fixing by the Netfabb service will not be compiled") message("STL fixing by the Netfabb service will not be compiled")

View File

@@ -10,10 +10,12 @@ function usage() {
echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-h][-i][-j N][-p][-r][-s][-t][-u][-l][-L]" echo "Usage: ./${SCRIPT_NAME} [-1][-b][-c][-d][-h][-i][-j N][-p][-r][-s][-t][-u][-l][-L]"
echo " -1: limit builds to one core (where possible)" echo " -1: limit builds to one core (where possible)"
echo " -j N: limit builds to N cores (where possible)" echo " -j N: limit builds to N cores (where possible)"
echo " -b: build in debug mode" echo " -b: build in Debug mode"
echo " -c: force a clean build" echo " -c: force a clean build"
echo " -C: enable ANSI-colored compile output (GNU/Clang only)" echo " -C: enable ANSI-colored compile output (GNU/Clang only)"
echo " -d: download and build dependencies in ./deps/ (build prerequisite)" echo " -d: download and build dependencies in ./deps/ (build prerequisite)"
echo " -D: dry run"
echo " -e: build in RelWithDebInfo mode"
echo " -h: prints this help text" echo " -h: prints this help text"
echo " -i: build the Orca Slicer AppImage (optional)" echo " -i: build the Orca Slicer AppImage (optional)"
echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)" echo " -p: boost ccache hit rate by disabling precompiled headers (default: ON)"
@@ -31,7 +33,9 @@ function usage() {
SLIC3R_PRECOMPILED_HEADERS="ON" SLIC3R_PRECOMPILED_HEADERS="ON"
unset name unset name
while getopts ":1j:bcCdhiprstulL" opt ; do BUILD_DIR=build
BUILD_CONFIG=Release
while getopts ":1j:bcCdDehiprstulL" opt ; do
case ${opt} in case ${opt} in
1 ) 1 )
export CMAKE_BUILD_PARALLEL_LEVEL=1 export CMAKE_BUILD_PARALLEL_LEVEL=1
@@ -40,7 +44,8 @@ while getopts ":1j:bcCdhiprstulL" opt ; do
export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG export CMAKE_BUILD_PARALLEL_LEVEL=$OPTARG
;; ;;
b ) b )
BUILD_DEBUG="1" BUILD_DIR=build-dbg
BUILD_CONFIG=Debug
;; ;;
c ) c )
CLEAN_BUILD=1 CLEAN_BUILD=1
@@ -51,6 +56,13 @@ while getopts ":1j:bcCdhiprstulL" opt ; do
d ) d )
BUILD_DEPS="1" BUILD_DEPS="1"
;; ;;
D )
DRY_RUN="1"
;;
e )
BUILD_DIR=build-dbginfo
BUILD_CONFIG=RelWithDebInfo
;;
h ) usage h ) usage
exit 1 exit 1
;; ;;
@@ -112,6 +124,21 @@ function check_available_memory_and_disk() {
fi fi
} }
function print_and_run() {
cmd=()
# Remove empty arguments, leading and trailing spaces
for item in "$@" ; do
if [[ -n $item ]]; then
cmd+=( "$(echo "${item}" | xargs)" )
fi
done
echo "${cmd[@]}"
if [[ -z "${DRY_RUN}" ]] ; then
"${cmd[@]}"
fi
}
# cmake 4.x compatibility workaround # cmake 4.x compatibility workaround
export CMAKE_POLICY_VERSION_MINIMUM=3.5 export CMAKE_POLICY_VERSION_MINIMUM=3.5
@@ -137,7 +164,7 @@ else
source "./scripts/linux.d/${DISTRIBUTION}" source "./scripts/linux.d/${DISTRIBUTION}"
fi fi
echo "FOUND_GTK3=${FOUND_GTK3}" echo "FOUND_GTK3_DEV=${FOUND_GTK3_DEV}"
if [[ -z "${FOUND_GTK3_DEV}" ]] ; then if [[ -z "${FOUND_GTK3_DEV}" ]] ; then
echo "Error, you must install the dependencies before." echo "Error, you must install the dependencies before."
echo "Use option -u with sudo" echo "Use option -u with sudo"
@@ -176,51 +203,27 @@ fi
if [[ -n "${BUILD_DEPS}" ]] ; then if [[ -n "${BUILD_DEPS}" ]] ; then
echo "Configuring dependencies..." echo "Configuring dependencies..."
read -r -a BUILD_ARGS <<< "${DEPS_EXTRA_BUILD_ARGS}" read -r -a BUILD_ARGS <<< "${DEPS_EXTRA_BUILD_ARGS}"
BUILD_ARGS+=(-DDEP_WX_GTK3=ON)
if [[ -n "${CLEAN_BUILD}" ]] if [[ -n "${CLEAN_BUILD}" ]]
then then
rm -fr deps/build print_and_run rm -fr deps/$BUILD_DIR
fi fi
mkdir -p deps/build mkdir -p deps/$BUILD_DIR
if [[ -n "${BUILD_DEBUG}" ]] ; then if [[ $BUILD_CONFIG != Release ]] ; then
# build deps with debug and release else cmake will not find required sources BUILD_ARGS+=(-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}")
mkdir -p deps/build/release
set -x
cmake -S deps -B deps/build/release "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G Ninja \
-DSLIC3R_PCH="${SLIC3R_PRECOMPILED_HEADERS}" \
-DDESTDIR="${SCRIPT_PATH}/deps/build/destdir" \
-DDEP_DOWNLOAD_DIR="${SCRIPT_PATH}/deps/DL_CACHE" \
"${COLORED_OUTPUT}" \
"${BUILD_ARGS[@]}"
set +x
cmake --build deps/build/release
BUILD_ARGS+=(-DCMAKE_BUILD_TYPE=Debug)
fi fi
set -x print_and_run cmake -S deps -B deps/$BUILD_DIR "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G Ninja "${COLORED_OUTPUT}" "${BUILD_ARGS[@]}"
cmake -S deps -B deps/build "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G Ninja \ print_and_run cmake --build deps/$BUILD_DIR
-DSLIC3R_PCH="${SLIC3R_PRECOMPILED_HEADERS}" \
-DDESTDIR="${SCRIPT_PATH}/deps/build/destdir" \
-DDEP_DOWNLOAD_DIR="${SCRIPT_PATH}/deps/DL_CACHE" \
"${COLORED_OUTPUT}" \
"${BUILD_ARGS[@]}"
set +x
cmake --build deps/build
fi fi
if [[ -n "${BUILD_ORCA}" ]] ; then if [[ -n "${BUILD_ORCA}" ]] ; then
echo "Configuring OrcaSlicer..." echo "Configuring OrcaSlicer..."
if [[ -n "${CLEAN_BUILD}" ]] ; then if [[ -n "${CLEAN_BUILD}" ]] ; then
rm -fr build print_and_run rm -fr $BUILD_DIR
fi fi
read -r -a BUILD_ARGS <<< "${ORCA_EXTRA_BUILD_ARGS}" read -r -a BUILD_ARGS <<< "${ORCA_EXTRA_BUILD_ARGS}"
if [[ -n "${FOUND_GTK3_DEV}" ]] ; then if [[ $BUILD_CONFIG != Release ]] ; then
BUILD_ARGS+=(-DSLIC3R_GTK=3) BUILD_ARGS+=(-DCMAKE_BUILD_TYPE="${BUILD_CONFIG}")
fi
if [[ -n "${BUILD_DEBUG}" ]] ; then
BUILD_ARGS+=(-DCMAKE_BUILD_TYPE=Debug -DBBL_INTERNAL_TESTING=1)
else
BUILD_ARGS+=(-DBBL_RELEASE_TO_PUBLIC=1 -DBBL_INTERNAL_TESTING=0)
fi fi
if [[ -n "${BUILD_TESTS}" ]] ; then if [[ -n "${BUILD_TESTS}" ]] ; then
BUILD_ARGS+=(-DBUILD_TESTS=ON) BUILD_ARGS+=(-DBUILD_TESTS=ON)
@@ -229,35 +232,22 @@ if [[ -n "${BUILD_ORCA}" ]] ; then
BUILD_ARGS+=(-DORCA_UPDATER_SIG_KEY="${ORCA_UPDATER_SIG_KEY}") BUILD_ARGS+=(-DORCA_UPDATER_SIG_KEY="${ORCA_UPDATER_SIG_KEY}")
fi fi
echo "Configuring OrcaSlicer..." print_and_run cmake -S . -B $BUILD_DIR "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G "Ninja Multi-Config" \
set -x -DSLIC3R_PCH=${SLIC3R_PRECOMPILED_HEADERS} \
cmake -S . -B build "${CMAKE_C_CXX_COMPILER_CLANG[@]}" "${CMAKE_LLD_LINKER_ARGS[@]}" -G "Ninja Multi-Config" \ -DORCA_TOOLS=ON \
-DSLIC3R_PCH="${SLIC3R_PRECOMPILED_HEADERS}" \ "${COLORED_OUTPUT}" \
-DCMAKE_PREFIX_PATH="${SCRIPT_PATH}/deps/build/destdir/usr/local" \ "${BUILD_ARGS[@]}"
-DSLIC3R_STATIC=1 \
-DORCA_TOOLS=ON \
"${COLORED_OUTPUT}" \
"${BUILD_ARGS[@]}"
set +x
echo "done" echo "done"
echo "Building OrcaSlicer ..." echo "Building OrcaSlicer ..."
if [[ -n "${BUILD_DEBUG}" ]] ; then print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer
cmake --build build --config Debug --target OrcaSlicer
else
cmake --build build --config Release --target OrcaSlicer
fi
echo "Building OrcaSlicer_profile_validator .." echo "Building OrcaSlicer_profile_validator .."
if [[ -n "${BUILD_DEBUG}" ]] ; then print_and_run cmake --build $BUILD_DIR --config "${BUILD_CONFIG}" --target OrcaSlicer_profile_validator
cmake --build build --config Debug --target OrcaSlicer_profile_validator
else
cmake --build build --config Release --target OrcaSlicer_profile_validator
fi
./scripts/run_gettext.sh ./scripts/run_gettext.sh
echo "done" echo "done"
fi fi
if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then
pushd build > /dev/null pushd $BUILD_DIR > /dev/null
echo "[9/9] Generating Linux app..." echo "[9/9] Generating Linux app..."
build_linux_image="./src/build_linux_image.sh" build_linux_image="./src/build_linux_image.sh"
if [[ -e ${build_linux_image} ]] ; then if [[ -e ${build_linux_image} ]] ; then
@@ -265,7 +255,7 @@ if [[ -n "${BUILD_IMAGE}" || -n "${BUILD_ORCA}" ]] ; then
if [[ -n "${BUILD_IMAGE}" ]] ; then if [[ -n "${BUILD_IMAGE}" ]] ; then
extra_script_args="-i" extra_script_args="-i"
fi fi
${build_linux_image} ${extra_script_args} print_and_run ${build_linux_image} ${extra_script_args}
echo "done" echo "done"
fi fi

View File

@@ -31,8 +31,8 @@ if "%1"=="slicer" (
) )
echo "building deps.." echo "building deps.."
echo cmake ../ -G "Visual Studio 16 2019" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo% echo cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake ../ -G "Visual Studio 16 2019" -A x64 -DDESTDIR="%CD%/OrcaSlicer_dep" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo% cmake ../ -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m cmake --build . --config %build_type% --target deps -- -m
if "%1"=="deps" exit /b 0 if "%1"=="deps" exit /b 0
@@ -43,8 +43,8 @@ cd %WP%
mkdir %build_dir% mkdir %build_dir%
cd %build_dir% cd %build_dir%
echo cmake .. -G "Visual Studio 16 2019" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type% echo cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake .. -G "Visual Studio 16 2019" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 %SIG_FLAG% -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type% -DWIN10SDK_PATH="C:/Program Files (x86)/Windows Kits/10/Include/10.0.19041.0" cmake .. -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=%build_type% %SIG_FLAG%
cmake --build . --config %build_type% --target ALL_BUILD -- -m cmake --build . --config %build_type% --target ALL_BUILD -- -m
cd .. cd ..
call scripts/run_gettext.bat call scripts/run_gettext.bat

View File

@@ -109,8 +109,6 @@ echo
PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_BUILD_DIR="$PROJECT_DIR/build/$ARCH" PROJECT_BUILD_DIR="$PROJECT_DIR/build/$ARCH"
DEPS_DIR="$PROJECT_DIR/deps" DEPS_DIR="$PROJECT_DIR/deps"
DEPS_BUILD_DIR="$DEPS_DIR/build/$ARCH"
DEPS="$DEPS_BUILD_DIR/OrcaSlicer_deps"
# For Multi-config generators like Ninja and Xcode # For Multi-config generators like Ninja and Xcode
export BUILD_DIR_CONFIG_SUBDIR="/$BUILD_CONFIG" export BUILD_DIR_CONFIG_SUBDIR="/$BUILD_CONFIG"
@@ -133,8 +131,6 @@ function build_deps() {
if [ "1." != "$BUILD_ONLY". ]; then if [ "1." != "$BUILD_ONLY". ]; then
cmake "${DEPS_DIR}" \ cmake "${DEPS_DIR}" \
-G "${DEPS_CMAKE_GENERATOR}" \ -G "${DEPS_CMAKE_GENERATOR}" \
-DDESTDIR="$DEPS" \
-DOPENSSL_ARCH="darwin64-${_ARCH}-cc" \
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \ -DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
-DCMAKE_OSX_ARCHITECTURES:STRING="${_ARCH}" \ -DCMAKE_OSX_ARCHITECTURES:STRING="${_ARCH}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" -DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}"
@@ -172,15 +168,9 @@ function build_slicer() {
if [ "1." != "$BUILD_ONLY". ]; then if [ "1." != "$BUILD_ONLY". ]; then
cmake "${PROJECT_DIR}" \ cmake "${PROJECT_DIR}" \
-G "${SLICER_CMAKE_GENERATOR}" \ -G "${SLICER_CMAKE_GENERATOR}" \
-DBBL_RELEASE_TO_PUBLIC=1 \
-DORCA_TOOLS=ON \ -DORCA_TOOLS=ON \
${ORCA_UPDATER_SIG_KEY:+-DORCA_UPDATER_SIG_KEY="$ORCA_UPDATER_SIG_KEY"} \ ${ORCA_UPDATER_SIG_KEY:+-DORCA_UPDATER_SIG_KEY="$ORCA_UPDATER_SIG_KEY"} \
-DCMAKE_PREFIX_PATH="$DEPS/usr/local" \
-DCMAKE_INSTALL_PREFIX="$PWD/OrcaSlicer" \
-DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \ -DCMAKE_BUILD_TYPE="$BUILD_CONFIG" \
-DCMAKE_MACOSX_RPATH=ON \
-DCMAKE_INSTALL_RPATH="${DEPS}/usr/local" \
-DCMAKE_MACOSX_BUNDLE=ON \
-DCMAKE_OSX_ARCHITECTURES="${_ARCH}" \ -DCMAKE_OSX_ARCHITECTURES="${_ARCH}" \
-DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}" -DCMAKE_OSX_DEPLOYMENT_TARGET="${OSX_DEPLOYMENT_TARGET}"
fi fi

View File

@@ -37,7 +37,6 @@ setlocal DISABLEDELAYEDEXPANSION
cd deps cd deps
mkdir %build_dir% mkdir %build_dir%
cd %build_dir% cd %build_dir%
set DEPS=%CD%/OrcaSlicer_dep
set "SIG_FLAG=" set "SIG_FLAG="
if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%" if defined ORCA_UPDATER_SIG_KEY set "SIG_FLAG=-DORCA_UPDATER_SIG_KEY=%ORCA_UPDATER_SIG_KEY%"
@@ -47,7 +46,7 @@ if "%1"=="slicer" (
echo "building deps.." echo "building deps.."
echo on echo on
cmake ../ -G "Visual Studio 17 2022" -A x64 -DDESTDIR="%DEPS%" -DCMAKE_BUILD_TYPE=%build_type% -DDEP_DEBUG=%debug% -DORCA_INCLUDE_DEBUG_INFO=%debuginfo% cmake ../ -G "Visual Studio 17 2022" -A x64 -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target deps -- -m cmake --build . --config %build_type% --target deps -- -m
@echo off @echo off
@@ -60,7 +59,7 @@ mkdir %build_dir%
cd %build_dir% cd %build_dir%
echo on echo on
cmake .. -G "Visual Studio 17 2022" -A x64 -DBBL_RELEASE_TO_PUBLIC=1 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_PREFIX_PATH="%DEPS%/usr/local" -DCMAKE_INSTALL_PREFIX="./OrcaSlicer" -DCMAKE_BUILD_TYPE=%build_type% -DWIN10SDK_PATH="%WindowsSdkDir%Include\%WindowsSDKVersion%\" cmake .. -G "Visual Studio 17 2022" -A x64 -DORCA_TOOLS=ON %SIG_FLAG% -DCMAKE_BUILD_TYPE=%build_type%
cmake --build . --config %build_type% --target ALL_BUILD -- -m cmake --build . --config %build_type% --target ALL_BUILD -- -m
@echo off @echo off
cd .. cd ..

View File

@@ -152,7 +152,7 @@ find_library(GLEW_STATIC_LIBRARY_RELEASE
PATHS ENV GLEW_ROOT) PATHS ENV GLEW_ROOT)
find_library(GLEW_STATIC_LIBRARY_DEBUG find_library(GLEW_STATIC_LIBRARY_DEBUG
NAMES GLEWds glewd glewds glew32ds NAMES GLEWds GLEWd glewd glewds glew32ds
PATH_SUFFIXES lib lib64 PATH_SUFFIXES lib lib64
PATHS ENV GLEW_ROOT) PATHS ENV GLEW_ROOT)

View File

@@ -3,13 +3,6 @@
#// #//
#// Description: #// Description:
#// cmake module for finding NLopt installation #// cmake module for finding NLopt installation
#// NLopt installation location is defined by environment variable $NLOPT
#//
#// following variables are defined:
#// NLopt_DIR - NLopt installation directory
#// NLopt_INCLUDE_DIR - NLopt header directory
#// NLopt_LIBRARY_DIR - NLopt library directory
#// NLopt_LIBS - NLopt library files
#// #//
#// Example usage: #// Example usage:
#// find_package(NLopt 1.4 REQUIRED) #// find_package(NLopt 1.4 REQUIRED)
@@ -17,114 +10,27 @@
#// #//
#//------------------------------------------------------------------------- #//-------------------------------------------------------------------------
include(FindPackageHandleStandardArgs)
set(NLopt_FOUND FALSE) unset(_q)
set(NLopt_ERROR_REASON "") if (NLopt_FIND_QUIETLY)
set(NLopt_DEFINITIONS "") set(_q QUIET)
unset(NLopt_LIBS CACHE) endif ()
set(NLopt_DIR $ENV{NLOPT})
if(NOT NLopt_DIR)
set(NLopt_FOUND TRUE)
set(_NLopt_LIB_NAMES "nlopt")
find_library(NLopt_LIBS
NAMES ${_NLopt_LIB_NAMES})
if(NOT NLopt_LIBS)
set(NLopt_FOUND FALSE)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt library '${_NLopt_LIB_NAMES}'.")
else()
get_filename_component(NLopt_DIR ${NLopt_LIBS} PATH)
endif()
unset(_NLopt_LIB_NAMES)
set(_NLopt_HEADER_FILE_NAME "nlopt.hpp")
find_file(_NLopt_HEADER_FILE
NAMES ${_NLopt_HEADER_FILE_NAME})
if(NOT _NLopt_HEADER_FILE)
set(NLopt_FOUND FALSE)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt header file '${_NLopt_HEADER_FILE_NAME}'.")
endif()
unset(_NLopt_HEADER_FILE_NAME)
if(NOT NLopt_FOUND)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} NLopt not found in system directories (and environment variable NLOPT is not set).")
else()
get_filename_component(NLopt_INCLUDE_DIR ${_NLopt_HEADER_FILE} DIRECTORY )
endif()
unset(_NLopt_HEADER_FILE CACHE)
else()
set(NLopt_FOUND TRUE)
set(NLopt_INCLUDE_DIR "${NLopt_DIR}/include")
if(NOT EXISTS "${NLopt_INCLUDE_DIR}")
set(NLopt_FOUND FALSE)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Directory '${NLopt_INCLUDE_DIR}' does not exist.")
endif()
set(NLopt_LIBRARY_DIR "${NLopt_DIR}/lib")
if(NOT EXISTS "${NLopt_LIBRARY_DIR}")
set(NLopt_FOUND FALSE)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Directory '${NLopt_LIBRARY_DIR}' does not exist.")
endif()
set(_NLopt_LIB_NAMES "nlopt_cxx")
find_library(NLopt_LIBS
NAMES ${_NLopt_LIB_NAMES}
PATHS ${NLopt_LIBRARY_DIR}
NO_DEFAULT_PATH)
if(NOT NLopt_LIBS)
set(NLopt_FOUND FALSE)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt library '${_NLopt_LIB_NAMES}' in '${NLopt_LIBRARY_DIR}'.")
endif()
unset(_NLopt_LIB_NAMES)
set(_NLopt_HEADER_FILE_NAME "nlopt.hpp")
find_file(_NLopt_HEADER_FILE
NAMES ${_NLopt_HEADER_FILE_NAME}
PATHS ${NLopt_INCLUDE_DIR}
NO_DEFAULT_PATH)
if(NOT _NLopt_HEADER_FILE)
set(NLopt_FOUND FALSE)
set(NLopt_ERROR_REASON "${NLopt_ERROR_REASON} Cannot find NLopt header file '${_NLopt_HEADER_FILE_NAME}' in '${NLopt_INCLUDE_DIR}'.")
endif()
unset(_NLopt_HEADER_FILE_NAME)
unset(_NLopt_HEADER_FILE CACHE)
endif()
# make variables changeable
mark_as_advanced(
NLopt_INCLUDE_DIR
NLopt_LIBRARY_DIR
NLopt_LIBS
NLopt_DEFINITIONS
)
find_package(NLopt ${NLopt_VERSION} CONFIG ${_q})
find_package_handle_standard_args(NLopt CONFIG_MODE)
# report result # report result
if(NLopt_FOUND) if(NLopt_FOUND AND NOT _q)
message(STATUS "Found NLopt in '${NLopt_DIR}'.") get_filename_component(NLOPT_LIBRARY_DIRS ${NLOPT_LIBRARY_DIRS} ABSOLUTE)
message(STATUS "Using NLopt include directory '${NLopt_INCLUDE_DIR}'.") get_filename_component(NLOPT_INCLUDE_DIRS ${NLOPT_INCLUDE_DIRS} ABSOLUTE)
message(STATUS "Using NLopt library '${NLopt_LIBS}'.")
add_library(NLopt::nlopt INTERFACE IMPORTED) message(STATUS "Found NLopt in '${NLOPT_LIBRARY_DIRS}'.")
set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_LINK_LIBRARIES ${NLopt_LIBS}) message(STATUS "Using NLopt include directory '${NLOPT_INCLUDE_DIRS}'.")
set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${NLopt_INCLUDE_DIR})
set_target_properties(NLopt::nlopt PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${NLopt_DEFINITIONS}") get_target_property(_configs NLopt::nlopt IMPORTED_CONFIGURATIONS)
# target_link_libraries(Nlopt::Nlopt INTERFACE ${NLopt_LIBS}) foreach (_config ${_configs})
# target_include_directories(Nlopt::Nlopt INTERFACE ${NLopt_INCLUDE_DIR}) get_target_property(_lib NLopt::nlopt IMPORTED_LOCATION_${_config})
# target_compile_definitions(Nlopt::Nlopt INTERFACE ${NLopt_DEFINITIONS}) message(STATUS "Found NLopt ${_config} library: ${_lib}")
else() endforeach ()
if(NLopt_FIND_REQUIRED)
message(FATAL_ERROR "Unable to find requested NLopt installation:${NLopt_ERROR_REASON}")
else()
if(NOT NLopt_FIND_QUIETLY)
message(STATUS "NLopt was not found:${NLopt_ERROR_REASON}")
endif()
endif()
endif() endif()

View File

@@ -1,15 +1,41 @@
find_path(LIBNOISE_INCLUDE_DIR libnoise/noise.h) find_path(LIBNOISE_INCLUDE_DIR libnoise/noise.h)
find_library(LIBNOISE_LIBRARY NAMES libnoise libnoise_static liblibnoise_static) find_library(LIBNOISE_LIBRARY_RELEASE NAMES libnoise libnoise_static liblibnoise_static)
find_library(LIBNOISE_LIBRARY_DEBUG NAMES libnoised libnoise_staticd liblibnoise_staticd)
set(libnoise_LIB_FOUND FALSE)
if (LIBNOISE_LIBRARY_RELEASE OR LIBNOISE_LIBRARY_DEBUG)
set(libnoise_LIB_FOUND TRUE)
endif ()
include(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(libnoise DEFAULT_MSG find_package_handle_standard_args(libnoise DEFAULT_MSG
LIBNOISE_LIBRARY libnoise_LIB_FOUND
LIBNOISE_INCLUDE_DIR LIBNOISE_INCLUDE_DIR
) )
if(libnoise_FOUND) if(libnoise_FOUND)
add_library(noise::noise STATIC IMPORTED) add_library(noise::noise STATIC IMPORTED)
set_target_properties(noise::noise PROPERTIES set_target_properties(noise::noise PROPERTIES
IMPORTED_LOCATION "${LIBNOISE_LIBRARY}" INTERFACE_INCLUDE_DIRECTORIES "${LIBNOISE_INCLUDE_DIR}"
INTERFACE_INCLUDE_DIRECTORIES "${LIBNOISE_INCLUDE_DIR}"
) )
if (NOT libnoise_FIND_QUIETLY)
message(STATUS "Found libnoise include directory: ${LIBNOISE_INCLUDE_DIR}")
if (LIBNOISE_LIBRARY_RELEASE)
message(STATUS "Found libnoise RELEASE library: ${LIBNOISE_LIBRARY_RELEASE}")
endif ()
if (LIBNOISE_LIBRARY_DEBUG)
message(STATUS "Found libnoise DEBUG library: ${LIBNOISE_LIBRARY_DEBUG}")
endif ()
endif ()
if (LIBNOISE_LIBRARY_RELEASE)
set_property(TARGET noise::noise APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
set_target_properties(noise::noise PROPERTIES IMPORTED_LOCATION_RELEASE ${LIBNOISE_LIBRARY_RELEASE})
endif ()
if (LIBNOISE_LIBRARY_DEBUG)
set_property(TARGET noise::noise APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
set_target_properties(noise::noise PROPERTIES IMPORTED_LOCATION_DEBUG ${LIBNOISE_LIBRARY_DEBUG})
endif ()
endif() endif()

112
deps/CMakeLists.txt vendored
View File

@@ -36,6 +36,11 @@ endif()
project(OrcaSlicer-deps) project(OrcaSlicer-deps)
# Backward compatibility for old CMake versions
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_VERSION VERSION_LESS "3.25")
set(LINUX ON CACHE BOOL "" FORCE)
endif ()
include(ExternalProject) include(ExternalProject)
include(ProcessorCount) include(ProcessorCount)
@@ -44,9 +49,36 @@ if (NPROC EQUAL 0)
set(NPROC 1) set(NPROC 1)
endif () endif ()
set(DESTDIR "${CMAKE_CURRENT_BINARY_DIR}/destdir" CACHE PATH "Destination directory")
set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_DIR}/DL_CACHE CACHE PATH "Path for downloaded source packages.") set(DEP_DOWNLOAD_DIR ${CMAKE_CURRENT_SOURCE_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") set(FLATPAK FALSE CACHE BOOL "Toggles various build settings for flatpak, like /usr/local in DESTDIR or not building wxwidgets")
if ("${DESTDIR}" STREQUAL "" OR "${DESTDIR}" STREQUAL "${AUTOGENERATED_DESTDIR}")
if (LINUX AND (NOT DEFINED USE_OLD_DESTDIR_PREV OR USE_OLD_DESTDIR_PREV) AND EXISTS "${CMAKE_BINARY_DIR}/destdir/usr/local" AND NOT EXISTS "${CMAKE_BINARY_DIR}/OrcaSlicer_dep/usr/local")
set(USE_OLD_DESTDIR TRUE)
message(WARNING "You are using an old directory name for dependencies that is being deprecated. "
"Please remove the \"destdir\" directory and rebuild to update to the new name. "
"The current \"destdir\" directory will be used until then.")
endif ()
if (NOT USE_OLD_DESTDIR AND USE_OLD_DESTDIR_PREV)
set(REGEN_DESTDIR TRUE)
endif ()
else ()
unset(AUTOGENERATED_DESTDIR CACHE)
endif ()
if ("${DESTDIR}" STREQUAL "" OR REGEN_DESTDIR)
if (USE_OLD_DESTDIR) # backward compatibility for old directory name
set(DESTDIR "${CMAKE_BINARY_DIR}/destdir" CACHE PATH "Path to dependencies install directory" FORCE)
else ()
set(DESTDIR "${CMAKE_BINARY_DIR}/OrcaSlicer_dep" CACHE PATH "Path to dependencies install directory" FORCE)
endif ()
set(DESTDIR_MSG "(generated automatically and saved to cache)")
set(AUTOGENERATED_DESTDIR ${DESTDIR} CACHE STRING "Provides the last autogenerated destdir" FORCE)
unset(REGEN_DESTDIR CACHE)
else ()
set(DESTDIR_MSG "(from cache or command line)")
endif ()
if (NOT FLATPAK) if (NOT FLATPAK)
set(DESTDIR "${DESTDIR}/usr/local/") set(DESTDIR "${DESTDIR}/usr/local/")
endif() endif()
@@ -56,15 +88,32 @@ get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (_is_multi) if (_is_multi)
option(DEP_DEBUG "Build debug variants (only applicable on Windows)" OFF) option(DEP_DEBUG "Build debug variants (only applicable on Windows)" OFF)
option(ORCA_INCLUDE_DEBUG_INFO "Includes debug information in a release build (like RelWithDebInfo) in a way that works with multi-configuration generators and incompatible dependencies. DEP_DEBUG option takes priority over this." OFF) option(ORCA_INCLUDE_DEBUG_INFO "Includes debug information in a release build (like RelWithDebInfo) in a way that works with multi-configuration generators and incompatible dependencies. DEP_DEBUG option takes priority over this." OFF)
option(AUTO_DEBUG_WORKAROUND "Automatically sets DEP_DEBUG and ORCA_INCLUDE_DEBUG_INFO based on CMAKE_BUILD_TYPE" ON)
if (AUTO_DEBUG_WORKAROUND)
set(DEP_DEBUG OFF)
set(ORCA_INCLUDE_DEBUG_INFO OFF)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(DEP_DEBUG ON)
message(STATUS "DEP_DEBUG has been automatically turned ON due to CMAKE_BUILD_TYPE being set to Debug")
elseif (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
set(ORCA_INCLUDE_DEBUG_INFO ON)
message(STATUS "ORCA_INCLUDE_DEBUG_INFO has been automatically turned ON due to CMAKE_BUILD_TYPE being set to RelWithDebInfo")
endif ()
endif ()
endif () endif ()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
option(DEP_WX_GTK3 "Build wxWidgets against GTK3" OFF) option(DEP_WX_GTK3 "Build wxWidgets against GTK3" ON)
endif() endif()
set(IS_CROSS_COMPILE FALSE) set(IS_CROSS_COMPILE FALSE)
if (APPLE) if (APPLE)
list(LENGTH CMAKE_OSX_ARCHITECTURES _arch_len)
if (_arch_len GREATER 1)
message(FATAL_ERROR "OrcaSlicer only supports building for one architecture at a time. Please make sure only one architecture is specified in CMAKE_OSX_ARCHITECTURES")
endif ()
set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_FRAMEWORK LAST)
set(CMAKE_FIND_APPBUNDLE LAST) set(CMAKE_FIND_APPBUNDLE LAST)
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx) list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
@@ -87,7 +136,7 @@ endif ()
# Slic3r compiles with a different version which will cause runtime errors. # Slic3r compiles with a different version which will cause runtime errors.
# option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF) # option(DEP_BUILD_IGL_STATIC "Build IGL as a static library. Might cause link errors and increase binary size." OFF)
message(STATUS "OrcaSlicer deps DESTDIR: ${DESTDIR}") message(STATUS "OrcaSlicer deps DESTDIR: ${DESTDIR} ${DESTDIR_MSG}")
message(STATUS "OrcaSlicer download dir for source packages: ${DEP_DOWNLOAD_DIR}") message(STATUS "OrcaSlicer download dir for source packages: ${DEP_DOWNLOAD_DIR}")
message(STATUS "OrcaSlicer deps debug build: ${DEP_DEBUG}") message(STATUS "OrcaSlicer deps debug build: ${DEP_DEBUG}")
@@ -144,39 +193,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
) )
elseif(FLATPAK)
# the only reason this is here is because of the HACK at the bottom for ci if (FLATPAK)
# # Free up space during flatpak builds to prevent running out of space during CI/CD
# 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) # note for future devs: shared libs may actually create a size reduction
# so, as much as I would like to use that, it's not happening # but orcaslicer_deps tends to get really funny regarding linking after that (notably boost)
ExternalProject_Add( # so, as much as I would like to use that, it's not happening
dep_${projectname} ExternalProject_Add_Step(dep_${projectname} free_download_space
EXCLUDE_FROM_ALL ON DEPENDEES download # do after download
INSTALL_DIR ${DESTDIR} COMMENT "Freeing Space: Removing source archive"
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname} WORKING_DIRECTORY ${DEP_DOWNLOAD_DIR}
${_gen} COMMAND ${CMAKE_COMMAND} -E rm -r ${projectname}
CMAKE_ARGS )
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR} ExternalProject_Add_Step(dep_${projectname} free_build_space
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules DEPENDEES install # do after install
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR} COMMENT "Freeing Space: Removing source and build files"
-DCMAKE_DEBUG_POSTFIX:STRING=d WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dep_${projectname}-prefix/src
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER} COMMAND ${CMAKE_COMMAND} -E rm -rf dep_${projectname} dep_${projectname}-build
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER} )
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE} endif ()
-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
# 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() else()
ExternalProject_Add( ExternalProject_Add(
dep_${projectname} dep_${projectname}
@@ -320,10 +356,10 @@ if (NOT JPEG_FOUND)
set(JPEG_PKG dep_JPEG) set(JPEG_PKG dep_JPEG)
endif() endif()
# flatpak builds wxwidgets separately # flatpak builds wxwidgets separately, so it is not included in the deps target
set(WXWIDGETS_PKG "") set(WXWIDGETS_PKG "")
include(wxWidgets/wxWidgets.cmake)
if (NOT FLATPAK) if (NOT FLATPAK)
include(wxWidgets/wxWidgets.cmake)
set(WXWIDGETS_PKG "dep_wxWidgets") set(WXWIDGETS_PKG "dep_wxWidgets")
endif() endif()

View File

@@ -8,7 +8,7 @@ else()
if(WIN32) if(WIN32)
set(_cross_arch "VC-WIN64A") set(_cross_arch "VC-WIN64A")
elseif(APPLE) elseif(APPLE)
set(_cross_arch "darwin64-arm64-cc") set(_cross_arch "darwin64-${CMAKE_OSX_ARCHITECTURES}-cc")
endif() endif()
endif() endif()

View File

@@ -1,5 +1,7 @@
set(_wx_toolkit "") set(_wx_toolkit "")
set(_wx_private_font "-DwxUSE_PRIVATE_FONTS=1") set(_wx_debug_postfix "")
set(_wx_shared -DwxBUILD_SHARED=OFF)
set(_wx_flatpak_patch "")
if(CMAKE_SYSTEM_NAME STREQUAL "Linux") if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
set(_gtk_ver 2) set(_gtk_ver 2)
@@ -9,6 +11,11 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
endif () endif ()
set(_wx_toolkit "-DwxBUILD_TOOLKIT=gtk${_gtk_ver}") set(_wx_toolkit "-DwxBUILD_TOOLKIT=gtk${_gtk_ver}")
if (FLATPAK)
set(_wx_debug_postfix "d")
set(_wx_shared -DwxBUILD_SHARED=ON -DBUILD_SHARED_LIBS:BOOL=ON)
set(_wx_flatpak_patch PATCH_COMMAND ${PATCH_CMD} ${CMAKE_CURRENT_LIST_DIR}/0001-flatpak.patch)
endif ()
endif() endif()
if (MSVC) if (MSVC)
@@ -17,34 +24,29 @@ 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 `scripts/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} ${JPEG_PKG} DEPENDS ${PNG_PKG} ${ZLIB_PKG} ${EXPAT_PKG} ${JPEG_PKG}
${_wx_flatpak_patch}
CMAKE_ARGS CMAKE_ARGS
-DwxBUILD_PRECOMP=ON -DwxBUILD_PRECOMP=ON
${_wx_toolkit} ${_wx_toolkit}
"-DCMAKE_DEBUG_POSTFIX:STRING=" "-DCMAKE_DEBUG_POSTFIX:STRING=${_wx_debug_postfix}"
-DwxBUILD_DEBUG_LEVEL=0 -DwxBUILD_DEBUG_LEVEL=0
-DwxBUILD_SAMPLES=OFF -DwxBUILD_SAMPLES=OFF
-DwxBUILD_SHARED=OFF ${_wx_shared}
-DwxUSE_MEDIACTRL=ON -DwxUSE_MEDIACTRL=ON
-DwxUSE_DETECT_SM=OFF -DwxUSE_DETECT_SM=OFF
-DwxUSE_UNICODE=ON -DwxUSE_UNICODE=ON
${_wx_private_font} -DwxUSE_PRIVATE_FONTS=ON
-DwxUSE_OPENGL=ON -DwxUSE_OPENGL=ON
-DwxUSE_WEBREQUEST=ON -DwxUSE_WEBREQUEST=ON
-DwxUSE_WEBVIEW=ON -DwxUSE_WEBVIEW=ON
${_wx_edge} ${_wx_edge}
-DwxUSE_WEBVIEW_IE=OFF -DwxUSE_WEBVIEW_IE=OFF
-DwxUSE_REGEX=builtin -DwxUSE_REGEX=builtin
-DwxUSE_LIBXPM=builtin
-DwxUSE_LIBSDL=OFF -DwxUSE_LIBSDL=OFF
-DwxUSE_XTEST=OFF -DwxUSE_XTEST=OFF
-DwxUSE_STC=OFF -DwxUSE_STC=OFF
@@ -53,7 +55,6 @@ orcaslicer_add_cmake_project(
-DwxUSE_ZLIB=sys -DwxUSE_ZLIB=sys
-DwxUSE_LIBJPEG=sys -DwxUSE_LIBJPEG=sys
-DwxUSE_LIBTIFF=OFF -DwxUSE_LIBTIFF=OFF
-DwxUSE_NANOSVG=OFF
-DwxUSE_EXPAT=sys -DwxUSE_EXPAT=sys
) )

View File

@@ -64,219 +64,54 @@ modules:
url: https://github.com/FreeSpacenav/libspnav/releases/download/v1.2/libspnav-1.2.tar.gz url: https://github.com/FreeSpacenav/libspnav/releases/download/v1.2/libspnav-1.2.tar.gz
sha256: 093747e7e03b232e08ff77f1ad7f48552c06ac5236316a5012db4269951c39db sha256: 093747e7e03b232e08ff77f1ad7f48552c06ac5236316a5012db4269951c39db
- 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=OFF \
-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: ../
- type: file
path: patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch
dest-filename: wxwidgets-dark-theme.patch
- type: shell
commands:
- patch -p1 < wxwidgets-dark-theme.patch
cleanup:
- "*.la"
- "*.a"
- "*.cmake"
- /include
- /app/bin/*
- name: orca_deps - name: orca_deps
build-options:
build-args:
- --share=network # allow cmake to download the needed deps
env:
BUILD_DIR: deps/build_flatpak
buildsystem: simple buildsystem: simple
build-commands: build-commands:
# start build # start build
- | - |
mkdir -p deps/build_flatpak && cd deps/build_flatpak cmake -S deps -B $BUILD_DIR \
cmake ../ \ -DFLATPAK=ON \
-DDEP_WX_GTK3=ON \
-DDEP_DOWNLOAD_DIR=/run/build/orca_deps/external-packages \ -DDEP_DOWNLOAD_DIR=/run/build/orca_deps/external-packages \
-DCMAKE_PREFIX_PATH=/app \ -DCMAKE_PREFIX_PATH=/app \
-DDESTDIR=/app \ -DDESTDIR=/app \
-DFLATPAK=ON \
-DCMAKE_INSTALL_PREFIX=/app -DCMAKE_INSTALL_PREFIX=/app
cmake --build . --parallel - cmake --build $BUILD_DIR --parallel --target dep_wxWidgets
rm -rf /run/build/orca_deps/external-packages - cmake --build $BUILD_DIR --parallel
- rm -rf /run/build/orca_deps/external-packages
cleanup: cleanup:
- /app/include - /app/include
- "*.a" - "*.a"
- "*.la" - "*.la"
sources: 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 # OrcaSlicer Source Archive
- type: dir - type: dir
path: ../../ path: ../../deps
dest: deps
# Blosc
- type: file - type: file
url: https://github.com/tamasmeszaros/c-blosc/archive/refs/heads/v1.17.0_tm.zip path: patches/0001-Enable-using-a-dark-theme-when-Gnome-dark-style-is-s.patch
dest: external-packages/Blosc dest: deps/wxWidgets
sha256: dcb48bf43a672fa3de6a4b1de2c4c238709dad5893d1e097b8374ad84b1fc3b3 dest-filename: 0001-flatpak.patch
# 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
# curl
- type: file
url: https://github.com/curl/curl/archive/refs/tags/curl-7_75_0.zip
dest: external-packages/CURL
sha256: a63ae025bb0a14f119e73250f2c923f4bf89aa93b8d4fafa4a9f5353a96a765a
# MPFR
- type: file
url: https://www.mpfr.org/mpfr-4.2.2/mpfr-4.2.2.tar.bz2
dest: external-packages/MPFR
sha256: 9ad62c7dc910303cd384ff8f1f4767a655124980bb6d8650fe62c815a231bb7b
# 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
# OpenSSL
- type: file
url: https://github.com/openssl/openssl/archive/OpenSSL_1_1_1w.tar.gz
dest: external-packages/OpenSSL
sha256: 2130e8c2fb3b79d1086186f78e59e8bc8d1a6aedf17ab3907f4cb9ae20918c41
# 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
# libnoise
- type: file
url: https://github.com/SoftFever/Orca-deps-libnoise/archive/refs/tags/1.0.zip
dest: external-packages/libnoise
sha256: 96ffd6cc47898dd8147aab53d7d1b1911b507d9dbaecd5613ca2649468afd8b6
- name: OrcaSlicer - name: OrcaSlicer
buildsystem: simple buildsystem: simple
build-commands: build-commands:
- | - |
mkdir -p build_flatpak cmake . -B build_flatpak \
CXXFLAGS=-std=gnu++20 cmake . -B build_flatpak \
-DSLIC3R_PCH=OFF \
-DSLIC3R_FHS=ON \
-DSLIC3R_GTK=3 \
-DSLIC3R_STATIC=ON \
-DBUILD_TESTS=OFF \
-DSLIC3R_DESKTOP_INTEGRATION=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DFLATPAK=ON \ -DFLATPAK=ON \
-DBBL_RELEASE_TO_PUBLIC=1 \ -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH=/app \ -DCMAKE_PREFIX_PATH=/app \
-DCMAKE_INSTALL_PREFIX=/app -DCMAKE_INSTALL_PREFIX=/app
CXXFLAGS=-std=gnu++20 cmake --build build_flatpak --target OrcaSlicer -j$FLATPAK_BUILDER_N_JOBS - cmake --build build_flatpak --target OrcaSlicer -j$FLATPAK_BUILDER_N_JOBS
./scripts/run_gettext.sh - ./scripts/run_gettext.sh
CXXFLAGS=-std=gnu++20 cmake --build build_flatpak --target install -j$FLATPAK_BUILDER_N_JOBS - cmake --build build_flatpak --target install -j$FLATPAK_BUILDER_N_JOBS
cleanup: cleanup:
- /include - /include
@@ -292,16 +127,29 @@ modules:
install -Dm755 umount /app/bin install -Dm755 umount /app/bin
sources: 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 # OrcaSlicer Source Archive
- type: dir - type: dir
path: ../../ path: ../../cmake
dest: cmake
- type: dir
path: ../../deps_src
dest: deps_src
- type: dir
path: ../../resources
dest: resources
- type: dir
path: ../../src
dest: src
- type: file
path: ../../CMakeLists.txt
- type: file
path: ../../LICENSE.txt
- type: file
path: ../../version.inc
- type: file
path: ../run_gettext.sh
dest: scripts
# AppData metainfo for Gnome Software & Co. # AppData metainfo for Gnome Software & Co.
- type: file - type: file

View File

@@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# these are the Arch Linux specific build functions # these are the Arch Linux specific build functions
export FOUND_GTK3
FOUND_GTK3=$(pacman -Q gtk3)
# Addtional Dev packages for OrcaSlicer # Addtional Dev packages for OrcaSlicer
export REQUIRED_DEV_PACKAGES=( export REQUIRED_DEV_PACKAGES=(
@@ -45,4 +43,4 @@ then
fi fi
export FOUND_GTK3_DEV export FOUND_GTK3_DEV
FOUND_GTK3_DEV=${FOUND_GTK3} FOUND_GTK3_DEV=$(pacman -Q gtk3)

View File

@@ -1,7 +1,5 @@
#!/bin/bash #!/bin/bash
# these are the Clear Linux specific build functions # these are the Clear Linux specific build functions
export FOUND_GTK3
FOUND_GTK3=$(find /usr/lib64/libgtk-3.so.* 2>/dev/null | tail -n 1 || true)
# Addtional bundles for OrcaSlicer # Addtional bundles for OrcaSlicer
export REQUIRED_BUNDLES=( export REQUIRED_BUNDLES=(

View File

@@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
export FOUND_GTK3
FOUND_GTK3=$(dpkg -l libgtk* | grep gtk-3 || echo '')
REQUIRED_DEV_PACKAGES=( REQUIRED_DEV_PACKAGES=(
autoconf autoconf

View File

@@ -1,6 +1,4 @@
#!/bin/bash #!/bin/bash
export FOUND_GTK3
FOUND_GTK3=$(rpm -qa | grep -P '^gtk3' || true)
REQUIRED_DEV_PACKAGES=( REQUIRED_DEV_PACKAGES=(
autoconf autoconf

View File

@@ -9,6 +9,8 @@ add_subdirectory(dev-utils)
# add_subdirectory(avrdude) # add_subdirectory(avrdude)
# Note: semver and hints are now included from deps_src/CMakeLists.txt # Note: semver and hints are now included from deps_src/CMakeLists.txt
find_package(libnoise REQUIRED)
add_subdirectory(libslic3r) add_subdirectory(libslic3r)
if (SLIC3R_GUI) if (SLIC3R_GUI)

View File

@@ -564,7 +564,6 @@ set(OCCT_LIBS
TKernel TKernel
) )
find_package(libnoise REQUIRED)
target_link_libraries(libslic3r target_link_libraries(libslic3r
PUBLIC PUBLIC
admesh admesh

View File

@@ -10,7 +10,6 @@
#endif #endif
#define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@" #define SLIC3R_BUILD_ID "@SLIC3R_BUILD_ID@"
//#define SLIC3R_RC_VERSION "@SLIC3R_VERSION@" //#define SLIC3R_RC_VERSION "@SLIC3R_VERSION@"
#define BBL_RELEASE_TO_PUBLIC @BBL_RELEASE_TO_PUBLIC@
#define BBL_INTERNAL_TESTING @BBL_INTERNAL_TESTING@ #define BBL_INTERNAL_TESTING @BBL_INTERNAL_TESTING@
#define ORCA_CHECK_GCODE_PLACEHOLDERS @ORCA_CHECK_GCODE_PLACEHOLDERS@ #define ORCA_CHECK_GCODE_PLACEHOLDERS @ORCA_CHECK_GCODE_PLACEHOLDERS@

View File

@@ -687,7 +687,6 @@ source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SLIC3R_GUI_SOURCES})
encoding_check(libslic3r_gui) encoding_check(libslic3r_gui)
find_package(libnoise REQUIRED)
target_link_libraries(libslic3r_gui libslic3r cereal::cereal imgui imguizmo minilzo GLEW::GLEW OpenGL::GL hidapi ${wxWidgets_LIBRARIES} glfw libcurl OpenSSL::SSL OpenSSL::Crypto noise::noise) target_link_libraries(libslic3r_gui libslic3r cereal::cereal imgui imguizmo minilzo GLEW::GLEW OpenGL::GL hidapi ${wxWidgets_LIBRARIES} glfw libcurl OpenSSL::SSL OpenSSL::Crypto noise::noise)
if (MSVC) if (MSVC)

View File

@@ -4,9 +4,6 @@
set(SLIC3R_APP_NAME "OrcaSlicer") set(SLIC3R_APP_NAME "OrcaSlicer")
set(SLIC3R_APP_KEY "OrcaSlicer") set(SLIC3R_APP_KEY "OrcaSlicer")
if(NOT DEFINED BBL_RELEASE_TO_PUBLIC)
set(BBL_RELEASE_TO_PUBLIC "1")
endif()
if(NOT DEFINED BBL_INTERNAL_TESTING) if(NOT DEFINED BBL_INTERNAL_TESTING)
set(BBL_INTERNAL_TESTING "0") set(BBL_INTERNAL_TESTING "0")
endif() endif()