Kaydet (Commit) 89c4700e authored tarafından Tor Lillqvist's avatar Tor Lillqvist

Fix OpenCL-less build

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