##
# This script includes windows specific config (MSVS/MSVC)
##
-Import('env', 'RELEASE_BUILD', 'TARGET_CPU_ARCH')
+Import('env')
+import os.path
# Set common flags
-env.AppendUnique(CXXFLAGS=['/wd4244', '/wd4267','/wd4345', '/wd4355', '/wd4800', '/wd4996'])
-env.AppendUnique(CFLAGS=['/EHsc'])
-env.AppendUnique(CXXFLAGS=['/EHsc'])
+if env['CC'] == 'cl':
+
+ # TODO: re-enable warnings, especially: 4244, 4267, 4365
+ env.AppendUnique(CXXFLAGS=[
+ '/wd4244', # C4244 conversion from one type to another type results in a possible loss of data.
+ '/wd4267', # C4267 conversion from size_t to a smaller type.
+ '/wd4355', # C4355 'this' used in base member initializer list.
+ '/wd4800', # C4800 forcing value to bool 'true' or 'false'.
+ '/wd4996', # C4996 deprecated declaration.
+ '/wd4820', # C4820 added padding to the end of a struct.
+ '/wd4514', # C4514 unreferenced inline function has been removed
+ '/wd4365', # C4365 signed/unsigned mismatch
+ '/wd4503']) # C4503 decorated name length exceeded, name was truncated
+
+ env.AppendUnique(CCFLAGS=['/EHsc'])
+
+ vs_version = env['MSVC_VERSION']
+
+ # Set release/debug flags
+ if env.get('RELEASE'):
+ env.AppendUnique(CCFLAGS = ['/MD', '/O2', '/GF'])
+ env.AppendUnique(CPPDEFINES = ['NDEBUG'])
+ elif env.get('TARGET_ARCH') in ['x86', 'x86_64'] or "14.0" in vs_version:
+ env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/ZI', '/RTC1', '/Gm'])
+ env.AppendUnique(LINKFLAGS = ['/debug'])
+ else:
+ env.AppendUnique(CCFLAGS = ['/MDd', '/Od', '/Zi', '/RTC1', '/Gm'])
+ env.AppendUnique(LINKFLAGS = ['/debug'])
+ env.AppendUnique(LIBPATH = [env.get('BUILD_DIR')])
+ env.AppendUnique(PATH = os.environ['PATH'])
+
+elif env['CC'] == 'gcc':
+ print("\nError: gcc not supported on Windows. Use Visual Studio!\n")
+ Exit(1);
-# Set release/debug flags
-if RELEASE_BUILD:
- env.AppendUnique(CFLAGS = ['/MD', '/O2', '/GF'])
- env.AppendUnique(CXXFLAGS = ['/MD', '/O2', '/GF'])
- env.AppendUnique(CPPDEFINES = ['NDEBUG'])
-else:
- env.AppendUnique(CFLAGS = ['/MDd', '/Od', '/ZI', '/GZ', '/Gm'])
- env.AppendUnique(CXXFLAGS = ['/MDd', '/Od', '/ZI', '/GZ', '/Gm'])
- env.AppendUnique(CPPDEFINES = ['_DEBUG'])
- env.AppendUnique(LINKFLAGS = ['/debug'])
\ No newline at end of file