From 724ba513ad2cb43f2e325b68c30bbf6e8d73591e Mon Sep 17 00:00:00 2001 From: Frederick ROY Date: Wed, 15 Nov 2023 11:18:28 +0100 Subject: [PATCH] Fix linking with LTO on macos --- Sofa/framework/Core/CMakeLists.txt | 1 + .../src/sofa/core/topology/TopologyData.cpp | 32 +++++++++++++++++++ .../src/sofa/core/topology/TopologyData.h | 4 +++ .../core/topology/TopologySubsetIndices.cpp | 1 - .../src/sofa/linearalgebra/FullVector.cpp | 2 +- .../src/sofa/linearalgebra/FullVector.h | 2 +- 6 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 Sofa/framework/Core/src/sofa/core/topology/TopologyData.cpp diff --git a/Sofa/framework/Core/CMakeLists.txt b/Sofa/framework/Core/CMakeLists.txt index 88e44c0829c..8ba69b2f109 100644 --- a/Sofa/framework/Core/CMakeLists.txt +++ b/Sofa/framework/Core/CMakeLists.txt @@ -306,6 +306,7 @@ set(SOURCE_FILES ${SRC_ROOT}/topology/Topology.cpp ${SRC_ROOT}/topology/TopologyChange.cpp ${SRC_ROOT}/topology/TopologyHandler.cpp + ${SRC_ROOT}/topology/TopologyData.cpp ${SRC_ROOT}/topology/TopologySubsetIndices.cpp ${SRC_ROOT}/visual/Data[DisplayFlags].cpp ${SRC_ROOT}/visual/DisplayFlags.cpp diff --git a/Sofa/framework/Core/src/sofa/core/topology/TopologyData.cpp b/Sofa/framework/Core/src/sofa/core/topology/TopologyData.cpp new file mode 100644 index 00000000000..ac1a0847a0c --- /dev/null +++ b/Sofa/framework/Core/src/sofa/core/topology/TopologyData.cpp @@ -0,0 +1,32 @@ +/****************************************************************************** +* SOFA, Simulation Open-Framework Architecture * +* (c) 2006 INRIA, USTL, UJF, CNRS, MGH * +* * +* This program is free software; you can redistribute it and/or modify it * +* under the terms of the GNU Lesser General Public License as published by * +* the Free Software Foundation; either version 2.1 of the License, or (at * +* your option) any later version. * +* * +* This program is distributed in the hope that it will be useful, but WITHOUT * +* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * +* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License * +* for more details. * +* * +* You should have received a copy of the GNU Lesser General Public License * +* along with this program. If not, see . * +******************************************************************************* +* Authors: The SOFA Team and external contributors (see Authors.txt) * +* * +* Contact information: contact@sofa-framework.org * +******************************************************************************/ +#define SOFA_CORE_TOPOLOGY_TOPOLOGYDATA_DEFINITION + +#include + + +namespace sofa::core::topology +{ + +template class SOFA_CORE_API sofa::core::topology::TopologyData < core::topology::BaseMeshTopology::Point, type::vector >; + +} //namespace sofa::core::topology diff --git a/Sofa/framework/Core/src/sofa/core/topology/TopologyData.h b/Sofa/framework/Core/src/sofa/core/topology/TopologyData.h index 645fd16ce9b..25f5366c8d8 100644 --- a/Sofa/framework/Core/src/sofa/core/topology/TopologyData.h +++ b/Sofa/framework/Core/src/sofa/core/topology/TopologyData.h @@ -164,5 +164,9 @@ template< class VecT > using QuadData = TopologyData using TetrahedronData = TopologyData; template< class VecT > using HexahedronData = TopologyData; +#if !defined(SOFA_CORE_TOPOLOGY_TOPOLOGYDATA_DEFINITION) +extern template class SOFA_CORE_API sofa::core::topology::TopologyData < core::topology::BaseMeshTopology::Point, type::vector >; +#endif + } //namespace sofa::core::topology diff --git a/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetIndices.cpp b/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetIndices.cpp index 38770cc257c..59c5dfc48f1 100644 --- a/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetIndices.cpp +++ b/Sofa/framework/Core/src/sofa/core/topology/TopologySubsetIndices.cpp @@ -85,7 +85,6 @@ void TopologySubsetIndices::updateLastIndex(Index posLastIndex, Index newGlobalI } template class SOFA_CORE_API sofa::core::topology::TopologyDataHandler < core::topology::BaseMeshTopology::Point, type::vector >; -template class SOFA_CORE_API sofa::core::topology::TopologyData < core::topology::BaseMeshTopology::Point, type::vector >; //template class SOFA_CORE_API sofa::core::topology::BaseTopologyData < type::vector >; } //namespace sofa::core::topology diff --git a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.cpp b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.cpp index 35e24709a93..104a3d23deb 100644 --- a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.cpp +++ b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.cpp @@ -19,7 +19,7 @@ * * * Contact information: contact@sofa-framework.org * ******************************************************************************/ -#define SOFABASELINEARSOLVER_FULLMATRIX_DEFINITION +#define SOFA_LINEARALGEBRA_FULLVECTOR_DEFINITION #include namespace sofa::linearalgebra diff --git a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.h b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.h index 628a702fe36..8f4e7b0a71e 100644 --- a/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.h +++ b/Sofa/framework/LinearAlgebra/src/sofa/linearalgebra/FullVector.h @@ -220,7 +220,7 @@ class FullVector : public linearalgebra::BaseVector SOFA_LINEARALGEBRA_API std::ostream& operator <<(std::ostream& out, const FullVector& v); SOFA_LINEARALGEBRA_API std::ostream& operator <<(std::ostream& out, const FullVector& v); -#if !defined(SOFABASELINEARSOLVER_FULLMATRIX_DEFINITION) +#if !defined(SOFA_LINEARALGEBRA_FULLVECTOR_DEFINITION) extern template class SOFA_LINEARALGEBRA_API FullVector; extern template class SOFA_LINEARALGEBRA_API FullVector; #endif