Files
scons-presentation/execEx/01/SConstruct
2017-09-27 00:56:48 -05:00

125 lines
5.5 KiB
Python

Help("""
This is the first scons example. In this example we see a very simple way
of calling scons to create an executable
>> ls
main.cpp SConstruct
>> scons -h (get this help message)
>> scons -H (get scons command help)
usage: scons [OPTION] [TARGET] ...
SCons Options:
-b, -d, -e, -m, -S, -t, -w, --environment-overrides, --no-keep-going,
--no-print-directory, --print-directory, --stop, --touch
Ignored for compatibility.
-c, --clean, --remove Remove specified targets and dependencies.
-C DIR, --directory=DIR Change to DIR before doing anything.
--cache-debug=FILE Print CacheDir debug info to FILE.
--cache-disable, --no-cache
Do not retrieve built targets from CacheDir.
--cache-force, --cache-populate
Copy already-built targets into the CacheDir.
--cache-readonly Do not update CacheDir with built targets.
--cache-show Print build actions for files from CacheDir.
--config=MODE Controls Configure subsystem: auto, force,
cache.
-D Search up directory tree for SConstruct,
build all Default() targets.
--debug=TYPE Print various types of debugging information:
count, duplicate, explain, findlibs, includes,
memoizer, memory, objects, pdb, prepare,
presub, stacktrace, time.
--diskcheck=TYPE Enable specific on-disk checks.
--duplicate=DUPLICATE Set the preferred duplication methods. Must be
one of hard-soft-copy, soft-hard-copy,
hard-copy, soft-copy, copy
-f FILE, --file=FILE, --makefile=FILE, --sconstruct=FILE
Read FILE as the top-level SConstruct file.
-h, --help Print defined help message, or this one.
-H, --help-options Print this message and exit.
-i, --ignore-errors Ignore errors from build actions.
-I DIR, --include-dir=DIR Search DIR for imported Python modules.
--implicit-cache Cache implicit dependencies
--implicit-deps-changed Ignore cached implicit dependencies.
--implicit-deps-unchanged Ignore changes in implicit dependencies.
--interact, --interactive Run in interactive mode.
-j N, --jobs=N Allow N jobs at once.
-k, --keep-going Keep going when a target can't be made.
--max-drift=N Set maximum system clock drift to N seconds.
--md5-chunksize=N Set chunk-size for MD5 signature computation to
N kilobytes.
-n, --no-exec, --just-print, --dry-run, --recon
Don't build; just print commands.
--no-site-dir Don't search or use the usual site_scons dir.
--profile=FILE Profile SCons and put results in FILE.
-q, --question Don't build; exit status says if up to date.
-Q Suppress "Reading/Building" progress messages.
--random Build dependencies in random order.
-s, --silent, --quiet Don't print commands.
--site-dir=DIR Use DIR instead of the usual site_scons dir.
--stack-size=N Set the stack size of the threads used to run
jobs to N kilobytes.
--taskmastertrace=FILE Trace Node evaluation to FILE.
--tree=OPTIONS Print a dependency tree in various formats: all,
derived, prune, status.
-u, --up, --search-up Search up directory tree for SConstruct,
build targets at or below current directory.
-U Search up directory tree for SConstruct,
build Default() targets from local SConscript.
-v, --version Print the SCons version number and exit.
--warn=WARNING-SPEC, --warning=WARNING-SPEC
Enable or disable warnings.
-Y REPOSITORY, --repository=REPOSITORY, --srcdir=REPOSITORY
Search REPOSITORY for source and target files.
>> scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
g++ -o main.o -c main.cpp
g++ -o helloworld main.o
scons: done building targets.
>> scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
scons: `.' is up to date.
scons: done building targets.
>> ls -a
total 32
drwxr-xr-x 2 brgirgis users 96 Sep 26 22:50 ./
drwxr-xr-x 5 brgirgis users 36 Sep 26 22:44 ../
-rwxr-xr-x 1 brgirgis users 13176 Sep 26 22:50 helloworld*
-rw-r--r-- 1 brgirgis users 94 Sep 26 22:20 main.cpp
-rw-r--r-- 1 brgirgis users 2728 Sep 26 22:50 main.o
-rw-r--r-- 1 brgirgis users 1749 Sep 26 22:50 .sconsign.dblite
-rw-r--r-- 1 brgirgis users 400 Sep 26 22:50 SConstruct
>> scons -c
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Cleaning targets ...
Removed main.o
Removed helloworld
scons: done cleaning targets.
>> ls -a
total 12
drwxr-xr-x 2 brgirgis users 64 Sep 26 22:53 ./
drwxr-xr-x 5 brgirgis users 36 Sep 26 22:44 ../
-rw-r--r-- 1 brgirgis users 94 Sep 26 22:20 main.cpp
-rw-r--r-- 1 brgirgis users 1759 Sep 26 22:51 .sconsign.dblite
-rw-r--r-- 1 brgirgis users 1178 Sep 26 22:54 SConstruct
""")
Program('helloworld', 'main.cpp')