如何在“ tf_http_archive(...)”之后从bazel运行autoconf和make?

时间:2019-12-05 22:30:44

标签: bazel autotools

我正在尝试在Bazel中导入一个自动工具项目(在tensorflow中运行systemC)。

我可以通过以下方式下载我的自动工具项目:

workspace.bzl

...
    tf_http_archive(                                                               
        name = "systemc",                                                          
        sha256 = "5781b9a351e5afedabc37d145e5f7edec08f3fd5de00ffeb8fa1f3086b1f7b3f",
        urls = [                                                                   
            "https://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.3.tar.gz",
            "https://www.accellera.org/images/downloads/standards/systemc/systemc-2.3.3.tar.gz",
        ],
...                                                                         
    )

只要我自己编译库,我就可以使用它:

cd $BZL_SYSTEMC_PATH/systemc-2.3.3
mkdir build
cd build
../configure CXXFLAGS=-std=c++14 --prefix=$BZL_SYSTEMC_PATH/systemc-2.3.3/install/ \
    --includedir=$BZL_SYSTEMC_PATH/systemc-2.3.3/install/include/systemc \
    --with-unix-layout
make install

只要以下文件存在于$BZL_SYSTEMC_PATH上:

BUILD.bazel

package(default_visibility = ["//visibility:public"])                              

licenses(["notice"])                                                               

cc_library(                                                                        
    name = "systemc",                                                              
    hdrs = glob([                                                                  
      "systemc-2.3.3/install/include/system.h",                                    
      #"systemc-2.3.1a/install/include/communication/*.h",                         
    ]),                                                                            
    includes = [                                                                   
          "systemc-2.3.3/install/include",                                         
          "systemc-2.3.3/install/include/systemc",                                 
          ],                                                                       
    srcs = ["systemc-2.3.3/install/lib/libsystemc.a",],                            
    copts = ["std=c++14",],                                                        
)  

我可以在依赖systemc外部依赖关系的库上使用bazel构建。

下载后我如何告诉bazel编译我的外部依赖项?

0 个答案:

没有答案