|
| 1 | +load("@pixelmatch-cpp17//third_party:stb.bzl", "stb_library") |
| 2 | + |
| 3 | +STB_COPTS = [ |
| 4 | + "-Wno-unused-function", |
| 5 | + "-Wno-self-assign", |
| 6 | +] |
| 7 | + |
| 8 | +stb_library( |
| 9 | + name = "c_lexer", |
| 10 | + copts = STB_COPTS, |
| 11 | + emit_definition_macro = "STB_C_LEXER_IMPLEMENTATION", |
| 12 | +) |
| 13 | + |
| 14 | +# |
| 15 | +# Note that this needs to be instantiated by following the instructions in stb_connected_components.h |
| 16 | +# |
| 17 | +# In one source file, create the implementation by doing something like this: |
| 18 | +# |
| 19 | +# #define STBCC_GRID_COUNT_X_LOG2 10 |
| 20 | +# #define STBCC_GRID_COUNT_Y_LOG2 10 |
| 21 | +# #define STB_CONNECTED_COMPONENTS_IMPLEMENTATION |
| 22 | +# #include "stb_connected_components.h" |
| 23 | +# |
| 24 | +stb_library( |
| 25 | + name = "connected_components", |
| 26 | + copts = STB_COPTS, |
| 27 | +) |
| 28 | + |
| 29 | +stb_library( |
| 30 | + name = "divide", |
| 31 | + copts = STB_COPTS, |
| 32 | + emit_definition_macro = "STB_DIVIDE_IMPLEMENTATION", |
| 33 | +) |
| 34 | + |
| 35 | +stb_library( |
| 36 | + name = "ds", |
| 37 | + copts = STB_COPTS, |
| 38 | + emit_definition_macro = "STB_DS_IMPLEMENTATION", |
| 39 | +) |
| 40 | + |
| 41 | +stb_library( |
| 42 | + name = "dxt", |
| 43 | + copts = STB_COPTS, |
| 44 | + definition_includes = ["memory.h"], |
| 45 | + emit_definition_macro = "STB_DXT_IMPLEMENTATION", |
| 46 | +) |
| 47 | + |
| 48 | +stb_library( |
| 49 | + name = "easy_font", |
| 50 | + copts = STB_COPTS, |
| 51 | + emit_definition_macro = "STB_EASY_FONT_IMPLEMENTATION", |
| 52 | +) |
| 53 | + |
| 54 | +stb_library( |
| 55 | + name = "herringbone_wang_tile", |
| 56 | + copts = STB_COPTS, |
| 57 | + emit_definition_macro = "STB_HERRINGBONE_WANG_TILE_IMPLEMENTATION", |
| 58 | +) |
| 59 | + |
| 60 | +stb_library( |
| 61 | + name = "hexwave", |
| 62 | + copts = STB_COPTS, |
| 63 | + emit_definition_macro = "STB_HEXWAVE_IMPLEMENTATION", |
| 64 | +) |
| 65 | + |
| 66 | +stb_library( |
| 67 | + name = "image", |
| 68 | + copts = STB_COPTS, |
| 69 | + emit_definition_macro = "STB_IMAGE_IMPLEMENTATION", |
| 70 | +) |
| 71 | + |
| 72 | +stb_library( |
| 73 | + name = "image_resize2", |
| 74 | + copts = STB_COPTS, |
| 75 | + emit_definition_macro = "STB_IMAGE_RESIZE_IMPLEMENTATION", |
| 76 | +) |
| 77 | + |
| 78 | +stb_library( |
| 79 | + name = "image_write", |
| 80 | + copts = STB_COPTS, |
| 81 | + emit_definition_macro = "STB_IMAGE_WRITE_IMPLEMENTATION", |
| 82 | +) |
| 83 | + |
| 84 | +stb_library( |
| 85 | + name = "include", |
| 86 | + copts = STB_COPTS, |
| 87 | + emit_definition_macro = "STB_INCLUDE_IMPLEMENTATION", |
| 88 | +) |
| 89 | + |
| 90 | +stb_library( |
| 91 | + name = "leakcheck", |
| 92 | + copts = STB_COPTS, |
| 93 | + emit_definition_macro = "STB_LEAKCHECK_IMPLEMENTATION", |
| 94 | +) |
| 95 | + |
| 96 | +stb_library( |
| 97 | + name = "perlin", |
| 98 | + copts = STB_COPTS, |
| 99 | + emit_definition_macro = "STB_PERLIN_IMPLEMENTATION", |
| 100 | +) |
| 101 | + |
| 102 | +stb_library( |
| 103 | + name = "rect_pack", |
| 104 | + copts = STB_COPTS, |
| 105 | + emit_definition_macro = "STB_RECT_PACK_IMPLEMENTATION", |
| 106 | +) |
| 107 | + |
| 108 | +stb_library( |
| 109 | + name = "sprintf", |
| 110 | + copts = STB_COPTS, |
| 111 | + emit_definition_macro = "STB_SPRINTF_IMPLEMENTATION", |
| 112 | +) |
| 113 | + |
| 114 | +stb_library( |
| 115 | + name = "textedit", |
| 116 | + copts = STB_COPTS, |
| 117 | + emit_definition_macro = "STB_TRUETYPE_IMPLEMENTATION", |
| 118 | +) |
| 119 | + |
| 120 | +stb_library( |
| 121 | + name = "tilemap_editor", |
| 122 | + copts = STB_COPTS, |
| 123 | + emit_definition_macro = "STB_TRUETYPE_IMPLEMENTATION", |
| 124 | +) |
| 125 | + |
| 126 | +stb_library( |
| 127 | + name = "truetype", |
| 128 | + copts = STB_COPTS, |
| 129 | + emit_definition_macro = "STB_TRUETYPE_IMPLEMENTATION", |
| 130 | +) |
| 131 | + |
| 132 | +stb_library( |
| 133 | + name = "stretchy_buffer", |
| 134 | + stb_prefix = False, |
| 135 | +) |
| 136 | + |
| 137 | +# stb_vorbis has a reversed mechanism |
| 138 | +genrule( |
| 139 | + name = "vorbis_definition", |
| 140 | + outs = ["stb_vorbis.cpp"], |
| 141 | + cmd = 'echo "#include <stb/{0}>" > $(@D)/{1}'.format( |
| 142 | + "stb_vorbis.c", |
| 143 | + "stb_vorbis.cpp", |
| 144 | + ), |
| 145 | + visibility = ["//visibility:private"], |
| 146 | +) |
| 147 | + |
| 148 | +cc_library( |
| 149 | + name = "vorbis-private", |
| 150 | + srcs = ["stb_vorbis.c"], |
| 151 | + copts = STB_COPTS + ["-Wno-unused-value"], |
| 152 | + include_prefix = "stb", |
| 153 | + visibility = ["//visibility:private"], |
| 154 | +) |
| 155 | + |
| 156 | +cc_library( |
| 157 | + name = "vorbis", |
| 158 | + defines = ["STB_VORBIS_HEADER_ONLY"], |
| 159 | + visibility = ["//visibility:public"], |
| 160 | + deps = ["//:vorbis-private"], |
| 161 | +) |
0 commit comments