From c167d7b79a9f72c4ff24ee0f650e0dfb5fcdb79c Mon Sep 17 00:00:00 2001 From: Jens Verwiebe Date: Fri, 6 Dec 2013 17:06:37 +0100 Subject: =?UTF-8?q?OSX/scons:=20Introduce=20a=20new=20env=20var=20'MACOSX?= =?UTF-8?q?=5FCOMPILER'=20This=20is=20needed=20to=20resolve=20the=20real?= =?UTF-8?q?=20used=20compiler=20from=20the=20compatibility=20shim=E2=80=99?= =?UTF-8?q?S=20or=20symlinks.=20Also=20set=20the=20real=20CCVERSION=20as?= =?UTF-8?q?=20scons=20CCVERSION=20would=20only=20read=20the=20default=20on?= =?UTF-8?q?e,=20which=20is=20not=20useful=20for=20OSX?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SConstruct | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'SConstruct') diff --git a/SConstruct b/SConstruct index d95811a40d3..98bb61a3c07 100644 --- a/SConstruct +++ b/SConstruct @@ -296,6 +296,19 @@ env['CONFIGURELOG'] = os.path.abspath(os.path.normpath(os.path.join(env['BF_BUIL if env['OURPLATFORM']=='darwin': import commands + import subprocess + + command = ["%s"%env['CC'], "--version"] + process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=None, shell=False) + line = process.communicate()[0] + ver = re.search(r'[0-9]+(\.[0-9]+)+', line) + if ver: + env['CCVERSION'] = ver.group(0) + frontend = re.search(r'gcc', line) or re.search(r'clang', line) or re.search(r'llvm-gcc', line) + if frontend: + env['MACOSX_COMPILER'] = frontend.group(0) + + print B.bc.OKGREEN + "Using Compiler: " + B.bc.ENDC + env['MACOSX_COMPILER'] + '-' + env['CCVERSION'] cmd = 'sw_vers -productVersion' MAC_CUR_VER=cmd_res=commands.getoutput(cmd) @@ -374,7 +387,7 @@ if env['OURPLATFORM']=='darwin': #Intel Macs are CoreDuo and Up if env['MACOSX_ARCHITECTURE'] == 'i386' or env['MACOSX_ARCHITECTURE'] == 'x86_64': env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-msse','-msse2','-msse3'] - if env['XCODE_CUR_VER'] >= '5': + if env['MACOSX_COMPILER'] != 'clang' or (env['MACOSX_COMPILER'] == 'clang' and env['CCVERSION'] >= '5.0'): env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-ftree-vectorize'] # clang xcode 4 does not accept flag else: env['CCFLAGS'] = env['CCFLAGS']+['-fno-strict-aliasing'] @@ -383,7 +396,7 @@ if env['OURPLATFORM']=='darwin': if env['MACOSX_ARCHITECTURE'] == 'x86_64': env['REL_CCFLAGS'] = env['REL_CCFLAGS']+['-mssse3'] - if env['XCODE_CUR_VER'] >= '5' and not env['CC'].split('/')[len(env['CC'].split('/'))-1][4:] >= '4.6.1': + if env['MACOSX_COMPILER'] == 'clang' and env['CCVERSION'] >= '5.0': env['CCFLAGS'].append('-ftemplate-depth=1024') # only valid for clang bundled with xcode 5 # 3DconnexionClient.framework, optionally install @@ -411,7 +424,7 @@ 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['CC'].split('/')[len(env['CC'].split('/'))-1].strip('llvm - gcc clang') >= '4.6.1': # strip down to version string if any + if env['MACOSX_COMPILER'] == 'gcc' and env['CCVERSION'] >= '4.6.1': # strip down to version string if any env['WITH_BF_OPENMP'] = 1 # multithreading for fluids, cloth, sculpt and smoke print B.bc.OKGREEN + "Using OpenMP" else: @@ -421,7 +434,7 @@ if env['OURPLATFORM']=='darwin': if env['WITH_BF_CYCLES_OSL'] == 1: OSX_OSL_LIBPATH = Dir(env.subst(env['BF_OSL_LIBPATH'])).abspath # we need 2 variants of passing the oslexec with the force_load option, string and list type atm - if env['CC'].split('/')[len(env['CC'].split('/'))-1].strip('llvm - gcc clang') >= '4.8': # strip down to version string if any + if env['MACOSX_COMPILER'] == 'gcc' and env['CCVERSION'] >= '4.8': # strip down to version string if any env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-loslexec','-loslquery']) else: env.Append(LINKFLAGS=['-L'+OSX_OSL_LIBPATH,'-loslcomp','-force_load '+ OSX_OSL_LIBPATH +'/liboslexec.a','-loslquery']) -- cgit v1.2.3