使用 waf 构建 fortran 库,安装 .mod 文件

发布于 2024-12-18 04:55:53 字数 1125 浏览 3 评论 0原文

我使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

无悔心 2024-12-25 04:55:53

对于此线程 (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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文