From 5e3c200bb36f057177840bb49ba7958f9525585a Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Mon, 16 May 2016 11:53:08 +0900 Subject: [PATCH] Precompile templates if enabled by roboptim-core only --- .travis.yml | 3 +-- .../core/manifold-map/decorator/function-on-manifold.hxx | 2 ++ .../core/manifold-map/decorator/manifold-problem-factory.hxx | 2 ++ .../core/manifold-map/decorator/problem-on-manifold.hxx | 2 ++ .../roboptim/core/manifold-map/decorator/sum-on-manifold.hxx | 3 ++- .../core/manifold-map/decorator/wrapper-on-manifold.hxx | 2 ++ src/roboptim-core-manifold-precompile.cc | 2 ++ 7 files changed, 13 insertions(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 2d187d6..169794b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,7 @@ script: after_success: ./.travis/run after_success after_failure: ./.travis/run after_failure before_install: + - if [ "${ENABLE_CXX11}" == "1" ]; then export CMAKE_ADDITIONAL_OPTIONS="-DUSE_CXX11:BOOL=ON -DROBOPTIM_PRECOMPILE_DENSE_SPARSE:BOOL=ON ${CMAKE_ADDITIONAL_OPTIONS}"; fi - ./.travis/dependencies/eigen-3.2 - ./.travis/run before_install matrix: @@ -39,12 +40,10 @@ matrix: - os: linux dist: trusty compiler: gcc - env: CMAKE_ADDITIONAL_OPTIONS="-DUSE_CXX11:BOOL=ON -DROBOPTIM_PRECOMPILE_DENSE_SPARSE:BOOL=ON" env: ENABLE_CXX11=1 - os: linux dist: trusty compiler: clang - env: CMAKE_ADDITIONAL_OPTIONS="-DUSE_CXX11:BOOL=ON -DROBOPTIM_PRECOMPILE_DENSE_SPARSE:BOOL=ON" env: ENABLE_CXX11=1 os: - linux diff --git a/include/roboptim/core/manifold-map/decorator/function-on-manifold.hxx b/include/roboptim/core/manifold-map/decorator/function-on-manifold.hxx index cbfa5a1..11815b4 100644 --- a/include/roboptim/core/manifold-map/decorator/function-on-manifold.hxx +++ b/include/roboptim/core/manifold-map/decorator/function-on-manifold.hxx @@ -41,8 +41,10 @@ namespace roboptim {} +# ifdef ROBOPTIM_PRECOMPILED_DENSE_SPARSE extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI FunctionOnManifold; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI FunctionOnManifold; +# endif } // end of namespace roboptim. #endif //! ROBOPTIM_CORE_MANIFOLD_MAP_DECORATOR_FUNCTION_ON_MANIFOLD_HXX diff --git a/include/roboptim/core/manifold-map/decorator/manifold-problem-factory.hxx b/include/roboptim/core/manifold-map/decorator/manifold-problem-factory.hxx index 967b11d..a285baa 100644 --- a/include/roboptim/core/manifold-map/decorator/manifold-problem-factory.hxx +++ b/include/roboptim/core/manifold-map/decorator/manifold-problem-factory.hxx @@ -376,11 +376,13 @@ BoundsAndScalingSetter::BoundsAndScalingSetter(std::pair; extern template struct ROBOPTIM_CORE_MANIFOLD_DLLAPI BoundsAndScalingSetter; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI ManifoldProblemFactory; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI ManifoldProblemFactory; +# endif } diff --git a/include/roboptim/core/manifold-map/decorator/problem-on-manifold.hxx b/include/roboptim/core/manifold-map/decorator/problem-on-manifold.hxx index b90e8ef..f86060c 100644 --- a/include/roboptim/core/manifold-map/decorator/problem-on-manifold.hxx +++ b/include/roboptim/core/manifold-map/decorator/problem-on-manifold.hxx @@ -59,7 +59,9 @@ namespace roboptim return manifold_; } +# ifdef ROBOPTIM_PRECOMPILED_DENSE_SPARSE extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI ProblemOnManifold; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI ProblemOnManifold; +# endif } #endif //!ROBOPTIM_CORE_MANIFOLD_MAP_DECORATOR_PROBLEM_ON_MANIFOLD_HXX diff --git a/include/roboptim/core/manifold-map/decorator/sum-on-manifold.hxx b/include/roboptim/core/manifold-map/decorator/sum-on-manifold.hxx index c3cbb42..c32ccb8 100644 --- a/include/roboptim/core/manifold-map/decorator/sum-on-manifold.hxx +++ b/include/roboptim/core/manifold-map/decorator/sum-on-manifold.hxx @@ -233,11 +233,12 @@ namespace roboptim return functionsToSum_.size(); } +# ifdef ROBOPTIM_PRECOMPILED_DENSE_SPARSE extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI SumOnManifold; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI SumOnManifold; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI AdderOnManifold; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI AdderOnManifold; - +# endif } #endif //! ROBOPTIM_CORE_MANIFOLD_MAP_DECORATOR_SUM_ON_MANIFOLD_HXX diff --git a/include/roboptim/core/manifold-map/decorator/wrapper-on-manifold.hxx b/include/roboptim/core/manifold-map/decorator/wrapper-on-manifold.hxx index 3310af1..2d31053 100644 --- a/include/roboptim/core/manifold-map/decorator/wrapper-on-manifold.hxx +++ b/include/roboptim/core/manifold-map/decorator/wrapper-on-manifold.hxx @@ -609,10 +609,12 @@ namespace roboptim return flags|fct_->getFlags(); } +# ifdef ROBOPTIM_PRECOMPILED_DENSE_SPARSE ROBOPTIM_ALLOW_ATTRIBUTES_ON extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI WrapperOnManifold; extern template class ROBOPTIM_CORE_MANIFOLD_DLLAPI WrapperOnManifold; ROBOPTIM_ALLOW_ATTRIBUTES_OFF +# endif } // end of namespace roboptim. diff --git a/src/roboptim-core-manifold-precompile.cc b/src/roboptim-core-manifold-precompile.cc index 2cd3090..93f66c5 100644 --- a/src/roboptim-core-manifold-precompile.cc +++ b/src/roboptim-core-manifold-precompile.cc @@ -1,3 +1,4 @@ +# ifdef ROBOPTIM_PRECOMPILED_DENSE_SPARSE # include # include # include @@ -28,3 +29,4 @@ namespace roboptim template class WrapperOnManifold; template class WrapperOnManifold; } +# endif // ROBOPTIM_PRECOMPILE_DENSE_SPARSE