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',
30 'transfer.cpp', 'p2tp.cpp', 'sendrecv.cpp', 'ext/send_control.cpp',
31 'compat/hirestimeofday.cpp', 'compat/util.cpp']
34 if sys.platform == "win32":
35 # "MSVC works out of the box". Sure.
36 # Make sure scons finds cl.exe, etc.
37 env.Append ( ENV = { 'PATH' : os.environ['PATH'] } )
39 # Make sure scons finds std MSVC include files
40 if not 'INCLUDE' in os.environ:
41 print "p2tp: Please run scons in a Visual Studio Command Prompt"
44 include = os.environ['INCLUDE']
45 include += '..\\gtest-1.4.0\\include;'
46 include += '..\\glog-0.3.0\\src\\windows;' # Funky
47 include += '\\openssl\\include;'
49 env.Append ( ENV = { 'INCLUDE' : include } )
51 # Other compiler flags
52 env.Append(CPPPATH=".")
54 env.Append(CXXFLAGS="/Zi /Yd /MTd")
55 env.Append(LINKFLAGS="/DEBUG")
57 # Add simulated pread/write
58 source += ['compat/unixio.cpp']
61 libs = ['libglog','ws2_32']
63 libs += ['gtestd','libeay32MTd']
65 libs += ['gtest','libeay32']
67 # Update lib search path
68 libpath = os.environ['LIBPATH']
70 libpath += '\\build\\gtest-1.4.0\\msvc\\gtest\\Debug;'
71 libpath += '\\build\\glog-0.3.0\\vsprojects\\libglog\\Debug;'
72 libpath += '\\openssl\\lib\\VC\\static;'
74 libpath += '\\build\\gtest-1.4.0\\msvc\\gtest\\Release;'
75 libpath += '\\build\\glog-0.3.0\\vsprojects\\libglog\\Release;'
76 libpath += '\\openssl\\lib;'
77 # Somehow linker can't find uuid.lib
78 libpath += 'C:\\Program Files\\Microsoft SDKs\\Windows\\v6.0A\\Lib;'
81 # Enable the user defining external includes
82 if 'CPPPATH' in os.environ:
83 cpppath = os.environ['CPPPATH']
86 print "To use external libs, set CPPPATH environment variable to list of colon-separated include dirs"
87 env.Append(CPPPATH=".:"+cpppath)
88 #env.Append(LINKFLAGS="--static")
91 # env.Append(CXXFLAGS="-g")
94 libs = ['stdc++','gtest','glog','pthread','crypto']
95 if 'LIBPATH' in os.environ:
96 libpath = os.environ['LIBPATH']
99 print "To use external libs, set LIBPATH environment variable to list of colon-separated lib dirs"
111 SConscript('tests/SConscript')