1 # Written by Victor Grishchenko, Arno Bakker
2 # see LICENSE.txt for license information
5 # - scons: Cross-platform build system http://www.scons.org/
6 # - googletest: Google C++ Test Framework http://code.google.com/p/googletest/
7 # * Install in ..\gtest-1.4.0
8 # - google-glog: Google Logging Library for C++ http://code.google.com/p/google-glog/
9 # * Install in ..\glog-0.3.0
10 # * I get ..\glog-0.3.0\src\windows\glog/log_severity.h(51) : error C2059: syntax error :
11 # 'constant' while running scons. Apparently the ERROR constant is already defined somewhere.
12 # #undef ERROR before the def allows include.
14 # - OpenSSL: http://www.slproweb.com/products/Win32OpenSSL.html
15 # * Install non-light Win32 binary in \openssl
16 # * Using a openssl-0.9.8k tar-ball doesn't work as the includes there
17 # are symbolic links which get turned into 0 length files by 7Zip.
29 source = [ 'bin64.cpp','hashtree.cpp','datagram.cpp','bins.cpp', 'transfer.cpp', 'compat/hirestimeofday.cpp', 'compat/util.cpp']
32 if sys.platform == "win32":
33 # "MSVC works out of the box". Sure.
34 # Make sure scons finds cl.exe, etc.
35 env.Append ( ENV = { 'PATH' : os.environ['PATH'] } )
37 # Make sure scons finds std MSVC include files
38 if not 'INCLUDE' in os.environ:
39 print "p2tp: Please run scons in a Visual Studio Command Prompt"
42 include = os.environ['INCLUDE']
43 include += '..\\gtest-1.4.0\\include;'
44 include += '..\\glog-0.3.0\\src\\windows;' # Funky
45 include += '\\openssl\\include;'
47 env.Append ( ENV = { 'INCLUDE' : include } )
49 # Other compiler flags
50 env.Append(CPPPATH=".")
52 env.Append(CXXFLAGS="/Zi /Yd /MTd")
53 env.Append(LINKFLAGS="/DEBUG")
55 # Add simulated pread/write
56 source += ['compat/unixio.cpp']
59 libs = ['libglog','ws2_32']
61 libs += ['gtestd','libeay32MTd']
63 libs += ['gtest','libeay32']
65 # Update lib search path
66 libpath = os.environ['LIBPATH']
68 libpath += '\\build\\gtest-1.4.0\\msvc\\gtest\\Debug;'
69 libpath += '\\build\\glog-0.3.0\\vsprojects\\libglog\\Debug;'
70 libpath += '\\openssl\\lib\\VC\\static;'
72 libpath += '\\build\\gtest-1.4.0\\msvc\\gtest\\Release;'
73 libpath += '\\build\\glog-0.3.0\\vsprojects\\libglog\\Release;'
74 libpath += '\\openssl\\lib;'
75 # Somehow linker can't find uuid.lib
76 libpath += 'C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Lib;'
79 # Enable the user defining external includes
80 if 'CPPPATH' in os.environ:
81 cpppath = os.environ['CPPPATH']
84 print "To use external libs, set CPPPATH environment variable to list of colon-separated include dirs"
85 env.Append(CPPPATH=".:"+cpppath)
86 env.Append(LINKFLAGS="--static")
89 # env.Append(CXXFLAGS="-g")
92 libs = ['stdc++','gtest','glog','pthread','crypto']
93 if 'LIBPATH' in os.environ:
94 libpath = os.environ['LIBPATH']
97 print "To use external libs, set LIBPATH environment variable to list of colon-separated lib dirs"
109 SConscript('tests/SConscript')