Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ CMakeUserPresets.json


## Build
build*
build/
bin*

## IDES
Expand Down Expand Up @@ -658,6 +658,7 @@ ipctk

IPCToolkitOptions.cmake

# Generated HPP files
src/ipc/config.hpp
tests/src/tests/config.hpp

Expand Down
46 changes: 40 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ if(IPC_TOOLKIT_WITH_CCACHE AND CCACHE_PROGRAM)
endforeach()
endif()

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

################################################################################
# CMake Policies
################################################################################
Expand All @@ -53,6 +55,7 @@ cmake_policy(SET CMP0076 NEW) # target_sources() command converts relative paths
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24")
cmake_policy(SET CMP0135 NEW) # Set the timestamps of all extracted contents to the time of the extraction.
endif()
cmake_policy(SET CMP0114 NEW) # Support the Xcode "new build system"

################################################################################

Expand All @@ -64,8 +67,16 @@ project(IPCToolkit
include(CheckLanguage)
check_language(CUDA)

option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ${IPC_TOOLKIT_TOPLEVEL_PROJECT})
option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF)
if(IPC_TOOLKIT_TOPLEVEL_PROJECT)
option(IPC_TOOLKIT_BUILD_TESTS "Build unit-tests" ON)
option(IPC_TOOLKIT_BUILD_PYTHON "Build Python bindings" OFF)
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 INTERNAL BOOL "Build unit-tests" FORCE)
set(IPC_TOOLKIT_BUILD_PYTHON OFF CACHE INTERNAL BOOL "Build Python bindings" FORCE)
endif()

if(CMAKE_CUDA_COMPILER)
option(IPC_TOOLKIT_WITH_CUDA "Enable CUDA CCD" ON)
else()
Expand Down Expand Up @@ -117,13 +128,21 @@ add_library(ipc::toolkit ALIAS ipc_toolkit)
# Fill in configuration options
configure_file(
"${IPC_TOOLKIT_SOURCE_DIR}/config.hpp.in"
"${IPC_TOOLKIT_SOURCE_DIR}/config.hpp")
"${PROJECT_BINARY_DIR}/include/ipc/config.hpp")

# Add source and header files to ipc_toolkit
add_subdirectory("${IPC_TOOLKIT_SOURCE_DIR}")

# Public include directory for IPC Toolkit
target_include_directories(ipc_toolkit PUBLIC "${IPC_TOOLKIT_INCLUDE_DIR}")
target_include_directories(ipc_toolkit PUBLIC
"${IPC_TOOLKIT_INCLUDE_DIR}" # public headers
"${PROJECT_BINARY_DIR}/include" # generated config.hpp
)

# Folder name for IDE
set_target_properties(ipc_toolkit PROPERTIES FOLDER "SRC")
get_target_property(IPC_TOOLKIT_SOURCES ipc_toolkit SOURCES)
source_group(TREE "${PROJECT_SOURCE_DIR}" FILES ${IPC_TOOLKIT_SOURCES})

################################################################################
# Dependencies
Expand Down Expand Up @@ -243,7 +262,7 @@ endif()
################################################################################

# Enable unit testing at the root level
if(IPC_TOOLKIT_TOPLEVEL_PROJECT AND IPC_TOOLKIT_BUILD_TESTS)
if(IPC_TOOLKIT_BUILD_TESTS)
include(CTest)
enable_testing()
add_subdirectory(tests)
Expand All @@ -270,6 +289,21 @@ endif()
# Python bindings
################################################################################

if(IPC_TOOLKIT_TOPLEVEL_PROJECT AND IPC_TOOLKIT_BUILD_PYTHON)
if(IPC_TOOLKIT_BUILD_PYTHON)
add_subdirectory(python)
endif()

################################################################################
# Xcode
################################################################################

if (CMAKE_GENERATOR STREQUAL "Xcode")
set(CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION "${CMAKE_BUILD_TYPE}")
set_target_properties(ipc_toolkit PROPERTIES XCODE_GENERATE_SCHEME ON)
if(IPC_TOOLKIT_BUILD_TESTS)
set_target_properties(ipc_toolkit_tests PROPERTIES XCODE_GENERATE_SCHEME ON)
endif()
if(IPC_TOOLKIT_BUILD_PYTHON)
set_target_properties(ipctk PROPERTIES XCODE_GENERATE_SCHEME ON)
endif()
endif()
71 changes: 39 additions & 32 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"major": 3,
"minor": 18
},
"configurePresets": [
{
"configurePresets": [{
"name": "release",
"displayName": "Release Build",
"description": "Base preset for release builds",
Expand Down Expand Up @@ -33,11 +32,21 @@
"binaryDir": "${sourceDir}/build/default"
},
{
"name": "cuda",
"name": "cuda-release",
"inherits": "release",
"displayName": "CUDA Enabled",
"description": "Build with CUDA support",
"binaryDir": "${sourceDir}/build/cuda",
"displayName": "CUDA (Release)",
"description": "Release build with CUDA support",
"binaryDir": "${sourceDir}/build/cuda-release",
"cacheVariables": {
"IPC_TOOLKIT_WITH_CUDA": "ON"
}
},
{
"name": "cuda-debug",
"inherits": "debug",
"displayName": "CUDA (Debug)",
"description": "Debug build with CUDA support",
"binaryDir": "${sourceDir}/build/cuda-debug",
"cacheVariables": {
"IPC_TOOLKIT_WITH_CUDA": "ON"
}
Expand All @@ -55,7 +64,7 @@
{
"name": "test",
"inherits": "debug",
"displayName": "Build for Testing",
"displayName": "Unit Tests",
"description": "Build with unit tests enabled",
"binaryDir": "${sourceDir}/build/test",
"cacheVariables": {
Expand Down Expand Up @@ -87,54 +96,52 @@
"IPC_TOOLKIT_WITH_CODE_COVERAGE": "ON",
"IPC_TOOLKIT_BUILD_TESTS": "ON"
}
},
{
"name": "debug-cuda",
"inherits": [ "debug", "cuda" ],
"displayName": "CUDA Debug",
"description": "Debug build with CUDA support",
"binaryDir": "${sourceDir}/build/debug-cuda"
}
],
"buildPresets": [
{
"buildPresets": [{
"name": "release",
"configurePreset": "release",
"displayName": "Release Build",
"description": "Base preset for release builds"
},
{
"name": "debug",
"configurePreset": "debug",
"displayName": "Debug Build",
"description": "Base preset for debug builds"
},
{
"name": "default-build",
"configurePreset": "default",
"displayName": "Default Configuration",
"description": "Build using default configuration"
},
{
"name": "cuda-build",
"configurePreset": "cuda",
"name": "cuda-release",
"configurePreset": "cuda-release",
"displayName": "CUDA (Release)",
"description": "Build with CUDA support"
},
{
"name": "cuda-debug",
"configurePreset": "cuda-debug",
"displayName": "CUDA (Debug)",
"description": "Debug build with CUDA support"
},
{
"name": "test-build",
"configurePreset": "test",
"displayName": "Unit Tests",
"description": "Build for running tests"
},
{
"name": "python-build",
"configurePreset": "python",
"displayName": "Python Bindings",
"description": "Build with Python bindings enabled"
},
{
"name": "debug-cuda-build",
"configurePreset": "debug-cuda",
"description": "Debug build with CUDA support"
}
],
"testPresets": [
{
"testPresets": [{
"name": "default-tests",
"description": "Run default tests",
"configurePreset": "test",
Expand All @@ -143,20 +150,20 @@
}
},
{
"name": "cuda-tests",
"description": "Run tests with CUDA enabled",
"configurePreset": "cuda",
"name": "cuda-tests-release",
"description": "Run tests with CUDA (Release) enabled",
"configurePreset": "cuda-release",
"execution": {
"stopOnFailure": true
}
},
{
"name": "debug-cuda-tests",
"description": "Run tests with CUDA Debug configuration",
"configurePreset": "debug-cuda",
"name": "cuda-tests-debug",
"description": "Run tests with CUDA (Debug) enabled",
"configurePreset": "cuda-debug",
"execution": {
"stopOnFailure": true
}
}
]
}
}
1 change: 1 addition & 0 deletions cmake/recipes/abseil.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ message(STATUS "Third-party: creating target 'absl::flat_hash_map'")
option(ABSL_PROPAGATE_CXX_STD "Use CMake C++ standard meta features (e.g. cxx_std_11) that propagate to targets that link to Abseil" ON)
option(ABSL_USE_SYSTEM_INCLUDES "Silence warnings in Abseil headers by marking them as SYSTEM includes" ON)
option(ABSL_BUILD_TESTING "If ON, Abseil will build all of Abseil's own tests." OFF)
set(ABSL_IDE_FOLDER "ThirdParty/Abseil")

include(CPM)
CPMAddPackage("gh:abseil/abseil-cpp#20230125.3")
6 changes: 5 additions & 1 deletion cmake/recipes/catch2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,8 @@ option(CATCH_INSTALL_DOCS "Install documentation alongside library" OFF)
option(CATCH_INSTALL_EXTRAS "Install extras alongside library" OFF)

include(CPM)
CPMAddPackage("gh:catchorg/Catch2@3.3.2")
CPMAddPackage("gh:catchorg/Catch2@3.8.1")

# Folder name for IDE
set_target_properties(Catch2 PROPERTIES FOLDER "ThirdParty/Catch2")
set_target_properties(Catch2WithMain PROPERTIES FOLDER "ThirdParty/Catch2")
3 changes: 3 additions & 0 deletions cmake/recipes/evouga_ccd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,6 @@ target_link_libraries(evouga_ccd PUBLIC Eigen3::Eigen)

# Turn off floating point contraction for CCD robustness
target_compile_options(evouga_ccd PRIVATE "-ffp-contract=off")

# Folder name for IDE
set_target_properties(evouga_ccd PROPERTIES FOLDER "ThirdParty")
5 changes: 4 additions & 1 deletion cmake/recipes/filib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,7 @@ message(STATUS "Third-party: creating target 'filib::filib'")
option(FILIB_BUILD_SHARED_LIB "Build shared library" OFF)

include(CPM)
CPMAddPackage("gh:zfergus/filib#7cf13519b0db72df2493c9c8997a8bef9e372848")
CPMAddPackage("gh:zfergus/filib#7cf13519b0db72df2493c9c8997a8bef9e372848")

# Folder name for IDE
set_target_properties(filib PROPERTIES FOLDER "ThirdParty")
5 changes: 4 additions & 1 deletion cmake/recipes/finite_diff.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ endif()
message(STATUS "Third-party: creating target 'finitediff::finitediff'")

include(CPM)
CPMAddPackage("gh:zfergus/finite-diff@1.0.1")
CPMAddPackage("gh:zfergus/finite-diff@1.0.1")

# Folder name for IDE
set_target_properties(finitediff_finitediff PROPERTIES FOLDER "ThirdParty")
7 changes: 6 additions & 1 deletion cmake/recipes/libigl.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,9 @@ set(LIBIGL_PREDICATES ON CACHE BOOL "Use exact predicates" FORCE)
include(eigen)

include(CPM)
CPMAddPackage("gh:libigl/libigl#89267b4a80b1904de3f6f2812a2053e5e9332b7e")
CPMAddPackage("gh:libigl/libigl#89267b4a80b1904de3f6f2812a2053e5e9332b7e")

# Folder name for IDE
foreach(target_name IN ITEMS core predicates)
set_target_properties(igl_${target_name} PROPERTIES FOLDER "ThirdParty/libigl")
endforeach()
2 changes: 1 addition & 1 deletion cmake/recipes/onetbb.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ endif()
foreach(name IN ITEMS tbb tbbmalloc tbbmalloc_proxy)
if(TARGET ${name})
# Folder name for IDE
set_target_properties(${name} PROPERTIES FOLDER "third_party//tbb")
set_target_properties(${name} PROPERTIES FOLDER "ThirdParty/tbb")

# Force debug postfix for library name. Our pre-compiled MKL library expects "tbb12.dll" (without postfix).
set_target_properties(${name} PROPERTIES DEBUG_POSTFIX "")
Expand Down
5 changes: 4 additions & 1 deletion cmake/recipes/scalable_ccd.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@ message(STATUS "Third-party: creating target 'scalable_ccd::scalable_ccd'")
set(SCALABLE_CCD_WITH_CUDA ${IPC_TOOLKIT_WITH_CUDA} CACHE BOOL "Enable CUDA CCD" FORCE)

include(CPM)
CPMAddPackage("gh:continuous-collision-detection/scalable-ccd#95a078bbaf9659f2e1b4285d51475deff163bfa0")
CPMAddPackage("gh:continuous-collision-detection/scalable-ccd#2c82b9ca43fba30b85f7e9aa83283464b1bb7843")

# Folder name for IDE
set_target_properties(scalable_ccd PROPERTIES FOLDER "ThirdParty")
5 changes: 4 additions & 1 deletion cmake/recipes/simple_bvh.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@ endif()
message(STATUS "Third-party: creating target 'simple_bvh::simple_bvh'")

include(CPM)
CPMAddPackage("gh:geometryprocessing/SimpleBVH#e1a931337a9e07e8bd2d2e8bbdfd7e54bc850df5")
CPMAddPackage("gh:geometryprocessing/SimpleBVH#e1a931337a9e07e8bd2d2e8bbdfd7e54bc850df5")

# Folder name for IDE
set_target_properties(simple_bvh PROPERTIES FOLDER "ThirdParty")
3 changes: 2 additions & 1 deletion cmake/recipes/spdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ CPMAddPackage("gh:gabime/spdlog@1.11.0")

set_target_properties(spdlog PROPERTIES POSITION_INDEPENDENT_CODE ON)

set_target_properties(spdlog PROPERTIES FOLDER external)
# Folder name for IDE
set_target_properties(spdlog PROPERTIES FOLDER "ThirdParty")

if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang" OR
"${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
Expand Down
5 changes: 4 additions & 1 deletion cmake/recipes/tight_inclusion.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,7 @@ endif()
message(STATUS "Third-party: creating target 'tight_inclusion::tight_inclusion'")

include(CPM)
CPMAddPackage("gh:Continuous-Collision-Detection/Tight-Inclusion@1.0.5")
CPMAddPackage("gh:Continuous-Collision-Detection/Tight-Inclusion@1.0.5")

# Folder name for IDE
set_target_properties(tight_inclusion PROPERTIES FOLDER "ThirdParty")
Loading