User Tools

Site Tools


scons

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
scons [2009/08/11 11:56] suapapascons [2013/08/03 05:04] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== 윈도에서 scons 설치하기 ======
 +  *파이썬 2.6.x설치
 +  *[[http://sourceforge.net/projects/scons/files/scons/1.2.0/scons-1.2.0.win32.exe/download|윈도용 scons]] 다운로드 -> 설치
 +  *제어판->시스템->고급->환경변수->PATH에서 편집 ;C:\Python26\Scripts 추가
 +
 +====== basic ======
 정적라이브러리 정적라이브러리
 <code python> <code python>
Line 9: Line 15:
 라이브러리와 링크 라이브러리와 링크
 <code python> <code python>
-Library(foo, [f1.cf2.cf3.c]) +Library('foo', ['f1.c''f2.c''f3.c']) 
-Program(prog.c, LIBS=[foobar], LIBPATH=.)+Program('prog.c', LIBS=['foo''bar'], LIBPATH='.')
 </code> </code>
 <code python> <code python>
-Program(prog.c, LIBS = m, LIBPATH = [/usr/lib/usr/local/lib])+Program('prog.c', LIBS = 'm', LIBPATH = ['/usr/lib''/usr/local/lib'])
 </code> </code>
 +====== env ======
 +<code python>
 +env = Environment(FOO = 'foo', BAR = 'bar')
 +dict = env.Dictionary()
 +for key in ['OBJSUFFIX', 'LIBSUFFIX', 'PROGSUFFIX']:
 +        print "key = %s, value = %s" % (key, dict[key])
 +</code>
 +<code python>
 +opt = Environment(CCFLAGS = '-O2')
 +dbg = Environment(CCFLAGS = '-g')
 +o = opt.Object('foo-opt', 'foo.c')
 +opt.Program(o)
 +d = dbg.Object('foo-dbg', 'foo.c')
 +dbg.Program(d)
 +</code>
 +환경 추가
 +<code python>
 +env.Append(CCFLAGS = "-g" )
 +env.Append(LINKFLAGS = "-Xlinker -Map=output.map")
 +</code>
 +
 +====== install ======
 +install 이라는 alias를 생성
 +<code python>
 +env = Environment()
 +hello = env.Program('hello.c')
 +env.Install('/usr/bin', hello)
 +env.Alias('install', ’/usr/bin’)
 +</code>
 +실행하면 요래
 +<code bash>
 +% scons -Q
 +cc -o hello.o -c hello.c
 +cc -o hello hello.o
 +% scons -Q install
 +Install file: "hello" as "/usr/bin/hello"
 +</code>
 +====== custom builder ======
 +외부 명령어 foobuild를 쓸 때
 +<code python>
 +bld = Builder(action = 'foobuild < $SOURCE > $TARGET', suffix = '.foo', src_suffix = '.input')
 +env = Environment(BUILDERS = {'Foo' : bld})
 +env.Foo('file1')
 +env.Foo('file2')
 +</code>
 +파이썬 코드를 쓸 때
 +<code python>
 +def build_function(target, source, env):
 +  # Code to build "target" from "source"
 +  return None
 +bld = Builder(action = build_function, suffix = '.foo', src_suffix = '.input')
 +env = Environment(BUILDERS = {'Foo' : bld})
 +env.Foo('file')
 +</code>
 +====== references ======
 +  *[[http://www.scons.org/|scons]] official home
 +  *[[http://www.doyub.com/blog/tag/SCons|scons tutorial]] in Doyub Kim's blog
 +  *[[http://quirkygba.blogspot.com/2008/10/alternatives-to-make-part-ii.html|Alternatives to Make, Part II] scons with arm-tool-chain]]
scons.1249991819.txt.gz · Last modified: 2013/08/03 05:04 (external edit)