Fix build error with scons-4.4.0 version which is based on python3
[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
10     # TODO: re-enable warnings, especially: 4244, 4267, 4365
11     env.AppendUnique(CXXFLAGS=[
12         '/wd4244',   # C4244 conversion from one type to another type results in a possible loss of data.
13         '/wd4267',   # C4267 conversion from size_t to a smaller type.
14         '/wd4355',   # C4355 'this' used in base member initializer list.
15         '/wd4800',   # C4800 forcing value to bool 'true' or 'false'.
16         '/wd4996',   # C4996 deprecated declaration.
17         '/wd4820',   # C4820 added padding to the end of a struct.
18         '/wd4514',   # C4514 unreferenced inline function has been removed
19         '/wd4365',   # C4365 signed/unsigned mismatch
20         '/wd4503'])  # C4503 decorated name length exceeded, name was truncated
21
22     env.AppendUnique(CCFLAGS=['/EHsc'])
23
24     vs_version = env['MSVC_VERSION']
25
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