demo2_2  使用baze编译动态库

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

BUILD:

cc_binary(
    name = "libfunc.so",
    srcs = ["func.hpp","func.cpp"],
    linkshared = True,
)	

cc_binary.srcs

  1. 支持的文件类型
    • c/c++源文件:.c,.cc,.cpp,.cxx,.c++,.C
    • c/c++头文件:.h,.hh,.hpp,.hxx,.inc
    • .S
    • .a,.pic.a
    • .lo,.pic.lo
    • .so,.so.version
    • .o, .pic.o

cc_binary.linkshared

作用:编译生成动态库。需要使能linkshared属性,默认该属性是关闭状态。如果使能该属性后,binary的name属性必须要要命名成lib*.so。使能这个属性相当于gcc -shared。

bazel-编译动态库

相关文章:

  • 2021-05-06
  • 2021-07-07
  • 2022-01-03
  • 2021-06-06
  • 2021-06-11
  • 2022-01-14
  • 2022-12-23
猜你喜欢
  • 2021-09-06
  • 2022-01-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-12
相关资源
相似解决方案