OSX: more futurework for clang-openmp:
- moved assumed location of omp lib to blender libs - prepared libiomp5 to link out of the box with cmake - changed according in scons - introduced a local var C_VENDOR, cause Apple clang 3.4 may not include omp support yet - added a linklibs for msgfmt ( may not be needed for other than OSX )
This commit is contained in:
parent
7aa86ec243
commit
c987bcc416
14
SConstruct
14
SConstruct
@ -293,8 +293,14 @@ if env['OURPLATFORM']=='darwin':
|
||||
frontend = re.search(r'gcc', line) or re.search(r'clang', line) or re.search(r'llvm-gcc', line) or re.search(r'icc', line)
|
||||
if frontend:
|
||||
env['C_COMPILER_ID'] = frontend.group(0)
|
||||
|
||||
vendor = re.search(r'Apple', line)
|
||||
if vendor:
|
||||
C_VENDOR = vendor.group(0)
|
||||
else:
|
||||
C_VENDOR = 'Open Source'
|
||||
|
||||
print B.bc.OKGREEN + "Using Compiler: " + B.bc.ENDC + env['C_COMPILER_ID'] + '-' + env['CCVERSION']
|
||||
print B.bc.OKGREEN + "Using Compiler: " + B.bc.ENDC + env['C_COMPILER_ID'] + '-' + env['CCVERSION'] + ' ( ' + C_VENDOR + ' )'
|
||||
|
||||
cmd = 'sw_vers -productVersion'
|
||||
MAC_CUR_VER=cmd_res=commands.getoutput(cmd)
|
||||
@ -410,9 +416,13 @@ if env['OURPLATFORM']=='darwin':
|
||||
#Defaults openMP to true if compiler handles it ( only gcc 4.6.1 and newer )
|
||||
# if your compiler does not have accurate suffix you may have to enable it by hand !
|
||||
if env['WITH_BF_OPENMP'] == 1:
|
||||
if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6.1' or env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
|
||||
if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6.1' or env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4' and C_VENDOR != 'Apple':
|
||||
env['WITH_BF_OPENMP'] = 1 # multithreading for fluids, cloth, sculpt and smoke
|
||||
print B.bc.OKGREEN + "Using OpenMP"
|
||||
if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
|
||||
OSX_OMP_LIBPATH = Dir(env.subst(env['LCGDIR'])).abspath
|
||||
env.Append(BF_PROGRAM_LINKFLAGS=['-L'+OSX_OMP_LIBPATH+'/openmp/lib','-liomp5'])
|
||||
env['CCFLAGS'].append('-I'+OSX_OMP_LIBPATH+'/openmp/include') # include for omp.h
|
||||
else:
|
||||
env['WITH_BF_OPENMP'] = 0
|
||||
print B.bc.OKGREEN + "Disabled OpenMP, not supported by compiler"
|
||||
|
@ -263,11 +263,9 @@ def setup_syslibs(lenv):
|
||||
if lenv['WITH_BF_OPENAL']:
|
||||
if not lenv['WITH_BF_STATICOPENAL']:
|
||||
syslibs += Split(lenv['BF_OPENAL_LIB'])
|
||||
if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc' and not lenv['WITH_BF_STATICOPENMP']:
|
||||
if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc' and lenv['C_COMPILER_ID'] != 'clang' and not lenv['WITH_BF_STATICOPENMP']:
|
||||
if lenv['CC'] == 'cl.exe':
|
||||
syslibs += ['vcomp']
|
||||
elif lenv['OURPLATFORM']=='darwin' and lenv['C_COMPILER_ID'] == 'clang' and lenv['CCVERSION'] >= '3.4': # clang-omp-3.4 !
|
||||
syslibs += ['iomp5']
|
||||
else:
|
||||
syslibs += ['gomp']
|
||||
if lenv['WITH_BF_ICONV']:
|
||||
@ -730,32 +728,33 @@ def AppIt(target=None, source=None, env=None):
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(installdir, binary)
|
||||
commands.getoutput(cmd)
|
||||
if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6.1': # for correct errorhandling with gcc >= 4.6.1 we need the gcc.dylib and gomp.dylib to link, thus distribute in app-bundle
|
||||
print "Bundling libgcc and libgomp"
|
||||
instname = env['BF_CXX']
|
||||
cmd = 'ditto --arch %s %s/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/'%(osxarch, instname, installdir, binary) # copy libgcc
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/libgcc_s.1.dylib'%(installdir, binary) # change id of libgcc
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'ditto --arch %s %s/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/lib/'%(osxarch, instname, installdir, binary) # copy libgomp
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @executable_path/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/lib/libgomp.1.dylib'%(installdir, binary) # change id of libgomp
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/libgomp.1.dylib'%(instname, installdir, binary) # change ref to libgcc
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libgcc ( blender )
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgomp.1.dylib @executable_path/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libgomp ( blender )
|
||||
commands.getoutput(cmd)
|
||||
if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
|
||||
print "Bundling libiomp5"
|
||||
instname = env['BF_CXX']
|
||||
cmd = 'ditto --arch %s %s/lib/libiomp5.dylib %s/%s.app/Contents/MacOS/lib/'%(osxarch, instname, installdir, binary) # copy libiomp5
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @executable_path/lib/libiomp5.dylib %s/%s.app/Contents/MacOS/lib/libiomp5.dylib'%(installdir, binary) # change id of libiomp5
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libiomp5.dylib @executable_path/lib/libiomp5.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libiomp5 ( blender )
|
||||
commands.getoutput(cmd)
|
||||
if env['WITH_BF_OPENMP']:
|
||||
if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6.1': # for correct errorhandling with gcc >= 4.6.1 we need the gcc.dylib and gomp.dylib to link, thus distribute in app-bundle
|
||||
print "Bundling libgcc and libgomp"
|
||||
instname = env['BF_CXX']
|
||||
cmd = 'ditto --arch %s %s/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/'%(osxarch, instname, installdir, binary) # copy libgcc
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/libgcc_s.1.dylib'%(installdir, binary) # change id of libgcc
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'ditto --arch %s %s/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/lib/'%(osxarch, instname, installdir, binary) # copy libgomp
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @executable_path/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/lib/libgomp.1.dylib'%(installdir, binary) # change id of libgomp
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/lib/libgomp.1.dylib'%(instname, installdir, binary) # change ref to libgcc
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libgcc ( blender )
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change %s/lib/libgomp.1.dylib @executable_path/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libgomp ( blender )
|
||||
commands.getoutput(cmd)
|
||||
if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4':
|
||||
print "Bundling libiomp5"
|
||||
instname = env['LCGDIR'][1:] # made libiomp5 part of blender libs
|
||||
cmd = 'ditto --arch %s %s/openmp/lib/libiomp5.dylib %s/%s.app/Contents/MacOS/lib/'%(osxarch, instname, installdir, binary) # copy libiomp5
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -id @loader_path/lib/libiomp5.dylib %s/%s.app/Contents/MacOS/lib/libiomp5.dylib'%(installdir, binary) # change id of libiomp5
|
||||
commands.getoutput(cmd)
|
||||
cmd = 'install_name_tool -change @loader_path/libiomp5.dylib @loader_path/lib/libiomp5.dylib %s/%s.app/Contents/MacOS/%s'%(installdir, binary, binary) # change ref to libiomp5 ( blender )
|
||||
commands.getoutput(cmd)
|
||||
|
||||
# extract copy system python, be sure to update other build systems
|
||||
# when making changes to the files that are copied.
|
||||
|
@ -51,5 +51,10 @@ blender_add_lib(bf_intern_locale "${SRC}" "${INC}" "${INC_SYS}")
|
||||
set(MSFFMT_SRC
|
||||
msgfmt.cc
|
||||
)
|
||||
|
||||
add_executable(msgfmt ${MSFFMT_SRC})
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "Clang" AND (CMAKE_C_COMPILER_VERSION VERSION_EQUAL 3.4 OR CMAKE_C_COMPILER_VERSION VERSION_GREATER 3.4))
|
||||
# needed for clang 3.4+
|
||||
target_link_libraries(msgfmt ${PLATFORM_LINKLIBS})
|
||||
endif()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user