[Libreoffice-commits] core.git: sc/inc sc/source

Tor Lillqvist tml at collabora.com
Thu Nov 27 04:13:18 PST 2014


 sc/inc/formulagroup.hxx              |    7 ++++++-
 sc/source/core/tool/formulagroup.cxx |   23 ++++++-----------------
 sc/source/ui/unoobj/docuno.cxx       |   12 ++++++++++++
 3 files changed, 24 insertions(+), 18 deletions(-)

New commits:
commit 89c4700e6ab6ba105d9084e5dc70325896eba419
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Nov 27 14:02:01 2014 +0200

    Fix OpenCL-less build
    
    Change-Id: I8e049a6df5946344110b38887301d186991a475d

diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx
index 19debee..5bca2d5 100644
--- a/sc/inc/formulagroup.hxx
+++ b/sc/inc/formulagroup.hxx
@@ -10,12 +10,16 @@
 #ifndef INCLUDED_SC_INC_FORMULAGROUP_HXX
 #define INCLUDED_SC_INC_FORMULAGROUP_HXX
 
+#include <config_features.h>
+
 #include "address.hxx"
 #include "types.hxx"
 #include "stlalgorithm.hxx"
 
 #include <formula/opcode.hxx>
+#if HAVE_FEATURE_OPENCL
 #include <opencl/platforminfo.hxx>
+#endif
 #include <svl/sharedstringpool.hxx>
 
 #include <set>
@@ -122,11 +126,12 @@ class SC_DLLPUBLIC FormulaGroupInterpreter
 
  public:
     static FormulaGroupInterpreter *getStatic();
+#if HAVE_FEATURE_OPENCL
     static void fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rPlatforms);
     static bool switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation = false);
     static void enableOpenCL(bool bEnable, bool bEnableCompletely = false, const std::set<OpCodeEnum>& rSubsetToEnable = std::set<OpCodeEnum>());
     static void getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int32& rPlatformId);
-
+#endif
     virtual ScMatrixRef inverseMatrix(const ScMatrix& rMat) = 0;
     virtual CompiledFormula* createCompiledFormula(ScDocument& rDoc,
                                                    const ScAddress& rTopPos,
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 332072c..705029b 100644
--- a/sc/source/core/tool/formulagroup.cxx
+++ b/sc/source/core/tool/formulagroup.cxx
@@ -21,7 +21,9 @@
 
 #include <formula/vectortoken.hxx>
 #include <officecfg/Office/Common.hxx>
+#if HAVE_FEATURE_OPENCL
 #include <opencl/platforminfo.hxx>
+#endif
 #include <rtl/bootstrap.hxx>
 
 #include <vector>
@@ -33,9 +35,7 @@
 #include <cstdio>
 
 #if HAVE_FEATURE_OPENCL
-
 #include "openclwrapper.hxx"
-
 #endif
 
 namespace sc {
@@ -537,16 +537,13 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic()
     return msInstance;
 }
 
+#if HAVE_FEATURE_OPENCL
 void FormulaGroupInterpreter::fillOpenCLInfo(std::vector<OpenCLPlatformInfo>& rPlatforms)
 {
-#if !HAVE_FEATURE_OPENCL
-    (void) rPlatforms;
-#else
     const std::vector<OpenCLPlatformInfo>& rPlatformsFromWrapper =
         sc::opencl::fillOpenCLInfo();
 
     rPlatforms.assign(rPlatformsFromWrapper.begin(), rPlatformsFromWrapper.end());
-#endif
 }
 
 bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation)
@@ -566,26 +563,19 @@ bool FormulaGroupInterpreter::switchOpenCLDevice(const OUString& rDeviceId, bool
         msInstance = new sc::FormulaGroupInterpreterSoftware();
         return true;
     }
-#if HAVE_FEATURE_OPENCL
     bool bSuccess = sc::opencl::switchOpenCLDevice(&rDeviceId, bAutoSelect, bForceEvaluation);
     if(!bSuccess)
         return false;
-#else
-    (void) bAutoSelect;
-#endif
 
     delete msInstance;
     msInstance = NULL;
 
-#if HAVE_FEATURE_OPENCL
     if ( officecfg::Office::Common::Misc::UseOpenCL::get() )
     {
         msInstance = new sc::opencl::FormulaGroupInterpreterOpenCL();
         return msInstance != NULL;
     }
-#else
-    (void) bForceEvaluation;
-#endif
+
     return false;
 }
 
@@ -597,15 +587,12 @@ void FormulaGroupInterpreter::getOpenCLDeviceInfo(sal_Int32& rDeviceId, sal_Int3
     if(!bOpenCLEnabled)
         return;
 
-#if HAVE_FEATURE_OPENCL
-
     size_t aDeviceId = static_cast<size_t>(-1);
     size_t aPlatformId = static_cast<size_t>(-1);
 
     sc::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId);
     rDeviceId = aDeviceId;
     rPlatformId = aPlatformId;
-#endif
 }
 
 void FormulaGroupInterpreter::enableOpenCL(bool bEnable, bool bEnableCompletely, const std::set<OpCodeEnum>& rSubsetToEnable)
@@ -620,6 +607,8 @@ void FormulaGroupInterpreter::enableOpenCL(bool bEnable, bool bEnableCompletely,
     ScInterpreter::SetGlobalConfig(aConfig);
 }
 
+#endif
+
 } // namespace sc
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx
index 2e1ee23..a4de29c 100644
--- a/sc/source/ui/unoobj/docuno.cxx
+++ b/sc/source/ui/unoobj/docuno.cxx
@@ -17,6 +17,8 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <config_features.h>
+
 #include "scitems.hxx"
 #include <svx/fmdpage.hxx>
 #include <svx/fmview.hxx>
@@ -58,7 +60,9 @@
 #include <comphelper/servicehelper.hxx>
 #include <comphelper/string.hxx>
 #include <cppuhelper/supportsservice.hxx>
+#if HAVE_FEATURE_OPENCL
 #include <opencl/platforminfo.hxx>
+#endif
 
 #include "docuno.hxx"
 #include "cellsuno.hxx"
@@ -2369,6 +2373,9 @@ void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice )
     if(nPlatform < 0 || nDevice < 0)
         throw uno::RuntimeException();
 
+#if !HAVE_FEATURE_OPENCL
+    throw uno::RuntimeException();
+#else
     std::vector<OpenCLPlatformInfo> aPlatformInfo;
     sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
     if(size_t(nPlatform) >= aPlatformInfo.size())
@@ -2379,6 +2386,7 @@ void ScModelObj::selectOpenCLDevice( sal_Int32 nPlatform, sal_Int32 nDevice )
 
     OUString aDeviceString = aPlatformInfo[nPlatform].maVendor + " " + aPlatformInfo[nPlatform].maDevices[nDevice].maName;
     sc::FormulaGroupInterpreter::switchOpenCLDevice(aDeviceString, false);
+#endif
 }
 
 sal_Int32 ScModelObj::getPlatformID()
@@ -2402,6 +2410,9 @@ sal_Int32 ScModelObj::getDeviceID()
 uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
     throw (uno::RuntimeException, std::exception)
 {
+#if !HAVE_FEATURE_OPENCL
+    return uno::Sequence<sheet::opencl::OpenCLPlatform>();
+#else
     std::vector<OpenCLPlatformInfo> aPlatformInfo;
     sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo);
 
@@ -2422,6 +2433,7 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms()
     }
 
     return aRet;
+#endif
 }
 
 ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) :


More information about the Libreoffice-commits mailing list