sconsの便利っぷり
- sconsの日本語情報が少ない気がするので自分の知ってる情報を晒してみます。
- sconsを使ったWindows環境下でのサンプルです。githubにあげました。
- https://github.com/shive/scons-test/tree/master/test001-forwin
何やってるのか?
どう使うのか?
- scons呼び出しはMakefileにまとめました。
$ cd scons-test/test001-forwin/ $ ls -1 main.cpp Makefile SConstruct stdafx.cpp stdafx.h ### 元になるファイルはこの5つだけ $ make -s msvcproj-all Adding 'test-win32vc9 - Debug|win32' to 'test-win32vc9.vcproj' Adding 'test-win32vc9 - Release|win32' to 'test-win32vc9.vcproj' Adding 'test-x64vc9 - Debug|x64' to 'test-x64vc9.vcproj' Adding 'test-x64vc9 - Release|x64' to 'test-x64vc9.vcproj' Adding 'test-win32vc10 - Debug|win32' to 'test-win32vc10.vcxproj' Adding 'test-win32vc10 - Release|win32' to 'test-win32vc10.vcxproj' Adding 'test-x64vc10 - Debug|x64' to 'test-x64vc10.vcxproj' Adding 'test-x64vc10 - Release|x64' to 'test-x64vc10.vcxproj' Adding 'test-win32vc11 - Debug|win32' to 'test-win32vc11.vcxproj' Adding 'test-win32vc11 - Release|win32' to 'test-win32vc11.vcxproj' Adding 'test-x64vc11 - Debug|x64' to 'test-x64vc11.vcxproj' Adding 'test-x64vc11 - Release|x64' to 'test-x64vc11.vcxproj' ### VisualStudioの各バージョン向けのプロジェクトファイル出力 ### ちなみに実は2010と2012は同じ内容 ### ちょっと修正すればx86/x64はひとつに統合できる $ make -s build-all (省略) ### 全ターゲットをビルドしてみます $ ls -1 bin/ main.cpp Makefile obj/ SConstruct stdafx.cpp stdafx.h test-win32vc10.vcxproj test-win32vc10.vcxproj.filters test-win32vc11.vcxproj test-win32vc11.vcxproj.filters test-win32vc9.vcproj test-x64vc10.vcxproj test-x64vc10.vcxproj.filters test-x64vc11.vcxproj test-x64vc11.vcxproj.filters test-x64vc9.vcproj $ ls -1 bin/ test-mingw32-debug.exe* test-mingw32-release.exe* test-win32vc10-debug.exe* test-win32vc10-debug.map test-win32vc10-debug.pdb test-win32vc10-release.exe* test-win32vc10-release.map test-win32vc10-release.pdb test-win32vc11-debug.exe* test-win32vc11-debug.map test-win32vc11-debug.pdb test-win32vc11-release.exe* test-win32vc11-release.map test-win32vc11-release.pdb test-win32vc9-debug.exe* test-win32vc9-debug.exe.manifest test-win32vc9-debug.map test-win32vc9-debug.pdb test-win32vc9-release.exe* test-win32vc9-release.exe.manifest test-win32vc9-release.map test-win32vc9-release.pdb test-x64vc10-debug.exe* test-x64vc10-debug.map test-x64vc10-debug.pdb test-x64vc10-release.exe* test-x64vc10-release.map test-x64vc10-release.pdb test-x64vc11-debug.exe* test-x64vc11-debug.map test-x64vc11-debug.pdb test-x64vc11-release.exe* test-x64vc11-release.map test-x64vc11-release.pdb test-x64vc9-debug.exe* test-x64vc9-debug.exe.manifest test-x64vc9-debug.map test-x64vc9-debug.pdb test-x64vc9-release.exe* test-x64vc9-release.exe.manifest test-x64vc9-release.map test-x64vc9-release.pdb $ ls -1 obj/ test-mingw32-debug/ test-mingw32-release/ test-win32vc10-debug/ test-win32vc10-release/ test-win32vc11-debug/ test-win32vc11-release/ test-win32vc9-debug/ test-win32vc9-release/ test-x64vc10-debug/ test-x64vc10-release/ test-x64vc11-debug/ test-x64vc11-release/ test-x64vc9-debug/ test-x64vc9-release/ $ bin/test-mingw32-debug hoge hoge hoge. $ bin/test-x64vc11-release HOGE HOGE HOGE. $ make -s run-debug msvc_version=10.0 msvc_arch=x86 hoge hoge hoge. $ make -s run-debug msvc_version=10.0 msvc_arch=x86 toolset=mingw hoge hoge hoge.