You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Implement missing WinRT functions
- Fix buildsystem for WinRT/UWP platform. - Add audio driver and joystick mapping for WinRT. - Enable thread class for WinRT. - Refactor MSVC compiler architecture detection to methods.py, so it can be used by Windows and WinRT.
This commit is contained in:
69
methods.py
69
methods.py
@@ -1450,3 +1450,72 @@ def colored(sys,env):
|
||||
env.Append( JARCOMSTR=[java_library_message] )
|
||||
env.Append( JAVACCOMSTR=[java_compile_source_message] )
|
||||
|
||||
def detect_visual_c_compiler_version(tools_env):
|
||||
# tools_env is the variable scons uses to call tools that execute tasks, SCons's env['ENV'] that executes tasks...
|
||||
# (see the SCons documentation for more information on what it does)...
|
||||
# in order for this function to be well encapsulated i choose to force it to recieve SCons's TOOLS env (env['ENV']
|
||||
# and not scons setup environment (env)... so make sure you call the right environment on it or it will fail to detect
|
||||
# the propper vc version that will be called
|
||||
|
||||
# These is no flag to give to visual c compilers to set the architecture, ie scons bits argument (32,64,ARM etc)
|
||||
# There are many different cl.exe files that are run, and each one compiles & links to a different architecture
|
||||
# As far as I know, the only way to figure out what compiler will be run when Scons calls cl.exe via Program()
|
||||
# is to check the PATH varaible and figure out which one will be called first. Code bellow does that and returns:
|
||||
# the following string values:
|
||||
|
||||
# "" Compiler not detected
|
||||
# "amd64" Native 64 bit compiler
|
||||
# "amd64_x86" 64 bit Cross Compiler for 32 bit
|
||||
# "x86" Native 32 bit compiler
|
||||
# "x86_amd64" 32 bit Cross Compiler for 64 bit
|
||||
|
||||
# There are other architectures, but Godot does not support them currently, so this function does not detect arm/amd64_arm
|
||||
# and similar architectures/compilers
|
||||
|
||||
# Set chosen compiler to "not detected"
|
||||
vc_chosen_compiler_index = -1
|
||||
vc_chosen_compiler_str = ""
|
||||
|
||||
# find() works with -1 so big ifs bellow are needed... the simplest solution, in fact
|
||||
# First test if amd64 and amd64_x86 compilers are present in the path
|
||||
vc_amd64_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN\\amd64;")
|
||||
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;")
|
||||
if(vc_amd64_x86_compiler_detection_index > -1
|
||||
and (vc_chosen_compiler_index == -1
|
||||
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"
|
||||
|
||||
|
||||
# Now check the 32 bit compilers
|
||||
vc_x86_compiler_detection_index = tools_env["PATH"].find(tools_env["VCINSTALLDIR"]+"BIN;")
|
||||
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"].find(tools_env['VCINSTALLDIR']+"BIN\\x86_amd64;")
|
||||
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
|
||||
#print vc_amd64_compiler_detection_index
|
||||
#print vc_amd64_x86_compiler_detection_index
|
||||
#print vc_x86_compiler_detection_index
|
||||
#print vc_x86_amd64_compiler_detection_index
|
||||
#print "chosen "+str(vc_chosen_compiler_index)+ " | "+str(vc_chosen_compiler_str)
|
||||
|
||||
return vc_chosen_compiler_str
|
||||
|
||||
def precious_program(env, program, sources, **args):
|
||||
program = env.ProgramOriginal(program, sources, **args)
|
||||
env.Precious(program)
|
||||
return program
|
||||
|
||||
Reference in New Issue
Block a user