Commit d0c30421 authored by Martin Heistermann's avatar Martin Heistermann
Browse files

Improve incremental compile time with explicit template instantiation.

By not including the *T_impl.hh files in the corresponding *T.hh files,
but only providing explicit template declarations and instantiations for
the types we use them for, we can avoid recompilation of code that
(indirectly) depends on the *T.hh files, which turn out to be many.

This still leaves a lot of re-linking with libACG, but at least it's
much faster than before.
parent 4a4c984c
#pragma once
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenFlipper * * OpenFlipper *
...@@ -39,21 +40,12 @@ ...@@ -39,21 +40,12 @@
* * * *
\*===========================================================================*/ \*===========================================================================*/
//============================================================================= //=============================================================================
// //
// CLASS DrawMeshT // CLASS DrawMeshT
// //
//============================================================================= //=============================================================================
#ifndef ACG_DRAW_MESH_HH
#define ACG_DRAW_MESH_HH
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include <vector> #include <vector>
...@@ -61,6 +53,9 @@ ...@@ -61,6 +53,9 @@
#include <OpenMesh/Core/Utils/Property.hh> #include <OpenMesh/Core/Utils/Property.hh>
#include <OpenMesh/Core/Utils/color_cast.hh> #include <OpenMesh/Core/Utils/color_cast.hh>
#include <OpenMesh/Core/Mesh/DefaultTriMesh.hh>
#include <OpenMesh/Core/Mesh/DefaultPolyMesh.hh>
#include <ACG/GL/globjects.hh> #include <ACG/GL/globjects.hh>
#include <ACG/GL/GLState.hh> #include <ACG/GL/GLState.hh>
#include <ACG/GL/IRenderer.hh> #include <ACG/GL/IRenderer.hh>
...@@ -1106,13 +1101,8 @@ private: ...@@ -1106,13 +1101,8 @@ private:
}; };
//============================================================================= // defined in DrawMeshT_impl.cc:
extern template class DrawMeshT<::OpenMesh::TriMesh>;
extern template class DrawMeshT<::OpenMesh::PolyMesh>;
} // namespace ACG } // namespace ACG
//=============================================================================
#if defined(INCLUDE_TEMPLATES) && !defined(ACG_DRAW_MESH_TCC)
#define ACG_DRAW_MESH_TEMPLATES
#include "DrawMeshT_impl.hh"
#endif
//=============================================================================
#endif // ACG_DRAW_MESH_HH defined
//=============================================================================
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2020, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#include "DrawMeshT_impl.hh"
#include "Config/ACGDefines.hh"
namespace ACG
{
template class ACGDLLEXPORT DrawMeshT<::OpenMesh::TriMesh>;
template class ACGDLLEXPORT DrawMeshT<::OpenMesh::PolyMesh>;
} // namespace ACG
...@@ -2792,9 +2792,4 @@ void ACG::DrawMeshT<Mesh>::updateFullVBO() ...@@ -2792,9 +2792,4 @@ void ACG::DrawMeshT<Mesh>::updateFullVBO()
} }
} }
} }
} // namespace ACG
}
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <ACG/GL/acg_glew.hh> #include <ACG/GL/acg_glew.hh>
#include "MeshNode2T.hh" #include "MeshNode2T.hh"
#include "MeshNode2T_impl.hh"
namespace ACG { namespace ACG {
namespace SceneGraph { namespace SceneGraph {
......
#pragma once
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenFlipper * * OpenFlipper *
...@@ -40,21 +41,12 @@ ...@@ -40,21 +41,12 @@
\*===========================================================================*/ \*===========================================================================*/
//============================================================================= //=============================================================================
// //
// CLASS MeshNodeT // CLASS MeshNodeT
// //
//============================================================================= //=============================================================================
#ifndef ACG_MESHNODE_HH
#define ACG_MESHNODE_HH
//== INCLUDES ================================================================= //== INCLUDES =================================================================
...@@ -63,6 +55,8 @@ ...@@ -63,6 +55,8 @@
#include <vector> #include <vector>
#include <ACG/GL/DrawMesh.hh> #include <ACG/GL/DrawMesh.hh>
#include <ACG/ShaderUtils/GLSLShader.hh> #include <ACG/ShaderUtils/GLSLShader.hh>
#include <OpenMesh/Core/Mesh/DefaultTriMesh.hh>
#include <OpenMesh/Core/Mesh/DefaultPolyMesh.hh>
//== NAMESPACES =============================================================== //== NAMESPACES ===============================================================
...@@ -513,14 +507,11 @@ public: ...@@ -513,14 +507,11 @@ public:
void set_offset(bool enable) { draw_with_offset_ = enable; } void set_offset(bool enable) { draw_with_offset_ = enable; }
}; };
// defined in MeshNode2T_impl.cc:
extern template class MeshNodeT<::OpenMesh::TriMesh>;
extern template class MeshNodeT<::OpenMesh::PolyMesh>;
//============================================================================= //=============================================================================
} // namespace SceneGraph } // namespace SceneGraph
} // namespace ACG } // namespace ACG
//============================================================================= //=============================================================================
#if defined(INCLUDE_TEMPLATES) && !defined(ACG_MESHNODE_C)
#define ACG_MESHNODE_TEMPLATES
#include "MeshNode2T_impl.hh"
#endif
//=============================================================================
#endif // ACG_MESHNODE_HH defined
//=============================================================================
/*===========================================================================*\
* *
* OpenFlipper *
* Copyright (c) 2001-2020, RWTH-Aachen University *
* Department of Computer Graphics and Multimedia *
* All rights reserved. *
* www.openflipper.org *
* *
*---------------------------------------------------------------------------*
* This file is part of OpenFlipper. *
*---------------------------------------------------------------------------*
* *
* Redistribution and use in source and binary forms, with or without *
* modification, are permitted provided that the following conditions *
* are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice, *
* this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. Neither the name of the copyright holder nor the names of its *
* contributors may be used to endorse or promote products derived from *
* this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
* OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
\*===========================================================================*/
#include "MeshNode2T_impl.hh"
#include "Config/ACGDefines.hh"
namespace ACG {
namespace SceneGraph {
template class ACGDLLEXPORT MeshNodeT<::OpenMesh::TriMesh>;
template class ACGDLLEXPORT MeshNodeT<::OpenMesh::PolyMesh>;
}
}
#pragma once
/*===========================================================================*\ /*===========================================================================*\
* * * *
* OpenFlipper * * OpenFlipper *
...@@ -52,6 +53,8 @@ ...@@ -52,6 +53,8 @@
#define ACG_MESHNODE_C #define ACG_MESHNODE_C
#include "MeshNode2T.hh"
#include <ACG/Geometry/GPUCacheOptimizer.hh> #include <ACG/Geometry/GPUCacheOptimizer.hh>
#include <ACG/GL/DrawMesh.hh> #include <ACG/GL/DrawMesh.hh>
#include <ACG/GL/GLError.hh> #include <ACG/GL/GLError.hh>
...@@ -67,7 +70,6 @@ namespace SceneGraph { ...@@ -67,7 +70,6 @@ namespace SceneGraph {
//== INCLUDES ================================================================= //== INCLUDES =================================================================
#include "MeshNode2T.hh"
template<class Mesh> template<class Mesh>
MeshNodeT<Mesh>:: MeshNodeT<Mesh>::
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment