Prevent SCons from looking for standard tools

后端 未结 3 592
北海茫月
北海茫月 2020-12-07 02:11

I am currently setting up SCons for cross-compilation with Windows as the host OS. I am building a custom Environment for the cross-compiler, but SCons insists

3条回答
  •  温柔的废话
    2020-12-07 02:37

    Consider redefining the DefaultEnvironment instead of defining an Environment.

    All of the Builder functions that we've introduced so far, like Program and Library, actually use a default construction environment that contains settings for the various compilers and other tools that SCons configures by default, or otherwise knows about and has discovered on your system. The goal of the default construction environment is to make many configurations to "just work" to build software using readily available tools with a minimum of configuration changes.

    This way, SCons won't try to make predictions based on common usage and apply them to your project. For example:

    PATH = {'PATH' : ['C:/cygwin/bin']}
    env = Environment(ENV=PATH)
    env.Program('helloworld.c++')
    

    will make assumptions based on what it thinks is the most likely case & try to find Visual Studio before resorting to whatever it finds in PATH, whereas:

    PATH = {'PATH' : ['C:/cygwin/bin']}
    env = DefaultEnvironment(ENV=PATH)
    env.Program('helloworld.c++')
    

    will make no such a assumption, and go directly to whatever it finds in PATH without looking for Visual Studio.

提交回复
热议问题