zoukankan      html  css  js  c++  java
  • bazel-demo2_1

    demo2_1目录树

    ├── app
    │ ├── BUILD
    │ ├── hello_world.cpp
    │ └── lib
    │ ├── BUILD
    │ ├── func.cpp
    │ └── func.hpp
    ├── README.md
    └── WORKSPACE

    我们知道子目录下再创建一个BUILD文件,那么该子目录也是一个Package。

    app/BUILD:

    cc_binary(
        name = "hello_world",
        srcs = ["hello_world.cpp"],
        deps = ["//app/lib:hello_func",],
    )
    

    hello_world目标需要调用func1()函数,所以需要依赖lib包。

    lib/BUILD:

    cc_library(
        name = "hello_func",
        srcs = ["func.cpp"],
        hdrs = ["func.hpp"],
        visibility = ["//app:__pkg__"],
    )
    

    The visibility attribute on a rule controls whether the rule can be used by other packages. Rules are always visible to other rules declared in the same package.

    visibility属性相当于设置规则的可见域,使其他规则能够使用本规则。这里的“//app:__pkg__”表明app包可以访问本规则。

  • 相关阅读:
    grid layout
    flex box布局
    box-shadow
    text-shadow
    border-radius
    manjaro conky配置
    博客园样式设置
    python排序参数key以及lambda函数
    python-批量解压zip、rar文件
    Python
  • 原文地址:https://www.cnblogs.com/black-mamba/p/9834635.html
Copyright © 2011-2022 走看看