diff options
Diffstat (limited to 'platform/uwp')
-rw-r--r-- | platform/uwp/detect.py | 106 |
1 files changed, 53 insertions, 53 deletions
diff --git a/platform/uwp/detect.py b/platform/uwp/detect.py index baff7f9788..ca469d0056 100644 --- a/platform/uwp/detect.py +++ b/platform/uwp/detect.py @@ -1,8 +1,7 @@ +import methods import os - -import sys import string -import methods +import sys def is_active(): @@ -26,7 +25,9 @@ def can_build(): def get_opts(): - return [] + + return [ + ] def get_flags(): @@ -39,16 +40,36 @@ def get_flags(): def configure(env): - if(env["bits"] != "default"): - print "Error: bits argument is disabled for MSVC" - print ("Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console (or Visual Studio settings)" - + " that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits argument (example: scons p=uwp) and SCons will attempt to detect what MSVC compiler" - + " will be executed and inform you.") + if (env["bits"] != "default"): + print("Error: bits argument is disabled for MSVC") + print(""" + Bits argument is not supported for MSVC compilation. Architecture depends on the Native/Cross Compile Tools Prompt/Developer Console + (or Visual Studio settings) that is being used to run SCons. As a consequence, bits argument is disabled. Run scons again without bits + argument (example: scons p=uwp) and SCons will attempt to detect what MSVC compiler will be executed and inform you. + """) sys.exit() - arch = "" - env['ENV'] = os.environ + ## Build type + + if (env["target"] == "release"): + env.Append(CPPFLAGS=['/O2', '/GL']) + env.Append(CPPFLAGS=['/MD']) + env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG']) + + elif (env["target"] == "release_debug"): + env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED']) + env.Append(CPPFLAGS=['/MD']) + env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + + elif (env["target"] == "debug"): + env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED']) + env.Append(CPPFLAGS=['/MDd']) + env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + env.Append(LINKFLAGS=['/DEBUG']) + + ## Compiler configuration + env['ENV'] = os.environ vc_base_path = os.environ['VCTOOLSINSTALLDIR'] if "VCTOOLSINSTALLDIR" in os.environ else os.environ['VCINSTALLDIR'] # ANGLE @@ -60,9 +81,12 @@ def configure(env): if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"): env["build_angle"] = True + ## Architecture + + arch = "" if os.getenv('Platform') == "ARM": - print "Compiled program architecture will be an ARM executable. (forcing bits=32)." + print("Compiled program architecture will be an ARM executable. (forcing bits=32).") arch = "arm" env["bits"] = "32" @@ -74,17 +98,16 @@ def configure(env): env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_ARM/lib']) else: - compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV']) if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"): env["bits"] = "64" - print "Compiled program architecture will be a x64 executable (forcing bits=64)." + print("Compiled program architecture will be a x64 executable (forcing bits=64).") elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"): env["bits"] = "32" - print "Compiled program architecture will be a x86 executable. (forcing bits=32)." + print("Compiled program architecture will be a x86 executable. (forcing bits=32).") else: - print "Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup." + print("Failed to detect MSVC compiler architecture version... Defaulting to 32bit executable settings (forcing bits=32). Compilation attempt will continue, but SCons can not detect for what architecture this build is compiled for. You should check your settings/compilation setup.") env["bits"] = "32" if (env["bits"] == "32"): @@ -106,48 +129,30 @@ def configure(env): env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64']) env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib']) - env.Append(CPPPATH=['#platform/uwp', '#drivers/windows']) - env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"']) - env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32']) - - env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references']) - env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references']) - - if (env["target"] == "release"): - - env.Append(CPPFLAGS=['/O2', '/GL']) - env.Append(CPPFLAGS=['/MD']) - env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS', '/LTCG']) + env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"] + env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"] + env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"] - elif (env["target"] == "release_debug"): + ## Compile flags - env.Append(CCFLAGS=['/O2', '/Zi', '/DDEBUG_ENABLED']) - env.Append(CPPFLAGS=['/MD']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) + env.Append(CPPPATH=['#platform/uwp', '#drivers/windows']) + env.Append(CCFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND']) + env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) + winver = "0x0602" # Windows 8 is the minimum target for UWP build + env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver]) - elif (env["target"] == "debug"): + env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32']) - env.Append(CCFLAGS=['/Zi', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED']) - env.Append(CPPFLAGS=['/MDd']) - env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE']) - env.Append(LINKFLAGS=['/DEBUG']) + env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references']) + env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references']) env.Append(CCFLAGS=string.split('/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /D "_UNICODE" /D "UNICODE" /D "WINAPI_FAMILY=WINAPI_FAMILY_APP" /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo')) env.Append(CXXFLAGS=string.split('/ZW /FS')) env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral']) - env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"] - env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"] - env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"] - - env.Append(CCFLAGS=['/DUWP_ENABLED']) - env.Append(CCFLAGS=['/DWINDOWS_ENABLED']) - env.Append(CCFLAGS=['/DTYPED_METHOD_BIND']) - - env.Append(CCFLAGS=['/DGLES2_ENABLED', '/DGL_GLEXT_PROTOTYPES', '/DEGL_EGLEXT_PROTOTYPES', '/DANGLE_ENABLED']) + ## Link flags - winver = "0x0602" # Windows 8 is the minimum target for UWP build - env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver]) + env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"']) LIBS = [ 'WindowsApp', @@ -164,8 +169,3 @@ def configure(env): env['BUILDERS']['Program'] = methods.precious_program env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)}) - - env.Append(BUILDERS={'GLSL120': env.Builder(action=methods.build_legacygl_headers, suffix='glsl.h', src_suffix='.glsl')}) - env.Append(BUILDERS={'GLSL': env.Builder(action=methods.build_glsl_headers, suffix='glsl.h', src_suffix='.glsl')}) - env.Append(BUILDERS={'HLSL9': env.Builder(action=methods.build_hlsl_dx9_headers, suffix='hlsl.h', src_suffix='.hlsl')}) - env.Append(BUILDERS={'GLSL120GLES': env.Builder(action=methods.build_gles2_headers, suffix='glsl.h', src_suffix='.glsl')}) |