1genrule( 2 name = "cbor_cmake", 3 srcs = glob(["**"]), 4 outs = [ 5 "libcbor.a", 6 "cbor.h", 7 "cbor/arrays.h", 8 "cbor/bytestrings.h", 9 "cbor/callbacks.h", 10 "cbor/cbor_export.h", 11 "cbor/common.h", 12 "cbor/configuration.h", 13 "cbor/data.h", 14 "cbor/encoding.h", 15 "cbor/floats_ctrls.h", 16 "cbor/ints.h", 17 "cbor/maps.h", 18 "cbor/serialization.h", 19 "cbor/streaming.h", 20 "cbor/strings.h", 21 "cbor/tags.h", 22 ], 23 cmd = " && ".join([ 24 # Remember where output should go. 25 "INITIAL_WD=`pwd`", 26 "cd `dirname $(location CMakeLists.txt)`", 27 "cmake -DCMAKE_BUILD_TYPE=Release .", 28 "cmake --build .", 29 # Export the .a and .h files for cbor rule, below. 30 "cp -R src/* $$INITIAL_WD/$(RULEDIR)", 31 "cp cbor/configuration.h $$INITIAL_WD/$(RULEDIR)/cbor", 32 ]), 33 visibility = ["//visibility:private"], 34) 35 36cc_import( 37 name = "cbor", 38 hdrs = [ 39 "cbor.h", 40 "cbor/arrays.h", 41 "cbor/bytestrings.h", 42 "cbor/callbacks.h", 43 "cbor/cbor_export.h", 44 "cbor/common.h", 45 "cbor/configuration.h", 46 "cbor/data.h", 47 "cbor/encoding.h", 48 "cbor/floats_ctrls.h", 49 "cbor/ints.h", 50 "cbor/maps.h", 51 "cbor/serialization.h", 52 "cbor/streaming.h", 53 "cbor/strings.h", 54 "cbor/tags.h", 55 ], 56 static_library = "libcbor.a", 57 visibility = ["//visibility:public"], 58) 59