SConstruct
branchpyrit
changeset 66 c5b89d16497a
parent 65 242839c6d27d
child 67 249553e1d4fe
equal deleted inserted replaced
65:242839c6d27d 66:c5b89d16497a
    45 		)
    45 		)
    46 opt.Update(env)
    46 opt.Update(env)
    47 opt.Save('.optioncache', env)
    47 opt.Save('.optioncache', env)
    48 Help(opt.GenerateHelpText(env))
    48 Help(opt.GenerateHelpText(env))
    49 
    49 
    50 if env['intelc']:
       
    51 	Tool("intelc")(env)
       
    52 
       
    53 platform = 'unknown'
    50 platform = 'unknown'
    54 def CheckPlatform(context):
    51 def CheckPlatform(context):
    55 	global platform
    52 	global platform
    56 	context.Message('Platform is... ')
    53 	context.Message('Platform is... ')
    57 	if sys.platform[:5] == 'linux':
    54 	if sys.platform[:5] == 'linux':
    71 		if (os.system("cat /proc/cpuinfo | grep 'Core(TM)2 CPU' >/dev/null") == 0):
    68 		if (os.system("cat /proc/cpuinfo | grep 'Core(TM)2 CPU' >/dev/null") == 0):
    72 			cpu = 'core2'
    69 			cpu = 'core2'
    73 	context.Result(cpu)
    70 	context.Result(cpu)
    74 	return True
    71 	return True
    75 
    72 
       
    73 intelc = Tool("intelc").exists(env)
    76 def CheckIntelC(context):
    74 def CheckIntelC(context):
    77 	global intelc
    75 	global intelc
    78 	context.Message('Checking for Intel C++ Compiler... ')
    76 	context.Message('Checking for Intel C++ Compiler... ')
    79 	intelc = "intelc" in env['TOOLS']
    77 	if intelc:
    80 	context.Result(intelc)
    78 		testenv = Environment()
       
    79 		Tool("intelc").generate(testenv)
       
    80 		context.Result(str(testenv['INTEL_C_COMPILER_VERSION']/10.))
       
    81 	else:
       
    82 		context.Result(intelc)
    81 	return intelc
    83 	return intelc
    82 
    84 
    83 def CheckGCC(context):
    85 def CheckGCC(context):
    84 	global gcc, gccversion
    86 	global gcc, gccversion
    85 	context.Message('Checking for GCC... ')
    87 	context.Message('Checking for GCC... ')
    99 conf.CheckCPU()
   101 conf.CheckCPU()
   100 conf.CheckGCC()
   102 conf.CheckGCC()
   101 conf.CheckIntelC()
   103 conf.CheckIntelC()
   102 env = conf.Finish()
   104 env = conf.Finish()
   103 
   105 
   104 if intelc:
   106 
       
   107 if intelc and env['intelc']:
       
   108 	Tool("intelc").generate(env)
   105 	cc = 'intelc'
   109 	cc = 'intelc'
   106 elif gcc:
   110 elif gcc:
   107 	cc = 'gcc'
   111 	cc = 'gcc'
   108 
   112 
   109 cpu_flags = ''
   113 cpu_flags = ''
   116 		cpu_flags += '-xT '
   120 		cpu_flags += '-xT '
   117 	if cc == 'gcc':
   121 	if cc == 'gcc':
   118 		cpu_flags += '-msse3 -mfpmath=sse '
   122 		cpu_flags += '-msse3 -mfpmath=sse '
   119 cpu_flags += env['flags']
   123 cpu_flags += env['flags']
   120 
   124 
   121 if intelc:
   125 if cc == 'intelc':
   122 	env.Append(CCFLAGS="-O3 -w1 " + cpu_flags)
   126 	env.Append(CCFLAGS="-O3 -w1 " + cpu_flags)
   123 elif gcc:
   127 elif cc == 'gcc':
   124 	env.Append(CCFLAGS="-O3 -Wall -pipe " + cpu_flags)
   128 	env.Append(CCFLAGS="-O3 -Wall -pipe " + cpu_flags)
   125 	# CCFLAGS= -fno-strict-aliasing
   129 	# CCFLAGS= -fno-strict-aliasing
   126 else:
   130 else:
   127 	print "No supported compiler found."
   131 	print "No supported compiler found."
   128 	Exit(1)
   132 	Exit(1)
   129 
   133 
   130 print "Additional compiler flags: " + cpu_flags
   134 print "Using compiler: " + cc
       
   135 print "Additional flags: " + cpu_flags
   131 
   136 
   132 # pthread
   137 # pthread
   133 if env['PLATFORM'] == 'win32':
   138 if env['PLATFORM'] == 'win32':
   134 	env.Append(LIBS=["pthreadGC2"])
   139 	env.Append(LIBS=["pthreadGC2"])
   135 else:
   140 else:
   144 env.Alias('demos', ['cc-demos', 'python-demos'])
   149 env.Alias('demos', ['cc-demos', 'python-demos'])
   145 
   150 
   146 SConscript('models/SConscript')
   151 SConscript('models/SConscript')
   147 
   152 
   148 env.Alias('docs', Command('docs/html', [], 'doxygen'))
   153 env.Alias('docs', Command('docs/html', [], 'doxygen'))
   149 env.Clean('docs', ['docs/html', 'docs/latex'])
   154 env.Clean('docs', ['docs/html'])
   150 
   155 
   151 env.Alias('no-docs', ['libs', 'demos', 'models'])
   156 env.Alias('no-docs', ['libs', 'demos', 'models'])
   152 env.Alias('no-download', ['libs', 'demos', 'local-models'])
   157 env.Alias('no-download', ['libs', 'demos', 'local-models'])
   153 
   158 
   154 env.Alias('all', ['no-docs', 'docs'])
   159 env.Alias('all', ['no-docs', 'docs'])