mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-01-30 04:40:47 -07:00
* Replace spline with PchipInterpolatorHelper in flow compensator Swapped out the tk::spline implementation for PchipInterpolatorHelper in SmallAreaInfillFlowCompensator. Updated member types and method calls to use the new interpolator for improved flow compensation modeling. * Enforce strictly increasing flow compensation factors Added a check to ensure that flow compensation factors in SmallAreaInfillFlowCompensator strictly increase with extrusion length, throwing an exception if this condition is not met. This improves input validation and prevents invalid compensation models. * Add context to Small Area Flow Compensation errors Prefixed error messages in SmallAreaInfillFlowCompensator with 'Small Area Flow Compensation' for improved clarity and debugging. Also rethrows exceptions after logging to ensure proper error propagation. * Remove spline library from dependencies Eliminated the spline header-only library from the project by deleting its CMake configuration and header file, and updating documentation and build scripts to remove references to spline. This streamlines the dependencies and build process.
2.9 KiB
2.9 KiB
CMake Interfaces for deps_src Libraries
This document describes how to use the CMake interface libraries created for the subdirectories in deps_src/.
Available Libraries
1. semver (Static Library)
- Type: Static library
- Target:
semverorsemver::semver - Headers:
semver.h - Usage:
target_link_libraries(your_target PRIVATE semver)
# or
target_link_libraries(your_target PRIVATE semver::semver)
2. hints (Interface Library)
- Type: Interface library (header-only)
- Target:
hints - Utility:
hintsToPotexecutable - Usage:
target_link_libraries(your_target PRIVATE hints)
3. stb_dxt (Interface Library)
- Type: Interface library (header-only)
- Target:
stb_dxtorstb_dxt::stb_dxt - Headers:
stb_dxt.h - Usage:
target_link_libraries(your_target PRIVATE stb_dxt)
# or
target_link_libraries(your_target PRIVATE stb_dxt::stb_dxt)
How to Use in Your Project
From within the OrcaSlicer src/ directory:
- In your CMakeLists.txt, simply link the library:
add_executable(my_app main.cpp)
target_link_libraries(my_app
PRIVATE
semver::semver # For version parsing
stb_dxt::stb_dxt # For DXT texture compression
hints # For hints functionality
)
- In your C++ code, include the headers:
// For semver
#include <semver.h>
// For stb_dxt
#include <stb_dxt.h>
// Use the libraries as documented in their respective headers
Benefits of This Approach
- Modern CMake: Uses target-based CMake with proper INTERFACE/PUBLIC/PRIVATE visibility
- Proper Include Paths: Automatically sets up include directories
- Namespace Aliases: Provides namespaced aliases (e.g.,
spline::spline) for clarity - Position Independent Code: Static libraries are built with
-fPICfor compatibility - Install Support: Libraries can be installed and used by external projects
- Build/Install Interface: Separates build-time and install-time include paths
Example Integration
Here's a complete example of using these libraries in a new component:
# In src/mycomponent/CMakeLists.txt
add_library(mycomponent STATIC
mycomponent.cpp
mycomponent.h
)
target_link_libraries(mycomponent
PUBLIC
semver::semver # Version handling is part of public API
PRIVATE
stb_dxt::stb_dxt # Used internally for texture compression
)
target_include_directories(mycomponent
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include>
)
Notes
- All header-only libraries use the INTERFACE library type, which means they don't produce any binaries
- The
semverlibrary produces a static library that will be linked into your target - The
hintsproject also produces ahintsToPotexecutable utility - All libraries require at least C++11 (some require C++17)