使用 waf 构建 fortran 库,安装 .mod 文件
我使用 waf (http://code.google.com/p/waf/) 构建一个 fortran 库(它也使用一些 c 代码)。
相应的 wscript 如下所示:
def build(bld):
bld(
features = 'fc',
source = 'fortran_interface.f90',
target = 'fortran_interface.o')
#install_path = '${PREFIX}/mod')
#bld.install_files('${PREFIX}/mod','fortran_interface.mod')
bld(
features = 'c',
includes = '../../include',
source = 'init_wrapper.c',
target = 'init_wrapper.o')
bld(
features = 'fc fcstlib',
use = 'init_wrapper.o fortran_interface.o',
target = 'fortran_interface',
install_path = '${PREFIX}/lib')
调用 waf 生成的结果如下所示:
fc: src/fortran/fortran_interface.f90 ->
build/src/fortran/fortran_interface.f90.1.o
build/fortran_interface.mod
我希望能够将 .mod
文件安装到 ${PREFIX}/mod
。 我尝试了 install_path
,在这种情况下没有任何效果,或者 install_files 不起作用,因为 a) 它不会在 build/ 目录中查找,b) 因为它抱怨 before 如果文件不存在则建筑物。3
I use waf (http://code.google.com/p/waf/) to build a fortran library (which also uses some c-code).
The corresponding wscript looks like this:
def build(bld):
bld(
features = 'fc',
source = 'fortran_interface.f90',
target = 'fortran_interface.o')
#install_path = '${PREFIX}/mod')
#bld.install_files('${PREFIX}/mod','fortran_interface.mod')
bld(
features = 'c',
includes = '../../include',
source = 'init_wrapper.c',
target = 'init_wrapper.o')
bld(
features = 'fc fcstlib',
use = 'init_wrapper.o fortran_interface.o',
target = 'fortran_interface',
install_path = '${PREFIX}/lib')
The call waf produces looks like this:
fc: src/fortran/fortran_interface.f90 ->
build/src/fortran/fortran_interface.f90.1.o
build/fortran_interface.mod
I want to be able to install the .mod
file to ${PREFIX}/mod
.
I tried install_path
which has no effect in this case, or install_files which does not work because a) it doesn't look inside the build/ directory and b) because it complains before the building if a file is not present.3
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于此线程 (http://groups.google.com/group/waf-users/browse_thread/thread/c771a2f4fedd4e3?pli=1),答案是创建
一个单独的构建组
bld.add_group()
并使用
bld.srcnode.find_or_declare(.mod)
让 waf 在构建目录中查找 .mod 文件。
As to this thread (http://groups.google.com/group/waf-users/browse_thread/thread/c771a2f4fedd4e3?pli=1) the answer was to create
a separate build group
bld.add_group()
and to use
bld.srcnode.find_or_declare(<filename>.mod)
to make waf look in the build directory for the .mod file.