76 lines
2.0 KiB
Python
76 lines
2.0 KiB
Python
|
|
Help("""
|
|
|
|
This is the second scons example. In this example we explore more options in
|
|
scons. Once you start doing anything useful with scons other than showing
|
|
how simple scons works, you will have to create an environment to have more
|
|
control on the build.
|
|
|
|
One can "Dump()" the environment to see all the underlying details. We can
|
|
also compare between Linux and windows environments.
|
|
|
|
>> ls
|
|
foo.cpp foo.hpp main.cpp SConstruct
|
|
|
|
>> scons
|
|
scons: Reading SConscript files ...
|
|
------------------>starting
|
|
------------------>ending
|
|
scons: done reading SConscript files.
|
|
scons: Building targets ...
|
|
g++ -o foo.o -c foo.cpp
|
|
g++ -o main.o -c main.cpp
|
|
g++ -o helloworld main.o foo.o
|
|
scons: done building targets.
|
|
|
|
|
|
>> ls -a
|
|
total 68
|
|
drwxr-xr-x 2 brgirgis users 154 Sep 26 23:04 ./
|
|
drwxr-xr-x 5 brgirgis users 36 Sep 26 22:44 ../
|
|
-rw-r--r-- 1 brgirgis users 21096 Sep 26 23:04 env.txt
|
|
-rw-r--r-- 1 brgirgis users 48 Sep 26 22:42 foo.cpp
|
|
-rw-r--r-- 1 brgirgis users 109 Sep 26 22:40 foo.hpp
|
|
-rw-r--r-- 1 brgirgis users 1256 Sep 26 23:03 foo.o
|
|
-rwxr-xr-x 1 brgirgis users 13288 Sep 26 23:03 helloworld*
|
|
-rw-r--r-- 1 brgirgis users 117 Sep 26 22:41 main.cpp
|
|
-rw-r--r-- 1 brgirgis users 2872 Sep 26 23:03 main.o
|
|
-rw-r--r-- 1 brgirgis users 2441 Sep 26 23:04 .sconsign.dblite
|
|
-rw-r--r-- 1 brgirgis users 1348 Sep 26 23:04 SConstruct
|
|
|
|
|
|
>> scons --tree=all helloworld
|
|
scons: Reading SConscript files ...
|
|
------------------>starting
|
|
------------------>ending
|
|
scons: done reading SConscript files.
|
|
scons: Building targets ...
|
|
scons: `helloworld' is up to date.
|
|
+-helloworld
|
|
+-main.o
|
|
| +-main.cpp
|
|
| +-foo.hpp
|
|
| +-/usr/bin/g++
|
|
+-foo.o
|
|
| +-foo.cpp
|
|
| +-foo.hpp
|
|
| +-/usr/bin/g++
|
|
+-/usr/bin/g++
|
|
scons: done building targets.
|
|
|
|
|
|
""")
|
|
|
|
import os
|
|
|
|
print('------------------>starting')
|
|
env = Environment(ENV=os.environ)
|
|
|
|
open('env.txt', 'w').write(env.Dump())
|
|
|
|
env.Program(target='helloworld',
|
|
source=['main.cpp', 'foo.cpp'])
|
|
|
|
print('------------------>ending')
|
|
|