Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
9b74235
Add start of dynamics code
zfergus May 31, 2024
75d0588
Add comments to OrthogonalityPotential::hessian
zfergus May 31, 2024
8b3a1b2
Add J matrix to AffineBody class
zfergus Jun 6, 2024
1e31d41
Merge branch 'main' into dynamics
zfergus Nov 10, 2024
5c73e27
Fix comment
zfergus Nov 11, 2024
73c28ce
Merge branch 'main' into dynamics
zfergus Jun 8, 2025
47c282b
[WIP] Implement rigid body dynamics framework
zfergus Jun 13, 2025
caf4d50
Fix rotation_vector_to_matrix derivatives
zfergus Jun 14, 2025
59edd85
Test RigidBody class
zfergus Jun 17, 2025
5cbe3d4
Test InertialTerm
zfergus Jun 18, 2025
dbad1ba
Add density parameter to mass calculations; store R0 in RB
zfergus Jun 18, 2025
5d7512a
Add (empty) simulator loop
zfergus Jun 18, 2025
0107073
Move body forces into separate class
zfergus Jun 21, 2025
e118277
Merge branch 'main' into dynamics
zfergus Aug 18, 2025
6987872
Remove duplicate cross_product_matrix function
zfergus Aug 18, 2025
3bb8029
Refactor error handling in matrix projection functions to use log_and…
zfergus Aug 18, 2025
f34250b
Remove cross_product_matrix function from pose.cpp
zfergus Aug 18, 2025
42510aa
Fix CMake option syntax for CCD Query IO, filib, libigl, and scalable…
zfergus Aug 18, 2025
e560de5
Initialize integral array in compute_mass_properties_3D with empty br…
zfergus Aug 18, 2025
3a9b326
Remove unicode from test names for Windows CI
zfergus Aug 18, 2025
3491217
Remove unused K_dKj_plus_K_dKj_T
zfergus Aug 19, 2025
e10542a
Add RigidBody class bindings to expose mass and inertia properties.
zfergus Aug 20, 2025
ea38e5d
Fix broad phase benchmark
zfergus Aug 24, 2025
f27fbe8
Update GIT_TAG for ipc_toolkit_tests_data and modify expected output …
zfergus Aug 24, 2025
7f75e25
Refactor broad phase collision detection methods
zfergus Aug 24, 2025
0c00276
Refactor nonlinear CCD methods to use NonlinearCCD class and simplify…
zfergus Aug 28, 2025
0f3bc00
Add RigidCandidates class for managing collision candidates and imple…
zfergus Aug 28, 2025
7470786
Merge branch 'main' into dynamics
zfergus Sep 1, 2025
a5674a6
Merge branch 'main' into dynamics
zfergus Sep 1, 2025
7c702d6
Merge branch 'main' into dynamics
zfergus Jan 27, 2026
6b834f5
Refactor math utils and update NonlinearCCD API
zfergus Jan 27, 2026
d647396
Fix NonlinearCCD parameter order
zfergus Jan 27, 2026
63b330c
Fix Clang-Tidy Errors
zfergus Jan 27, 2026
701318d
Add NOLINTNEXTLINE for identifier-naming
zfergus Jan 27, 2026
30c802f
Assert Q_hat size instead of torque size
zfergus Jan 27, 2026
ebf466f
Fix nonlinear CCD; update body force parameter names
zfergus Jan 28, 2026
7cb148b
Use Eigen::ConstRef for function parameters
zfergus Jan 28, 2026
52bdbfd
Start work on RigidCandidates
zfergus Feb 1, 2026
d29ec6a
Update normal hessians to vectorized 3rd-order tensor format
zfergus Feb 2, 2026
1c89c51
Remove invisible unicode
zfergus Feb 2, 2026
e7c63c3
Skip force and torque computations when zero
zfergus Feb 2, 2026
22fc7b1
Fix normal hessian calculations for vectorized order
zfergus Feb 3, 2026
860f714
Refactor tangent basis and rel velocity Jacobians and update tests
zfergus Feb 4, 2026
c1cbee6
Update TangentialPotential to match new layout for Jacobians
zfergus Feb 4, 2026
81d7b29
Update finite-diff package version to 1.0.4
zfergus Feb 4, 2026
7febecd
Add ground contact dynamics and related tests
zfergus Feb 4, 2026
486985b
Bind write_gltf and add Save button
zfergus Feb 4, 2026
ae11670
Merge branch 'main' into dynamics
zfergus Feb 7, 2026
c182fe8
Remove maybe_parallel_for from utils sources
zfergus Feb 7, 2026
41c8b71
Rigid dynamics: simulator API, fixes, and tests
zfergus Feb 7, 2026
0aa7eda
Merge branch 'main' into dynamics
zfergus Feb 9, 2026
5bb84f1
Add linearized rigid body collision to simulator
zfergus Feb 10, 2026
40ec7cd
Enhance rigid body dynamics and GLTF I/O support
zfergus Feb 18, 2026
29fdcb9
Improve robustness of rigid simulator
zfergus Feb 20, 2026
6a1b2c9
Use Eigen::Hyperplane for planes
zfergus Feb 21, 2026
1948283
Refactor rigid/affine dynamics API and potentials
zfergus Feb 21, 2026
72379e7
Merge branch 'main' into dynamics
zfergus Feb 21, 2026
122f4e7
Enable extra-semi warning and fix extra semicolons
zfergus Feb 21, 2026
07f211e
Bump ipc_toolkit tests data Git tag
zfergus Feb 21, 2026
73256f8
Include <memory> in read_gltf.hpp
zfergus Feb 21, 2026
2b20d22
Use Eigen::VectorXd for gradient in test
zfergus Feb 21, 2026
18a0e90
Expose Eigen system include dir and fix tests
zfergus Feb 21, 2026
bccae4e
Merge branch 'main' into dynamics
zfergus Feb 28, 2026
5d432b4
Merge branch 'main' into dynamics
zfergus Feb 28, 2026
0581aa9
Merge branch 'main' into dynamics
zfergus Mar 1, 2026
f08278a
Fix tests for ColMajor derivatives
zfergus Mar 1, 2026
34fe26e
Merge branch 'main' into dynamics
zfergus Mar 1, 2026
14503a6
Merge branch 'main' into dynamics
zfergus Mar 1, 2026
60f9b69
Merge branch 'main' into dynamics
zfergus Jul 4, 2026
314b361
Add optional glTF I/O for rigid-body scenes
zfergus Jul 5, 2026
5c009c1
Add rigid-body collision detection and BDF time integration
zfergus Jul 6, 2026
0c3f654
Restructure dynamics into a library/demo split with a polysolve solver
zfergus Jul 7, 2026
c679c61
Apply clang-format
zfergus Jul 7, 2026
4ad1617
Merge branch 'main' into dynamics
zfergus Jul 7, 2026
b521c8d
Fix CI: clang-tidy member naming and pin Windows to MSVC
zfergus Jul 7, 2026
ae95e91
Include demo and glTF I/O in the coverage build
zfergus Jul 7, 2026
088dcf6
Fix CI
zfergus Jul 7, 2026
be74bad
Fix debug tests and update polysolve
zfergus Jul 7, 2026
7c4defb
Set solver logger level to info; fix affine test
zfergus Jul 7, 2026
f7d5935
Update polysolve
zfergus Jul 7, 2026
52e82e2
Update clang-format-check and .gitattributes
zfergus Jul 7, 2026
d35d6d0
Merge remote-tracking branch 'origin/main' into dynamics
zfergus Jul 7, 2026
f52fac8
Merge branch 'main' into dynamics
zfergus Jul 7, 2026
aecc0c1
Complete dynamics port: friction, static/kinematic, 2D, codim
zfergus Jul 8, 2026
7cda910
Unify rotation derivatives and move AffinePose to ipc::affine::Pose
zfergus Jul 8, 2026
ece98a2
Add ToAffine parameterization and BodyPotentials aggregator
zfergus Jul 8, 2026
aaac74b
Unify RBD/ABD in the simulator via BodyPotentials + ToAffine; delete …
zfergus Jul 8, 2026
2e95f6e
Update demo README for the RBD/ABD unification
zfergus Jul 8, 2026
6973701
Applied clang-format
zfergus Jul 8, 2026
db2a71d
Fix clang-tidy error
zfergus Jul 8, 2026
0e47917
Use MSVC /W4 instead of /Wall to reduce warning noise
zfergus Jul 9, 2026
78cadbc
Fix MSVC build: use igl::PI instead of bare M_PI in demo tests
zfergus Jul 9, 2026
535c01b
Loosen affine rotation_vector unitary assert for ABD drift
zfergus Jul 9, 2026
55cc49e
Apply clang-format
zfergus Jul 9, 2026
b2044f9
Prevent nonunitary matrix from being passed to Pose::rotation_vector
zfergus Jul 9, 2026
64add5a
Fix clang-format pre-commit hook: add -i for in-place formatting
zfergus Jul 9, 2026
59f13d2
Update test_orthogonality_potential.cpp
zfergus Jul 9, 2026
5ce8b57
Silence MSVC warnings; fix Eigen SVD instantiation
zfergus Jul 9, 2026
f98c7c5
Remove MSVC external warning suppression
zfergus Jul 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# These files should be ignored from GitHub's language statistics.
python/example.ipynb linguist-vendored
python/examples/*.ipynb linguist-vendored
notebooks/*.ipynb linguist-vendored
3 changes: 3 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@ on:
- '.github/workflows/clang-format-check.yml'
- '.clang-format'
- 'src/**'
- 'demo/**'
- 'tests/src/**'
- 'python/src/**'
pull_request:
paths:
- '.github/workflows/clang-format-check.yml'
- '.clang-format'
- 'src/**'
- 'demo/**'
- 'tests/src/**'
- 'python/src/**'
jobs:
Expand All @@ -22,6 +24,7 @@ jobs:
matrix:
path:
- 'src'
- 'demo'
- 'tests/src'
- 'python/src'
steps:
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
paths:
- '.github/workflows/coverage.yml'
- 'cmake/**'
- 'demo/**'
- 'src/**'
- 'tests/**'
- 'CMakeLists.txt'
Expand Down Expand Up @@ -56,6 +57,8 @@ jobs:
cd build
cmake .. \
-DIPC_TOOLKIT_BUILD_TESTS=ON \
-DIPC_TOOLKIT_BUILD_DEMO=ON \
-DIPC_TOOLKIT_WITH_GLTF=ON \
-DIPC_TOOLKIT_WITH_CODE_COVERAGE=ON \
-DCMAKE_BUILD_TYPE=Release \

Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -676,4 +676,6 @@ CMakeGraphVizOptions.cmake

CLAUDE.md
.claude
graphify-out
graphify-out
__cmake_systeminformation
simulator_test.glb
4 changes: 1 addition & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ repos:
rev: v21.1.2
hooks:
- id: clang-format
name: clang-format
description: "Use clang-format to format C/C++ code"
entry: clang-format
args:
- -i
- --style=file
- --verbose
files: '\.(c|cc|cpp|h|hpp|tpp|cxx|hh|inl|ipp)$'
61 changes: 55 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,34 @@ project(IPCToolkit
VERSION "1.6.0")

if(IPC_TOOLKIT_TOPLEVEL_PROJECT)
option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ON)
option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF)
# Generate a compile_commands.json file
set(CMAKE_EXPORT_COMPILE_COMMANDS ${CLO_IPC_TOPLEVEL_PROJECT})

# If we are on a Mac, explicitly add the sysroot to the compiler flags
if(CMAKE_EXPORT_COMPILE_COMMANDS AND APPLE)
# CMake usually finds the sysroot automatically, but if it didn't, fetch it
if(NOT CMAKE_OSX_SYSROOT)
execute_process(COMMAND xcrun --show-sdk-path
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()

# Force the -isysroot flag into the compile commands for clang-tidy
add_compile_options("-isysroot" "${CMAKE_OSX_SYSROOT}")
endif()
endif()

if(IPC_TOOLKIT_TOPLEVEL_PROJECT)
option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ON)
option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF)
option(IPC_TOOLKIT_BUILD_DEMO "Build the demo simulator" ON)
else()
# If this is not the top-level project, we don't want to build tests or Python
# bindings. This is useful for projects that use IPC Toolkit as a submodule.
set(IPC_TOOLKIT_BUILD_TESTS OFF CACHE BOOL "Build unit-tests" FORCE)
set(IPC_TOOLKIT_BUILD_PYTHON OFF CACHE BOOL "Build Python bindings" FORCE)
# If this is not the top-level project, we don't want to build tests, Python
# bindings, or the demo simulator. This is useful for projects that use IPC
# Toolkit as a submodule.
set(IPC_TOOLKIT_BUILD_TESTS OFF CACHE BOOL "Build unit-tests" FORCE)
set(IPC_TOOLKIT_BUILD_PYTHON OFF CACHE BOOL "Build Python bindings" FORCE)
set(IPC_TOOLKIT_BUILD_DEMO OFF CACHE BOOL "Build the demo simulator" FORCE)
endif()

option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" OFF)
Expand All @@ -80,6 +101,7 @@ option(IPC_TOOLKIT_WITH_RATIONAL_INTERSECTION "Use rational edge-triangle inters
option(IPC_TOOLKIT_WITH_ROBIN_MAP "Use Tessil's robin-map rather than std maps" ON)
option(IPC_TOOLKIT_WITH_ABSEIL "Use Abseil's hash functions" ON)
option(IPC_TOOLKIT_WITH_FILIB "Use filib for interval arithmetic" ON)
option(IPC_TOOLKIT_WITH_GLTF "Enable glTF I/O (tinygltf)" OFF)
option(IPC_TOOLKIT_WITH_INEXACT_CCD "Use the original inexact CCD method of IPC" OFF)
option(IPC_TOOLKIT_WITH_PROFILER "Enable performance profiler" OFF)
option(IPC_TOOLKIT_WITH_TRACY "Enable Tracy frame profiler" OFF)
Expand Down Expand Up @@ -214,6 +236,12 @@ include(tinyad)
# TODO: Make this a private dependency once we stop exposing TinyAD types in the public API.
target_link_libraries(ipc_toolkit PUBLIC TinyAD::TinyAD)

# TinyGLTF
if(IPC_TOOLKIT_WITH_GLTF)
include(tinygltf)
target_link_libraries(ipc_toolkit PRIVATE tinygltf::tinygltf)
endif()

# CCD
if(IPC_TOOLKIT_WITH_INEXACT_CCD)
# Etienne Vouga's CTCD Library for the floating point root finding algorithm
Expand Down Expand Up @@ -287,6 +315,16 @@ endif()
# Use C++17
target_compile_features(ipc_toolkit PUBLIC cxx_std_17)

################################################################################
# Demo simulator (application-side code: solver, problem glue, stepping loop)
################################################################################

# Added before the tests and Python bindings so both can optionally include
# the demo's tests and bindings.
if(IPC_TOOLKIT_BUILD_DEMO)
add_subdirectory(demo)
endif()

################################################################################
# Tests
################################################################################
Expand All @@ -313,6 +351,17 @@ if(IPC_TOOLKIT_WITH_CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
--coverage
-fprofile-update=atomic
)
if(IPC_TOOLKIT_BUILD_DEMO)
target_compile_options(ipc_toolkit_demo PRIVATE
-g # generate debug info
--coverage # sets all required flags
-fprofile-update=atomic
)
target_link_options(ipc_toolkit_demo PUBLIC
--coverage
-fprofile-update=atomic
)
endif()
endif()

################################################################################
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ IPC Toolkit is a set of reusable functions to integrate Incremental Potential Co

### Limitations

This is not a full simulation library. As such, it does not include any physics or solvers. For a full simulation implementation, we recommend [PolyFEM](https://polyfem.github.io/) (a finite element library) or [Rigid IPC](https://github.com/ipc-sim/rigid-ipc) (rigid-body dynamics), both of which utilize the IPC Toolkit.
This is not a full simulation library. As such, it does not include any solvers. For a full simulation implementation, we recommend [PolyFEM](https://polyfem.github.io/) (a finite element library) or [Rigid IPC](https://github.com/ipc-sim/rigid-ipc) (rigid-body dynamics), both of which utilize the IPC Toolkit.

A small demo simulator ([`demo/`](demo)) shows how to assemble the toolkit's components (energies, time integration, and CCD) into a rigid/affine body simulator driven by [polysolve](https://github.com/polyfem/polysolve).

## Build

Expand Down
2 changes: 1 addition & 1 deletion cmake/ipc_toolkit/ipc_toolkit_tests_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ else()
SOURCE_DIR ${IPC_TOOLKIT_TESTS_DATA_DIR}

GIT_REPOSITORY https://github.com/ipc-sim/ipc-toolkit-tests-data.git
GIT_TAG c7eba549d9a80d15569a013c473f0aff104ac44a
GIT_TAG 5f455c16f461e56d68e9241fa038bd20d95bce0a

CONFIGURE_COMMAND ""
BUILD_COMMAND ""
Expand Down
11 changes: 0 additions & 11 deletions cmake/ipc_toolkit/ipc_toolkit_use_colors.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,6 @@ include_guard(GLOBAL)

# options
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# Reduce the warning level of external files to the selected value (W1 - only major).
# Requires Visual Studio 2017 version 15.7
# https://blogs.msdn.microsoft.com/vcblog/2017/12/13/broken-warnings-theory/

# There is an issue in using these flags in earlier versions of MSVC:
# https://developercommunity.visualstudio.com/content/problem/220812/experimentalexternal-generates-a-lot-of-c4193-warn.html
if(MSVC_VERSION GREATER 1920)
add_compile_options(/experimental:external)
add_compile_options(/external:W1)
endif()

# When building in parallel, MSVC sometimes fails with the following error:
# > fatal error C1090: PDB API call failed, error code '23'
# To avoid this problem, we force PDB write to be synchronous with /FS.
Expand Down
18 changes: 16 additions & 2 deletions cmake/ipc_toolkit/ipc_toolkit_warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,22 @@ endif()
# Flags above don't make sense for MSVC
if(MSVC)
set(IPC_TOOLKIT_WARNING_FLAGS
/Wall # Display all warnings
/MP # Multi-processor compilation
/W4 # High warning level (MSVC equivalent of -Wall -Wextra; /Wall is
# unusably noisy, enabling off-by-default warnings like C4711/C4710/
# C4514/C4820/C5045)
/MP # Multi-processor compilation
# Silence /W4 warnings that have no counterpart in our GCC/Clang flag set
# (-Wall -Wextra -Wpedantic, with -Wconversion intentionally off), so the
# MSVC output matches the other compilers:
/wd4250 # 'inherits via dominance' (benign; from virtual inheritance)
/wd4244 # conversion, possible loss of data (GCC: -Wconversion, off)
/wd4267 # size_t -> smaller conversion (GCC: -Wconversion, off)
/wd4201 # nonstandard nameless struct/union (a GCC/Clang extension)
/wd4068 # unknown pragma (cross-compiler #pragma gcc/clang directives)
/wd4100 # unreferenced formal parameter. GCC's -Wunused-parameter only
# fires here because the Windows CI builds Release: asserts (and the
# params they use) are compiled out, and the collision-stencil
# virtual overrides legitimately ignore some params.
)
else()
set(IPC_TOOLKIT_WARNING_FLAGS
Expand Down
37 changes: 37 additions & 0 deletions cmake/recipes/polysolve.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# PolySolve (https://github.com/polyfem/polysolve)
# License: MIT
if(TARGET polysolve::polysolve)
return()
endif()

message(STATUS "Third-party: creating target 'polysolve::polysolve'")

# Only the Eigen built-in linear solvers are needed for the demo simulator;
# disable the optional heavyweight backends and their dependency tails.
# (Accelerate also conflicts with Eigen's BLAS prototypes on recent macOS SDKs.)
set(POLYSOLVE_WITH_ACCELERATE OFF CACHE BOOL "Enable Apple Accelerate" FORCE)
set(POLYSOLVE_WITH_AMGCL OFF CACHE BOOL "Use AMGCL" FORCE)
set(POLYSOLVE_WITH_CHOLMOD OFF CACHE BOOL "Enable Cholmod library" FORCE)
set(POLYSOLVE_WITH_HYPRE OFF CACHE BOOL "Enable hypre" FORCE)
set(POLYSOLVE_WITH_MKL OFF CACHE BOOL "Enable MKL library" FORCE)
set(POLYSOLVE_WITH_PARDISO OFF CACHE BOOL "Enable Pardiso library" FORCE)
set(POLYSOLVE_WITH_SPECTRA OFF CACHE BOOL "Enable Spectra library" FORCE)
set(POLYSOLVE_WITH_SPQR OFF CACHE BOOL "Enable SPQR library" FORCE)
set(POLYSOLVE_WITH_SUPERLU OFF CACHE BOOL "Enable SuperLU library" FORCE)
set(POLYSOLVE_WITH_TESTS OFF CACHE BOOL "Build unit-tests" FORCE)
set(POLYSOLVE_WITH_UMFPACK OFF CACHE BOOL "Enable UmfPack library" FORCE)

# Pre-register shared dependencies so this project's pins win over polysolve's
# older ones (both recipe sets guard on the existing targets): finite-diff
# 1.0.4 vs 1.0.2 (the tests need fd::finite_jacobian_tensor), nlohmann/json
# 3.12 vs 3.11, and spdlog 1.17.0 vs 1.9.2.
include(finite_diff)
include(json)
include(spdlog)

include(CPM)
CPMAddPackage("gh:polyfem/polysolve#1b01e6cec13c6813ae48846d1f98654bbbf1402b")

# Folder name for IDE
set_target_properties(polysolve PROPERTIES FOLDER "ThirdParty")
set_target_properties(polysolve_linear PROPERTIES FOLDER "ThirdParty")
21 changes: 21 additions & 0 deletions cmake/recipes/tinygltf.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# TinyGLTF (https://github.com/syoyo/tinygltf)
# License: MIT
if(TARGET tinygltf::tinygltf)
return()
endif()

message(STATUS "Third-party: creating target 'tinygltf::tinygltf'")

include(CPM)
CPMAddPackage(
URI "gh:syoyo/tinygltf@2.9.6"
DOWNLOAD_ONLY TRUE
)

add_library(tinygltf)
add_library(tinygltf::tinygltf ALIAS tinygltf)
target_sources(tinygltf PRIVATE ${tinygltf_SOURCE_DIR}/tiny_gltf.cc)
target_include_directories(tinygltf INTERFACE
$<BUILD_INTERFACE:${tinygltf_SOURCE_DIR}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
43 changes: 43 additions & 0 deletions demo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
################################################################################
# IPC Toolkit Demo Simulator
#
# Application-side code intentionally kept out of the core library: the
# incremental potential presented to the (polysolve) nonlinear solver and the
# time-stepping loop. The core library only provides the modular components
# (energies, time integrators, potentials, and CCD); this target is the living
# proof that they are easy to assemble into a simulator.
################################################################################

set(SOURCES
src/kinematic_driver.cpp
src/kinematic_driver.hpp
src/kinematics.cpp
src/kinematics.hpp
src/simulator.cpp
src/simulator.hpp
)

add_library(ipc_toolkit_demo ${SOURCES})
add_library(ipc::toolkit::demo ALIAS ipc_toolkit_demo)

target_include_directories(ipc_toolkit_demo PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/src")

# The demo depends on the core library; the core library must never depend on
# the demo (or on any solver).
target_link_libraries(ipc_toolkit_demo PUBLIC ipc::toolkit)

# polysolve (nonlinear solver with PolyFEM-grade Newton + line search).
# PUBLIC: the Simulator IS a polysolve::nonlinear::Problem.
include(polysolve)
target_link_libraries(ipc_toolkit_demo PUBLIC polysolve::polysolve)

target_compile_features(ipc_toolkit_demo PUBLIC cxx_std_17)

# Folder name for IDE
set_target_properties(ipc_toolkit_demo PROPERTIES FOLDER "DEMO")
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES ${SOURCES})

# NOTE: The demo's tests live in the unified ipc_toolkit_tests binary
# (tests/src/tests/demo/) and its Python bindings in the core ipctk module as
# the ipctk.demo submodule (demo/python/simulator.cpp); both are added by
# their respective parent targets when IPC_TOOLKIT_BUILD_DEMO is ON.
Loading
Loading