views:

892

answers:

2

Are there any 'standard' plugins for detecting the CPU architecture in scons?

BTW, this question was asked already here in a more general form... just wondering if anyone has already taken the time to incorporate this information into scons.

+1  A: 

Something like this?

env = Environment()
conf = Configure(env)
if conf.CheckDeclaration("__i386__"):
    conf.Define("MY_ARCH", "blahblablah")
env = conf.Finish()
dsvensson
+3  A: 

Using i386 is rather compiler dependant, and won't detect non x86 32 bits archs. Assuming the python interpreter used by scons runs on the CPU you are interested in (not always the case - think cross compilation), you can just use python itself.

import platform
print platform.machine()
print platform.architecture()

If you need something more sophisticated, then maybe you will have to write your own configure function - but it may be better to deal with it in your code directly.

David Cournapeau
+1 platform.machine()
ceretullis