代码之家  ›  专栏  ›  技术社区  ›  chaosink

SCons:清理失败后重建

  •  0
  • chaosink  · 技术社区  · 7 年前

    我试着举一个例子: https://bitbucket.org/Anteru/build-systems/src/default/scons/

    我修改了文件 SConstruct 要设置生成目录的文件:

    SConscript(
        'statlib/SConscript',
        variant_dir='build/statlib',
        duplicate=0
    )
    SConscript(
        'dynlib/SConscript',
        variant_dir='build/dynlib',
        duplicate=0
    )
    SConscript(
        'executable/SConscript',
        variant_dir='build/executable',
        duplicate=0
    )
    

    但是,以后再建造 scons --clean 并用 scons --no-cache tablegen.py .

    修改后的示例: scons.zip

    1 回复  |  直到 7 年前
        1
  •  1
  •   bdbaddog    7 年前

    import os
    
    # This is needed so we get the python from PATH
    env = Environment(ENV = os.environ)
    
    env.Append (CPPPATH='#')
    pyexec = 'python' if os.name == 'nt' else 'python3'
    env.Command ('table.cpp', 'tablegen.py', '{} $SOURCE > $TARGET'.format (pyexec))
    
    env.StaticLibrary('statlib', [
        # This adds fPIC in a portable way
        SharedObject ('StaticLibrarySource.cpp'), 
        SharedObject ('table.cpp')])
    

    它应该会起作用。

    https://bitbucket.org/Anteru/build-systems/issues/2/youre-statlib-sconscript-has-issue-which