vs_menu.py 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import msvcrt
  2. import os
  3. #set standard settings (No XP support/64Bit version)
  4. compileXP = 0 #XP support 0 = off/1 = on
  5. version = 64 #32 = win32/64 = x64 version
  6. quit = 0 #Loop variable keep at 0
  7. #Some standard strings
  8. location='C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\' #location of Visual Studio 2015 (Community) VC files
  9. title=' openMSX build menu for Visual Studio 2015'
  10. menuval = {
  11. '[1] Update from Repository'
  12. ,'[2] Get 3rd Party Files\n'
  13. ,'[3] Compile 3rd-party files'
  14. ,'[4] Compile openMSX Release'
  15. ,'[5] Generate Installer and Packages\n'
  16. ,'[6] Toggle Win32/Win64 Version'
  17. ,'[7] Toggle Toggle XP Support\n'
  18. ,'[8] Quit\n'
  19. }
  20. def menu():
  21. os.system('color 9f')
  22. os.system('mode 80,24')
  23. os.system('TITLE'+title)
  24. os.system('cls')
  25. print('-'*50)
  26. print(title)
  27. print('-'*50+'\n')
  28. for item in sorted(menuval): print(item)
  29. print('-'*50)
  30. print(' Resulting Binary settings:')
  31. if version == 32: print(' - Windows 32bit Version')
  32. else: print(' - Windows 64bit Version')
  33. if compileXP == 1:print(' - XP Support ON')
  34. else: print(' - XP Support Off')
  35. print('-'*50)
  36. print()
  37. if compileXP == 1: print('The DirectX June 2010 SDK is needed for XP support')
  38. if quit == 1: os.system('cls')
  39. def execCommand(cmd):
  40. os.system('cls')
  41. os.chdir('..\\..\\')
  42. os.system(cmd)
  43. os.chdir('build\\package-windows')
  44. os.system('pause')
  45. def updateSourceCode():
  46. execCommand('git pull')
  47. def update3rdparty():
  48. execCommand('call "python" build\\thirdparty_download.py windows')
  49. def compile(whattocompile):
  50. compiler = 'x86' if version == 32 else 'amd64'
  51. support = 'v140' if compileXP == 0 else 'v140_xp'
  52. compilefor = 'Win32' if version == 32 else 'x64'
  53. compilewhat = 'build\\msvc\\openmsx.sln' if whattocompile == 'OpenMSX' else 'build\\3rdparty\\3rdparty.sln'
  54. cmd = 'call "'+location+'vcvarsall.bat" '+str(compiler)+'&&'
  55. cmd += 'set PlatformToolset='+str(support)+'&&'
  56. cmd += 'msbuild -p:Configuration=Release;Platform='+str(compilefor)+' '+compilewhat+' /m'
  57. execCommand(cmd)
  58. def package():
  59. packagefor = 'Win32' if version == 32 else 'x64'
  60. execCommand('build\\package-windows\\package.cmd '+packagefor+' release ..\\wxcatapult')
  61. # Main Loop
  62. menu()
  63. while quit == 0:
  64. x = ord(msvcrt.getch())
  65. if x == 49: updateSourceCode()
  66. if x == 50: update3rdparty()
  67. if x == 51: compile('3rdParty')
  68. if x == 52: compile('OpenMSX')
  69. if x == 53: package()
  70. if x == 54: version = 32 if version == 64 else 64
  71. if x == 55: compileXP = 0 if compileXP == 1 else 1
  72. if x == 56: quit = 1
  73. menu()