mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-10-03 05:41:10 +00:00
* Add developer flag for printer agents
* Parse user print info on the UI thread to prevent heap corruption (#119)
get_user_print_info()'s HTTP fetch can run on a worker thread (e.g. BindJob),
but parse_user_print_info() mutates userMachineList (insert/erase/delete
MachineObject). on_machine_alive (SSDP) mutates the same maps on the UI thread
without locking, so parsing off-thread races the map and frees MachineObjects
out from under it -> heap corruption.
Keep all device-list mutation on the UI thread: parse inline when already on
the main thread, otherwise marshal via CallAfter so it stays serialized with
on_machine_alive.
* Prevent loss of user access code on LAN reselect
Keep user access code intact to maintain access rights even if
device slot is unpopulated, ensuring continuous connection
and status message reception.
* Harden send flow and separate upload failure recovery (#111)
* fix(send): harden FT send path + IP pre-flight UX
* Remove early returns
* Working Moonraker and Qidi printer agent transport (#104)
Folds the Qidi AMS box-mapping print
overrides (apply_box_mapping +
start_* wrappers) that the transport
fix builds on.
* Add support for runtime error status in plugins
Distinguish a loaded plugin whose
capability errored (RuntimeError,
warn-styled, stays checked) from a
load-time Error. Status now derives
via resolve_plugin_status(); enum
ordinal keeps dialog sort priority.
Unloading clears stale errors.
* Resolve duplicate agent ID conflicts
Reject a printer-agent capability
whose agent ID is already owned by
another capability or built-in:
flag the plugin error, disable the
capability, and warn the user
instead of silently ignoring it.
* fix: checkbox should depend on plugin is_loaded status
* Replace fake-enum printer agent dropdown (#121)
A dedicated PrinterAgentChoice field
reads rows straight from the live
agent registry and stores the agent
id string, replacing the fake-coEnum
index mapping. The field moves to
TabPrinter and registers with the
searcher so UnsavedChanges renders
it; the PhysicalPrinterDialog copy
and its update hook are removed
(#125). switch_printer_agent now
resolves ids via
resolve_printer_agent_id.
* Reset device selection on agent swap or unload (#124)
set_live_printer_agent centralizes
the swap: deselect the machine,
clear stale sidebar state and the
previous agent's Other Devices, then
install the new agent (or null when
its provider vanished). Plugin
load/unload callbacks refresh the
dropdown and re-run agent selection.
load_last_machine no longer falls
back to the first available machine.
* Gate agent mode behind use_printer_agents toggle
Replace per-printer auto-activation
(is_current_printer_agent_plugin)
with a global experimental AppConfig
toggle, default off: legacy
print-host behavior is unchanged
until the user opts in. The toggle
drives device-tab routing, print
button defaults, connect-button
visibility and sidebar layout, and
dedups machine-select dialog opens.
* Track BBLPrinterAgentPlugin.py
* Add printer-agent and plugin status tests
Ports the agent lifecycle, duplicate
agent-id, built-in-id clash and
status-resolution tests. The loader
runs on a detached worker thread, so
the lifecycle tests live in their own
executable. Tests install the
production unload-side registry
wiring themselves (no GUI in the
test binary) and register agents
manually so concurrent loads stay
deterministic.
* fix: pin HTTP to prevent connection refusal
Set `use_ssl` to false to ensure Moonraker
connectivity, as the service uses HTTP rather
than HTTPS, preventing connection issues. Initialize
device info early for reliable name resolution.
* Bring Moonraker device panel to feature parity
The monitor panel showed wrong or missing
data for Moonraker printers, and its
controls did nothing.
Push payload now carries layer number and
total layers. Remaining time replaces the
wrong total_duration - print_duration
formula. The chamber light toggle maps to
Klipper SET_PIN / SET_LED, and pause,
resume and stop post to
/printer/print/{action}. Task thumbnails
resolve via /server/files/thumbnails onto
a new MachineObject thumbnail url.
Filament sync switches to pull mode so the
agent is queried on demand.
Not compiled or run.
* Stop blocking print on unreported nozzle data
* fix: make Klipper macro lamp control reliable
* Surface Moonraker webcams and gate unrunnable controls
* Keep Bambu AMS dialect out of the agent waist
M620 is Bambu firmware dialect, not a
neutral command. Composing it in
MachineObject let non-Bambu agents
(Moonraker/Klipper) forward it and
report success on firmware that
cannot run it.
Agents now own the dialect: the
default refusal on IPrinterAgent
returns not-supported so the UI
can say so; BBLPrinterAgent keeps
the byte-identical composition.
* Fix multi-color filament logic
Reuse color decoding across functions to improve
code readability and maintain consistency in
multi-color filament handling.
* Move Moonraker commands off the UI thread
Pause/resume/stop, g-code sends, temps, and
light ran synchronous HTTP on the UI thread,
freezing the app up to 10s per click on slow
or unreachable printers.
Run them on a single agent-owned FIFO worker
so g-code ordering is preserved, while command
translation stays synchronous so unsupported-
command dialogs still work.
Add a pending-disabled state to the pause,
resume, and abort buttons for Moonraker-family
printers: the icon only flips once the
WebSocket reports the real state, which also
rules out double-click races.
* Show Snapmaker U1 camera in Device tab
The U1 exposes no /server/webcams/list entry;
its camera only captures after an explicit
camera.start_monitor RPC, which the Moonraker
websocket executes unauthenticated but only
answers over MQTT - so the call is fire and
forget.
Start the camera when the camera view is
shown and renew every 300 s: the printer
retires the capture task at ~362 s and
stop_monitor is accepted but ineffective,
so teardown is simply to stop renewing.
Frames land in monitor.jpg as still JPEGs
(~2 fps at interval 0), so the webview loads
a local HTML wrapper that repolls with a
cache buster.
* fix: start stream when camera URL changes
* fix: stop Qidi slot parse throwing on null
* Keep printer-agent progress in sync
Keep the shared task progress aligned with agent
reports that lack Bambu cloud task identity.
Release the lazily allocated task during reset to
avoid leaks when machine objects reconnect.
* docs: document the printer-agent subsystem
* fix: merge access codes into one
* Reconcile implementation split with PR tip
* feat: abstract remaining gcode commands in devicemanager
* refactor: abstract bambu specific protocol to printer agent
* refactor: push bbl workflows to bbl printer agent
* remove unused
* fix: default impl
* fix callback error
* fix: remove redundant cache
* specify api for getting file transfer url
* revert file transfer abstraction
* fix: ams filament mapping workflow
* feat: update qidi to use subscription based filament sync mode
* fix: resolve stubgen byte header conflict
* fix: ams sync info and periodic ams sync via subscription workflow
* fix: skip filament sync dialog if filamentSyncMode is none
* feat: parse nozzle information for qidi and moonraker printer agents
* fix: extend access code requirements t 0, 8 or more characters.
* remove irrelevant docs
* fix: remove heavy includes from IPrinterAgent
* fix: defer filesystem and camera abstractions
* fix: remote do_fetch_filament_info from tests
* cleanup moonraker and snapmaker printer agents
* fix: access codes regression
* fix: tests
* fix: printer agent switching on preset change
* fix: remove unused variable
* fix: snapmaker U1 SelectMachineDialog blocking print
* fix: merge artifact
* fix: clear up some unrelated changes
* feat: connect to cloud printer and monitor
* feat: connect to cloud printer and monitor
* feat: generic camera stream support for http snapshot and rtsp
* fix: build & access code UI
* feat: generic camera stream support for http snapshot and rtsp
* fix: build & access code UI
* feat: connect to cloud printer and monitor
* feat: connect to cloud printer and monitor
* fix: build errors
* feat: camera via webrtc
* fix: build
* fix: cmake
* feat: remove frame assembler and change config to set protocol
* fix: orcaprinteragent refactor
* fix: LAN paths and camera stream
* feat: use ffmpeg to render http camera stream
* fix: make model_id/dev_type optional instead of blocking
* fix: connect via ip dialog
* feat: LAN impl for Orca Printer Agent
* fix: model_id resolution method for non bambu printers
* fix: ffmpeg http camera stream jittering due to incomplete frames
* fix: revert sdcard check
* feat: check printer storage status before sending
* fix: moonraker printer agent hang on printer power cut
* fix: shim layer for any compatibiliity changes
* fix: cloud printers were using the wrong MQTT endpoint
* feat: cloud download via HTTP
* temp: doc for intended change
* fix: warnings
* fix: warnings
* fix: camera auto-play on startup
* fix: split infra from impl
* fix: uninitialized ams state blocking print
* Fixes nullptr deref
* Log first before std::move
* fix: printer agent virutal optional functions
* fix: parameterize orcaslicer_copy_test_dlls() for printer_agent_plugin_tests
* Revert "fix: parameterize orcaslicer_copy_test_dlls() for printer_agent_plugin_tests"
This reverts commit 2f566e3779.
* Guard libdatachannel. Remove unused code
* fix: unit tests & unused variables
* fix(ci): deps build order for datachannel
* Resolve printer agent first before getting cloud printer agent
* fix(ci): set depends openssl
* fix: re-include apply header guarded by ifdef __APPLE__
* fix(ci): add libdatachannel to flatpak manifest
* fix: add internal_developer_mode chekc back to MediaPlayCtrl::load()
* fix: invoke js clearInterval on WebMediaController::stop
* fix: change rtc log level
* fix: inject provider, agent id and generation to get_user_print_info to ensure correct metadata
* fix: revert moonraker specific behavior
* fix: remove stale comment
* fix: use ORCA_CLOUD_PROVIDER instead of hardcoded string
* fix: remove hardcoded ICE servers
* feat: enable https camera stream mode
* fix: move non-mandatory printer agent function stubs to IPrinterAgent
* fix: dedupe compatible printer type check
* fix: stop the correct media controller
* fix: scope get_my_machine_list to printers listed under the current printer agent
* fix: move printer agent plugin tests into test_plugin_lifecycle.cpp
* fix: always build bundled DataChannel dep
* fix: disable unused DataChannel media support
* revert: filament sync work
* fix: wrap command_* with small wrapper
* fix: regression bug, connecting to bambu needs bblp username
* fix: default impl for vendor agnostic gcode commansd
* refactor: media controller playback routing and ownership
* fix: bump libdatachannel ver & update flatpak to use tar instead
* fix: stop flatpak DataChannel build from re-cloning over the sandboxed network
* fix: update windows ffmpeg prebuild
* fix: update printer agent plugin API
* fix: shift camera signaling channel to network agent
* fix: follow external-packages for flatpak libdatachannel deps & add flatpak path to use source_dir
* feat: add printer-agent.md doc to HLSD
* fix: guard DeviceManager command dispatch when no printer agent is bound
* fix: port BBL implementations from #15711
* refactor: connect_printer api and dialog
* fix(tests): make omitted printer agent operations answer like a missing agent
* fix: preserve printer agent defaults in PrinterAgentPluginCapabilityTrampoline
* test: cover printer agent default command dispatch
* fix: validate windows FFmpeg avformat library
* feat: extend optional printer model warnings to calibration & ams workflows
* fix: handle malformed printer progress values safely
* fix: clear webview document on stop
* chore: reduce diagnostic logging level to trace
* refactor: centralize printer compatibility checks
* tests: add device manager integration coverage
* tests: cover WebMediaController lifecycle with wxWebView stub
* fix: make integration tests headless
* refactor: collapse command_ams_refresh_rfid and command_ams_refresh_rfid2
* refactor: make printer connection SSL agent-specific
* fix: persist input printer host and port
* fix: use correct device id for Moonraker connections
* fix: make moonraker gcode commands asynchronous
* fix: preserve moonraker device names
* fix: add include for non BBL_RELEASE_TO_PUBLIC path in BBLPrinterAgent
---------
Co-authored-by: Andrew <159703254+andrewsoonqn@users.noreply.github.com>
Co-authored-by: SoftFever <softfeverever@gmail.com>
Co-authored-by: Lam Wei Lun <weilun.lam@gmail.com>
513 lines
19 KiB
CMake
513 lines
19 KiB
CMake
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "4.0")
|
||
set(CMAKE_POLICY_VERSION_MINIMUM 3.5 CACHE STRING "" FORCE)
|
||
endif()
|
||
|
||
#
|
||
# This CMake project downloads, configures and builds OrcaSlicer dependencies on Unix and Windows.
|
||
#
|
||
# When using this script, it's recommended to perform an out-of-source build using CMake.
|
||
#
|
||
# All the dependencies are installed in a `destdir` directory in the root of the build directory,
|
||
# in a traditional Unix-style prefix structure. The destdir can be used directly by CMake
|
||
# when building OrcaSlicer - to do this, set the CMAKE_PREFIX_PATH to ${destdir}/usr/local.
|
||
# Warning: On UNIX/Linux, you also need to set -DSLIC3R_STATIC=1 when building OrcaSlicer.
|
||
#
|
||
# For better clarity of console output, it's recommended to _not_ use a parallelized build
|
||
# for the top-level command, ie. use `make -j 1` or `ninja -j 1` to force single-threaded top-level
|
||
# build. This doesn't degrade performance as individual dependencies are built in parallel fashion
|
||
# if supported by the dependency.
|
||
#
|
||
# On Windows, architecture (64 vs 32 bits) is judged based on the compiler variant.
|
||
# To build dependencies for either 64 or 32 bit OS, use the respective compiler command line.
|
||
#
|
||
# WARNING: On UNIX platforms wxWidgets hardcode the destdir path into its `wx-config` utility,
|
||
# therefore, unfortunately, the installation cannot be copied/moved elsewhere without re-installing wxWidgets.
|
||
#
|
||
|
||
cmake_minimum_required(VERSION 3.2)
|
||
if (APPLE)
|
||
# if CMAKE_OSX_DEPLOYMENT_TARGET is not set, set it to 12.0 (the lowest Xcode 27 accepts)
|
||
if (NOT CMAKE_OSX_DEPLOYMENT_TARGET)
|
||
set(CMAKE_OSX_DEPLOYMENT_TARGET "12.0" CACHE STRING "Minimum OS X deployment version" FORCE)
|
||
endif ()
|
||
message(STATUS "CMAKE_OSX_DEPLOYMENT_TARGET: ${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||
|
||
endif ()
|
||
|
||
if(POLICY CMP0135) # DOWNLOAD_EXTRACT_TIMESTAMP
|
||
cmake_policy(SET CMP0135 NEW)
|
||
endif()
|
||
|
||
# project() reads this, so set it first. scripts/flatpak/make_deps_tar.sh packs deps/
|
||
# without cmake/, so the file is missing in a Flatpak build.
|
||
set(_rules_override "${CMAKE_CURRENT_LIST_DIR}/../cmake/modules/ClangClShowIncludes.cmake")
|
||
if (EXISTS "${_rules_override}")
|
||
set(CMAKE_USER_MAKE_RULES_OVERRIDE "${_rules_override}")
|
||
endif ()
|
||
unset(_rules_override)
|
||
|
||
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(ProcessorCount)
|
||
|
||
ProcessorCount(NPROC)
|
||
if (NPROC EQUAL 0)
|
||
set(NPROC 1)
|
||
endif ()
|
||
|
||
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")
|
||
option(SLIC3R_CAD "Build the SolveSpace solver and OCCT ModelingAlgorithms module the parametric Design/CAD tab needs. Must match the main project's SLIC3R_CAD." ON)
|
||
|
||
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)
|
||
set(DESTDIR "${DESTDIR}/usr/local/")
|
||
endif()
|
||
|
||
get_property(_is_multi GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
|
||
|
||
if (_is_multi)
|
||
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(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 ()
|
||
|
||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||
option(DEP_WX_GTK3 "Build wxWidgets against GTK3" ON)
|
||
endif()
|
||
|
||
set(IS_CROSS_COMPILE FALSE)
|
||
|
||
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_APPBUNDLE LAST)
|
||
list(FIND CMAKE_OSX_ARCHITECTURES ${CMAKE_SYSTEM_PROCESSOR} _arch_idx)
|
||
message(STATUS "prusaslicer_add_cmake_project for Apple")
|
||
if (CMAKE_OSX_ARCHITECTURES AND _arch_idx LESS 0)
|
||
message(STATUS "prusaslicer_add_cmake_project for Apple crosscompiling")
|
||
set(IS_CROSS_COMPILE TRUE)
|
||
set(CMAKE_CXX_COMPILER_ID "Clang")
|
||
string(REPLACE ";" "$<SEMICOLON>" CMAKE_OSX_ARCHS "${CMAKE_OSX_ARCHITECTURES}")
|
||
set(_cmake_osx_arch -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHS})
|
||
set(_cmake_args_osx_arch CMAKE_ARGS -DCMAKE_OSX_ARCHITECTURES:STRING=${CMAKE_OSX_ARCHS})
|
||
message(STATUS "Detect Cross-compilation. Will build for target ${CMAKE_OSX_ARCHS}" )
|
||
endif ()
|
||
endif ()
|
||
|
||
|
||
# On developer machines, it can be enabled to speed up compilation and suppress warnings coming from IGL.
|
||
# FIXME:
|
||
# Enabling this option is not safe. IGL will compile itself with its own version of Eigen while
|
||
# 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)
|
||
|
||
message(STATUS "OrcaSlicer deps DESTDIR: ${DESTDIR} ${DESTDIR_MSG}")
|
||
message(STATUS "OrcaSlicer download dir for source packages: ${DEP_DOWNLOAD_DIR}")
|
||
message(STATUS "OrcaSlicer deps debug build: ${DEP_DEBUG}")
|
||
|
||
find_package(Git REQUIRED)
|
||
|
||
# The default command line for patching. Only works for newer
|
||
set(PATCH_CMD ${GIT_EXECUTABLE} apply --verbose --ignore-space-change --whitespace=fix)
|
||
|
||
if (NOT _is_multi AND NOT CMAKE_BUILD_TYPE)
|
||
set(CMAKE_BUILD_TYPE Release)
|
||
message(STATUS "Forcing CMAKE_BUILD_TYPE to Release as it was not specified.")
|
||
endif ()
|
||
|
||
function(orcaslicer_add_cmake_project projectname)
|
||
cmake_parse_arguments(P_ARGS "FORWARD_CONFIG" "INSTALL_DIR;BUILD_COMMAND;INSTALL_COMMAND;SOURCE_DIR" "CMAKE_ARGS" ${ARGN})
|
||
|
||
# MSVC is true for clang-cl as well, so the sub-build toolchain has to key on the
|
||
# generator. A non-Visual-Studio superbuild passes its own generator down, and with
|
||
# it the CMAKE_C_COMPILER / CMAKE_CXX_COMPILER forwarded below.
|
||
set(_dep_msvc_gen FALSE)
|
||
if (MSVC AND CMAKE_GENERATOR MATCHES "Visual Studio")
|
||
set(_dep_msvc_gen TRUE)
|
||
endif ()
|
||
|
||
set(_configs_line -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
|
||
if (_is_multi OR _dep_msvc_gen)
|
||
if (P_ARGS_FORWARD_CONFIG)
|
||
set(_configs_line -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE})
|
||
elseif (ORCA_INCLUDE_DEBUG_INFO AND NOT DEP_DEBUG)
|
||
set(_configs_line "-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO} -DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
|
||
else ()
|
||
set(_configs_line "")
|
||
endif ()
|
||
endif ()
|
||
|
||
if (P_ARGS_FORWARD_CONFIG)
|
||
set(_target_config "$<CONFIG>")
|
||
else()
|
||
set(_target_config "Release")
|
||
endif()
|
||
|
||
if (_dep_msvc_gen)
|
||
set(_gen CMAKE_GENERATOR "${DEP_MSVC_GEN}" CMAKE_GENERATOR_PLATFORM "${DEP_PLATFORM}")
|
||
# The toolset picks the compiler here, not the CMAKE_<LANG>_COMPILER
|
||
# forwarded below, so without it a clang-cl superbuild builds with cl.
|
||
if (CMAKE_GENERATOR_TOOLSET)
|
||
list(APPEND _gen CMAKE_GENERATOR_TOOLSET "${CMAKE_GENERATOR_TOOLSET}")
|
||
endif ()
|
||
else()
|
||
set(_gen "")
|
||
endif()
|
||
|
||
if ($ENV{CMAKE_BUILD_PARALLEL_LEVEL})
|
||
set(_build_j "") # assume environment will control --build parallel setting
|
||
elseif(_dep_msvc_gen)
|
||
set(_build_j "/m")
|
||
else()
|
||
set(_build_j "-j${NPROC}")
|
||
endif ()
|
||
|
||
set(_source_dir_arg "")
|
||
if (P_ARGS_SOURCE_DIR)
|
||
set(_source_dir_arg SOURCE_DIR ${P_ARGS_SOURCE_DIR})
|
||
endif ()
|
||
|
||
if (NOT IS_CROSS_COMPILE OR NOT APPLE)
|
||
ExternalProject_Add(
|
||
dep_${projectname}
|
||
EXCLUDE_FROM_ALL ON
|
||
INSTALL_DIR ${DESTDIR}
|
||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||
${_source_dir_arg}
|
||
${_gen}
|
||
CMAKE_ARGS
|
||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
|
||
-DCMAKE_MODULE_PATH:STRING=${PROJECT_SOURCE_DIR}/../cmake/modules
|
||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
|
||
-DCMAKE_IGNORE_PREFIX_PATH:STRING=${CMAKE_IGNORE_PREFIX_PATH}
|
||
-DCMAKE_DEBUG_POSTFIX:STRING=d
|
||
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
|
||
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
|
||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=${CMAKE_C_COMPILER_LAUNCHER}
|
||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=${CMAKE_CXX_COMPILER_LAUNCHER}
|
||
-DCMAKE_USER_MAKE_RULES_OVERRIDE:STRING=${CMAKE_USER_MAKE_RULES_OVERRIDE}
|
||
-DCMAKE_TOOLCHAIN_FILE:STRING=${CMAKE_TOOLCHAIN_FILE}
|
||
-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}
|
||
-DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
|
||
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
|
||
-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 ${_target_config} -- ${_build_j}
|
||
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${_target_config}
|
||
)
|
||
|
||
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)
|
||
# so, as much as I would like to use that, it's not happening
|
||
if (NOT P_ARGS_SOURCE_DIR)
|
||
ExternalProject_Add_Step(dep_${projectname} free_download_space
|
||
DEPENDEES download # do after download
|
||
COMMENT "Freeing Space: Removing source archive"
|
||
WORKING_DIRECTORY ${DEP_DOWNLOAD_DIR}
|
||
COMMAND ${CMAKE_COMMAND} -E rm -rf ${projectname}
|
||
)
|
||
endif ()
|
||
ExternalProject_Add_Step(dep_${projectname} free_build_space
|
||
DEPENDEES install # do after install
|
||
COMMENT "Freeing Space: Removing source and build files"
|
||
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/dep_${projectname}-prefix/src
|
||
COMMAND ${CMAKE_COMMAND} -E rm -rf dep_${projectname} dep_${projectname}-build
|
||
)
|
||
endif ()
|
||
else()
|
||
ExternalProject_Add(
|
||
dep_${projectname}
|
||
EXCLUDE_FROM_ALL ON
|
||
INSTALL_DIR ${DESTDIR}
|
||
DOWNLOAD_DIR ${DEP_DOWNLOAD_DIR}/${projectname}
|
||
${_source_dir_arg}
|
||
${_gen}
|
||
CMAKE_ARGS
|
||
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
|
||
-DCMAKE_INSTALL_PREFIX:STRING=${DESTDIR}
|
||
-DCMAKE_PREFIX_PATH:STRING=${DESTDIR}
|
||
-DCMAKE_IGNORE_PREFIX_PATH:STRING=${CMAKE_IGNORE_PREFIX_PATH}
|
||
-DCMAKE_C_COMPILER_LAUNCHER:STRING=${CMAKE_C_COMPILER_LAUNCHER}
|
||
-DCMAKE_CXX_COMPILER_LAUNCHER:STRING=${CMAKE_CXX_COMPILER_LAUNCHER}
|
||
-DCMAKE_USER_MAKE_RULES_OVERRIDE:STRING=${CMAKE_USER_MAKE_RULES_OVERRIDE}
|
||
-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 ${_target_config} -- ${_build_j}
|
||
INSTALL_COMMAND ${CMAKE_COMMAND} --build . --target install --config ${_target_config}
|
||
)
|
||
|
||
endif()
|
||
|
||
endfunction(orcaslicer_add_cmake_project)
|
||
|
||
|
||
if (MSVC)
|
||
if ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
|
||
message(STATUS "\nDetected X64 compiler => building X64 deps bundle\n")
|
||
set(DEPS_ARCH "x64")
|
||
include("deps-windows.cmake")
|
||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "X86")
|
||
message(STATUS "\nDetected X86 compiler => building X86 deps bundle\n")
|
||
set(DEPS_ARCH "x86")
|
||
include("deps-windows.cmake")
|
||
elseif ("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ARM64")
|
||
message(STATUS "\nDetected ARM64 compiler => building ARM64 deps bundle\n")
|
||
set(DEPS_ARCH "arm64")
|
||
include("deps-windows.cmake")
|
||
else ()
|
||
message(FATAL_ERROR "Unable to detect architecture: ${CMAKE_SYSTEM_PROCESSOR}")
|
||
endif ()
|
||
elseif (APPLE)
|
||
message("OS X SDK Path: ${CMAKE_OSX_SYSROOT}")
|
||
if (CMAKE_OSX_DEPLOYMENT_TARGET)
|
||
set(DEP_OSX_TARGET "${CMAKE_OSX_DEPLOYMENT_TARGET}")
|
||
message("OS X Deployment Target: ${DEP_OSX_TARGET}")
|
||
else ()
|
||
# Attempt to infer the SDK version from the CMAKE_OSX_SYSROOT,
|
||
# this is done because wxWidgets need the min version explicitly set
|
||
string(REGEX MATCH "[0-9]+[.][0-9]+[.]sdk$" DEP_OSX_TARGET "${CMAKE_OSX_SYSROOT}")
|
||
string(REGEX MATCH "^[0-9]+[.][0-9]+" DEP_OSX_TARGET "${DEP_OSX_TARGET}")
|
||
|
||
if (NOT DEP_OSX_TARGET)
|
||
message(FATAL_ERROR "Could not determine OS X SDK version. Please use -DCMAKE_OSX_DEPLOYMENT_TARGET=<version>")
|
||
endif ()
|
||
|
||
message("OS X Deployment Target (inferred from SDK): ${DEP_OSX_TARGET}")
|
||
endif ()
|
||
|
||
include("deps-macos.cmake")
|
||
elseif (MINGW)
|
||
message(STATUS "Building for MinGW...")
|
||
include("deps-mingw.cmake")
|
||
else()
|
||
include("deps-linux.cmake")
|
||
endif()
|
||
|
||
if(FLATPAK)
|
||
# flatpak bundles some deps with the layer, so attempt to find them first
|
||
# also, yes, this reduces CI by not needing to vendor certain deps
|
||
find_package(ZLIB)
|
||
find_package(PNG)
|
||
find_package(EXPAT)
|
||
find_package(CURL)
|
||
find_package(JPEG)
|
||
find_package(Freetype)
|
||
find_package(OpenSSL 1.1...<3.2)
|
||
find_package(CURL)
|
||
endif()
|
||
|
||
set(ZLIB_PKG "")
|
||
if (NOT ZLIB_FOUND)
|
||
include(ZLIB/ZLIB.cmake)
|
||
set(ZLIB_PKG dep_ZLIB)
|
||
endif ()
|
||
set(PNG_PKG "")
|
||
if (NOT PNG_FOUND)
|
||
include(PNG/PNG.cmake)
|
||
set(PNG_PKG dep_PNG)
|
||
endif ()
|
||
set(EXPAT_PKG "")
|
||
find_package(EXPAT)
|
||
if (NOT EXPAT_FOUND)
|
||
include(EXPAT/EXPAT.cmake)
|
||
set(EXPAT_PKG dep_EXPAT)
|
||
endif ()
|
||
|
||
# The order of includes respects the dependencies between libraries
|
||
set(DEP_Boost_COMPONENTS system iostreams filesystem thread log locale regex date_time)
|
||
include(Boost/Boost.cmake)
|
||
|
||
include(Cereal/Cereal.cmake)
|
||
include(Qhull/Qhull.cmake)
|
||
include(GLEW/GLEW.cmake)
|
||
|
||
include(GLFW/GLFW.cmake)
|
||
include(OpenCSG/OpenCSG.cmake)
|
||
set(SLVS_PKG "")
|
||
if (SLIC3R_CAD)
|
||
include(SLVS/SLVS.cmake)
|
||
set(SLVS_PKG dep_SLVS)
|
||
endif ()
|
||
|
||
include(TBB/TBB.cmake)
|
||
|
||
include(Blosc/Blosc.cmake)
|
||
include(OpenEXR/OpenEXR.cmake)
|
||
include(OpenVDB/OpenVDB.cmake)
|
||
|
||
include(GMP/GMP.cmake)
|
||
include(MPFR/MPFR.cmake)
|
||
include(Eigen/Eigen.cmake)
|
||
include(CGAL/CGAL.cmake)
|
||
|
||
include(NLopt/NLopt.cmake)
|
||
include(libnoise/libnoise.cmake)
|
||
|
||
include(Draco/Draco.cmake)
|
||
|
||
# I *think* 1.1 is used for *just* md5 hashing?
|
||
# 3.1 has everything in the right place, but the md5 funcs used are deprecated
|
||
# a grep across the repo shows it is used for other things
|
||
# TODO: update openssl and everything that uses <openssl/md5.h>
|
||
set(OPENSSL_PKG "")
|
||
if(NOT OPENSSL_FOUND)
|
||
include(OpenSSL/OpenSSL.cmake)
|
||
set(OPENSSL_PKG dep_OpenSSL)
|
||
endif()
|
||
|
||
include(FFMPEG/FFMPEG.cmake)
|
||
include(Assimp/Assimp.cmake)
|
||
|
||
include(DataChannel/DataChannel.cmake)
|
||
set(DATACHANNEL_PKG dep_DataChannel)
|
||
|
||
# we don't want to load a "wrong" openssl when loading curl
|
||
# so, just don't even bother
|
||
# ...i think this is how it works? change if wrong
|
||
set(CURL_PKG "")
|
||
if (NOT OPENSSL_FOUND OR NOT CURL_FOUND)
|
||
include(CURL/CURL.cmake)
|
||
set(CURL_PKG dep_CURL)
|
||
endif ()
|
||
|
||
set(JPEG_PKG "")
|
||
if (NOT JPEG_FOUND)
|
||
include(JPEG/JPEG.cmake)
|
||
set(JPEG_PKG dep_JPEG)
|
||
endif()
|
||
|
||
# flatpak builds wxwidgets separately, so it is not included in the deps target
|
||
set(WXWIDGETS_PKG "")
|
||
include(wxWidgets/wxWidgets.cmake)
|
||
if (NOT FLATPAK)
|
||
set(WXWIDGETS_PKG "dep_wxWidgets")
|
||
endif()
|
||
|
||
set(FREETYPE_PKG "")
|
||
if(NOT FREETYPE_FOUND)
|
||
include(FREETYPE/FREETYPE.cmake)
|
||
set(FREETYPE_PKG "dep_FREETYPE")
|
||
endif()
|
||
|
||
execute_process(
|
||
COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree
|
||
RESULT_VARIABLE REV_PARSE_RESULT
|
||
OUTPUT_VARIABLE REV_PARSE_OUTPUT
|
||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||
)
|
||
|
||
# Will output "true" and have a 0 return code if within a git repo
|
||
if((REV_PARSE_RESULT EQUAL 0) AND (REV_PARSE_OUTPUT STREQUAL "true"))
|
||
set(IN_GIT_REPO TRUE)
|
||
# Find relative path from root to source used for adjusting patch command
|
||
file(RELATIVE_PATH BINARY_DIR_REL ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR})
|
||
endif ()
|
||
|
||
include(OCCT/OCCT.cmake)
|
||
include(OpenCV/OpenCV.cmake)
|
||
include(python3/python3.cmake)
|
||
include(wxInspector/wxInspector.cmake)
|
||
|
||
set(_dep_list
|
||
dep_Boost
|
||
dep_TBB
|
||
${OPENSSL_PKG}
|
||
${CURL_PKG}
|
||
${WXWIDGETS_PKG}
|
||
dep_Cereal
|
||
dep_Draco
|
||
dep_NLopt
|
||
dep_OpenVDB
|
||
dep_OpenCSG
|
||
${SLVS_PKG}
|
||
dep_OpenCV
|
||
dep_Eigen
|
||
dep_CGAL
|
||
dep_GLFW
|
||
dep_OCCT
|
||
${FREETYPE_PKG}
|
||
${PNG_PKG}
|
||
${ZLIB_PKG}
|
||
${EXPAT_PKG}
|
||
dep_libnoise
|
||
dep_python3
|
||
dep_wxInspector
|
||
dep_FFMPEG
|
||
dep_Assimp
|
||
${DATACHANNEL_PKG}
|
||
)
|
||
|
||
if (MSVC)
|
||
# Experimental
|
||
#list(APPEND _dep_list "dep_qhull")
|
||
else()
|
||
list(APPEND _dep_list "dep_Qhull")
|
||
# Not working, static build has different Eigen
|
||
#list(APPEND _dep_list "dep_libigl")
|
||
endif()
|
||
|
||
add_custom_target(deps ALL DEPENDS ${_dep_list})
|
||
|
||
# Note: I'm not using any of the LOG_xxx options in ExternalProject_Add() commands
|
||
# because they seem to generate bogus build files (possibly a bug in ExternalProject).
|