[build2] How can I store the result of external commands inside a buildfile
Luiz Fernando Afra Brito
luizfernandoafrabrito at gmail.com
Sun Mar 10 01:42:54 UTC 2019
Hello,
I'm trying to use other programs to get some info about the cpu and pass
it to c++ during compilation. What I'm trying to do looks like this:
if($cxx.target.class == 'linux')
{
obj{*}:
{
cxx.poptions += -DL1_SIZE=`/bin/getconf LEVEL1_DCACHE_SIZE`
cxx.poptions += -DL2_SIZE=`/bin/getconf LEVEL2_CACHE_SIZE`
cxx.poptions += -DL3_SIZE=`/bin/getconf LEVEL3_CACHE_SIZE`
cxx.poptions += -DL4_SIZE=`/bin/getconf LEVEL4_CACHE_SIZE`
...
# use some other linux program to get extra cpu information
}
}
elif($cxx.target.class == 'windows')
{
# call windows programs to get cpu information
}
elif($cxx.target.class == 'macos')
{
# call mac programs to get cpu information
}
...
In this example, I want to call /bin/getfonf to get cpu cache sizes,
probably I would need more information. In other OS's I would use other
programs to get this same information.
Can I get the result of external commands inside a buildfile? If not, there
is another approach to accomplish something similar?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.build2.org/archives/users/attachments/20190309/a08574af/attachment.html>
More information about the users
mailing list