[Bf-blender-cvs] [7673a92] opensubdiv-modifier: Move libclew from intern to extern step 1 of sharing it between compositor, cycles and opensubdiv

Martijn Berger noreply at git.blender.org
Tue May 20 22:03:03 CEST 2014


Commit: 7673a92eb33d76089cdf3d106116a98a18698406
Author: Martijn Berger
Date:   Tue May 20 22:01:57 2014 +0200
https://developer.blender.org/rB7673a92eb33d76089cdf3d106116a98a18698406

Move libclew from intern to extern
step 1 of sharing it between compositor, cycles and opensubdiv

===================================================================

M	extern/CMakeLists.txt
M	extern/SConscript
A	extern/libclew/CMakeLists.txt
A	extern/libclew/SConscript
A	extern/libclew/include/clew.h
A	extern/libclew/src/clew.c
M	intern/CMakeLists.txt
M	intern/SConscript
D	intern/opencl/CMakeLists.txt
D	intern/opencl/OCL_opencl.h
D	intern/opencl/SConscript
D	intern/opencl/intern/OCL_opencl.c
D	intern/opencl/intern/clew.c
D	intern/opencl/intern/clew.h
M	source/blender/compositor/CMakeLists.txt
M	source/blender/compositor/SConscript
M	source/blender/compositor/intern/COM_NodeOperation.h
M	source/blender/compositor/intern/COM_OpenCLDevice.h
M	source/blender/compositor/intern/COM_WorkScheduler.cpp
M	source/blender/compositor/intern/COM_compositor.cpp
M	source/creator/CMakeLists.txt

===================================================================

diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index f6de873..7d41e09 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -70,6 +70,10 @@ if(WITH_LZMA)
 	add_subdirectory(lzma)
 endif()
 
+if(WITH_COMPOSITOR)
+    add_subdirectory(libclew)
+endif()
+
 if(WITH_MOD_BOOLEAN)
 	add_subdirectory(carve)
 endif()
diff --git a/extern/SConscript b/extern/SConscript
index 041aa34..302446b 100644
--- a/extern/SConscript
+++ b/extern/SConscript
@@ -20,6 +20,9 @@ if env['WITH_BF_ELTOPO']:
 if env['WITH_BF_BULLET']:
     SConscript(['bullet2/src/SConscript'])
 
+if env['WITH_BF_COMPOSITOR']:
+    SConscript (['libclew/SConscript'])
+
 if env['WITH_BF_OPENJPEG'] and env['BF_OPENJPEG_LIB'] == '':
     SConscript(['libopenjpeg/SConscript'])
 
diff --git a/intern/opencl/CMakeLists.txt b/extern/libclew/CMakeLists.txt
similarity index 88%
rename from intern/opencl/CMakeLists.txt
rename to extern/libclew/CMakeLists.txt
index 03855cf..1953cb2 100644
--- a/intern/opencl/CMakeLists.txt
+++ b/extern/libclew/CMakeLists.txt
@@ -25,6 +25,7 @@
 
 set(INC
 	.
+	include
 )
 
 set(INC_SYS
@@ -32,11 +33,9 @@ set(INC_SYS
 )
 
 set(SRC
-	OCL_opencl.h
-	intern/clew.h
-	intern/clew.c
-	intern/OCL_opencl.c
+	include/clew.h
+	src/clew.c
 )
 
 
-blender_add_lib(bf_intern_opencl "${SRC}" "${INC}" "${INC_SYS}")
+blender_add_lib(extern_libclew "${SRC}" "${INC}" "${INC_SYS}")
diff --git a/intern/opencl/SConscript b/extern/libclew/SConscript
similarity index 86%
rename from intern/opencl/SConscript
rename to extern/libclew/SConscript
index 41a6d72..2b6117a 100644
--- a/intern/opencl/SConscript
+++ b/extern/libclew/SConscript
@@ -27,8 +27,8 @@
 
 Import ('env')
 
-sources = env.Glob('intern/*.c')
+sources = env.Glob('src/clew.c')
 
-incs = '.'
+incs = 'include'
 
-env.BlenderLib ( 'bf_intern_opencl', sources, Split(incs), libtype=['core','player'], priority = [192,192] )
+env.BlenderLib ( 'clew', sources, Split(incs), libtype=['core','player'], priority = [192,192] )
diff --git a/intern/opencl/intern/clew.h b/extern/libclew/include/clew.h
similarity index 99%
rename from intern/opencl/intern/clew.h
rename to extern/libclew/include/clew.h
index bb7e013..eef03b6 100644
--- a/intern/opencl/intern/clew.h
+++ b/extern/libclew/include/clew.h
@@ -1306,7 +1306,7 @@ CLEW_FUN_EXPORT     PFNCLGETEXTENSIONFUNCTIONADDRESS    __oclGetExtensionFunctio
 #define CLEW_ERROR_ATEXIT_FAILED    -2      //!<    Error code for failing to queue the closing of the dynamic library to atexit()
 
 //! \brief Load OpenCL dynamic library and set function entry points
-int         clewInit        (const char*);
+int         clewInit        ();
 //! \brief Convert an OpenCL error code to its string equivalent
 const char* clewErrorString (cl_int error);
 
diff --git a/intern/opencl/intern/clew.c b/extern/libclew/src/clew.c
similarity index 98%
rename from intern/opencl/intern/clew.c
rename to extern/libclew/src/clew.c
index 1e31ebc..92fae6c 100644
--- a/intern/opencl/intern/clew.c
+++ b/extern/libclew/src/clew.c
@@ -129,8 +129,15 @@ static void clewExit(void)
 //! \return CLEW_ERROR_OPEN_FAILED if the library could not be opened
 //! CLEW_ERROR_ATEXIT_FAILED if atexit(clewExit) failed
 //! CLEW_SUCCESS when the library was succesfully loaded
-int clewInit(const char* path)
+int clewInit()
 {
+#ifdef _WIN32
+    const char *path = "OpenCL.dll";
+#elif defined(__APPLE__)
+    const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
+#else
+    const char *path = "libOpenCL.so";
+#endif
     int error = 0;
 
     //  Check if already initialized
diff --git a/intern/CMakeLists.txt b/intern/CMakeLists.txt
index 7d3b920..07c0717 100644
--- a/intern/CMakeLists.txt
+++ b/intern/CMakeLists.txt
@@ -72,10 +72,6 @@ if(WITH_BULLET)
 	add_subdirectory(rigidbody)
 endif()
 
-if(WITH_COMPOSITOR)
-	add_subdirectory(opencl)
-endif()
-
 if(WITH_OPENNL)
 	add_subdirectory(opennl)
 endif()
diff --git a/intern/SConscript b/intern/SConscript
index 5259c0b..20fa4b0 100644
--- a/intern/SConscript
+++ b/intern/SConscript
@@ -59,9 +59,6 @@ if env['WITH_BF_INTERNATIONAL']:
 if env['WITH_BF_BULLET']:
     SConscript (['rigidbody/SConscript'])
 
-if env['WITH_BF_COMPOSITOR']:
-    SConscript (['opencl/SConscript'])
-
 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-mingw', 'linuxcross', 'win64-vc'):
     SConscript(['utfconv/SConscript'])
 
diff --git a/intern/opencl/OCL_opencl.h b/intern/opencl/OCL_opencl.h
deleted file mode 100644
index 733e352..0000000
--- a/intern/opencl/OCL_opencl.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor: 
- *		Jeroen Bakker 
- *		Monique Dewanchand
- */
-
-#ifndef OCL_OPENCL_H
-#define OCL_OPENCL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include "intern/clew.h"
-int OCL_init(void);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/intern/opencl/intern/OCL_opencl.c b/intern/opencl/intern/OCL_opencl.c
deleted file mode 100644
index 33a9368..0000000
--- a/intern/opencl/intern/OCL_opencl.c
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2011, Blender Foundation.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Contributor: 
- *		Jeroen Bakker 
- *		Monique Dewanchand
- */
-
-#include "OCL_opencl.h"
-
-int OCL_init(void)
-{
-#ifdef _WIN32
-	const char *path = "OpenCL.dll";
-#elif defined(__APPLE__)
-	const char *path = "/Library/Frameworks/OpenCL.framework/OpenCL";
-#else
-	const char *path = "libOpenCL.so";
-#endif
-
-	return (clewInit(path) == CLEW_SUCCESS);
-}
-
diff --git a/source/blender/compositor/CMakeLists.txt b/source/blender/compositor/CMakeLists.txt
index a194334..c856a14 100644
--- a/source/blender/compositor/CMakeLists.txt
+++ b/source/blender/compositor/CMakeLists.txt
@@ -39,7 +39,7 @@ set(INC
 	../nodes/intern
 	../render/extern/include
 	../render/intern/include
-	../../../intern/opencl
+	../../../extern/libclew/include
 	../../../intern/guardedalloc
 )
 
diff --git a/source/blender/compositor/SConscript b/source/blender/compositor/SConscript
index 073b100..e10917b 100644
--- a/source/blender/compositor/SConscript
+++ b/source/blender/compositor/SConscript
@@ -37,7 +37,7 @@ incs = [
     'intern',
     'nodes',
     'operations',
-    '#/intern/opencl',
+    '#/extern/libclew/include',
     '../blenkernel',
     '../blenlib',
     '../imbuf',
diff --git a/source/blender/compositor/intern/COM_NodeOperation.h b/source/blender/compositor/intern/COM_NodeOperation.h
index 3f636df..b9b6fb0 100644
--- a/source/blender/compositor/intern/COM_NodeOperation.h
+++ b/source/blender/compositor/intern/COM_NodeOperation.h
@@ -38,7 +38,7 @@ extern "C" {
 #include "COM_MemoryProxy.h"
 #include "COM_SocketReader.h"
 
-#include "OCL_opencl.h"
+#include "clew.h"
 
 using std::list;
 using std::min;
diff --git a/source/blender/compositor/intern/COM_OpenCLDevice.h b/source/blender/compositor/intern/COM_OpenCLDevice.h
index 50cc6f2..94df2f2 100644
--- a/source/blender/compositor/intern/COM_OpenCLDevice.h
+++ b/source/blender/compositor/intern/COM_OpenCLDevice.h
@@ -26,7 +26,7 @@ class OpenCLDevice;
 #define _COM_OpenCLDevice_h
 
 #include "COM_Device.h"
-#include "OCL_opencl.h"
+#include "clew.h"
 #include "COM_WorkScheduler.h"
 #include "COM_ReadBufferOperation.h"
 
diff --git a/source/blender/compositor/intern/COM_WorkScheduler.cpp b/source/blender/compositor/intern/COM_WorkScheduler.cpp
index d60f9cb..f4b0bac 100644
--- a/source/blender/compositor/intern/COM_WorkScheduler.cpp
+++ b/source/blender/compositor/intern/COM_WorkScheduler.cpp
@@ -28,7 +28,7 @@
 #include "COM_CPUDevice.h"
 #include "COM_OpenCLDevice.h"
 #include "COM_OpenCLKernels.cl.h"
-#include "OCL_opencl.h"
+#include "clew.h"
 #include "COM_WriteBufferOperation.h"
 
 #include "MEM_guardedalloc.h"
@@ -326,7 +326,7 @@ void WorkScheduler::initialize(bool use_opencl, int num_cpu_threads)
 		g_context = NULL;
 		g_program = NULL;
 
-		if (!OCL_init()) /* this will check for errors and skip if already initialized */
+		if (!clewInit()) /* this will check for errors and skip if already initialized */
 			return;
 
 		if (clCreateContextFromType) {
diff --git a/source/blender/compositor/intern/COM_compositor.cpp b/source/blender/compositor/intern/COM_compositor.cpp
index 99655c6..ec9ef6c 100644
--- a/source/blender/compositor/intern/COM_compositor.cpp
+++ b/source/blender/compositor/intern/COM_compositor.cpp
@@ -32,7 +32,7 @@ extern "C" {
 #include "COM_compositor.h"
 #include "COM_ExecutionSystem.h"
 #include "COM_WorkScheduler.h"
-#include "OCL_opencl.h"
+#include "clew.h"
 #include "COM_MovieDistortionOperation.h"
 
 static ThreadMutex s_compositorMutex;
diff --git a/source/creator/CMakeLists.txt b/source/creator/CMakeLists.txt
index 660a20d..a9bf938 100644
--- a/source/creator/CMakeLists.txt
+++ b/source/creator/CMakeLists.txt
@@ -1053,7 +1053,7 @@ endif()
 	if(W

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list