scons

SCons で一つのソースから複数のターゲットを作る

SCons で一つのソースから複数のターゲットを作るときにうまくいかないのでテストしてみる. def XXXBuilder(): return Builder(action = "perl xcommand $SOURCES") def YYYBuilder(): return Builder(action = "perl ycommand $SOURCES") env = Environmen…

SCons Tips

builder method で,ソースファイルの共通のディレクトリを指定できる. env.Program('hello', ['foo.c', 'bar.c'], srcdir = 'src') このことはドキュメントには書かれていない.man scons を参照せよ.

SCons での裸の builder method

SConstruct で Environment オブジェクトのメソッドでない builder method を記述できる. Program('hello', ['hello.c']) このとき scons を起動するマシンに最適化されたデフォルトの Environment オブジェクトに対して builder method が呼び出される.こ…

SCons における Options

scons コマンドのコマンドラインで指定する VAR=val 形式のビルドオプションは ARGUMENTS という辞書に入れられるので利用できる. if (int(ARGUMENTS.get('debug', 0))): env.Append(CCFLAGS = '-g') これでは面倒なので Options というクラスが用意してあ…

SCons と環境変数

SCons がツールを呼び出すときの環境は scons コマンドを呼び出したときの環境とは関係が無く,$ENV という Construction Variable に格納されている辞書から構成される新しい環境である. 特に,PATH 環境変数もユーザが .bashrc などで設定したものでなく…

SCons における Construction Variable

Construction Variable はビルドツールの呼び出し方法を制御する. Construction Variable の集合が Environment である. Environment とは Construction Variable=Value pair の集合 + Builder Methods 作成: env = Environtment(VAR1 = 'val1', VAR2 = '…

SCons でのコンパイルオプション

ops = Option('config.py') ops.Add('CONFIG_SUPPORT_HTML', '(help string)', 0) env = Environtment(options = ops, CPPDEFINES = { 'CONFIG_SUPPORT_HTML' : '${CONFIG_SUPPORT_HTML}' }) env.Program('hello.c') config.py が無い場合 -D CONFIG_SUPPORT…

SCons 疑問

次がうまく動作しない. $ ls SConstruct src/ $ ls src SConscript hello.c $ cat SConstruct SConscript('src/SConscript', build_dir = '../build') $ cat src/SConscript Program('hello', ['hello.c']) $ scons -Q scons: `.' is up to date. 以下のよ…

SCons 最初の一歩

Makefile ファイルにあたるのは SConstruct ファイル.中身は python のプログラム. 参照 SCons User Guide 0.97, Simple Builds hello world SConstruct: Program('hello', 'hello.c') そして, $ sconsとすると,Linux では hello ができ,Windows では h…