Skip to content

Commit

Permalink
[LinearAlgera, Core] Fix linking with LTO on MacOS/Clang (#4293)
Browse files Browse the repository at this point in the history
Fix linking with LTO on macos
  • Loading branch information
fredroy committed Nov 22, 2023
1 parent c00d082 commit b422d39
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 3 deletions.
1 change: 1 addition & 0 deletions Sofa/framework/Core/CMakeLists.txt
Expand Up @@ -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
Expand Down
32 changes: 32 additions & 0 deletions 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 <http://www.gnu.org/licenses/>. *
*******************************************************************************
* Authors: The SOFA Team and external contributors (see Authors.txt) *
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFA_CORE_TOPOLOGY_TOPOLOGYDATA_DEFINITION

#include <sofa/core/topology/TopologyData.inl>


namespace sofa::core::topology
{

template class SOFA_CORE_API sofa::core::topology::TopologyData < core::topology::BaseMeshTopology::Point, type::vector<Index> >;

} //namespace sofa::core::topology
4 changes: 4 additions & 0 deletions Sofa/framework/Core/src/sofa/core/topology/TopologyData.h
Expand Up @@ -164,5 +164,9 @@ template< class VecT > using QuadData = TopologyData<core::topology::Base
template< class VecT > using TetrahedronData = TopologyData<core::topology::BaseMeshTopology::Tetrahedron, VecT>;
template< class VecT > using HexahedronData = TopologyData<core::topology::BaseMeshTopology::Hexahedron, VecT>;

#if !defined(SOFA_CORE_TOPOLOGY_TOPOLOGYDATA_DEFINITION)
extern template class SOFA_CORE_API sofa::core::topology::TopologyData < core::topology::BaseMeshTopology::Point, type::vector<Index> >;
#endif


} //namespace sofa::core::topology
Expand Up @@ -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<Index> >;
template class SOFA_CORE_API sofa::core::topology::TopologyData < core::topology::BaseMeshTopology::Point, type::vector<Index> >;
//template class SOFA_CORE_API sofa::core::topology::BaseTopologyData < type::vector<Index> >;

} //namespace sofa::core::topology
Expand Up @@ -19,7 +19,7 @@
* *
* Contact information: contact@sofa-framework.org *
******************************************************************************/
#define SOFABASELINEARSOLVER_FULLMATRIX_DEFINITION
#define SOFA_LINEARALGEBRA_FULLVECTOR_DEFINITION
#include <sofa/linearalgebra/FullVector.inl>

namespace sofa::linearalgebra
Expand Down
Expand Up @@ -220,7 +220,7 @@ class FullVector : public linearalgebra::BaseVector
SOFA_LINEARALGEBRA_API std::ostream& operator <<(std::ostream& out, const FullVector<float>& v);
SOFA_LINEARALGEBRA_API std::ostream& operator <<(std::ostream& out, const FullVector<double>& v);

#if !defined(SOFABASELINEARSOLVER_FULLMATRIX_DEFINITION)
#if !defined(SOFA_LINEARALGEBRA_FULLVECTOR_DEFINITION)
extern template class SOFA_LINEARALGEBRA_API FullVector<float>;
extern template class SOFA_LINEARALGEBRA_API FullVector<double>;
#endif
Expand Down

0 comments on commit b422d39

Please sign in to comment.