Exemplo n.º 1
0
def setup_msvc_manual(env):
    """Set up env to use MSVC manually, using VCINSTALLDIR"""
    if env["bits"] != "default":
        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=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
            """
        )
        raise SCons.Errors.UserError("Bits argument should not be used when using VCINSTALLDIR")

    # Force bits arg
    # (Actually msys2 mingw can support 64-bit, we could detect that)
    env["bits"] = "32"
    env["x86_libtheora_opt_vc"] = True

    # find compiler manually
    compiler_version_str = methods.detect_visual_c_compiler_version(env["ENV"])
    print("Found MSVC compiler: " + compiler_version_str)

    # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writing)... vc compiler for 64bit can not compile _asm
    if compiler_version_str == "amd64" or compiler_version_str == "x86_amd64":
        env["bits"] = "64"
        env["x86_libtheora_opt_vc"] = False
        print("Compiled program architecture will be a 64 bit executable (forcing bits=64).")
    elif compiler_version_str == "x86" or compiler_version_str == "amd64_x86":
        print("Compiled program architecture will be a 32 bit executable. (forcing bits=32).")
    else:
        print(
            "Failed to manually 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, or avoid setting VCINSTALLDIR."
        )
Exemplo n.º 2
0
Arquivo: detect.py Projeto: 93i/godot
def setup_msvc_manual(env):
    """Set up env to use MSVC manually, using VCINSTALLDIR"""
    if (env["bits"] != "default"):
        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=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
            """)
        raise SCons.Errors.UserError("Bits argument should not be used when using VCINSTALLDIR")

    # Force bits arg
    # (Actually msys2 mingw can support 64-bit, we could detect that)
    env["bits"] = "32"
    env["x86_libtheora_opt_vc"] = True

    # find compiler manually
    compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])
    print("Found MSVC compiler: " + compiler_version_str)

    # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writing)... vc compiler for 64bit can not compile _asm
    if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
        env["bits"] = "64"
        env["x86_libtheora_opt_vc"] = False
        print("Compiled program architecture will be a 64 bit executable (forcing bits=64).")
    elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
        print("Compiled program architecture will be a 32 bit executable. (forcing bits=32).")
    else:
        print("Failed to manually 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, or avoid setting VCINSTALLDIR.")
def configure(env):

    env.msvc = True

    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()

    ## 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
    angle_root = os.getenv("ANGLE_SRC_PATH")
    env.Append(CPPPATH=[angle_root + '/include'])
    jobs = str(env.GetOption("num_jobs"))
    angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="

    if os.path.isfile(
            str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
        env["build_angle"] = True

    ## Architecture

    arch = ""
    if str(os.getenv('Platform')).lower() == "arm":

        print(
            "Compiled program architecture will be an ARM executable. (forcing bits=32)."
        )

        arch = "arm"
        env["bits"] = "32"
        env.Append(LINKFLAGS=['/MACHINE:ARM'])
        env.Append(LIBPATH=[vc_base_path + 'lib/store/arm'])

        angle_build_cmd += "ARM"

        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)."
            )
        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)."
            )
        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."
            )
            env["bits"] = "32"

        if (env["bits"] == "32"):
            arch = "x86"

            angle_build_cmd += "Win32"

            env.Append(LINKFLAGS=['/MACHINE:X86'])
            env.Append(LIBPATH=[vc_base_path + 'lib/store'])
            env.Append(
                LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])

        else:
            arch = "x64"

            angle_build_cmd += "x64"

            env.Append(LINKFLAGS=['/MACHINE:X64'])
            env.Append(
                LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
            env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])

    env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
    env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
    env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]

    ## Compile flags

    env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
    env.Append(
        CCFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
    env.Append(CCFLAGS=[
        '/DGLES_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])

    env.Append(CPPFLAGS=[
        '/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32', '/DPNG_ABORT=abort'
    ])

    env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
    env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references'])

    env.Append(
        CCFLAGS=
        '/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'
        .split())
    env.Append(CXXFLAGS='/ZW /FS'.split())
    env.Append(CCFLAGS=[
        '/AI', vc_base_path +
        '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] +
        '\\References\\CommonConfiguration\\Neutral'
    ])

    ## Link flags

    env.Append(LINKFLAGS=[
        '/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER',
        '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1',
        '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'
    ])

    LIBS = [
        'WindowsApp',
        'mincore',
        'ws2_32',
        'libANGLE',
        'libEGL',
        'libGLESv2',
        'bcrypt',
    ]
    env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])

    # Incremental linking fix
    env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
    env['BUILDERS']['Program'] = methods.precious_program

    env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})
Exemplo n.º 4
0
def configure(env):
    env.msvc = True

    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()

    ## Build type

    if env["target"] == "release":
        env.Append(CCFLAGS=["/MD"])
        env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
        if env["optimize"] != "none":
            env.Append(CCFLAGS=["/O2", "/GL"])
            env.Append(LINKFLAGS=["/LTCG"])

    elif env["target"] == "release_debug":
        env.Append(CCFLAGS=["/MD"])
        env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
        if env["optimize"] != "none":
            env.Append(CCFLAGS=["/O2", "/Zi"])

    elif env["target"] == "debug":
        env.Append(CCFLAGS=["/Zi"])
        env.Append(CCFLAGS=["/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"]

    # Force to use Unicode encoding
    env.AppendUnique(CCFLAGS=["/utf-8"])

    # ANGLE
    angle_root = os.getenv("ANGLE_SRC_PATH")
    env.Prepend(CPPPATH=[angle_root + "/include"])
    jobs = str(env.GetOption("num_jobs"))
    angle_build_cmd = ("msbuild.exe " + angle_root +
                       "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs +
                       " /p:Configuration=Release /p:Platform=")

    if os.path.isfile(
            str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
        env["build_angle"] = True

    ## Architecture

    arch = ""
    if str(os.getenv("Platform")).lower() == "arm":

        print(
            "Compiled program architecture will be an ARM executable. (forcing bits=32)."
        )

        arch = "arm"
        env["bits"] = "32"
        env.Append(LINKFLAGS=["/MACHINE:ARM"])
        env.Append(LIBPATH=[vc_base_path + "lib/store/arm"])

        angle_build_cmd += "ARM"

        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)."
            )
        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)."
            )
        else:
            print(
                "Failed to detect MSVC compiler architecture version... Defaulting to 32-bit 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":
            arch = "x86"

            angle_build_cmd += "Win32"

            env.Append(LINKFLAGS=["/MACHINE:X86"])
            env.Append(LIBPATH=[vc_base_path + "lib/store"])
            env.Append(
                LIBPATH=[angle_root + "/winrt/10/src/Release_Win32/lib"])

        else:
            arch = "x64"

            angle_build_cmd += "x64"

            env.Append(LINKFLAGS=["/MACHINE:X64"])
            env.Append(
                LIBPATH=[os.environ["VCINSTALLDIR"] + "lib/store/amd64"])
            env.Append(LIBPATH=[angle_root + "/winrt/10/src/Release_x64/lib"])

    env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
    env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
    env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]

    ## Compile flags

    env.Prepend(CPPPATH=["#platform/uwp", "#drivers/windows"])
    env.Append(
        CPPDEFINES=["UWP_ENABLED", "WINDOWS_ENABLED", "TYPED_METHOD_BIND"])
    env.Append(CPPDEFINES=[
        "GLES_ENABLED", "GL_GLEXT_PROTOTYPES", "EGL_EGLEXT_PROTOTYPES",
        "ANGLE_ENABLED"
    ])
    winver = "0x0602"  # Windows 8 is the minimum target for UWP build
    env.Append(CPPDEFINES=[("WINVER", winver), ("_WIN32_WINNT",
                                                winver), "WIN32"])

    env.Append(CPPDEFINES=["__WRL_NO_DEFAULT_LIB__", ("PNG_ABORT", "abort")])

    env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/store/references"])
    env.Append(CPPFLAGS=["/AI", vc_base_path + "lib/x86/store/references"])

    env.Append(
        CCFLAGS=
        '/FS /MP /GS /wd"4453" /wd"28204" /wd"4291" /Zc:wchar_t /Gm- /fp:precise /errorReport:prompt /WX- /Zc:forScope /Gd /EHsc /nologo'
        .split())
    env.Append(CPPDEFINES=[
        "_UNICODE", "UNICODE", ("WINAPI_FAMILY", "WINAPI_FAMILY_APP")
    ])
    env.Append(CXXFLAGS=["/ZW"])
    env.Append(CCFLAGS=[
        "/AI",
        vc_base_path + "\\vcpackages",
        "/AI",
        os.environ["WINDOWSSDKDIR"] +
        "\\References\\CommonConfiguration\\Neutral",
    ])

    ## Link flags

    env.Append(LINKFLAGS=[
        "/MANIFEST:NO",
        "/NXCOMPAT",
        "/DYNAMICBASE",
        "/WINMD",
        "/APPCONTAINER",
        "/ERRORREPORT:PROMPT",
        "/NOLOGO",
        "/TLBID:1",
        '/NODEFAULTLIB:"kernel32.lib"',
        '/NODEFAULTLIB:"ole32.lib"',
    ])

    LIBS = [
        "WindowsApp",
        "mincore",
        "ws2_32",
        "libANGLE",
        "libEGL",
        "libGLESv2",
        "bcrypt",
    ]
    env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])

    # Incremental linking fix
    env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
    env["BUILDERS"]["Program"] = methods.precious_program

    env.Append(BUILDERS={"ANGLE": env.Builder(action=angle_build_cmd)})
Exemplo n.º 5
0
def configure(env):

    env.Append(CPPPATH=['#platform/windows'])

    # Targeted Windows version: Vista (and later)
    winver = "0x0600"  # Windows Vista is the minimum target for windows builds

    env['is_mingw'] = False
    if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
        # build using visual studio
        env['ENV']['TMP'] = os.environ['TMP']
        env.Append(CPPPATH=['#platform/windows/include'])
        env.Append(LIBPATH=['#platform/windows/lib'])
        env.Append(
            CCFLAGS=['/DWINVER=%s' % winver,
                     '/D_WIN32_WINNT=%s' % winver])

        if (env["target"] == "release"):

            env.Append(CCFLAGS=['/O2'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "release_debug"):

            env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
        elif (env["target"] == "debug_release"):

            env.Append(CCFLAGS=['/Z7', '/Od'])
            env.Append(LINKFLAGS=['/DEBUG'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "debug"):

            env.Append(CCFLAGS=[
                '/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED',
                '/DD3D_DEBUG_INFO', '/Od'
            ])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
            env.Append(LINKFLAGS=['/DEBUG'])

        env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
        env.Append(CXXFLAGS=['/TP'])
        env.Append(CPPFLAGS=[
            '/DMSVC',
            '/GR',
        ])
        env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
        env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
        env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['/DWIN32'])
        env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])

        env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
        LIBS = [
            'winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32',
            'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32',
            'shell32', 'advapi32', 'dinput8', 'dxguid'
        ]
        env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])

        env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
        if (os.getenv("DXSDK_DIR")):
            DIRECTX_PATH = os.getenv("DXSDK_DIR")
        else:
            DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"

        if (os.getenv("VCINSTALLDIR")):
            VC_PATH = os.getenv("VCINSTALLDIR")
        else:
            VC_PATH = ""

        env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
        env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
        env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
        env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
        env['ENV'] = os.environ

        # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
        compiler_version_str = methods.detect_visual_c_compiler_version(
            env['ENV'])

        # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
        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=windows) and SCons will attempt to detect what MSVC compiler"
                + " will be executed and inform you.")
            sys.exit()

        # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the proper command prompt
        # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
        env["bits"] = "32"
        env["x86_libtheora_opt_vc"] = True

        print "Detected MSVC compiler: " + compiler_version_str
        # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
        if (compiler_version_str == "amd64"
                or compiler_version_str == "x86_amd64"):
            env["bits"] = "64"
            env["x86_libtheora_opt_vc"] = False
            print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
        elif (compiler_version_str == "x86"
              or compiler_version_str == "amd64_x86"):
            print "Compiled program architecture will be a 32 bit 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."
        if env["bits"] == "64":
            env.Append(CCFLAGS=['/D_WIN64'])

        # Incremental linking fix
        env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
        env['BUILDERS']['Program'] = methods.precious_program

    else:

        # Workaround for MinGW. See:
        # http://www.scons.org/wiki/LongCmdLinesOnWin32
        env.use_windows_spawn_fix()

        # build using mingw
        env.Append(
            CCFLAGS=['-DWINVER=%s' % winver,
                     '-D_WIN32_WINNT=%s' % winver])
        if (os.name == "nt"):
            env['ENV']['TMP'] = os.environ[
                'TMP']  # way to go scons, you can be so stupid sometimes
        else:
            env["PROGSUFFIX"] = env[
                "PROGSUFFIX"] + ".exe"  # for linux cross-compilation

        mingw_prefix = ""

        if (env["bits"] == "default"):
            env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"

        if (env["bits"] == "32"):
            env.Append(LINKFLAGS=['-static'])
            env.Append(LINKFLAGS=['-static-libgcc'])
            env.Append(LINKFLAGS=['-static-libstdc++'])
            mingw_prefix = env["mingw_prefix"]
        else:
            env.Append(LINKFLAGS=['-static'])
            mingw_prefix = env["mingw_prefix_64"]

        nulstr = ""

        if (os.name == "posix"):
            nulstr = ">/dev/null"
        else:
            nulstr = ">nul"

        # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
        # #not really super consistent but..
        # print("Can't find Windows compiler: "+mingw_prefix)
        # sys.exit(255)

        if (env["target"] == "release"):

            env.Append(CCFLAGS=['-msse2'])

            if (env["bits"] == "64"):
                env.Append(CCFLAGS=['-O3'])
            else:
                env.Append(CCFLAGS=['-O2'])

            env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])

        elif (env["target"] == "release_debug"):

            env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])

        elif (env["target"] == "debug"):

            env.Append(
                CCFLAGS=['-g', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])

        env["CC"] = mingw_prefix + "gcc"
        env['AS'] = mingw_prefix + "as"
        env['CXX'] = mingw_prefix + "g++"
        env['AR'] = mingw_prefix + "ar"
        env['RANLIB'] = mingw_prefix + "ranlib"
        env['LD'] = mingw_prefix + "g++"
        env["x86_libtheora_opt_gcc"] = True

        #env['CC'] = "winegcc"
        #env['CXX'] = "wineg++"

        env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
        env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
        env.Append(LIBS=[
            'mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32',
            'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32',
            'dinput8', 'dxguid'
        ])

        # if (env["bits"]=="32"):
        # env.Append(LIBS=['gcc_s'])
        # #--with-arch=i686
        # env.Append(CPPFLAGS=['-march=i686'])
        # env.Append(LINKFLAGS=['-march=i686'])

        #'d3dx9d'
        env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
        # env.Append(LINKFLAGS=['-g'])

        # resrc
        env['is_mingw'] = True
        env.Append(
            BUILDERS={
                'RES':
                env.Builder(
                    action=build_res_file, suffix='.o', src_suffix='.rc')
            })

    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')
        })
Exemplo n.º 6
0
def configure(env):

    env.Append(CPPPATH=['#platform/windows'])

    # Targeted Windows version: Vista (and later)
    winver = "0x0600" # Windows Vista is the minimum target for windows builds

    env['is_mingw'] = False
    if (os.name == "nt" and os.getenv("VCINSTALLDIR")):
        # build using visual studio
        env['ENV']['TMP'] = os.environ['TMP']
        env.Append(CPPPATH=['#platform/windows/include'])
        env.Append(LIBPATH=['#platform/windows/lib'])
        env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])

        if (env["target"] == "release"):

            env.Append(CCFLAGS=['/O2'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "release_debug"):

            env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
        elif (env["target"] == "debug_release"):

            env.Append(CCFLAGS=['/Z7', '/Od'])
            env.Append(LINKFLAGS=['/DEBUG'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "debug"):

            env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
            env.Append(LINKFLAGS=['/DEBUG'])

        env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
        env.Append(CXXFLAGS=['/TP'])
        env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
        env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])
        env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
        env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['/DWIN32'])
        env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])

        env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
        LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid']
        env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])

        env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
        if (os.getenv("DXSDK_DIR")):
            DIRECTX_PATH = os.getenv("DXSDK_DIR")
        else:
            DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"

        if (os.getenv("VCINSTALLDIR")):
            VC_PATH = os.getenv("VCINSTALLDIR")
        else:
            VC_PATH = ""

        env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
        env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
        env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
        env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
        env['ENV'] = os.environ

        # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
        compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])

        # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
        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=windows) and SCons will attempt to detect what MSVC compiler"
                   + " will be executed and inform you.")
            sys.exit()

        # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the proper command prompt
        # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
        env["bits"] = "32"
        env["x86_libtheora_opt_vc"] = True

        print "Detected MSVC compiler: " + compiler_version_str
        # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
        if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
            env["bits"] = "64"
            env["x86_libtheora_opt_vc"] = False
            print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
        elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
            print "Compiled program architecture will be a 32 bit 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."
        if env["bits"] == "64":
            env.Append(CCFLAGS=['/D_WIN64'])

        # Incremental linking fix
        env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
        env['BUILDERS']['Program'] = methods.precious_program

    else:

        # Workaround for MinGW. See:
        # http://www.scons.org/wiki/LongCmdLinesOnWin32
        env.use_windows_spawn_fix()

        # build using mingw
        env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver])
        if (os.name == "nt"):
            env['ENV']['TMP'] = os.environ['TMP']  # way to go scons, you can be so stupid sometimes
        else:
            env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe"  # for linux cross-compilation

        mingw_prefix = ""

        if (env["bits"] == "default"):
            env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"

        if (env["bits"] == "32"):
            env.Append(LINKFLAGS=['-static'])
            env.Append(LINKFLAGS=['-static-libgcc'])
            env.Append(LINKFLAGS=['-static-libstdc++'])
            mingw_prefix = env["mingw_prefix"]
        else:
            env.Append(LINKFLAGS=['-static'])
            mingw_prefix = env["mingw_prefix_64"]

        nulstr = ""

        if (os.name == "posix"):
            nulstr = ">/dev/null"
        else:
            nulstr = ">nul"

        # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
            # #not really super consistent but..
            # print("Can't find Windows compiler: "+mingw_prefix)
            # sys.exit(255)

        if (env["target"] == "release"):

            env.Append(CCFLAGS=['-msse2'])

            if (env["bits"] == "64"):
                env.Append(CCFLAGS=['-O3'])
            else:
                env.Append(CCFLAGS=['-O2'])

            env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])

        elif (env["target"] == "release_debug"):

            env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])

        elif (env["target"] == "debug"):

            env.Append(CCFLAGS=['-g', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])

        env["CC"] = mingw_prefix + "gcc"
        env['AS'] = mingw_prefix + "as"
        env['CXX'] = mingw_prefix + "g++"
        env['AR'] = mingw_prefix + "ar"
        env['RANLIB'] = mingw_prefix + "ranlib"
        env['LD'] = mingw_prefix + "g++"
        env["x86_libtheora_opt_gcc"] = True

        #env['CC'] = "winegcc"
        #env['CXX'] = "wineg++"

        env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
        env.Append(CPPFLAGS=['-DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
        env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid'])

        # if (env["bits"]=="32"):
        # env.Append(LIBS=['gcc_s'])
        # #--with-arch=i686
        # env.Append(CPPFLAGS=['-march=i686'])
        # env.Append(LINKFLAGS=['-march=i686'])

        #'d3dx9d'
        env.Append(CPPFLAGS=['-DMINGW_ENABLED'])
        # env.Append(LINKFLAGS=['-g'])

        # resrc
        env['is_mingw'] = True
        env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})

    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')})
Exemplo n.º 7
0
def configure(env):

    env.Append(CPPPATH=["#platform/windows"])
    env["is_mingw"] = False
    if os.name == "nt" and os.getenv("VSINSTALLDIR") != None:
        # build using visual studio
        env["ENV"]["TMP"] = os.environ["TMP"]
        env.Append(CPPPATH=["#platform/windows/include"])
        env.Append(LIBPATH=["#platform/windows/lib"])

        if env["target"] == "release":

            env.Append(CCFLAGS=["/O2"])
            env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
            env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])

        elif env["target"] == "release_debug":

            env.Append(CCFLAGS=["/O2", "/DDEBUG_ENABLED"])
            env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
        elif env["target"] == "debug_release":

            env.Append(CCFLAGS=["/Z7", "/Od"])
            env.Append(LINKFLAGS=["/DEBUG"])
            env.Append(LINKFLAGS=["/SUBSYSTEM:WINDOWS"])
            env.Append(LINKFLAGS=["/ENTRY:mainCRTStartup"])

        elif env["target"] == "debug":

            env.Append(CCFLAGS=["/Z7", "/DDEBUG_ENABLED", "/DDEBUG_MEMORY_ENABLED", "/DD3D_DEBUG_INFO", "/Od"])
            env.Append(LINKFLAGS=["/SUBSYSTEM:CONSOLE"])
            env.Append(LINKFLAGS=["/DEBUG"])

        env.Append(CCFLAGS=["/MT", "/Gd", "/GR", "/nologo"])
        env.Append(CXXFLAGS=["/TP"])
        env.Append(CPPFLAGS=["/DMSVC", "/GR"])
        env.Append(CCFLAGS=["/I" + os.getenv("WindowsSdkDir") + "/Include"])
        env.Append(CCFLAGS=["/DWINDOWS_ENABLED"])
        env.Append(CCFLAGS=["/DRTAUDIO_ENABLED"])
        env.Append(CCFLAGS=["/DWIN32"])
        env.Append(CCFLAGS=["/DTYPED_METHOD_BIND"])

        env.Append(CCFLAGS=["/DGLES2_ENABLED"])
        LIBS = [
            "winmm",
            "opengl32",
            "dsound",
            "kernel32",
            "ole32",
            "oleaut32",
            "user32",
            "gdi32",
            "IPHLPAPI",
            "Shlwapi",
            "wsock32",
            "Ws2_32",
            "shell32",
            "advapi32",
            "dinput8",
            "dxguid",
        ]
        env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])

        env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])
        if os.getenv("DXSDK_DIR"):
            DIRECTX_PATH = os.getenv("DXSDK_DIR")
        else:
            DIRECTX_PATH = "C:/Program Files/Microsoft DirectX SDK (March 2009)"

        if os.getenv("VCINSTALLDIR"):
            VC_PATH = os.getenv("VCINSTALLDIR")
        else:
            VC_PATH = ""

        env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
        env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])
        env.Append(CCFLAGS=["/I" + DIRECTX_PATH + "/Include"])
        env.Append(LIBPATH=[DIRECTX_PATH + "/Lib/x86"])
        env["ENV"] = os.environ

        # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
        compiler_version_str = methods.detect_visual_c_compiler_version(env["ENV"])

        # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
        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=windows) and SCons will attempt to detect what MSVC compiler"
                + " will be executed and inform you."
            )
            sys.exit()

        # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the propper command prompt
        # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
        env["bits"] = "32"
        env["x86_opt_vc"] = True

        print "Detected MSVC compiler: " + compiler_version_str
        # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
        if compiler_version_str == "amd64" or compiler_version_str == "x86_amd64":
            env["bits"] = "64"
            env["x86_opt_vc"] = False
            print "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
        elif compiler_version_str == "x86" or compiler_version_str == "amd64_x86":
            print "Compiled program architecture will be a 32 bit 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."
        if env["bits"] == "64":
            env.Append(CCFLAGS=["/D_WIN64"])

            # Incremental linking fix
        env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
        env["BUILDERS"]["Program"] = methods.precious_program

    else:

        # Workaround for MinGW. See:
        # http://www.scons.org/wiki/LongCmdLinesOnWin32
        env.use_windows_spawn_fix()

        # build using mingw
        if os.name == "nt":
            env["ENV"]["TMP"] = os.environ["TMP"]  # way to go scons, you can be so stupid sometimes
        else:
            env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe"  # for linux cross-compilation

        mingw_prefix = ""

        if env["bits"] == "default":
            env["bits"] = "32"

        if env["bits"] == "32":
            env.Append(LINKFLAGS=["-static"])
            env.Append(LINKFLAGS=["-static-libgcc"])
            env.Append(LINKFLAGS=["-static-libstdc++"])
            mingw_prefix = env["mingw_prefix"]
        else:
            env.Append(LINKFLAGS=["-static"])
            mingw_prefix = env["mingw_prefix_64"]

        nulstr = ""

        if os.name == "posix":
            nulstr = ">/dev/null"
        else:
            nulstr = ">nul"

            # if os.system(mingw_prefix+"gcc --version"+nulstr)!=0:
            # #not really super consistent but..
            # print("Can't find Windows compiler: "+mingw_prefix)
            # sys.exit(255)

        if env["target"] == "release":

            env.Append(CCFLAGS=["-msse2"])

            if env["bits"] == "64":
                env.Append(CCFLAGS=["-O3"])
            else:
                env.Append(CCFLAGS=["-O2"])

            env.Append(LINKFLAGS=["-Wl,--subsystem,windows"])

        elif env["target"] == "release_debug":

            env.Append(CCFLAGS=["-O2", "-DDEBUG_ENABLED"])

        elif env["target"] == "debug":

            env.Append(CCFLAGS=["-g", "-Wall", "-DDEBUG_ENABLED", "-DDEBUG_MEMORY_ENABLED"])

        env["CC"] = mingw_prefix + "gcc"
        env["AS"] = mingw_prefix + "as"
        env["CXX"] = mingw_prefix + "g++"
        env["AR"] = mingw_prefix + "ar"
        env["RANLIB"] = mingw_prefix + "ranlib"
        env["LD"] = mingw_prefix + "g++"
        env["x86_opt_gcc"] = True

        # env['CC'] = "winegcc"
        # env['CXX'] = "wineg++"

        env.Append(CCFLAGS=["-DWINDOWS_ENABLED", "-mwindows"])
        env.Append(CPPFLAGS=["-DRTAUDIO_ENABLED"])
        env.Append(CCFLAGS=["-DGLES2_ENABLED"])
        env.Append(
            LIBS=[
                "mingw32",
                "opengl32",
                "dsound",
                "ole32",
                "d3d9",
                "winmm",
                "gdi32",
                "iphlpapi",
                "shlwapi",
                "wsock32",
                "ws2_32",
                "kernel32",
                "oleaut32",
                "dinput8",
                "dxguid",
            ]
        )

        # if (env["bits"]=="32"):
        # env.Append(LIBS=['gcc_s'])
        # #--with-arch=i686
        # env.Append(CPPFLAGS=['-march=i686'])
        # env.Append(LINKFLAGS=['-march=i686'])

        #'d3dx9d'
        env.Append(CPPFLAGS=["-DMINGW_ENABLED"])
        # env.Append(LINKFLAGS=['-g'])

        # resrc
        env["is_mingw"] = True
        env.Append(BUILDERS={"RES": env.Builder(action=build_res_file, suffix=".o", src_suffix=".rc")})

    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")}
    )
Exemplo n.º 8
0
def configure(env):

    env.Append(CPPPATH=['#platform/windows'])

    # Targeted Windows version: 7 (and later), minimum supported version
    # XP support dropped after EOL due to missing API for IPv6 and other issues
    # Vista support dropped after EOL due to GH-10243
    winver = "0x0601"

    if (os.name == "nt" and os.getenv("VCINSTALLDIR")):  # MSVC

        env['ENV']['TMP'] = os.environ['TMP']

        ## Build type

        if (env["target"] == "release"):
            env.Append(CCFLAGS=['/O2'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "release_debug"):
            env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])

        elif (env["target"] == "debug_release"):
            env.Append(CCFLAGS=['/Z7', '/Od'])
            env.Append(LINKFLAGS=['/DEBUG'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "debug"):
            env.Append(CCFLAGS=[
                '/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED',
                '/DD3D_DEBUG_INFO', '/Od', '/EHsc'
            ])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
            env.Append(LINKFLAGS=['/DEBUG'])

        ## Architecture

        # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
        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=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
                """)
            sys.exit()

        # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the proper command prompt
        # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
        env["bits"] = "32"
        env["x86_libtheora_opt_vc"] = True

        ## Compiler configuration

        env['ENV'] = os.environ
        # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
        compiler_version_str = methods.detect_visual_c_compiler_version(
            env['ENV'])

        print("Detected MSVC compiler: " + compiler_version_str)
        # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
        if (compiler_version_str == "amd64"
                or compiler_version_str == "x86_amd64"):
            env["bits"] = "64"
            env["x86_libtheora_opt_vc"] = False
            print(
                "Compiled program architecture will be a 64 bit executable (forcing bits=64)."
            )
        elif (compiler_version_str == "x86"
              or compiler_version_str == "amd64_x86"):
            print(
                "Compiled program architecture will be a 32 bit 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."
            )

        ## Compile flags

        env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
        env.Append(CXXFLAGS=['/TP'])
        env.Append(CPPFLAGS=[
            '/DMSVC',
            '/GR',
        ])
        env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])

        env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
        env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
        env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['/DWASAPI_ENABLED'])
        env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
        env.Append(CCFLAGS=['/DWIN32'])
        env.Append(
            CCFLAGS=['/DWINVER=%s' % winver,
                     '/D_WIN32_WINNT=%s' % winver])
        if env["bits"] == "64":
            env.Append(CCFLAGS=['/D_WIN64'])

        LIBS = [
            'winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32',
            'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32',
            'shell32', 'advapi32', 'dinput8', 'dxguid'
        ]
        env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])

        env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])

        if (os.getenv("VCINSTALLDIR")):
            VC_PATH = os.getenv("VCINSTALLDIR")
        else:
            VC_PATH = ""

        env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
        env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])

        # Incremental linking fix
        env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
        env['BUILDERS']['Program'] = methods.precious_program

    else:  # MinGW

        # Workaround for MinGW. See:
        # http://www.scons.org/wiki/LongCmdLinesOnWin32
        env.use_windows_spawn_fix()

        ## Build type

        if (env["target"] == "release"):
            env.Append(CCFLAGS=['-msse2'])

            if (env["bits"] == "64"):
                env.Append(CCFLAGS=['-O3'])
            else:
                env.Append(CCFLAGS=['-O2'])

            env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])

            if (env["debug_symbols"] == "yes"):
                env.Prepend(CCFLAGS=['-g1'])
            if (env["debug_symbols"] == "full"):
                env.Prepend(CCFLAGS=['-g2'])

        elif (env["target"] == "release_debug"):
            env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
            if (env["debug_symbols"] == "yes"):
                env.Prepend(CCFLAGS=['-g1'])
            if (env["debug_symbols"] == "full"):
                env.Prepend(CCFLAGS=['-g2'])

        elif (env["target"] == "debug"):
            env.Append(
                CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])

        ## Compiler configuration

        if (os.name == "nt"):
            env['ENV']['TMP'] = os.environ[
                'TMP']  # way to go scons, you can be so stupid sometimes
        else:
            env["PROGSUFFIX"] = env[
                "PROGSUFFIX"] + ".exe"  # for linux cross-compilation

        if (env["bits"] == "default"):
            if (os.name == "nt"):
                env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"
            else:  # default to 64-bit on Linux
                env["bits"] = "64"

        mingw_prefix = ""

        if (env["bits"] == "32"):
            env.Append(LINKFLAGS=['-static'])
            env.Append(LINKFLAGS=['-static-libgcc'])
            env.Append(LINKFLAGS=['-static-libstdc++'])
            mingw_prefix = env["mingw_prefix_32"]
        else:
            env.Append(LINKFLAGS=['-static'])
            mingw_prefix = env["mingw_prefix_64"]

        env["CC"] = mingw_prefix + "gcc"
        env['AS'] = mingw_prefix + "as"
        env['CXX'] = mingw_prefix + "g++"
        env['AR'] = mingw_prefix + "ar"
        env['RANLIB'] = mingw_prefix + "ranlib"
        env['LD'] = mingw_prefix + "g++"
        env["x86_libtheora_opt_gcc"] = True

        ## Compile flags

        env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
        env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
        env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
        env.Append(
            CCFLAGS=['-DWINVER=%s' % winver,
                     '-D_WIN32_WINNT=%s' % winver])
        env.Append(LIBS=[
            'mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32',
            'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32',
            'dinput8', 'dxguid', 'ksuser'
        ])

        env.Append(CPPFLAGS=['-DMINGW_ENABLED'])

        # resrc
        env.Append(
            BUILDERS={
                'RES':
                env.Builder(
                    action=build_res_file, suffix='.o', src_suffix='.rc')
            })
Exemplo n.º 9
0
def configure(env):

    env.Append(CPPPATH=['#platform/windows'])

    # Targeted Windows version: 7 (and later), minimum supported version
    # XP support dropped after EOL due to missing API for IPv6 and other issues
    # Vista support dropped after EOL due to GH-10243
    winver = "0x0601"

    if (os.name == "nt" and os.getenv("VCINSTALLDIR")): # MSVC

        env['ENV']['TMP'] = os.environ['TMP']

        ## Build type

        if (env["target"] == "release"):
            env.Append(CCFLAGS=['/O2'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "release_debug"):
            env.Append(CCFLAGS=['/O2', '/DDEBUG_ENABLED'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])

        elif (env["target"] == "debug_release"):
            env.Append(CCFLAGS=['/Z7', '/Od'])
            env.Append(LINKFLAGS=['/DEBUG'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
            env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])

        elif (env["target"] == "debug"):
            env.Append(CCFLAGS=['/Z7', '/DDEBUG_ENABLED', '/DDEBUG_MEMORY_ENABLED', '/DD3D_DEBUG_INFO', '/Od', '/EHsc'])
            env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
            env.Append(LINKFLAGS=['/DEBUG'])

        ## Architecture

        # Note: this detection/override code from here onward should be here instead of in SConstruct because it's platform and compiler specific (MSVC/Windows)
        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=windows) and SCons will attempt to detect what MSVC compiler will be executed and inform you.
                """)
            sys.exit()

        # Forcing bits argument because MSVC does not have a flag to set this through SCons... it's different compilers (cl.exe's) called from the proper command prompt
        # that decide the architecture that is build for. Scons can only detect the os.getenviron (because vsvarsall.bat sets a lot of stuff for cl.exe to work with)
        env["bits"] = "32"
        env["x86_libtheora_opt_vc"] = True

        ## Compiler configuration

        env['ENV'] = os.environ
        # This detection function needs the tools env (that is env['ENV'], not SCons's env), and that is why it's this far bellow in the code
        compiler_version_str = methods.detect_visual_c_compiler_version(env['ENV'])

        print("Detected MSVC compiler: " + compiler_version_str)
        # If building for 64bit architecture, disable assembly optimisations for 32 bit builds (theora as of writting)... vc compiler for 64bit can not compile _asm
        if(compiler_version_str == "amd64" or compiler_version_str == "x86_amd64"):
            env["bits"] = "64"
            env["x86_libtheora_opt_vc"] = False
            print("Compiled program architecture will be a 64 bit executable (forcing bits=64).")
        elif (compiler_version_str == "x86" or compiler_version_str == "amd64_x86"):
            print("Compiled program architecture will be a 32 bit 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.")

        ## Compile flags

        env.Append(CCFLAGS=['/MT', '/Gd', '/GR', '/nologo'])
        env.Append(CXXFLAGS=['/TP'])
        env.Append(CPPFLAGS=['/DMSVC', '/GR', ])
        env.Append(CCFLAGS=['/I' + os.getenv("WindowsSdkDir") + "/Include"])

        env.Append(CCFLAGS=['/DWINDOWS_ENABLED'])
        env.Append(CCFLAGS=['/DOPENGL_ENABLED'])
        env.Append(CCFLAGS=['/DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['/DWASAPI_ENABLED'])
        env.Append(CCFLAGS=['/DTYPED_METHOD_BIND'])
        env.Append(CCFLAGS=['/DWIN32'])
        env.Append(CCFLAGS=['/DWINVER=%s' % winver, '/D_WIN32_WINNT=%s' % winver])
        if env["bits"] == "64":
            env.Append(CCFLAGS=['/D_WIN64'])

        LIBS = ['winmm', 'opengl32', 'dsound', 'kernel32', 'ole32', 'oleaut32', 'user32', 'gdi32', 'IPHLPAPI', 'Shlwapi', 'wsock32', 'Ws2_32', 'shell32', 'advapi32', 'dinput8', 'dxguid']
        env.Append(LINKFLAGS=[p + env["LIBSUFFIX"] for p in LIBS])

        env.Append(LIBPATH=[os.getenv("WindowsSdkDir") + "/Lib"])

        if (os.getenv("VCINSTALLDIR")):
            VC_PATH = os.getenv("VCINSTALLDIR")
        else:
            VC_PATH = ""

        env.Append(CCFLAGS=["/I" + p for p in os.getenv("INCLUDE").split(";")])
        env.Append(LIBPATH=[p for p in os.getenv("LIB").split(";")])

        # Incremental linking fix
        env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
        env['BUILDERS']['Program'] = methods.precious_program

    else: # MinGW

        # Workaround for MinGW. See:
        # http://www.scons.org/wiki/LongCmdLinesOnWin32
        env.use_windows_spawn_fix()

        ## Build type

        if (env["target"] == "release"):
            env.Append(CCFLAGS=['-msse2'])

            if (env["bits"] == "64"):
                env.Append(CCFLAGS=['-O3'])
            else:
                env.Append(CCFLAGS=['-O2'])

            env.Append(LINKFLAGS=['-Wl,--subsystem,windows'])

            if (env["debug_symbols"] == "yes"):
               env.Prepend(CCFLAGS=['-g1'])
            if (env["debug_symbols"] == "full"):
               env.Prepend(CCFLAGS=['-g2'])

        elif (env["target"] == "release_debug"):
            env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
            if (env["debug_symbols"] == "yes"):
               env.Prepend(CCFLAGS=['-g1'])
            if (env["debug_symbols"] == "full"):
               env.Prepend(CCFLAGS=['-g2'])

        elif (env["target"] == "debug"):
            env.Append(CCFLAGS=['-g3', '-DDEBUG_ENABLED', '-DDEBUG_MEMORY_ENABLED'])

        ## Compiler configuration

        if (os.name == "nt"):
            env['ENV']['TMP'] = os.environ['TMP']  # way to go scons, you can be so stupid sometimes
        else:
            env["PROGSUFFIX"] = env["PROGSUFFIX"] + ".exe"  # for linux cross-compilation

        if (env["bits"] == "default"):
            if (os.name == "nt"):
                env["bits"] = "64" if "PROGRAMFILES(X86)" in os.environ else "32"
            else: # default to 64-bit on Linux
                env["bits"] = "64"

        mingw_prefix = ""

        if (env["bits"] == "32"):
            env.Append(LINKFLAGS=['-static'])
            env.Append(LINKFLAGS=['-static-libgcc'])
            env.Append(LINKFLAGS=['-static-libstdc++'])
            mingw_prefix = env["mingw_prefix_32"]
        else:
            env.Append(LINKFLAGS=['-static'])
            mingw_prefix = env["mingw_prefix_64"]

        env["CC"] = mingw_prefix + "gcc"
        env['AS'] = mingw_prefix + "as"
        env['CXX'] = mingw_prefix + "g++"
        env['AR'] = mingw_prefix + "gcc-ar"
        env['RANLIB'] = mingw_prefix + "gcc-ranlib"
        env['LD'] = mingw_prefix + "g++"
        env["x86_libtheora_opt_gcc"] = True

        if env['use_lto']:
            env.Append(CCFLAGS=['-flto'])
            env.Append(LINKFLAGS=['-flto=' + str(env.GetOption("num_jobs"))])

        ## Compile flags

        env.Append(CCFLAGS=['-DWINDOWS_ENABLED', '-mwindows'])
        env.Append(CCFLAGS=['-DOPENGL_ENABLED'])
        env.Append(CCFLAGS=['-DRTAUDIO_ENABLED'])
        env.Append(CCFLAGS=['-DWASAPI_ENABLED'])
        env.Append(CCFLAGS=['-DWINVER=%s' % winver, '-D_WIN32_WINNT=%s' % winver])
        env.Append(LIBS=['mingw32', 'opengl32', 'dsound', 'ole32', 'd3d9', 'winmm', 'gdi32', 'iphlpapi', 'shlwapi', 'wsock32', 'ws2_32', 'kernel32', 'oleaut32', 'dinput8', 'dxguid', 'ksuser'])

        env.Append(CPPFLAGS=['-DMINGW_ENABLED'])

        # resrc
        env.Append(BUILDERS={'RES': env.Builder(action=build_res_file, suffix='.o', src_suffix='.rc')})
Exemplo n.º 10
0
def configure(env):

    env.msvc = True

    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()

    ## 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
    angle_root = os.getenv("ANGLE_SRC_PATH")
    env.Append(CPPPATH=[angle_root + '/include'])
    jobs = str(env.GetOption("num_jobs"))
    angle_build_cmd = "msbuild.exe " + angle_root + "/winrt/10/src/angle.sln /nologo /v:m /m:" + jobs + " /p:Configuration=Release /p:Platform="

    if os.path.isfile(str(os.getenv("ANGLE_SRC_PATH")) + "/winrt/10/src/angle.sln"):
        env["build_angle"] = True

    ## Architecture

    arch = ""
    if str(os.getenv('Platform')).lower() == "arm":

        print("Compiled program architecture will be an ARM executable. (forcing bits=32).")

        arch = "arm"
        env["bits"] = "32"
        env.Append(LINKFLAGS=['/MACHINE:ARM'])
        env.Append(LIBPATH=[vc_base_path + 'lib/store/arm'])

        angle_build_cmd += "ARM"

        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).")
        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).")
        else:
            print("Failed to detect MSVC compiler architecture version... Defaulting to 32-bit 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"):
            arch = "x86"

            angle_build_cmd += "Win32"

            env.Append(LINKFLAGS=['/MACHINE:X86'])
            env.Append(LIBPATH=[vc_base_path + 'lib/store'])
            env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_Win32/lib'])

        else:
            arch = "x64"

            angle_build_cmd += "x64"

            env.Append(LINKFLAGS=['/MACHINE:X64'])
            env.Append(LIBPATH=[os.environ['VCINSTALLDIR'] + 'lib/store/amd64'])
            env.Append(LIBPATH=[angle_root + '/winrt/10/src/Release_x64/lib'])

    env["PROGSUFFIX"] = "." + arch + env["PROGSUFFIX"]
    env["OBJSUFFIX"] = "." + arch + env["OBJSUFFIX"]
    env["LIBSUFFIX"] = "." + arch + env["LIBSUFFIX"]

    ## Compile flags

    env.Append(CPPPATH=['#platform/uwp', '#drivers/windows'])
    env.Append(CCFLAGS=['/DUWP_ENABLED', '/DWINDOWS_ENABLED', '/DTYPED_METHOD_BIND'])
    env.Append(CCFLAGS=['/DGLES_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])

    env.Append(CPPFLAGS=['/D', '__WRL_NO_DEFAULT_LIB__', '/D', 'WIN32', '/DPNG_ABORT=abort'])

    env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/store/references'])
    env.Append(CPPFLAGS=['/AI', vc_base_path + 'lib/x86/store/references'])

    env.Append(CCFLAGS='/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'.split())
    env.Append(CXXFLAGS='/ZW /FS'.split())
    env.Append(CCFLAGS=['/AI', vc_base_path + '\\vcpackages', '/AI', os.environ['WINDOWSSDKDIR'] + '\\References\\CommonConfiguration\\Neutral'])

    ## Link flags

    env.Append(LINKFLAGS=['/MANIFEST:NO', '/NXCOMPAT', '/DYNAMICBASE', '/WINMD', '/APPCONTAINER', '/ERRORREPORT:PROMPT', '/NOLOGO', '/TLBID:1', '/NODEFAULTLIB:"kernel32.lib"', '/NODEFAULTLIB:"ole32.lib"'])

    LIBS = [
        'WindowsApp',
        'mincore',
        'ws2_32',
        'libANGLE',
        'libEGL',
        'libGLESv2',
        'bcrypt',
    ]
    env.Append(LINKFLAGS=[p + ".lib" for p in LIBS])

    # Incremental linking fix
    env['BUILDERS']['ProgramOriginal'] = env['BUILDERS']['Program']
    env['BUILDERS']['Program'] = methods.precious_program

    env.Append(BUILDERS={'ANGLE': env.Builder(action=angle_build_cmd)})