1 # Written by Victor Grishchenko, Arno Bakker
\r
2 # see LICENSE.txt for license information
\r
5 # - scons: Cross-platform build system http://www.scons.org/
\r
6 # - libevent2: Event driven network I/O http://www.libevent.org/
\r
7 # * Install in \build\libevent-2.0.14-stable
\r
9 # - googletest: Google C++ Test Framework http://code.google.com/p/googletest/
\r
10 # * Install in \build\gtest-1.4.0
\r
23 source = [ 'bin.cpp', 'binmap.cpp','binheap.cpp', 'sha1.cpp','hashtree.cpp',
\r
24 'transfer.cpp', 'channel.cpp', 'sendrecv.cpp', 'send_control.cpp',
\r
25 'compat.cpp','avgspeed.cpp', 'availability.cpp']
\r
29 if sys.platform == "win32":
\r
30 #libevent2path = '\\build\\libevent-2.0.14-stable'
\r
31 libevent2path = '\\build\\ttuki\\libevent-2.0.15-arno-http'
\r
33 # "MSVC works out of the box". Sure.
\r
34 # Make sure scons finds cl.exe, etc.
\r
35 env.Append ( ENV = { 'PATH' : os.environ['PATH'] } )
\r
37 # Make sure scons finds std MSVC include files
\r
38 if not 'INCLUDE' in os.environ:
\r
39 print "swift: Please run scons in a Visual Studio Command Prompt"
\r
42 include = os.environ['INCLUDE']
\r
43 include += libevent2path+'\\include;'
\r
44 include += libevent2path+'\\WIN32-Code;'
\r
46 include += '\\build\\gtest-1.4.0\\include;'
\r
48 env.Append ( ENV = { 'INCLUDE' : include } )
\r
50 if 'CXXPATH' in os.environ:
\r
51 cxxpath = os.environ['CXXPATH']
\r
56 env.Append(CXXFLAGS="/Zi /MTd")
\r
57 env.Append(LINKFLAGS="/DEBUG")
\r
58 env.Append(CXXPATH=cxxpath)
\r
59 env.Append(CPPPATH=cxxpath)
\r
62 source += ['getopt.c','getopt_long.c']
\r
64 # Set libs to link to
\r
65 # Advapi32.lib for CryptGenRandom in evutil_rand.obj
\r
66 libs = ['ws2_32','libevent','Advapi32']
\r
70 # Update lib search path
\r
71 libpath = os.environ['LIBPATH']
\r
72 libpath += libevent2path+';'
\r
74 libpath += '\\build\\gtest-1.4.0\\msvc\\gtest\\Debug;'
\r
76 # Somehow linker can't find uuid.lib
\r
77 libpath += 'C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Lib;'
\r
79 # TODO: Make the swift.exe a Windows program not a Console program
\r
81 env.Append(LINKFLAGS="/SUBSYSTEM:WINDOWS")
\r
83 APPSOURCE=['swift.cpp','httpgw.cpp','statsgw.cpp','cmdgw.cpp','getopt.c','getopt_long.c']
\r
86 libevent2path = '/usr/local'
\r
88 # Enable the user defining external includes
\r
89 if 'CPPPATH' in os.environ:
\r
90 cpppath = os.environ['CPPPATH']
\r
93 print "To use external libs, set CPPPATH environment variable to list of colon-separated include dirs"
\r
94 cpppath += libevent2path+'/include:'
\r
95 env.Append(CPPPATH=".:"+cpppath)
\r
96 #env.Append(LINKFLAGS="--static")
\r
99 # env.Append(CXXFLAGS="-g")
\r
101 # Large-file support always
\r
102 env.Append(CXXFLAGS="-D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE")
\r
104 # Set libs to link to
\r
105 libs = ['stdc++','libevent','pthread']
\r
106 if 'LIBPATH' in os.environ:
\r
107 libpath = os.environ['LIBPATH']
\r
110 print "To use external libs, set LIBPATH environment variable to list of colon-separated lib dirs"
\r
111 libpath += libevent2path+'/lib:'
\r
113 linkflags = '-Wl,-rpath,'+libevent2path+'/lib'
\r
114 env.Append(LINKFLAGS=linkflags);
\r
117 APPSOURCE=['swift.cpp','httpgw.cpp','statsgw.cpp','cmdgw.cpp']
\r
120 env.Append(CXXFLAGS="-DDEBUG")
\r
122 env.StaticLibrary (
\r
132 LIBS=[libs,'libswift'],
\r
133 LIBPATH=libpath+':.')
\r
139 # Arno: uncomment to build tests
\r
140 SConscript('tests/SConscript')
\r