【问题标题】:Determining Build Directory from SConscript从 SConscript 确定构建目录
【发布时间】:2009-12-16 17:59:06
【问题描述】:

我有一个 SConscript,它被复制到构建目录 (variant_dir = ...) 以进行构建。作为not being able to express dependencies 的解决方法,我正在尝试将一些其他文件复制到构建目录中。

如何在 SConscript 中确定当前构建目录是什么?

例如,在以下布局中,内部 SConscript 文件应将 my_build_directory 设置为“build/something”。

project/
    SConstruct      # "SConscript('something/SConscript', variant_dir = 'build/something')
    something/
        SConscript  # "my_build_directory = ..."

【问题讨论】:

    标签: python build-automation scons


    【解决方案1】:

    我的回答似乎太简单了,所以也许我误解了这个问题,但是……

    对我来说,在 subdir/SConscript 中:

    my_build_directory = '.'
    
    echo_cmd = Command('always.echo', [],  "echo %s" % (Dir('.').abspath))
    Alias('echo', echo_cmd)
    

    产生:

    # => cd test-scons
    # => ls 
    #    build/  SConstruct  subdir/
    # => scons echo 
    #    scons: Building targets ...
    #    echo HOME/test-scons/build/subdir
    #    HOME/test-scons/build/subdir
    #    scons: done building targets.
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-18
      • 1970-01-01
      相关资源
      最近更新 更多