From 89c4700e6ab6ba105d9084e5dc70325896eba419 Mon Sep 17 00:00:00 2001 From: Tor Lillqvist Date: Thu, 27 Nov 2014 14:02:01 +0200 Subject: Fix OpenCL-less build Change-Id: I8e049a6df5946344110b38887301d186991a475d --- 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(-) diff --git a/sc/inc/formulagroup.hxx b/sc/inc/formulagroup.hxx index 19debeeec669..5bca2d5634d5 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 + #include "address.hxx" #include "types.hxx" #include "stlalgorithm.hxx" #include +#if HAVE_FEATURE_OPENCL #include +#endif #include #include @@ -122,11 +126,12 @@ class SC_DLLPUBLIC FormulaGroupInterpreter public: static FormulaGroupInterpreter *getStatic(); +#if HAVE_FEATURE_OPENCL static void fillOpenCLInfo(std::vector& rPlatforms); static bool switchOpenCLDevice(const OUString& rDeviceId, bool bAutoSelect, bool bForceEvaluation = false); static void enableOpenCL(bool bEnable, bool bEnableCompletely = false, const std::set& rSubsetToEnable = std::set()); 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 332072c09def..705029b89f13 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -21,7 +21,9 @@ #include #include +#if HAVE_FEATURE_OPENCL #include +#endif #include #include @@ -33,9 +35,7 @@ #include #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& rPlatforms) { -#if !HAVE_FEATURE_OPENCL - (void) rPlatforms; -#else const std::vector& 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(-1); size_t aPlatformId = static_cast(-1); sc::opencl::getOpenCLDeviceInfo(aDeviceId, aPlatformId); rDeviceId = aDeviceId; rPlatformId = aPlatformId; -#endif } void FormulaGroupInterpreter::enableOpenCL(bool bEnable, bool bEnableCompletely, const std::set& 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 2e1ee23d5235..a4de29cad0d4 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 + #include "scitems.hxx" #include #include @@ -58,7 +60,9 @@ #include #include #include +#if HAVE_FEATURE_OPENCL #include +#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 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(); +#else std::vector aPlatformInfo; sc::FormulaGroupInterpreter::fillOpenCLInfo(aPlatformInfo); @@ -2422,6 +2433,7 @@ uno::Sequence< sheet::opencl::OpenCLPlatform > ScModelObj::getOpenCLPlatforms() } return aRet; +#endif } ScDrawPagesObj::ScDrawPagesObj(ScDocShell* pDocSh) : -- cgit