The following is a "doodle" for the direction I think the whole platform detection thing should go. It is all about removing strings as selectors, which has to be a bad thing given the propensity of many to mis-spell things.
from enum import Enum, unique
@unique
class OS_Type(Enum):
posix = 0
linux_debian = 1
linux_fedora = 2
darwin = 3
windows_win32 = 4
windows_cygwin = 5
windows_mingw = 6
def which_posix():
with open('/etc/os-release') as f:
for line in f:
if 'ID' in line:
return {
'debian': OS_Type.linux_debian,
'fedora': OS_Type.linux_fedora,
}[line.split('=')[1].strip()]
return OS_Type.posix
environment = Environment(
tools=('g++', 'gnulink'),
)
platform = {
'posix': which_posix(),
'darwin': OS_Type.darwin,
}[environment['PLATFORM']]
environment.MergeFlags('!pkg-config --cflags --libs gtkmm-3.0')
if platform == OS_Type.linux_fedora:
environment.MergeFlags('!pkg-config --cflags --libs gstreamermm-
0.10')
elif platform == OS_Type.linux_debian:
environment.MergeFlags('!pkg-config --cflags --libs gstreamermm-
1.0')
else:
print('Platform not understood.')
Exit(1)
environment.Program('stuff.cpp', CXXFLAGS=['-std=c++14', '-W', '-
Wall'])
--
Russel.
=============================================================================
Dr Russel Winder t: +44 20 7585 2200 voip: sip:[email protected]
41 Buckmaster Road m: +44 7770 465 077 xmpp: [email protected]
London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Scons-dev mailing list [email protected] https://pairlist2.pair.net/mailman/listinfo/scons-dev
