Fix a few issues compiling windows and using VS2015 and earlier

This commit is contained in:
BastiaanOlij 2017-05-23 21:50:06 +10:00
parent 6161e731d0
commit 8b01f9d28f
3 changed files with 58 additions and 51 deletions

View File

@ -1594,61 +1594,69 @@ def detect_visual_c_compiler_version(tools_env):
vc_chosen_compiler_index = -1 vc_chosen_compiler_index = -1
vc_chosen_compiler_str = "" vc_chosen_compiler_str = ""
# find() works with -1 so big ifs bellow are needed... the simplest solution, in fact # Start with Pre VS 2017 checks which uses VCINSTALLDIR:
# First test if amd64 and amd64_x86 compilers are present in the path if 'VCINSTALLDIR' in tools_env:
vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;") # print "Checking VCINSTALLDIR"
if(vc_amd64_compiler_detection_index > -1):
vc_chosen_compiler_index = vc_amd64_compiler_detection_index
vc_chosen_compiler_str = "amd64"
vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;") # find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
if(vc_amd64_x86_compiler_detection_index > -1 # First test if amd64 and amd64_x86 compilers are present in the path
and (vc_chosen_compiler_index == -1 vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64;")
or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)): if(vc_amd64_compiler_detection_index > -1):
vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index vc_chosen_compiler_index = vc_amd64_compiler_detection_index
vc_chosen_compiler_str = "amd64_x86" vc_chosen_compiler_str = "amd64"
# Now check the 32 bit compilers vc_amd64_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN\\amd64_x86;")
vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;") if(vc_amd64_x86_compiler_detection_index > -1
if(vc_x86_compiler_detection_index > -1 and (vc_chosen_compiler_index == -1
and (vc_chosen_compiler_index == -1 or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
or vc_chosen_compiler_index > vc_x86_compiler_detection_index)): vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
vc_chosen_compiler_index = vc_x86_compiler_detection_index vc_chosen_compiler_str = "amd64_x86"
vc_chosen_compiler_str = "x86"
vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;") # Now check the 32 bit compilers
if(vc_x86_amd64_compiler_detection_index > -1 vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"] + "BIN;")
and (vc_chosen_compiler_index == -1 if(vc_x86_compiler_detection_index > -1
or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)): and (vc_chosen_compiler_index == -1
vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
vc_chosen_compiler_str = "x86_amd64" vc_chosen_compiler_index = vc_x86_compiler_detection_index
vc_chosen_compiler_str = "x86"
# Newer versions have a different path available vc_x86_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env['VCINSTALLDIR'] + "BIN\\x86_amd64;")
vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;") if(vc_x86_amd64_compiler_detection_index > -1
if(vc_amd64_compiler_detection_index > -1): and (vc_chosen_compiler_index == -1
vc_chosen_compiler_index = vc_amd64_compiler_detection_index or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
vc_chosen_compiler_str = "amd64" vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64"
vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;") # and for VS 2017 and newer we check VCTOOLSINSTALLDIR:
if(vc_amd64_x86_compiler_detection_index > -1 if 'VCTOOLSINSTALLDIR' in tools_env:
and (vc_chosen_compiler_index == -1 # print "Checking VCTOOLSINSTALLDIR"
or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
vc_chosen_compiler_str = "amd64_x86"
vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;") # Newer versions have a different path available
if(vc_x86_compiler_detection_index > -1 vc_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X64;")
and (vc_chosen_compiler_index == -1 if(vc_amd64_compiler_detection_index > -1):
or vc_chosen_compiler_index > vc_x86_compiler_detection_index)): vc_chosen_compiler_index = vc_amd64_compiler_detection_index
vc_chosen_compiler_index = vc_x86_compiler_detection_index vc_chosen_compiler_str = "amd64"
vc_chosen_compiler_str = "x86"
vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;") vc_amd64_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX64\\X86;")
if(vc_x86_amd64_compiler_detection_index > -1 if(vc_amd64_x86_compiler_detection_index > -1
and (vc_chosen_compiler_index == -1 and (vc_chosen_compiler_index == -1
or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)): or vc_chosen_compiler_index > vc_amd64_x86_compiler_detection_index)):
vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index vc_chosen_compiler_index = vc_amd64_x86_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64" vc_chosen_compiler_str = "amd64_x86"
vc_x86_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X86;")
if(vc_x86_compiler_detection_index > -1
and (vc_chosen_compiler_index == -1
or vc_chosen_compiler_index > vc_x86_compiler_detection_index)):
vc_chosen_compiler_index = vc_x86_compiler_detection_index
vc_chosen_compiler_str = "x86"
vc_x86_amd64_compiler_detection_index = tools_env["PATH"].upper().find(tools_env['VCTOOLSINSTALLDIR'].upper() + "BIN\\HOSTX86\\X64;")
if(vc_x86_amd64_compiler_detection_index > -1
and (vc_chosen_compiler_index == -1
or vc_chosen_compiler_index > vc_x86_amd64_compiler_detection_index)):
vc_chosen_compiler_index = vc_x86_amd64_compiler_detection_index
vc_chosen_compiler_str = "x86_amd64"
# debug help # debug help
# print vc_amd64_compiler_detection_index # print vc_amd64_compiler_detection_index

View File

@ -565,7 +565,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
ScreenToClient(hWnd, &coords); ScreenToClient(hWnd, &coords);
mb->set_pos(coords); mb->set_pos(Vector2(coords.x, coords.y));
} }
if (main_loop) { if (main_loop) {

View File

@ -68,8 +68,7 @@ class OS_Windows : public OS {
struct KeyEvent { struct KeyEvent {
InputModifierState mod_state; bool alt, shift, control, meta;
bool alt, shift, ctrl, meta;
UINT uMsg; UINT uMsg;
WPARAM wParam; WPARAM wParam;
LPARAM lParam; LPARAM lParam;