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
16 changes: 12 additions & 4 deletions SofaPython3Config.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
include(SofaPython3Tools)

# Find Python3
if(NOT Python_FOUND)
find_package(Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development)
if(NOT TARGET Python::Python)
if(CMAKE_VERSION VERSION_LESS "3.24.0")
find_package(Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development)
else()
find_package(Python @PythonMAJMIN@ EXACT QUIET REQUIRED COMPONENTS Interpreter Development GLOBAL)
endif()
endif()

# Find pybind11
if(NOT pybind11_FOUND)
if(NOT TARGET pybind11)
# Save PYTHON_* vars
set(PYTHON_VERSION_RESET "${PYTHON_VERSION}")
set(PYTHON_EXECUTABLE_RESET "${PYTHON_EXECUTABLE}")
Expand All @@ -40,7 +44,11 @@ if(NOT pybind11_FOUND)
set(PYTHON_INCLUDE_DIR "${Python_INCLUDE_DIRS}" CACHE INTERNAL "" FORCE)
endif()

find_package(pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG)
if(CMAKE_VERSION VERSION_LESS "3.24.0")
find_package(pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG)
else()
find_package(pybind11 @pybind11_VERSION@ QUIET REQUIRED CONFIG GLOBAL)
endif()

# Reset PYTHON_* vars
set(PYTHON_VERSION "${PYTHON_VERSION_RESET}" CACHE STRING "" FORCE)
Expand Down
6 changes: 4 additions & 2 deletions bindings/BindingsConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@

set(SP3_WITH_SOFAEXPORTER @SP3_WITH_SOFAEXPORTER@)

find_package(SofaPython3 QUIET REQUIRED COMPONENTS
find_package(Sofa.Config QUIET REQUIRED)

sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS
Bindings.Modules
Bindings.Sofa
Bindings.SofaGui
Bindings.SofaRuntime
Bindings.SofaTypes
)
if(SP3_WITH_SOFAEXPORTER)
find_package(SofaPython3 QUIET REQUIRED COMPONENTS Bindings.SofaExporter)
sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS Bindings.SofaExporter)
endif()

# If we are importing this config file and the target is not yet there this is indicating that
Expand Down
9 changes: 5 additions & 4 deletions bindings/Modules/Bindings.ModulesConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,17 @@
@PACKAGE_GUARD@
@PACKAGE_INIT@

find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin Bindings.Sofa)
find_package(Sofa.Config QUIET REQUIRED)
sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin Bindings.Sofa)

# Required by Bindings.Modules.SofaBaseTopology
find_package(Sofa.Component.Topology.Container.Grid QUIET REQUIRED)
sofa_find_package(Sofa.Component.Topology.Container.Grid QUIET REQUIRED)

# Required by Bindings.Modules.SofaDeformable
find_package(Sofa.Component.SolidMechanics.Spring QUIET REQUIRED)
sofa_find_package(Sofa.Component.SolidMechanics.Spring QUIET REQUIRED)

# Required by Bindings.Modules.SofaLinearSolver
find_package(Sofa.Component.LinearSolver.Iterative QUIET REQUIRED)
sofa_find_package(Sofa.Component.LinearSolver.Iterative QUIET REQUIRED)

# If we are importing this config file and the target is not yet there this is indicating that
# target is an imported one. So we include it
Expand Down
16 changes: 9 additions & 7 deletions bindings/Sofa/Bindings.SofaConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
@PACKAGE_GUARD@
@PACKAGE_INIT@

find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin)
find_package(Sofa.Config QUIET REQUIRED)

sofa_find_package(SofaPython3 QUIET REQUIRED COMPONENTS Plugin)

# Required by Bindings.Sofa.Helper, Bindings.Sofa.Types
find_package(Sofa.Core QUIET REQUIRED)
sofa_find_package(Sofa.Core QUIET REQUIRED)

# Required by Bindings.Sofa.Core
find_package(Sofa.Simulation.Core QUIET REQUIRED)
sofa_find_package(Sofa.Simulation.Core QUIET REQUIRED)

# Required by Bindings.Sofa.Core
find_package(Sofa.Component.Visual QUIET REQUIRED)
find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED)
find_package(Sofa.SimpleApi QUIET REQUIRED)
sofa_find_package(Sofa.Component.Visual QUIET REQUIRED)
sofa_find_package(Sofa.Component.Collision.Response.Contact QUIET REQUIRED)
sofa_find_package(Sofa.SimpleApi QUIET REQUIRED)

# Required by Bindings.Sofa.Simulation
find_package(Sofa.Simulation.Graph QUIET REQUIRED)
sofa_find_package(Sofa.Simulation.Graph QUIET REQUIRED)

# If we are importing this config file and the target is not yet there this is indicating that
# target is an imported one. So we include it
Expand Down
Loading