From 4ecf503924516979970254eb3783f68037647ac3 Mon Sep 17 00:00:00 2001 From: Kohei Yoshida Date: Tue, 10 Sep 2013 21:09:24 -0400 Subject: First step toward splitting the opencl code into own shared library. Change-Id: I44fa3ded8d48b2972af17b78ab6c0af03e024f36 --- Repository.mk | 1 + RepositoryModule_host.mk | 2 +- sc/Library_sc.mk | 9 -------- sc/Library_scopencl.mk | 37 +++++++++++++++++++++++++++++++++ sc/Module_sc.mk | 6 ++++++ sc/inc/document.hxx | 2 +- sc/source/core/opencl/openclwrapper.cxx | 1 - sc/source/core/tool/formulagroup.cxx | 16 ++++++++++++++ 8 files changed, 62 insertions(+), 12 deletions(-) create mode 100644 sc/Library_scopencl.mk diff --git a/Repository.mk b/Repository.mk index b8b1aa003afb..57a513b4542d 100644 --- a/Repository.mk +++ b/Repository.mk @@ -157,6 +157,7 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,calc, \ scfilt \ scui \ solver \ + $(if $(ENABLE_OPENCL),scopencl) \ $(if $(DISABLE_SCRIPTING),,vbaobj) \ $(if $(ENABLE_TELEPATHY),tubes) \ )) diff --git a/RepositoryModule_host.mk b/RepositoryModule_host.mk index c57773477cf3..0b229520417d 100644 --- a/RepositoryModule_host.mk +++ b/RepositoryModule_host.mk @@ -246,7 +246,7 @@ endef # the default goal is all (see Module.mk) ifeq (,$(filter-out all,$(MAKECMDGOALS))) $(eval $(call repositorymodule_serialize,\ - scfilt \ + scfilt scopencl \ $(if $(filter SCRIPTING,$(BUILD_TYPE)),vbaobj) \ sc msword swui sw sd \ $(if $(filter DBCONNECTIVITY,$(BUILD_TYPE)),dbu) \ diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index bd1a9a3b2805..d1987371f327 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -54,15 +54,6 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ )) endif -ifeq ($(ENABLE_OPENCL),TRUE) -$(eval $(call gb_Library_use_externals,sc,opencl)) - -$(eval $(call gb_Library_add_exception_objects,sc,\ - sc/source/core/opencl/formulagroupcl \ - sc/source/core/opencl/openclwrapper \ -)) -endif - $(eval $(call gb_Library_use_libraries,sc,\ avmedia \ basegfx \ diff --git a/sc/Library_scopencl.mk b/sc/Library_scopencl.mk new file mode 100644 index 000000000000..f30f9c4a89ea --- /dev/null +++ b/sc/Library_scopencl.mk @@ -0,0 +1,37 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# + +$(eval $(call gb_Library_Library,scopencl)) + +$(eval $(call gb_Library_set_include,scopencl,\ + -I$(SRCDIR)/sc/source/core/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_Library_set_precompiled_header,scopencl,$(SRCDIR)/sc/inc/pch/precompiled_scopencl)) + +$(eval $(call gb_Library_use_sdk_api,scopencl)) + +$(eval $(call gb_Library_use_libraries,scopencl,\ + for \ + forui \ + sal \ + sc \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_Library_use_externals,scopencl,opencl)) + +$(eval $(call gb_Library_add_exception_objects,scopencl,\ + sc/source/core/opencl/formulagroupcl \ + sc/source/core/opencl/openclwrapper \ +)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 35f1fc1e6ca8..6522862f7389 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -19,6 +19,12 @@ $(eval $(call gb_Module_add_targets,sc,\ UIConfig_scalc \ )) +ifeq ($(ENABLE_OPENCL),TRUE) +$(eval $(call gb_Module_add_targets,sc,\ + Library_scopencl \ +)) +endif + ifneq (,$(filter DESKTOP,$(BUILD_TYPE))) $(eval $(call gb_Module_add_targets,sc,\ Library_scqahelper \ diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx index 6993abb0f8c7..1e720a87779d 100644 --- a/sc/inc/document.hxx +++ b/sc/inc/document.hxx @@ -1745,7 +1745,7 @@ public: * @param pResults array of numeric results. * @param nLen length of numeric results. */ - void SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen ); + void SC_DLLPUBLIC SetFormulaResults( const ScAddress& rTopPos, const double* pResults, size_t nLen ); private: ScDocument(const ScDocument& r); // disabled with no definition diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index 75e991bbdd33..c46bdceaeb6b 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -10,7 +10,6 @@ #include "openclwrapper.hxx" #include "sal/config.h" -#include "random.hxx" #include "oclkernels.hxx" #include diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx index 04bec4fb854a..98ef4a94ce4e 100644 --- a/sc/source/core/tool/formulagroup.cxx +++ b/sc/source/core/tool/formulagroup.cxx @@ -128,6 +128,15 @@ void fillMatrix( ScMatrix& rMat, size_t nCol, rtl_uString** pStrs, size_t nLen ) } +class FormulaGroupInterpreterOpenCLMissing : public FormulaGroupInterpreter +{ +public: + FormulaGroupInterpreterOpenCLMissing() : FormulaGroupInterpreter() {} + virtual ~FormulaGroupInterpreterOpenCLMissing() {} + virtual ScMatrixRef inverseMatrix(const ScMatrix&) { return ScMatrixRef(); } + virtual bool interpret(ScDocument&, const ScAddress&, const ScFormulaCellGroupRef&, ScTokenArray&) { return false; } +}; + ScMatrixRef FormulaGroupInterpreterSoftware::inverseMatrix(const ScMatrix& /*rMat*/) { return ScMatrixRef(); @@ -340,7 +349,14 @@ FormulaGroupInterpreter *FormulaGroupInterpreter::getStatic() { #if HAVE_FEATURE_OPENCL if ( ScInterpreter::GetGlobalConfig().mbOpenCLEnabled ) + { +#ifdef DISABLE_DYNLOADING msInstance = sc::opencl::createFormulaGroupInterpreter(); +#else + // TODO : Dynamically load scopencl shared object, and instantiate the opencl interpreter. + msInstance = new sc::FormulaGroupInterpreterOpenCLMissing(); +#endif + } #endif if ( !msInstance ) // software fallback { -- cgit