Merge branch 'master' into windows-port
[platform/upstream/iotivity.git] / build_common / windows / SConscript
1 ##
2 # This script includes windows specific config (MSVS/MSVC)
3 ##
4 Import('env')
5 import os.path
6
7 # Set common flags
8 if env['CC'] == 'cl':
9         # C4244 conversion from one type to another type results in a possible loss of data.
10         # C4267 conversion from size_t to a smaller type.
11         # C4355 'this' used in base member initializer list.
12         # C4800 forcing value to bool 'true' or 'false'.
13         # C4996 deprecated declaration.
14         # C4820 added padding to the end of a struct.
15         # C4514 unreferenced inline function has been removed
16         # C4365 signed/unsigned mismatch
17         # C4503 decorated name length exceeded, name was truncated
18         env.AppendUnique(CXXFLAGS=['/wd4244', '/wd4267', '/wd4355', '/wd4800', '/wd4996', '/wd4820', '/wd4514', '/wd4365', '/wd4503'])
19         env.AppendUnique(CCFLAGS=['/EHsc'])
20
21         vs_version = env['MSVC_VERSION']
22
23         # Enable special exports for unit test purposes
24         if env.get('TEST') == '1':
25                 env.AppendUnique(CPPDEFINES = ['ENABLE_TEST_EXPORTS'])
26         # Set release/debug flags
27         if env.get('RELEASE'):
28                 env.AppendUnique(CCFLAGS = ['/MD', '/O2', '/GF'])
29                 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
30         elif env.get('TARGET_ARCH') in ['x86', 'x86_64'] or "14.0" in vs_version:
31                 env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/ZI', '/RTC1', '/Gm'])
32                 env.AppendUnique(LINKFLAGS = ['/debug'])
33         else:
34                 env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/Zi', '/RTC1', '/Gm'])
35                 env.AppendUnique(LINKFLAGS = ['/debug'])
36         env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
37         env.AppendUnique(PATH = os.environ['PATH'])
38
39 elif env['CC'] == 'gcc':
40         print "\nError: gcc not supported on Windows.  Use Visual Studio!\n"
41         Exit(1);
42