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