diff -r 3b3257a410fe -r 2274a07510c1 SConstruct --- a/SConstruct Tue Jul 26 17:41:36 2016 +0200 +++ b/SConstruct Tue Jul 26 18:19:37 2016 +0200 @@ -39,12 +39,7 @@ Decider('MD5-timestamp') SConsignFile('build/.sconsign.dblite') -if sys.platform == 'win32': - tools = ['mingw'] -else: - tools = ['default'] - -env = Environment(tools = tools, CPPPATH = ['.','#include','#build/include']) +env = Environment(tools = ['default'], CPPPATH = ['.','#include','#build/include']) vars = Variables(files=['build/.varscache']) vars.AddVariables( @@ -54,17 +49,8 @@ BoolVariable('force_flags', "use only flags specified by 'flags' option (do not autodetect arch/sse flags)", False), ('ldflags', 'add additional linker flags', ""), BoolVariable('profile', "enable gcc's profiling support (-pg)", False), + BoolVariable('intelc', 'use Intel C++ Compiler, if available', False), ) -if env['PLATFORM'] == 'win32': - vars.AddVariables( - BoolVariable('mingw', 'use Mingw and GCC compiler, if available', False), - ('pythonpath', 'path to Python installation', - 'C:\\Python%c%c' % (sys.version[0], sys.version[2])), - ) -else: - vars.AddVariables( - BoolVariable('intelc', 'use Intel C++ Compiler, if available', False), - ) vars.Update(env) @@ -84,8 +70,6 @@ platform = 'linux' elif env['PLATFORM'] == 'posix': platform = 'posix' - elif env['PLATFORM'] == 'win32': - platform = 'win32' context.Result(platform) return True @@ -116,19 +100,6 @@ context.Result(False) return gcc -def CheckMSVC(context): - global msvc, msvcversion - context.Message('Checking for MSVC compiler... ') - testenv = Environment() - msvc = "msvc" in testenv['TOOLS'] - if msvc: - msvcversion = testenv['MSVS_VERSION'] - context.Result(msvcversion) - else: - msvcversion = '' - context.Result(False) - return msvc - def CheckCPUFlags(context): global cpu, cpuflags_gcc, cpuflags_intelc context.Message('Checking CPU arch and flags... ') @@ -144,25 +115,19 @@ conf = Configure(env, conf_dir=conf_dir, log_file=log_file, config_h=config_h, clean=False, help=False, custom_tests = { - 'CheckPlatform' : CheckPlatform, 'CheckCPUFlags' : CheckCPUFlags, - 'CheckIntelC' : CheckIntelC, 'CheckGCC' : CheckGCC, 'CheckMSVC' : CheckMSVC}) + 'CheckPlatform' : CheckPlatform, + 'CheckCPUFlags' : CheckCPUFlags, + 'CheckIntelC' : CheckIntelC, + 'CheckGCC' : CheckGCC, + }) conf.CheckPlatform() conf.CheckGCC() -if platform == 'win32': - conf.CheckMSVC() - intelc = False -else: - conf.CheckIntelC() - msvc=False +conf.CheckIntelC() if intelc and (not gcc or conf.env['intelc']): Tool('intelc').generate(conf.env) cc = 'intelc' -elif msvc and (not gcc or not conf.env['mingw']): - Tool('default').generate(conf.env) - conf.Define("MSVC") - cc = 'msvc' elif gcc: cc = 'gcc' else: @@ -171,19 +136,11 @@ if cc == 'intelc' or cc == 'gcc': conf.CheckCPUFlags() -if platform == 'win32' and cc == 'gcc': - conf.env.Append(LIBPATH=["C:/mingw/lib", "C:/msys/mingw/lib"]) - conf.env.Append(CPPPATH=["C:/mingw/include", "C:/msys/mingw/include"]) - add_flags = '' if cc == 'gcc': add_flags += cpuflags_gcc + ' -ffast-math ' if cc == 'intelc': add_flags += cpuflags_intelc + ' ' -if cc == 'msvc': - add_flags += '/fp:fast ' - if conf.env['simd']: - add_flags += '/arch:SSE ' if conf.env['force_flags']: add_flags = conf.env['flags'] + ' ' @@ -203,8 +160,6 @@ # Other useful flags: # -Wunsafe-loop-optimizations -Wpointer-arith -Wcast-align -Wconversion # -Wmissing-noreturn -Winline -Wdisabled-optimization -elif cc == 'msvc': - conf.env.Append(CCFLAGS="/Ox /Ob2 /GS- /Gy /GF /GR- /Zp16 /MD /EHsc /vmb " + add_flags) else: print "No supported compiler found." Exit(1) @@ -220,20 +175,7 @@ # configure pthread -pthread = True -if platform == 'win32': - if cc == 'msvc': - if not conf.CheckLib('pthreadVC2'): - pthread = False - elif cc == 'gcc': - if not conf.CheckLib('pthreadGC2'): - pthread = False -else: - conf.env.Append(CCFLAGS="-pthread ") - -if not pthread: - print 'Error: Cannot build without pthread.' - Exit(1) +conf.env.Append(CCFLAGS="-pthread ") # configure libpng @@ -247,23 +189,10 @@ # configure Python pyenv = env.Clone() have_python = True -if platform == 'win32': - pythonver = '%c%c' % (sys.version[0], sys.version[2]) - pythonlib = 'python'+pythonver - pythonpath = [env['pythonpath']] - pyenv.Append(CPPPATH=[s+'\\include' for s in pythonpath]) - pyenv.Append(LIBPATH=[s+'\\libs' for s in pythonpath]) - pyenv.Replace(SHLIBSUFFIX='.pyd') - conf = Configure(pyenv, conf_dir=conf_dir, log_file=log_file, config_h=config_h, - clean=False, help=False) - if not conf.CheckLib(pythonlib): - have_python = False - pyenv = conf.Finish() -else: - try: - pyenv.ParseConfig('python-config --includes --libs') - except: - have_python = False +try: + pyenv.ParseConfig('python-config --includes --libs') +except: + have_python = False if not have_python: print "Error: Python is required." @@ -271,15 +200,11 @@ # configure SDL sdlenv = env.Clone() -if cc == 'msvc': - sdlenv.Append(LIBS=['SDL', 'SDLmain']) - sdlenv.Append(LINKFLAGS="/SUBSYSTEM:WINDOWS") -else: - try: - sdlenv.ParseConfig('sdl-config --cflags') - sdlenv.ParseConfig('sdl-config --libs') - except: - pass +try: + sdlenv.ParseConfig('sdl-config --cflags') + sdlenv.ParseConfig('sdl-config --libs') +except: + pass def CheckSDL(context): global have_sdl @@ -304,16 +229,10 @@ Export('env pyenv sdlenv have_sdl cc') lib = SConscript('src/SConscript', variant_dir='build/lib', duplicate=0, exports={'buildmodule':False}) -if cc == 'msvc': - (pymodule, modvcproj) = SConscript('src/SConscript', variant_dir='build/pymodule', duplicate=0, - exports={'buildmodule':True}) - ccdemvcproj = SConscript('ccdemos/SConscript', variant_dir='build/ccdemos', duplicate=0, exports='lib') - demosvcproj = SConscript('demos/SConscript', exports='pymodule') -else: - pymodule = SConscript('src/SConscript', variant_dir='build/pymodule', duplicate=0, - exports={'buildmodule':True}) - SConscript('ccdemos/SConscript', variant_dir='build/ccdemos', duplicate=0, exports='lib') - SConscript('demos/SConscript', exports='pymodule') +pymodule = SConscript('src/SConscript', variant_dir='build/pymodule', duplicate=0, + exports={'buildmodule':True}) +SConscript('ccdemos/SConscript', variant_dir='build/ccdemos', duplicate=0, exports='lib') +SConscript('demos/SConscript', exports='pymodule') SConscript('tests/SConscript', variant_dir='build/tests', duplicate=0, exports='lib') SConscript('models/SConscript') @@ -327,12 +246,3 @@ env.Alias('all', ['no-docs', 'docs']) env.Alias('pyrit', 'no-download') Default('pyrit') - -if cc == 'msvc': - vcsol = env.MSVSSolution( - target = 'pyrit' + env['MSVSSOLUTIONSUFFIX'], - projects = [modvcproj, ccdemvcproj, demosvcproj], - variant = 'Release') - - env.Depends(vcsol, [modvcproj, ccdemvcproj, demosvcproj]); - env.Alias('vcproj', vcsol)