Skip to content

Commit e580653

Browse files
committed
- updated pybind11 to version 3.0.0
- updated zlib to version 1.3.1 - updated CMake files
1 parent 7b29484 commit e580653

File tree

99 files changed

+22359
-6256
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

99 files changed

+22359
-6256
lines changed

CMake/NeighborhoodSearch.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ else(USE_GPU_NEIGHBORHOOD_SEARCH)
3535
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/CompactNSearch.git
3636
GIT_TAG "3f11ece16a419fc1cc5795d6aa87cb7fe6b86960"
3737
INSTALL_DIR ${ExternalInstallDir}/NeighborhoodSearch
38-
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/NeighborhoodSearch -DUSE_DOUBLE_PRECISION:BOOL=${USE_DOUBLE_PRECISION} -DBUILD_DEMO:BOOL=OFF
38+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_CXX_FLAGS_RELEASE=${CMAKE_CXX_FLAGS_RELEASE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/NeighborhoodSearch -DUSE_DOUBLE_PRECISION:BOOL=${USE_DOUBLE_PRECISION} -DBUILD_DEMO:BOOL=OFF -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
3939
)
4040
set(NEIGHBORHOOD_ASSEMBLY_NAME CompactNSearch)
4141

CMake/SetUpExternalProjects.cmake

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ExternalProject_Add(
1616
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/Discregrid.git
1717
GIT_TAG "0b69062ff9c56fbb6dcecd296652028bedbacf0e"
1818
INSTALL_DIR ${ExternalInstallDir}/Discregrid
19-
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/Discregrid -DBUILD_CMD_EXECUTABLE:BOOL=0 -DEIGEN3_INCLUDE_DIR:PATH=${EIGEN3_INCLUDE_DIR} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
19+
CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/Discregrid -DBUILD_CMD_EXECUTABLE:BOOL=0 -DEIGEN3_INCLUDE_DIR:PATH=${EIGEN3_INCLUDE_DIR} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
2020
)
2121
ExternalProject_Get_Property(Ext_Discregrid INSTALL_DIR)
2222
set(DISCREGRID_INCLUDE_DIR ${INSTALL_DIR}/include)
@@ -35,7 +35,7 @@ ExternalProject_Add(
3535
GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/GenericParameters.git
3636
GIT_TAG "a4e2744eea526270cfe38b826440d09f66473316"
3737
INSTALL_DIR ${ExternalInstallDir}/GenericParameters
38-
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/GenericParameters -DGENERICPARAMETERS_NO_TESTS:BOOL=1 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
38+
CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/GenericParameters -DGENERICPARAMETERS_NO_TESTS:BOOL=1 -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_POLICY_VERSION_MINIMUM=3.10 -DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
3939
)
4040
ExternalProject_Get_Property(Ext_GenericParameters INSTALL_DIR)
4141
set(GENERICPARAMETERS_INCLUDE_DIR ${INSTALL_DIR}/include)
@@ -60,6 +60,8 @@ ExternalProject_Add(
6060
-DDiscregrid_DEBUG_LIB:FILEPATH=${DISCREGRID_DEBUG_LIB}
6161
-DDiscregrid_LIB:FILEPATH=${DISCREGRID_LIB}
6262
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS}
63+
-DCMAKE_POLICY_VERSION_MINIMUM=3.10
64+
-DCMAKE_PREFIX_PATH=${CMAKE_PREFIX_PATH}
6365
)
6466
ExternalProject_Get_Property(Ext_PBD INSTALL_DIR)
6567
set(PBD_INCLUDE_DIR ${INSTALL_DIR}/include)

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
################################################################################
22
# general CMake and project setup
33
################################################################################
4-
cmake_minimum_required(VERSION 3.1)
4+
cmake_minimum_required(VERSION 3.10)
55

66
project(SPlisHSPlasH)
77

Changelog.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.14.0
2+
- Implemented alternative (Blender style) camera controls (thanks to Fabian Löschner)
3+
- updated pybind11 to version 3.0.0
4+
- updated zlib to version 1.3.1
5+
- updated CMake files
6+
17
2.13.2
28
- updated pybind11
39
- added avx implementation of the paper Peer et al., "An implicit SPH formulation for incompressible linearly elastic solids", Computer Graphics Forum, 2018

extern/pybind/CMakeLists.txt

Lines changed: 108 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,15 @@ if(NOT CMAKE_VERSION VERSION_LESS "3.27")
1010
cmake_policy(GET CMP0148 _pybind11_cmp0148)
1111
endif()
1212

13-
cmake_minimum_required(VERSION 3.5)
14-
15-
# The `cmake_minimum_required(VERSION 3.5...3.29)` syntax does not work with
16-
# some versions of VS that have a patched CMake 3.11. This forces us to emulate
17-
# the behavior using the following workaround:
18-
if(${CMAKE_VERSION} VERSION_LESS 3.29)
19-
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
20-
else()
21-
cmake_policy(VERSION 3.29)
22-
endif()
13+
cmake_minimum_required(VERSION 3.15...4.0)
2314

2415
if(_pybind11_cmp0148)
2516
cmake_policy(SET CMP0148 ${_pybind11_cmp0148})
2617
unset(_pybind11_cmp0148)
2718
endif()
2819

2920
# Avoid infinite recursion if tests include this as a subdirectory
30-
if(DEFINED PYBIND11_MASTER_PROJECT)
31-
return()
32-
endif()
21+
include_guard(GLOBAL)
3322

3423
# Extract project version from source
3524
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/pybind11/detail/common.h"
@@ -74,16 +63,15 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
7463

7564
set(PYBIND11_MASTER_PROJECT ON)
7665

77-
if(OSX AND CMAKE_VERSION VERSION_LESS 3.7)
78-
# Bug in macOS CMake < 3.7 is unable to download catch
79-
message(WARNING "CMAKE 3.7+ needed on macOS to download catch, and newer HIGHLY recommended")
80-
elseif(WINDOWS AND CMAKE_VERSION VERSION_LESS 3.8)
81-
# Only tested with 3.8+ in CI.
82-
message(WARNING "CMAKE 3.8+ tested on Windows, previous versions untested")
83-
endif()
84-
8566
message(STATUS "CMake ${CMAKE_VERSION}")
8667

68+
if(DEFINED SKBUILD AND DEFINED ENV{PYBIND11_GLOBAL_SDIST})
69+
message(
70+
FATAL_ERROR
71+
"PYBIND11_GLOBAL_SDIST is not supported, use nox -s build_global or a pybind11-global SDist instead."
72+
)
73+
endif()
74+
8775
if(CMAKE_CXX_STANDARD)
8876
set(CMAKE_CXX_EXTENSIONS OFF)
8977
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -100,7 +88,7 @@ if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
10088
else()
10189
set(PYBIND11_MASTER_PROJECT OFF)
10290
set(pybind11_system SYSTEM)
103-
set(_pybind11_findpython_default OFF)
91+
set(_pybind11_findpython_default COMPAT)
10492
endif()
10593

10694
# Options
@@ -111,8 +99,6 @@ option(PYBIND11_DISABLE_HANDLE_TYPE_NAME_DEFAULT_IMPLEMENTATION
11199
"To enforce that a handle_type_name<> specialization exists" OFF)
112100
option(PYBIND11_SIMPLE_GIL_MANAGEMENT
113101
"Use simpler GIL management logic that does not support disassociation" OFF)
114-
option(PYBIND11_NUMPY_1_ONLY
115-
"Disable NumPy 2 support to avoid changes to previous pybind11 versions." OFF)
116102
set(PYBIND11_INTERNALS_VERSION
117103
""
118104
CACHE STRING "Override the ABI version, may be used to enable the unstable ABI.")
@@ -124,45 +110,102 @@ endif()
124110
if(PYBIND11_SIMPLE_GIL_MANAGEMENT)
125111
add_compile_definitions(PYBIND11_SIMPLE_GIL_MANAGEMENT)
126112
endif()
127-
if(PYBIND11_NUMPY_1_ONLY)
128-
add_compile_definitions(PYBIND11_NUMPY_1_ONLY)
129-
endif()
130113

131114
cmake_dependent_option(
132115
USE_PYTHON_INCLUDE_DIR
133116
"Install pybind11 headers in Python include directory instead of default installation prefix"
134117
OFF "PYBIND11_INSTALL" OFF)
135118

136-
cmake_dependent_option(PYBIND11_FINDPYTHON "Force new FindPython" ${_pybind11_findpython_default}
137-
"NOT CMAKE_VERSION VERSION_LESS 3.12" OFF)
119+
set(PYBIND11_FINDPYTHON
120+
${_pybind11_findpython_default}
121+
CACHE STRING "Force new FindPython - NEW, OLD, COMPAT")
122+
123+
if(PYBIND11_MASTER_PROJECT)
124+
125+
# Allow PYTHON_EXECUTABLE if in FINDPYTHON mode and building pybind11's tests
126+
# (makes transition easier while we support both modes).
127+
if(PYBIND11_FINDPYTHON
128+
AND DEFINED PYTHON_EXECUTABLE
129+
AND NOT DEFINED Python_EXECUTABLE)
130+
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
131+
endif()
138132

139-
# Allow PYTHON_EXECUTABLE if in FINDPYTHON mode and building pybind11's tests
140-
# (makes transition easier while we support both modes).
141-
if(PYBIND11_MASTER_PROJECT
142-
AND PYBIND11_FINDPYTHON
143-
AND DEFINED PYTHON_EXECUTABLE
144-
AND NOT DEFINED Python_EXECUTABLE)
145-
set(Python_EXECUTABLE "${PYTHON_EXECUTABLE}")
133+
# This is a shortcut that is primarily for the venv cmake preset,
134+
# but can be used to quickly setup tests manually, too
135+
set(PYBIND11_CREATE_WITH_UV
136+
""
137+
CACHE STRING "Create a virtualenv if it doesn't exist")
138+
139+
if(NOT PYBIND11_CREATE_WITH_UV STREQUAL "")
140+
set(Python_ROOT_DIR "${CMAKE_CURRENT_BINARY_DIR}/.venv")
141+
if(EXISTS "${Python_ROOT_DIR}")
142+
if(EXISTS "${CMAKE_BINARY_DIR}/CMakeCache.txt")
143+
message(STATUS "Using existing venv at ${Python_ROOT_DIR}, remove or --fresh to recreate")
144+
else()
145+
# --fresh used to remove the cache
146+
file(REMOVE_RECURSE "${CMAKE_CURRENT_BINARY_DIR}/.venv")
147+
endif()
148+
endif()
149+
if(NOT EXISTS "${Python_ROOT_DIR}")
150+
find_program(UV uv REQUIRED)
151+
# CMake 3.19+ would be able to use COMMAND_ERROR_IS_FATAL
152+
message(
153+
STATUS "Creating venv with ${UV} venv -p ${PYBIND11_CREATE_WITH_UV} '${Python_ROOT_DIR}'")
154+
execute_process(COMMAND ${UV} venv -p ${PYBIND11_CREATE_WITH_UV} "${Python_ROOT_DIR}"
155+
RESULT_VARIABLE _venv_result)
156+
if(_venv_result AND NOT _venv_result EQUAL 0)
157+
message(FATAL_ERROR "uv venv failed with '${_venv_result}'")
158+
endif()
159+
message(
160+
STATUS
161+
"Installing deps with ${UV} pip install -p '${Python_ROOT_DIR}' -r tests/requirements.txt"
162+
)
163+
execute_process(
164+
COMMAND ${UV} pip install -p "${Python_ROOT_DIR}" -r
165+
"${CMAKE_CURRENT_SOURCE_DIR}/tests/requirements.txt" RESULT_VARIABLE _pip_result)
166+
if(_pip_result AND NOT _pip_result EQUAL 0)
167+
message(FATAL_ERROR "uv pip install failed with '${_pip_result}'")
168+
endif()
169+
endif()
170+
else()
171+
if(NOT DEFINED Python3_EXECUTABLE
172+
AND NOT DEFINED Python_EXECUTABLE
173+
AND NOT DEFINED Python_ROOT_DIR
174+
AND NOT DEFINED ENV{VIRTUALENV}
175+
AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.venv")
176+
message(STATUS "Autodetecting Python in virtual environment")
177+
set(Python_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/.venv")
178+
endif()
179+
endif()
146180
endif()
147181

148-
# NB: when adding a header don't forget to also add it to setup.py
149182
set(PYBIND11_HEADERS
150183
include/pybind11/detail/class.h
151184
include/pybind11/detail/common.h
152185
include/pybind11/detail/cpp_conduit.h
153186
include/pybind11/detail/descr.h
187+
include/pybind11/detail/dynamic_raw_ptr_cast_if_possible.h
188+
include/pybind11/detail/exception_translation.h
189+
include/pybind11/detail/function_record_pyobject.h
154190
include/pybind11/detail/init.h
155191
include/pybind11/detail/internals.h
192+
include/pybind11/detail/native_enum_data.h
193+
include/pybind11/detail/pybind11_namespace_macros.h
194+
include/pybind11/detail/struct_smart_holder.h
156195
include/pybind11/detail/type_caster_base.h
157196
include/pybind11/detail/typeid.h
197+
include/pybind11/detail/using_smart_holder.h
158198
include/pybind11/detail/value_and_holder.h
159-
include/pybind11/detail/exception_translation.h
160199
include/pybind11/attr.h
161200
include/pybind11/buffer_info.h
162201
include/pybind11/cast.h
163202
include/pybind11/chrono.h
164203
include/pybind11/common.h
165204
include/pybind11/complex.h
205+
include/pybind11/conduit/pybind11_conduit_v1.h
206+
include/pybind11/conduit/pybind11_platform_abi_id.h
207+
include/pybind11/conduit/wrap_include_python_h.h
208+
include/pybind11/critical_section.h
166209
include/pybind11/options.h
167210
include/pybind11/eigen.h
168211
include/pybind11/eigen/common.h
@@ -172,20 +215,25 @@ set(PYBIND11_HEADERS
172215
include/pybind11/eval.h
173216
include/pybind11/gil.h
174217
include/pybind11/gil_safe_call_once.h
218+
include/pybind11/gil_simple.h
175219
include/pybind11/iostream.h
176220
include/pybind11/functional.h
221+
include/pybind11/native_enum.h
177222
include/pybind11/numpy.h
178223
include/pybind11/operators.h
179224
include/pybind11/pybind11.h
180225
include/pybind11/pytypes.h
226+
include/pybind11/subinterpreter.h
181227
include/pybind11/stl.h
182228
include/pybind11/stl_bind.h
183229
include/pybind11/stl/filesystem.h
230+
include/pybind11/trampoline_self_life_support.h
184231
include/pybind11/type_caster_pyobject_ptr.h
185-
include/pybind11/typing.h)
232+
include/pybind11/typing.h
233+
include/pybind11/warnings.h)
186234

187235
# Compare with grep and warn if mismatched
188-
if(PYBIND11_MASTER_PROJECT AND NOT CMAKE_VERSION VERSION_LESS 3.12)
236+
if(PYBIND11_MASTER_PROJECT)
189237
file(
190238
GLOB_RECURSE _pybind11_header_check
191239
LIST_DIRECTORIES false
@@ -203,10 +251,7 @@ if(PYBIND11_MASTER_PROJECT AND NOT CMAKE_VERSION VERSION_LESS 3.12)
203251
endif()
204252
endif()
205253

206-
# CMake 3.12 added list(TRANSFORM <list> PREPEND
207-
# But we can't use it yet
208-
string(REPLACE "include/" "${CMAKE_CURRENT_SOURCE_DIR}/include/" PYBIND11_HEADERS
209-
"${PYBIND11_HEADERS}")
254+
list(TRANSFORM PYBIND11_HEADERS PREPEND "${CMAKE_CURRENT_SOURCE_DIR}/")
210255

211256
# Cache variable so this can be used in parent projects
212257
set(pybind11_INCLUDE_DIR
@@ -261,6 +306,9 @@ elseif(USE_PYTHON_INCLUDE_DIR AND DEFINED PYTHON_INCLUDE_DIR)
261306
endif()
262307

263308
if(PYBIND11_INSTALL)
309+
if(DEFINED SKBUILD_PROJECT_NAME AND SKBUILD_PROJECT_NAME STREQUAL "pybind11_global")
310+
install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION "${SKBUILD_HEADERS_DIR}")
311+
endif()
264312
install(DIRECTORY ${pybind11_INCLUDE_DIR}/pybind11 DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
265313
set(PYBIND11_CMAKECONFIG_INSTALL_DIR
266314
"${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME}"
@@ -276,25 +324,11 @@ if(PYBIND11_INSTALL)
276324
tools/${PROJECT_NAME}Config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake"
277325
INSTALL_DESTINATION ${PYBIND11_CMAKECONFIG_INSTALL_DIR})
278326

279-
if(CMAKE_VERSION VERSION_LESS 3.14)
280-
# Remove CMAKE_SIZEOF_VOID_P from ConfigVersion.cmake since the library does
281-
# not depend on architecture specific settings or libraries.
282-
set(_PYBIND11_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
283-
unset(CMAKE_SIZEOF_VOID_P)
284-
285-
write_basic_package_version_file(
286-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
287-
VERSION ${PROJECT_VERSION}
288-
COMPATIBILITY AnyNewerVersion)
289-
290-
set(CMAKE_SIZEOF_VOID_P ${_PYBIND11_CMAKE_SIZEOF_VOID_P})
291-
else()
292-
# CMake 3.14+ natively supports header-only libraries
293-
write_basic_package_version_file(
294-
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
295-
VERSION ${PROJECT_VERSION}
296-
COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)
297-
endif()
327+
# CMake natively supports header-only libraries
328+
write_basic_package_version_file(
329+
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
330+
VERSION ${PROJECT_VERSION}
331+
COMPATIBILITY AnyNewerVersion ARCH_INDEPENDENT)
298332

299333
install(
300334
FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
@@ -341,6 +375,17 @@ if(PYBIND11_INSTALL)
341375
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pybind11.pc"
342376
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig/")
343377

378+
# When building a wheel, include __init__.py's for modules
379+
# (see https://github.com/pybind/pybind11/pull/5552)
380+
if(DEFINED SKBUILD_PROJECT_NAME AND SKBUILD_PROJECT_NAME STREQUAL "pybind11")
381+
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/empty")
382+
file(TOUCH "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py")
383+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py"
384+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/")
385+
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/empty/__init__.py"
386+
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig/")
387+
endif()
388+
344389
# Uninstall target
345390
if(PYBIND11_MASTER_PROJECT)
346391
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake_uninstall.cmake.in"

0 commit comments

Comments
 (0)