Randolph Fritz wrote:
I decided to put my money where my mouth was, and try to make scons
build the Radiance libraries in "src/common".
What I have is a global configuration script, and a script that
describes the build of the common library. They are attached, and you
can read them and try them. I think they're pretty straightforward.
Nice start. I played around with this a bit, added a SConscript
file for src/rt, and after some more fiddling, I ended up with
- If you use triple quotes (''' or """), then you don't need to
escape line wraps in literal Python strings.
- I changed the imports of the standard modules to just import
the module. It is usually less confusing to explicitly refer
eg. to the fully qualified sys.platform in the code, especially
for such generic names.
- ("this") is just "this" in Python. But I think you already
figured this out on your own...
- You created one environment named "env". I changed that name to
"build", so that we can later establish a seperate "install"
target (those names are used when you do eg. an "scons install").
There should also be a way to have "install" depend on "build".
- Check what the man page says about opts.Update(). I don't think
it really makes a functional difference, but what they
recommend is probably better style and may have other
advantages down the road (not changed yet).
- The compile options flag is named CCFLAGS, not CFLAGS.
- I changed the configure routines to look for the GL library
like you already did with X11, and not just for the headers.
Then I moved those routines to a seperate module
build_utils/find_libs.py. Maybe the option related routines can
go into build_utils as well.
- When checking for X11, I don't include the resulting paths in
the global CPPPATH and LIBPATH. It seems better to store them
in seperate variables, and add them as overrides to only those
files that actually need them. You can then also skip building
eg. rview if the respective variables aren't set.
- Similarly, I pass [NO]STEREO and SPEED as seperate variables,
which may be used to override the defaults further down.
- I have named all Radiance specific variables "RAD_XXX", so that
there will never be any confusion.
- In src/common/SConscript, you can use "#src/lib/rt" as a target
for the library, so it will be built in the correct place.
- Adding a library to env['LIBS'] means that every single
executable will be linked with it after that. I'm sure that a
majority currently does use librt.a, but maybe we can be more
specific here to improve the performance of the linking.
In src/rt, I'm making a copy of the "build" environment with
the changes required for all the targets there.
- The env['PLATFORM'] value is tuned for internal use by SCons.
I have decided to use the more standard sys.platform (and
os.name, where that isn't enough) for our own purposes.
SConstruct now supposts (almost) the full range of settings
If that still isn't enough, we also have os.uname(), at least
when os.name == 'posix'. This may be necessary eg. in case we
need to distinguish between Solaris or Linux on different
- I moved unix_process.c resp. win_process.c to a variable named
"RAD_PROCESS", which then gets added to the right file list in
src/common. Other files like "win_popen.c" may follow.
- I'll have to experiment a bit more with automatically
generating C files from a Python function, so that we can
replace the current "ed" script in a platform independent way.
- Interestingly, SCons uses c++ to link the executables on my
system. I think they do so to improve flexibility, in case
there might be any C++ object files involved. At first, I was a
bit confused by that, but I couldn't find any disadvantages of
The results of my fiddling are attached as a tgz, which expands
directly into the build tree from ray/.
Some of my experiments uncovered general build issues in Radiance
(eg. duplicate function names), which I'll address seperately.
I did build the binaries in src/rt (and everything they depend
on), and it worked very nicely.
I'm inclined to check this into CVS, so that we can use the
revision management there. For the moment, I don't think it will
interfere in any way with the old build system, so that a
coexistence of the two shouldn't be a problem.
raysc02.tgz (3.6 KB)
Georg Mischler -- simulations developer -- schorsch at schorsch com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/