0

我有源代码,代码需要参考其他文件夹库 (*.o)。

我可以使用makefile编译其他文件夹源代码,然后在liunx系统中生成并链接库文件。

如何在 scons 中操作相同的编译流程?

请帮助我,谢谢

4

1 回答 1

0

您应该能够在一个列表中列出来自不同目录的源文件。就我而言,我在顶级目录中有 build.scons 文件,然后在子目录中有源文件和测试文件,如下所示:

build.scons
src/
 |
  -> random.cc
test/
 |
  -> test.cc

这是我的 build.scons 中的一个片段:

import make_nacl_env
import nacl_utils
import os

nacl_env = make_nacl_env.NaClEnvironment(use_c_plus_plus_libs=True)
nacl_env.Append(
    CPPPATH=[os.path.dirname(os.path.dirname(os.getcwd()))],
    CCFLAGS=['-Wall', '-Wno-long-long', '-pthread', '-Werror', '-std=c++0x'],
   )

sources = ['test/test.cc',
           'src/random.cc']

nacl_env.AllNaClModules(sources, 'myproject')
于 2012-01-21T21:12:05.303 回答