# Detect gcc/clang not by executable name, but through pre-defined macros
# as autoconf does, to avoid drawing wrong conclusions when using tools
# that overrice CC/CXX like scan-build.
- env['gcc'] = 0
+ env['gcc_compat'] = 0
env['clang'] = 0
env['msvc'] = 0
if host_platform.system() == 'Windows':
env['msvc'] = check_cc(env, 'MSVC', 'defined(_MSC_VER)', '/E')
if not env['msvc']:
- env['gcc'] = check_cc(env, 'GCC', 'defined(__GNUC__) && !defined(__clang__)')
- env['clang'] = check_cc(env, 'Clang', '__clang__')
+ env['gcc_compat'] = check_cc(env, 'GCC', 'defined(__GNUC__)')
+ env['clang'] = check_cc(env, 'Clang', '__clang__')
+ env['gcc'] = env['gcc_compat'] and not env['clang']
env['suncc'] = env['platform'] == 'sunos' and os.path.basename(env['CC']) == 'cc'
env['icc'] = 'icc' == os.path.basename(env['CC'])
platform = env['platform']
x86 = env['machine'] == 'x86'
ppc = env['machine'] == 'ppc'
- gcc_compat = env['gcc'] or env['clang']
+ gcc_compat = env['gcc_compat']
msvc = env['msvc']
suncc = env['suncc']
icc = env['icc']
if env['build'] == 'profile':
env['debug'] = False
env['profile'] = True
- if env['build'] == 'release':
+ if env['build'] in ('release', 'opt'):
env['debug'] = False
env['profile'] = False
# C preprocessor options
cppdefines = []
cppdefines += [
- '__STDC_LIMIT_MACROS',
'__STDC_CONSTANT_MACROS',
+ '__STDC_FORMAT_MACROS',
+ '__STDC_LIMIT_MACROS',
'HAVE_NO_AUTOCONF',
]
if env['build'] in ('debug', 'checked'):
cppdefines += ['NDEBUG']
if env['build'] == 'profile':
cppdefines += ['PROFILE']
+ if env['build'] in ('opt', 'profile'):
+ cppdefines += ['VMX86_STATS']
if env['platform'] in ('posix', 'linux', 'freebsd', 'darwin'):
cppdefines += [
'_POSIX_SOURCE',
'GLX_DIRECT_RENDERING',
'GLX_INDIRECT_RENDERING',
]
- if env['platform'] in ('linux', 'freebsd'):
- cppdefines += ['HAVE_ALIAS']
- else:
- cppdefines += ['GLX_ALIAS_UNSUPPORTED']
if env['platform'] in ('linux', 'darwin'):
cppdefines += ['HAVE_XLOCALE_H']
ccflags += [
'/O2', # optimize for speed
]
- if env['build'] == 'release':
- ccflags += [
- '/GL', # enable whole program optimization
- ]
+ if env['build'] in ('release', 'opt'):
+ if not env['clang']:
+ ccflags += [
+ '/GL', # enable whole program optimization
+ ]
else:
ccflags += [
'/Oy-', # disable frame pointer omission
- '/GL-', # disable whole program optimization
]
ccflags += [
'/W3', # warning level
'/wd4800', # forcing value to bool 'true' or 'false' (performance warning)
'/wd4996', # disable deprecated POSIX name warnings
]
+ if env['clang']:
+ ccflags += [
+ '-Wno-microsoft-enum-value', # enumerator value is not representable in underlying type 'int'
+ ]
if env['machine'] == 'x86':
ccflags += [
'/arch:SSE2', # use the SSE2 instructions (default since MSVC 2012)
shlinkflags += ['-Wl,--enable-stdcall-fixup']
#shlinkflags += ['-Wl,--kill-at']
if msvc:
- if env['build'] == 'release':
+ if env['build'] in ('release', 'opt') and not env['clang']:
# enable Link-time Code Generation
linkflags += ['/LTCG']
env.Append(ARFLAGS = ['/LTCG'])
env.AddMethod(msvc2013_compat, 'MSVC2013Compat')
env.AddMethod(unit_test, 'UnitTest')
- env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage', 'xfixes', 'glproto >= 1.4.13'])
+ env.PkgCheckModules('X11', ['x11', 'xext', 'xdamage >= 1.1', 'xfixes', 'glproto >= 1.4.13', 'dri2proto >= 2.8'])
env.PkgCheckModules('XCB', ['x11-xcb', 'xcb-glx >= 1.8.1', 'xcb-dri2 >= 1.8'])
env.PkgCheckModules('XF86VIDMODE', ['xxf86vm'])
- env.PkgCheckModules('DRM', ['libdrm >= 2.4.38'])
- env.PkgCheckModules('UDEV', ['libudev >= 151'])
+ env.PkgCheckModules('DRM', ['libdrm >= 2.4.75'])
if env['x11']:
env.Append(CPPPATH = env['X11_CPPPATH'])