[Win32] Modify SConscripts to prepare for VS
[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         # Enable special exports for unit test purposes
22         if env.get('TEST') == '1':
23                 env.AppendUnique(CPPDEFINES = ['ENABLE_TEST_EXPORTS'])
24         # Set release/debug flags
25         if env.get('RELEASE'):
26                 env.AppendUnique(CCFLAGS = ['/MD', '/O2', '/GF'])
27                 env.AppendUnique(CPPDEFINES = ['NDEBUG'])
28         else:
29                 env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/ZI', '/RTC1', '/Gm'])
30                 env.AppendUnique(LINKFLAGS = ['/debug'])
31         env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
32         env.AppendUnique(PATH = os.environ['PATH'])
33
34 elif env['CC'] == 'gcc':
35         print "\nError: gcc not supported on Windows.  Use Visual Studio!\n"
36         Exit(1);
37