[Libreoffice-commits] core.git: Branch 'private/kohei/formula-opencl-work' - Repository.mk RepositoryModule_host.mk sc/inc sc/Library_sc.mk sc/Library_scopencl.mk sc/Module_sc.mk sc/source

Kohei Yoshida kohei.yoshida at collabora.com
Tue Sep 10 18:07:25 PDT 2013


 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(-)

New commits:
commit 518bbf0560ed96b9f87bea4e9fb38617344c2939
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Tue Sep 10 21:09:24 2013 -0400

    First step toward splitting the opencl code into own shared library.
    
    Change-Id: I44fa3ded8d48b2972af17b78ab6c0af03e024f36

diff --git a/Repository.mk b/Repository.mk
index cff654b..4d5125b 100644
--- a/Repository.mk
+++ b/Repository.mk
@@ -155,6 +155,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 c577734..0b22952 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 bd1a9a3..d198737 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 0000000..f30f9c4
--- /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 35f1fc1..6522862 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 6993abb..1e720a8 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 75e991b..c46bdce 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 <stdio.h>
diff --git a/sc/source/core/tool/formulagroup.cxx b/sc/source/core/tool/formulagroup.cxx
index 04bec4f..98ef4a9 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
         {


More information about the Libreoffice-commits mailing list