如何仅为 WAF 中库的一个文件添加编译选项?
我正在为我的 d 项目尝试使用 waf。 D 的优点之一是在编译时将整个文件“导入”到代码中。为此,您必须指定将在其中查找要导入的文件的文件夹。对于 dmd 编译器,您必须使用 -Jpath 命令行选项。
我正在构建一个在不同文件夹中包含一百个文件的库,并且我希望能够指定 -J 选项仅用于某些特定文件的编译。这是在 cmake 中完成的,类似于:
set_source_files_properties(
core/shader.d PROPERTIES COMPILE_FLAGS
-J${CMAKE_CURRENT_SOURCE_DIR}/core/gl2/shaders )
但在 waf 中我不知道该怎么做。我的 wscript 看起来像这样,但这将 -J 标志传递给所有文件:
#! /usr/bin/env python
# encoding: utf-8
def build(bld):
bld.stlib(
source =
'''
app/action.d
app/client.d
<...snip..>
core/shader.d
core/stream.d
''',
includes = ['..', '../extern' ],
name = 'mylib',
target = 'mylib
dflags = '-J/some/path/core/gl2/shaders')
I am experimenting with waf for my d project. One of the nice features of D is the "import" of entire files into the code at compile time. To do this you have to specify the folders that will be looked in for the files to import. In the case of the dmd compiler you have to use the -Jpath command-line option.
I am building a library with a hundred files in different folders, and i want to be able to specify the -J option only for the copilation of some specific files. This is done in cmake with something like:
set_source_files_properties(
core/shader.d PROPERTIES COMPILE_FLAGS
-J${CMAKE_CURRENT_SOURCE_DIR}/core/gl2/shaders )
But in waf i don't know how to do it. My wscript lookes like this but this passes the -J flags to all the files:
#! /usr/bin/env python
# encoding: utf-8
def build(bld):
bld.stlib(
source =
'''
app/action.d
app/client.d
<...snip..>
core/shader.d
core/stream.d
''',
includes = ['..', '../extern' ],
name = 'mylib',
target = 'mylib
dflags = '-J/some/path/core/gl2/shaders')
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以这样做:
You can do: