diff options
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/SConscript | 9 | ||||
-rw-r--r-- | source/blender/editors/physics/physics_fluid.c | 18 |
2 files changed, 26 insertions, 1 deletions
diff --git a/source/blender/editors/physics/SConscript b/source/blender/editors/physics/SConscript index 85a40c91b3a..fcf94eae994 100644 --- a/source/blender/editors/physics/SConscript +++ b/source/blender/editors/physics/SConscript @@ -8,6 +8,8 @@ incs += ' ../../windowmanager #/intern/guardedalloc #/extern/glew/include' incs += ' ../../gpu' incs += ' ../../makesrna ../../render/extern/include #/intern/elbeem/extern' +defs = '' + if env['OURPLATFORM'] == 'linux2': cflags='-pthread' incs += ' ../../../extern/binreloc/include' @@ -15,4 +17,9 @@ if env['OURPLATFORM'] == 'linux2': if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): incs += ' ' + env['BF_PTHREADS_INC'] -env.BlenderLib ( 'bf_editors_physics', sources, Split(incs), [], libtype=['core'], priority=[45] ) + +if env['OURPLATFORM'] == 'darwin': + if env['WITH_BF_OPENMP']: + defs += ' PARALLEL=1' + +env.BlenderLib ( 'bf_editors_physics', sources, Split(incs), Split(defs), libtype=['core'], priority=[45] ) diff --git a/source/blender/editors/physics/physics_fluid.c b/source/blender/editors/physics/physics_fluid.c index 7893b314e3e..eec971e777e 100644 --- a/source/blender/editors/physics/physics_fluid.c +++ b/source/blender/editors/physics/physics_fluid.c @@ -98,6 +98,14 @@ /* enable/disable overall compilation */ #ifndef DISABLE_ELBEEM +#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) +/* ************** libgomp (Apple gcc 4.2.1) TLS bug workaround *************** */ +#include <pthread.h> +extern pthread_key_t gomp_tls_key; +static void *thread_tls_data; +#endif + + /* XXX */ /* from header info.c */ static int start_progress_bar(void) {return 0;}; @@ -320,6 +328,11 @@ static void *fluidsimSimulateThread(void *unused) { // *ptr) { //char* fnameCfgPath = (char*)(ptr); int ret=0; +#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) + // Workaround for Apple gcc 4.2.1 omp vs background thread bug + pthread_setspecific (gomp_tls_key, thread_tls_data); +#endif + ret = elbeemSimulate(); BLI_lock_thread(LOCK_CUSTOM1); if(globalBakeState==0) { @@ -1036,6 +1049,11 @@ int fluidsimBake(bContext *C, ReportList *reports, Object *ob) // set to neutral, -1 means user abort, -2 means init error globalBakeState = 0; globalBakeFrame = 0; + +#if defined(__APPLE__) && (PARALLEL == 1) && (__GNUC__ == 4) && (__GNUC_MINOR__ == 2) + // Workaround for Apple gcc 4.2.1 omp vs background thread bug + thread_tls_data = pthread_getspecific(gomp_tls_key); +#endif BLI_init_threads(&threads, fluidsimSimulateThread, 1); BLI_insert_thread(&threads, targetFile); |