diff --git a/.gitignore b/.gitignore index 378eac2..d1f961a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ build +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..06f079a --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,28 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Cartographer is a system that provides real-time simultaneous localization +# and mapping (SLAM) in 2D and 3D across multiple platforms and sensor +# configurations. + +package(default_visibility = ["//visibility:public"]) + +exports_files(["LICENSE"]) + +filegroup( + name = "configuration_files", + srcs = glob([ + "configuration_files/*.lua", + ]), +) diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..f3c028e --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,25 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +workspace(name = "com_github_googlecartographer_cartographer") + +load("//:bazel/repositories.bzl", "cartographer_repositories") + +cartographer_repositories() + +# This can't be inside cartographer_repositories() because of: +# https://github.com/bazelbuild/bazel/issues/1550 +load("@com_github_nelhage_boost//:boost/boost.bzl", "boost_deps") + +boost_deps() diff --git a/bazel/repositories.bzl b/bazel/repositories.bzl new file mode 100644 index 0000000..5d01370 --- /dev/null +++ b/bazel/repositories.bzl @@ -0,0 +1,213 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""External dependencies for Cartographer.""" + +def cartographer_repositories(): + _maybe(native.http_archive, + name = "com_github_nelhage_boost", + sha256 = "5c88fc077f6b8111e997fec5146e5f9940ae9a2016eb9949447fcb4b482bcdb3", + strip_prefix = "rules_boost-7289bb1d8f938fdf98078297768c122ee9e11c9e", + urls = [ + "https://mirror.bazel.build/github.com/nelhage/rules_boost/archive/7289bb1d8f938fdf98078297768c122ee9e11c9e.tar.gz", + "https://github.com/nelhage/rules_boost/archive/7289bb1d8f938fdf98078297768c122ee9e11c9e.tar.gz", + ], + ) + + _maybe(native.http_archive, + name = "com_github_antonovvk_bazel_rules", + sha256 = "ba75b07d3fd297375a6688e9a16583eb616e7a74b3d5e8791e7a222cf36ab26e", + strip_prefix = "bazel_rules-98ddd7e4f7c63ea0868f08bcc228463dac2f9f12", + urls = [ + "https://mirror.bazel.build/github.com/antonovvk/bazel_rules/archive/98ddd7e4f7c63ea0868f08bcc228463dac2f9f12.tar.gz", + "https://github.com/antonovvk/bazel_rules/archive/98ddd7e4f7c63ea0868f08bcc228463dac2f9f12.tar.gz", + ], + ) + + _maybe(native.http_archive, + name = "com_github_gflags_gflags", + sha256 = "6e16c8bc91b1310a44f3965e616383dbda48f83e8c1eaa2370a215057b00cabe", + strip_prefix = "gflags-77592648e3f3be87d6c7123eb81cbad75f9aef5a", + urls = [ + "https://mirror.bazel.build/github.com/gflags/gflags/archive/77592648e3f3be87d6c7123eb81cbad75f9aef5a.tar.gz", + "https://github.com/gflags/gflags/archive/77592648e3f3be87d6c7123eb81cbad75f9aef5a.tar.gz", + ], + ) + + _maybe(native.http_archive, + name = "com_google_glog", + sha256 = "1ee310e5d0a19b9d584a855000434bb724aa744745d5b8ab1855c85bff8a8e21", + strip_prefix = "glog-028d37889a1e80e8a07da1b8945ac706259e5fd8", + urls = [ + "https://mirror.bazel.build/github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz", + "https://github.com/google/glog/archive/028d37889a1e80e8a07da1b8945ac706259e5fd8.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "net_zlib_zlib", + build_file = "//bazel/third_party:zlib.BUILD", + sha256 = "6d4d6640ca3121620995ee255945161821218752b551a1a180f4215f7d124d45", + strip_prefix = "zlib-cacf7f1d4e3d44d871b605da3b647f07d718623f", + urls = [ + "https://mirror.bazel.build/github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz", + "https://github.com/madler/zlib/archive/cacf7f1d4e3d44d871b605da3b647f07d718623f.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_cairographics_pixman", + build_file = "//bazel/third_party/pixman:pixman.BUILD", + sha256 = "21b6b249b51c6800dc9553b65106e1e37d0e25df942c90531d4c3997aa20a88e", + strip_prefix = "pixman-0.34.0", + urls = [ + "https://mirror.bazel.build/www.cairographics.org/releases/pixman-0.34.0.tar.gz", + "https://www.cairographics.org/releases/pixman-0.34.0.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_cairographics_cairo", + build_file = "//bazel/third_party/cairo:cairo.BUILD", + sha256 = "7e87878658f2c9951a14fc64114d4958c0e65ac47530b8ac3078b2ce41b66a09", + strip_prefix = "cairo-1.14.10", + urls = [ + "https://mirror.bazel.build/www.cairographics.org/releases/cairo-1.14.10.tar.xz", + "https://www.cairographics.org/releases/cairo-1.14.10.tar.xz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_freetype_freetype2", + build_file = "//bazel/third_party:freetype2.BUILD", + sha256 = "33a28fabac471891d0523033e99c0005b95e5618dc8ffa7fa47f9dadcacb1c9b", + strip_prefix = "freetype-2.8", + urls = [ + "https://mirror.bazel.build/download.savannah.gnu.org/releases/freetype/freetype-2.8.tar.gz", + "http://download.savannah.gnu.org/releases/freetype/freetype-2.8.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_libgd_libgd", + build_file = "//bazel/third_party:gd.BUILD", + sha256 = "a66111c9b4a04e818e9e2a37d7ae8d4aae0939a100a36b0ffb52c706a09074b5", + strip_prefix = "libgd-2.2.5", + urls = [ + "https://mirror.bazel.build/github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz", + "https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_freedesktop_fontconfig", + build_file = "//bazel/third_party/fontconfig:fontconfig.BUILD", + sha256 = "fd5a6a663f4c4a00e196523902626654dd0c4a78686cbc6e472f338e50fdf806", + strip_prefix = "fontconfig-2.12.4", + urls = [ + "https://mirror.bazel.build/www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.4.tar.gz", + "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.12.4.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_ceres_solver_ceres_solver", + build_file = "//bazel/third_party:ceres.BUILD", + sha256 = "cb69d1ca4900bc9c4703116a9facba00413eafd893430659fab63246f5320288", + strip_prefix = "ceres-solver-f58eacf082ddf198b2bf982e3cdb57ed3b5ea025", + urls = [ + "https://mirror.bazel.build/github.com/ceres-solver/ceres-solver/archive/f58eacf082ddf198b2bf982e3cdb57ed3b5ea025.tar.gz", + "https://github.com/ceres-solver/ceres-solver/archive/f58eacf082ddf198b2bf982e3cdb57ed3b5ea025.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_tuxfamily_eigen", + build_file = "//bazel/third_party:eigen.BUILD", + sha256 = "ca7beac153d4059c02c8fc59816c82d54ea47fe58365e8aded4082ded0b820c4", + strip_prefix = "eigen-eigen-f3a22f35b044", + urls = [ + "http://mirror.bazel.build/bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz", + "https://bitbucket.org/eigen/eigen/get/f3a22f35b044.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "com_github_libexpat_libexpat", + build_file = "//bazel/third_party:expat.BUILD", + sha256 = "b5dcb503e40f615a0296a18acc6d975f2f1a3d01c7b3a4b3bb69de27bc9475c3", + strip_prefix = "libexpat-R_2_2_4/expat", + urls = [ + "https://mirror.bazel.build/github.com/libexpat/libexpat/archive/R_2_2_4.tar.gz", + "https://github.com/libexpat/libexpat/archive/R_2_2_4.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "libjpeg", + build_file = "//bazel/third_party:libjpeg.BUILD", + sha256 = "240fd398da741669bf3c90366f58452ea59041cacc741a489b99f2f6a0bad052", + strip_prefix = "jpeg-9b", + urls = [ + "https://mirror.bazel.build/www.ijg.org/files/jpegsrc.v9b.tar.gz", + "http://www.ijg.org/files/jpegsrc.v9b.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_libpng_libpng", + build_file = "//bazel/third_party:libpng.BUILD", + sha256 = "7f415186d38ca71c23058386d7cf5135c8beda821ee1beecdc2a7a26c0356615", + strip_prefix = "libpng-1.2.57", + urls = [ + "https://mirror.bazel.build/github.com/glennrp/libpng/archive/v1.2.57.tar.gz", + "https://github.com/glennrp/libpng/archive/v1.2.57.tar.gz", + ], + ) + + _maybe(native.http_archive, + name = "com_google_googletest", + sha256 = "c18f281fd6621bb264570b99860a0241939b4a251c9b1af709b811d33bc63af8", + strip_prefix = "googletest-e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d", + urls = [ + "https://mirror.bazel.build/github.com/google/googletest/archive/e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d.tar.gz", + "https://github.com/google/googletest/archive/e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d.tar.gz", + ], + ) + + _maybe(native.http_archive, + name = "com_google_protobuf", + sha256 = "0cc6607e2daa675101e9b7398a436f09167dffb8ca0489b0307ff7260498c13c", + strip_prefix = "protobuf-3.5.0", + urls = [ + "https://mirror.bazel.build/github.com/google/protobuf/archive/v3.5.0.tar.gz", + "https://github.com/google/protobuf/archive/v3.5.0.tar.gz", + ], + ) + + _maybe(native.new_http_archive, + name = "org_lua_lua", + build_file = "//bazel/third_party:lua.BUILD", + sha256 = "b9e2e4aad6789b3b63a056d442f7b39f0ecfca3ae0f1fc0ae4e9614401b69f4b", + strip_prefix = "lua-5.2.4", + urls = [ + "https://mirror.bazel.build/www.lua.org/ftp/lua-5.2.4.tar.gz", + "https://www.lua.org/ftp/lua-5.2.4.tar.gz", + ], + ) + + +def _maybe(repo_rule, name, **kwargs): + if name not in native.existing_rules(): + repo_rule(name=name, **kwargs) diff --git a/bazel/third_party/BUILD.bazel b/bazel/third_party/BUILD.bazel new file mode 100644 index 0000000..7398680 --- /dev/null +++ b/bazel/third_party/BUILD.bazel @@ -0,0 +1,20 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Bazel build support for third-party packages. + +exports_files( + glob(["*.BUILD"]), + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/cairo/BUILD.bazel b/bazel/third_party/cairo/BUILD.bazel new file mode 100644 index 0000000..b90ab6c --- /dev/null +++ b/bazel/third_party/cairo/BUILD.bazel @@ -0,0 +1,26 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Files required for building Cairo with Bazel. + +licenses(["notice"]) + +exports_files( + [ + "cairo.BUILD", + "config.h", + "cairo-features.h", + ], + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/cairo/cairo-features.h b/bazel/third_party/cairo/cairo-features.h new file mode 100644 index 0000000..ec161ea --- /dev/null +++ b/bazel/third_party/cairo/cairo-features.h @@ -0,0 +1,50 @@ +/* + * Copyright 2018 The Cartographer Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef CAIRO_FEATURES_H +#define CAIRO_FEATURES_H + +#define CAIRO_HAS_FC_FONT 1 +#define CAIRO_HAS_FT_FONT 1 +#define CAIRO_HAS_GOBJECT_FUNCTIONS 1 +#define CAIRO_HAS_IMAGE_SURFACE 1 +#define CAIRO_HAS_MIME_SURFACE 1 +#define CAIRO_HAS_OBSERVER_SURFACE 1 +#define CAIRO_HAS_PDF_SURFACE 1 +#define CAIRO_HAS_PNG_FUNCTIONS 1 +#define CAIRO_HAS_PS_SURFACE 1 +#define CAIRO_HAS_RECORDING_SURFACE 1 +#define CAIRO_HAS_SCRIPT_SURFACE 1 +#define CAIRO_HAS_SVG_SURFACE 1 +#define CAIRO_HAS_TEE_SURFACE 1 +#define CAIRO_HAS_USER_FONT 1 + +#define CAIRO_HAS_GIF_FUNCTIONS 1 +#define CAIRO_HAS_JPEG_FUNCTIONS 1 + +/*#undef CAIRO_HAS_EGL_FUNCTIONS */ +/*#undef CAIRO_HAS_GLX_FUNCTIONS */ +/*#undef CAIRO_HAS_QUARTZ_FONT */ +/*#undef CAIRO_HAS_QUARTZ_SURFACE */ +/*#undef CAIRO_HAS_WGL_FUNCTIONS */ +/*#undef CAIRO_HAS_WIN32_FONT */ +/*#undef CAIRO_HAS_WIN32_SURFACE */ +/*#undef CAIRO_HAS_XCB_SHM_FUNCTIONS */ +/*#undef CAIRO_HAS_XCB_SURFACE */ +/*#undef CAIRO_HAS_XLIB_SURFACE */ +/*#undef CAIRO_HAS_XLIB_XRENDER_SURFACE */ + +#endif diff --git a/bazel/third_party/cairo/cairo.BUILD b/bazel/third_party/cairo/cairo.BUILD new file mode 100644 index 0000000..10fc0da --- /dev/null +++ b/bazel/third_party/cairo/cairo.BUILD @@ -0,0 +1,303 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# Cairo is a 2D graphics library with support for multiple output devices. + +licenses(["reciprocal"]) # MPL 1.1 + +genrule( + name = "config_h", + srcs = ["@com_github_googlecartographer_cartographer//bazel/third_party/cairo:config.h"], + outs = ["cairo_internal/config.h"], + cmd = "cp $< $@", +) + +genrule( + name = "cairo_features_h", + srcs = ["@com_github_googlecartographer_cartographer//bazel/third_party/cairo:cairo-features.h"], + outs = ["src/cairo-features.h"], + cmd = "cp $< $@", +) + +cc_library( + name = "cairo", + srcs = [ + "cairo-version.h", + "cairo_internal/config.h", + "src/cairo.c", + "src/cairo.h", + "src/cairo-analysis-surface.c", + "src/cairo-analysis-surface-private.h", + "src/cairo-arc.c", + "src/cairo-arc-private.h", + "src/cairo-array.c", + "src/cairo-array-private.h", + "src/cairo-atomic.c", + "src/cairo-atomic-private.h", + "src/cairo-backend-private.h", + "src/cairo-base64-stream.c", + "src/cairo-base85-stream.c", + "src/cairo-bentley-ottmann.c", + "src/cairo-bentley-ottmann-rectangular.c", + "src/cairo-bentley-ottmann-rectilinear.c", + "src/cairo-botor-scan-converter.c", + "src/cairo-box-inline.h", + "src/cairo-boxes.c", + "src/cairo-boxes-intersect.c", + "src/cairo-boxes-private.h", + "src/cairo-cache.c", + "src/cairo-cache-private.h", + "src/cairo-cff-subset.c", + "src/cairo-clip.c", + "src/cairo-clip-boxes.c", + "src/cairo-clip-inline.h", + "src/cairo-clip-polygon.c", + "src/cairo-clip-private.h", + "src/cairo-clip-region.c", + "src/cairo-clip-surface.c", + "src/cairo-clip-tor-scan-converter.c", + "src/cairo-color.c", + "src/cairo-combsort-inline.h", + "src/cairo-compiler-private.h", + "src/cairo-composite-rectangles.c", + "src/cairo-composite-rectangles-private.h", + "src/cairo-compositor.c", + "src/cairo-compositor-private.h", + "src/cairo-contour.c", + "src/cairo-contour-inline.h", + "src/cairo-contour-private.h", + "src/cairo-damage.c", + "src/cairo-damage-private.h", + "src/cairo-debug.c", + "src/cairo-default-context.c", + "src/cairo-default-context-private.h", + "src/cairo-deflate-stream.c", + "src/cairo-deprecated.h", + "src/cairo-device.c", + "src/cairo-device-private.h", + "src/cairo-error.c", + "src/cairo-error-private.h", + "src/cairo-fallback-compositor.c", + "src/cairo-features.h", + "src/cairo-fixed.c", + "src/cairo-fixed-private.h", + "src/cairo-fixed-type-private.h", + "src/cairo-font-face.c", + "src/cairo-font-face-twin.c", + "src/cairo-font-face-twin-data.c", + "src/cairo-font-options.c", + "src/cairo-fontconfig-private.h", + "src/cairo-freed-pool.c", + "src/cairo-freed-pool-private.h", + "src/cairo-freelist.c", + "src/cairo-freelist-private.h", + "src/cairo-freelist-type-private.h", + "src/cairo-ft.h", + "src/cairo-ft-font.c", + "src/cairo-ft-private.h", + "src/cairo-gstate.c", + "src/cairo-gstate-private.h", + "src/cairo-hash.c", + "src/cairo-hash-private.h", + "src/cairo-hull.c", + "src/cairo-image-compositor.c", + "src/cairo-image-info.c", + "src/cairo-image-info-private.h", + "src/cairo-image-source.c", + "src/cairo-image-surface.c", + "src/cairo-image-surface-inline.h", + "src/cairo-image-surface-private.h", + "src/cairo-line.c", + "src/cairo-line-inline.h", + "src/cairo-line-private.h", + "src/cairo-list-inline.h", + "src/cairo-list-private.h", + "src/cairo-lzw.c", + "src/cairo-malloc-private.h", + "src/cairo-mask-compositor.c", + "src/cairo-matrix.c", + "src/cairo-mempool.c", + "src/cairo-mempool-private.h", + "src/cairo-mesh-pattern-rasterizer.c", + "src/cairo-misc.c", + "src/cairo-mono-scan-converter.c", + "src/cairo-mutex.c", + "src/cairo-mutex-impl-private.h", + "src/cairo-mutex-list-private.h", + "src/cairo-mutex-private.h", + "src/cairo-mutex-type-private.h", + "src/cairo-no-compositor.c", + "src/cairo-observer.c", + "src/cairo-output-stream.c", + "src/cairo-output-stream-private.h", + "src/cairo-paginated-private.h", + "src/cairo-paginated-surface.c", + "src/cairo-paginated-surface-private.h", + "src/cairo-path.c", + "src/cairo-path-bounds.c", + "src/cairo-path-fill.c", + "src/cairo-path-fixed.c", + "src/cairo-path-fixed-private.h", + "src/cairo-path-in-fill.c", + "src/cairo-path-private.h", + "src/cairo-path-stroke.c", + "src/cairo-path-stroke-boxes.c", + "src/cairo-path-stroke-polygon.c", + "src/cairo-path-stroke-traps.c", + "src/cairo-path-stroke-tristrip.c", + "src/cairo-pattern.c", + "src/cairo-pattern-inline.h", + "src/cairo-pattern-private.h", + "src/cairo-pdf.h", + "src/cairo-pdf-operators.c", + "src/cairo-pdf-operators-private.h", + "src/cairo-pdf-shading.c", + "src/cairo-pdf-shading-private.h", + "src/cairo-pdf-surface.c", + "src/cairo-pdf-surface-private.h", + "src/cairo-pen.c", + "src/cairo-pixman-private.h", + "src/cairo-png.c", + "src/cairo-polygon.c", + "src/cairo-polygon-intersect.c", + "src/cairo-polygon-reduce.c", + "src/cairo-private.h", + "src/cairo-ps.h", + "src/cairo-ps-surface.c", + "src/cairo-ps-surface-private.h", + "src/cairo-raster-source-pattern.c", + "src/cairo-recording-surface.c", + "src/cairo-recording-surface-inline.h", + "src/cairo-recording-surface-private.h", + "src/cairo-rectangle.c", + "src/cairo-rectangular-scan-converter.c", + "src/cairo-reference-count-private.h", + "src/cairo-region.c", + "src/cairo-region-private.h", + "src/cairo-rtree.c", + "src/cairo-rtree-private.h", + "src/cairo-scaled-font.c", + "src/cairo-scaled-font-private.h", + "src/cairo-scaled-font-subsets.c", + "src/cairo-scaled-font-subsets-private.h", + "src/cairo-script.h", + "src/cairo-script-private.h", + "src/cairo-script-surface.c", + "src/cairo-shape-mask-compositor.c", + "src/cairo-slope.c", + "src/cairo-slope-private.h", + "src/cairo-spans.c", + "src/cairo-spans-compositor.c", + "src/cairo-spans-compositor-private.h", + "src/cairo-spans-private.h", + "src/cairo-spline.c", + "src/cairo-stroke-dash.c", + "src/cairo-stroke-dash-private.h", + "src/cairo-stroke-style.c", + "src/cairo-surface.c", + "src/cairo-surface-backend-private.h", + "src/cairo-surface-clipper.c", + "src/cairo-surface-clipper-private.h", + "src/cairo-surface-fallback.c", + "src/cairo-surface-fallback-private.h", + "src/cairo-surface-inline.h", + "src/cairo-surface-observer.c", + "src/cairo-surface-observer-inline.h", + "src/cairo-surface-observer-private.h", + "src/cairo-surface-offset.c", + "src/cairo-surface-offset-private.h", + "src/cairo-surface-private.h", + "src/cairo-surface-snapshot.c", + "src/cairo-surface-snapshot-inline.h", + "src/cairo-surface-snapshot-private.h", + "src/cairo-surface-subsurface.c", + "src/cairo-surface-subsurface-inline.h", + "src/cairo-surface-subsurface-private.h", + "src/cairo-surface-wrapper.c", + "src/cairo-surface-wrapper-private.h", + "src/cairo-svg.h", + "src/cairo-svg-surface.c", + "src/cairo-svg-surface-private.h", + "src/cairo-tee.h", + "src/cairo-tee-surface.c", + "src/cairo-tee-surface-private.h", + "src/cairo-time.c", + "src/cairo-time-private.h", + "src/cairo-tor-scan-converter.c", + "src/cairo-tor22-scan-converter.c", + "src/cairo-toy-font-face.c", + "src/cairo-traps.c", + "src/cairo-traps-compositor.c", + "src/cairo-traps-private.h", + "src/cairo-tristrip.c", + "src/cairo-tristrip-private.h", + "src/cairo-truetype-subset.c", + "src/cairo-truetype-subset-private.h", + "src/cairo-type1-fallback.c", + "src/cairo-type1-glyph-names.c", + "src/cairo-type1-private.h", + "src/cairo-type1-subset.c", + "src/cairo-type3-glyph-surface.c", + "src/cairo-type3-glyph-surface-private.h", + "src/cairo-types-private.h", + "src/cairo-unicode.c", + "src/cairo-user-font.c", + "src/cairo-user-font-private.h", + "src/cairo-version.c", + "src/cairo-version.h", + "src/cairo-wideint.c", + "src/cairo-wideint-private.h", + "src/cairo-wideint-type-private.h", + "src/cairoint.h", + ], + hdrs = [ + "src/cairo.h", + "src/cairo-deprecated.h", + "src/cairo-features.h", + "src/cairo-version.h", + ], + copts = [ + "-DHAVE_CONFIG_H", + "-D_REENTRANT", + "-Wno-attributes", + "-Wno-cpp", + "-Wno-maybe-uninitialized", + "-Wno-misleading-indentation", + "-Wno-strict-aliasing", + "-Wno-unused-but-set-variable", + "-Wno-unused-function", + "-I$(GENDIR)/external/org_cairographics_cairo/src", + "-I$(GENDIR)/external/org_cairographics_cairo/cairo_internal", + "-DCAIRO_HAS_XLIB_SURFACE=1", # Only effect is to create xlib display mutex + ], + include_prefix = "cairo", + linkopts = [ + "-lpthread", + "-lrt", + "-lm", + ], + strip_include_prefix = "src", + visibility = ["//visibility:public"], + deps = [ + "@com_github_libexpat_libexpat//:expat", + "@libjpeg//:jpeg", + "@net_zlib_zlib//:zlib", + "@org_cairographics_pixman//:pixman", + "@org_freedesktop_fontconfig//:fontconfig", + "@org_freetype_freetype2//:freetype2", + "@org_libgd_libgd//:gd", + "@org_libpng_libpng//:libpng", + ], +) diff --git a/bazel/third_party/cairo/config.h b/bazel/third_party/cairo/config.h new file mode 100644 index 0000000..2a7f986 --- /dev/null +++ b/bazel/third_party/cairo/config.h @@ -0,0 +1,428 @@ +/* + * Copyright 2018 The Cartographer Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* whether memory barriers are needed around atomic operations */ +/* #undef ATOMIC_OP_NEEDS_MEMORY_BARRIER */ + +/* Define to 1 if the PDF backend can be tested (need poppler and other + dependencies for pdf2png) */ +/* #undef CAIRO_CAN_TEST_PDF_SURFACE */ + +/* Define to 1 if the PS backend can be tested (needs ghostscript) */ +#define CAIRO_CAN_TEST_PS_SURFACE 1 + +/* Define to 1 if the SVG backend can be tested */ +/* #undef CAIRO_CAN_TEST_SVG_SURFACE */ + +/* Define to 1 if the Win32 Printing backend can be tested (needs ghostscript) + */ +/* #undef CAIRO_CAN_TEST_WIN32_PRINTING_SURFACE */ + +/* Define to 1 if dlsym is available */ +#define CAIRO_HAS_DLSYM 1 + +/* Define to 1 to enable cairo's cairo-script-interpreter feature */ +/* #undef CAIRO_HAS_INTERPRETER */ + +/* Define to 1 to enable cairo's pthread feature */ +#define CAIRO_HAS_PTHREAD 1 + +/* Define to 1 if we have full pthread support */ +#define CAIRO_HAS_REAL_PTHREAD 1 + +/* Define to 1 if libspectre is available */ +/* #undef CAIRO_HAS_SPECTRE */ + +/* Define to 1 to enable cairo's symbol-lookup feature */ +/* #undef CAIRO_HAS_SYMBOL_LOOKUP */ + +/* Define to 1 to enable cairo's test surfaces feature */ +/* #undef CAIRO_HAS_TEST_SURFACES */ + +/* Define to 1 to enable cairo's cairo-trace feature */ +/* #undef CAIRO_HAS_TRACE */ + +/* Define to 1 to disable certain code paths that rely heavily on double + precision floating-point calculation */ +/* #undef DISABLE_SOME_FLOATING_POINT */ + +/* Define to 1 if your system stores words within floats with the most + significant word first */ +/* #undef FLOAT_WORDS_BIGENDIAN */ + +/* Enable pixman glyph cache */ +#define HAS_PIXMAN_GLYPHS 1 + +/* Define to 1 if you have the `alarm' function. */ +#define HAVE_ALARM 1 + +/* Define to 1 if you have the binutils development files installed */ +/* #undef HAVE_BFD */ + +/* Define to 1 if your compiler supports the __builtin_return_address() + intrinsic. */ +#define HAVE_BUILTIN_RETURN_ADDRESS 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_BYTESWAP_H 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#define HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `ctime_r' function. */ +#define HAVE_CTIME_R 1 + +/* Enable if your compiler supports the GCC __atomic_* atomic primitives */ +#define HAVE_CXX11_ATOMIC_PRIMITIVES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you have the `drand48' function. */ +#define HAVE_DRAND48 1 + +/* Define to 1 if you have the `FcFini' function. */ +/* #undef HAVE_FCFINI */ + +/* Define to 1 if you have the `FcInit' function. */ +/* #undef HAVE_FCINIT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `feclearexcept' function. */ +#define HAVE_FECLEAREXCEPT 1 + +/* Define to 1 if you have the `fedisableexcept' function. */ +#define HAVE_FEDISABLEEXCEPT 1 + +/* Define to 1 if you have the `feenableexcept' function. */ +#define HAVE_FEENABLEEXCEPT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_FENV_H 1 + +/* Define to 1 if you have the `flockfile' function. */ +#define HAVE_FLOCKFILE 1 + +/* Define to 1 if you have the `fork' function. */ +#define HAVE_FORK 1 + +/* Define to 1 if you have the `FT_Get_X11_Font_Format' function. */ +#define HAVE_FT_GET_X11_FONT_FORMAT 1 + +/* Define to 1 if you have the `FT_GlyphSlot_Embolden' function. */ +#define HAVE_FT_GLYPHSLOT_EMBOLDEN 1 + +/* Define to 1 if you have the `FT_GlyphSlot_Oblique' function. */ +#define HAVE_FT_GLYPHSLOT_OBLIQUE 1 + +/* Define to 1 if you have the `FT_Library_SetLcdFilter' function. */ +#define HAVE_FT_LIBRARY_SETLCDFILTER 1 + +/* Define to 1 if you have the `FT_Load_Sfnt_Table' function. */ +#define HAVE_FT_LOAD_SFNT_TABLE 1 + +/* Define to 1 if you have the `funlockfile' function. */ +#define HAVE_FUNLOCKFILE 1 + +/* Whether you have gcov */ +/* #undef HAVE_GCOV */ + +/* Define to 1 if you have the `getline' function. */ +#define HAVE_GETLINE 1 + +/* Enable if your compiler supports the Intel __sync_* atomic primitives */ +/* #undef HAVE_INTEL_ATOMIC_PRIMITIVES */ + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_IO_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_LIBGEN_H 1 + +/* Define to 1 if you have the `rt' library (-lrt). */ +#define HAVE_LIBRT 1 + +/* Enable if you have libatomic-ops-dev installed */ +/* #undef HAVE_LIB_ATOMIC_OPS */ + +/* Define to 1 if you have the `link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the Valgrind lockdep tool */ +/* #undef HAVE_LOCKDEP */ + +/* Define to 1 if you have lzo available */ +/* #undef HAVE_LZO */ + +/* Define to 1 if you have the Valgrind memfault tool */ +/* #undef HAVE_MEMFAULT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to non-zero if your system has mkdir, and to 2 if your version of + mkdir requires a mode parameter */ +#define HAVE_MKDIR 2 + +/* Define to 1 if you have the `mmap' function. */ +#define HAVE_MMAP 1 + +/* Enable if you have MacOS X atomic operations */ +/* #undef HAVE_OS_ATOMIC_OPS */ + +/* Define to 1 if you have the `poppler_page_render' function. */ +/* #undef HAVE_POPPLER_PAGE_RENDER */ + +/* Define to 1 if you have the `raise' function. */ +#define HAVE_RAISE 1 + +/* Define to 1 if you have the `rsvg_pixbuf_from_file' function. */ +/* #undef HAVE_RSVG_PIXBUF_FROM_FILE */ + +/* Define to 1 if you have the `sched_getaffinity' function. */ +#define HAVE_SCHED_GETAFFINITY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SCHED_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SETJMP_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strndup' function. */ +#define HAVE_STRNDUP 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INT_TYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_UN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if the system has the type `uint128_t'. */ +/* #undef HAVE_UINT128_T */ + +/* Define to 1 if the system has the type `uint64_t'. */ +#define HAVE_UINT64_T 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have Valgrind */ +/* #undef HAVE_VALGRIND */ + +/* Define to 1 if you have the `waitpid' function. */ +#define HAVE_WAITPID 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_WINDOWS_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X11_EXTENSIONS_SHMPROTO_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X11_EXTENSIONS_SHMSTR_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_X11_EXTENSIONS_XSHM_H */ + +/* Define to 1 if you have the `XRenderCreateConicalGradient' function. */ +/* #undef HAVE_XRENDERCREATECONICALGRADIENT */ + +/* Define to 1 if you have the `XRenderCreateLinearGradient' function. */ +/* #undef HAVE_XRENDERCREATELINEARGRADIENT */ + +/* Define to 1 if you have the `XRenderCreateRadialGradient' function. */ +/* #undef HAVE_XRENDERCREATERADIALGRADIENT */ + +/* Define to 1 if you have zlib available */ +#define HAVE_ZLIB 1 + +/* Define to 1 if the system has the type `__uint128_t'. */ +#define HAVE___UINT128_T 1 + +/* Define to 1 if shared memory segments are released deferred. */ +/* #undef IPC_RMID_DEFERRED_RELEASE */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT \ + "http://bugs.freedesktop.org/enter_bug.cgi?product=cairo" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME USE_cairo_INSTEAD + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING USE_cairo_version_OR_cairo_version_string_INSTEAD + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME USE_cairo_INSTEAD + +/* Define to the home page for this package. */ +#define PACKAGE_URL "http://cairographics.org/" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION USE_cairo_version_OR_cairo_version_string_INSTEAD + +/* Shared library file extension */ +#define SHARED_LIB_EXT "so" + +/* The size of `int', as computed by sizeof. */ +#define SIZEOF_INT 4 + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* The size of `long long', as computed by sizeof. */ +#define SIZEOF_LONG_LONG 8 + +/* The size of `size_t', as computed by sizeof. */ +#define SIZEOF_SIZE_T 8 + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif + +/* Define to the value your compiler uses to support the warn-unused-result + attribute */ +#define WARN_UNUSED_RESULT + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +#if defined __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#else +#ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +#endif +#endif + +/* Deal with multiple architecture compiles on Mac OS X */ +#ifdef __APPLE_CC__ +#ifdef __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#define FLOAT_WORDS_BIGENDIAN 1 +#else +/* #undef WORDS_BIGENDIAN */ +/* #undef FLOAT_WORDS_BIGENDIAN */ +#endif +#endif + +/* Define to 1 if the X Window System is missing or not being used. */ +/* #undef X_DISPLAY_MISSING */ + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +#define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif diff --git a/bazel/third_party/ceres.BUILD b/bazel/third_party/ceres.BUILD new file mode 100644 index 0000000..227ca5a --- /dev/null +++ b/bazel/third_party/ceres.BUILD @@ -0,0 +1,161 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# Ceres Solver is an open source C++ library for modeling and solving large, +# complicated optimization problems. + +licenses(["notice"]) # New BSD, portions MIT. + +CERES_DEFINES = [ + "CERES_USE_CXX11", + "CERES_NO_EIGENSPARSE", + "CERES_NO_SUITESPARSE", + "CERES_NO_LAPACK", + "CERES_NO_CXSPARSE", + "CERES_STD_UNORDERED_MAP", + + # Enable support for OpenMP. + "CERES_USE_OPENMP", + + # Use the internal mutex code. Not ideal, but it works. + "CERES_HAVE_PTHREAD", + "CERES_HAVE_RWLOCK", +] + +cc_library( + name = "ceres", + srcs = [ + "internal/ceres/array_utils.cc", + "internal/ceres/blas.cc", + "internal/ceres/block_evaluate_preparer.cc", + "internal/ceres/block_jacobi_preconditioner.cc", + "internal/ceres/block_jacobian_writer.cc", + "internal/ceres/block_random_access_dense_matrix.cc", + "internal/ceres/block_random_access_diagonal_matrix.cc", + "internal/ceres/block_random_access_matrix.cc", + "internal/ceres/block_random_access_sparse_matrix.cc", + "internal/ceres/block_sparse_matrix.cc", + "internal/ceres/block_structure.cc", + "internal/ceres/callbacks.cc", + "internal/ceres/c_api.cc", + "internal/ceres/canonical_views_clustering.cc", + "internal/ceres/cgnr_solver.cc", + "internal/ceres/coordinate_descent_minimizer.cc", + "internal/ceres/compressed_col_sparse_matrix_utils.cc", + "internal/ceres/compressed_row_jacobian_writer.cc", + "internal/ceres/compressed_row_sparse_matrix.cc", + "internal/ceres/conditioned_cost_function.cc", + "internal/ceres/conjugate_gradients_solver.cc", + "internal/ceres/corrector.cc", + "internal/ceres/covariance.cc", + "internal/ceres/covariance_impl.cc", + "internal/ceres/dense_normal_cholesky_solver.cc", + "internal/ceres/dense_qr_solver.cc", + "internal/ceres/dense_sparse_matrix.cc", + "internal/ceres/detect_structure.cc", + "internal/ceres/dogleg_strategy.cc", + "internal/ceres/dynamic_compressed_row_jacobian_writer.cc", + "internal/ceres/dynamic_compressed_row_sparse_matrix.cc", + "internal/ceres/dynamic_sparse_normal_cholesky_solver.cc", + "internal/ceres/eigensparse.cc", + "internal/ceres/evaluator.cc", + "internal/ceres/file.cc", + "internal/ceres/function_sample.cc", + "internal/ceres/gradient_checker.cc", + "internal/ceres/gradient_checking_cost_function.cc", + "internal/ceres/gradient_problem.cc", + "internal/ceres/gradient_problem_solver.cc", + "internal/ceres/implicit_schur_complement.cc", + "internal/ceres/inner_product_computer.cc", + "internal/ceres/is_close.cc", + "internal/ceres/iterative_schur_complement_solver.cc", + "internal/ceres/lapack.cc", + "internal/ceres/levenberg_marquardt_strategy.cc", + "internal/ceres/line_search.cc", + "internal/ceres/line_search_direction.cc", + "internal/ceres/line_search_minimizer.cc", + "internal/ceres/line_search_preprocessor.cc", + "internal/ceres/linear_least_squares_problems.cc", + "internal/ceres/linear_operator.cc", + "internal/ceres/linear_solver.cc", + "internal/ceres/local_parameterization.cc", + "internal/ceres/loss_function.cc", + "internal/ceres/low_rank_inverse_hessian.cc", + "internal/ceres/minimizer.cc", + "internal/ceres/normal_prior.cc", + "internal/ceres/parameter_block_ordering.cc", + "internal/ceres/partitioned_matrix_view.cc", + "internal/ceres/polynomial.cc", + "internal/ceres/preconditioner.cc", + "internal/ceres/preprocessor.cc", + "internal/ceres/problem.cc", + "internal/ceres/problem_impl.cc", + "internal/ceres/program.cc", + "internal/ceres/reorder_program.cc", + "internal/ceres/residual_block.cc", + "internal/ceres/residual_block_utils.cc", + "internal/ceres/schur_complement_solver.cc", + "internal/ceres/schur_eliminator.cc", + "internal/ceres/schur_jacobi_preconditioner.cc", + "internal/ceres/schur_templates.cc", + "internal/ceres/scratch_evaluate_preparer.cc", + "internal/ceres/single_linkage_clustering.cc", + "internal/ceres/solver.cc", + "internal/ceres/solver_utils.cc", + "internal/ceres/sparse_cholesky.cc", + "internal/ceres/sparse_matrix.cc", + "internal/ceres/sparse_normal_cholesky_solver.cc", + "internal/ceres/split.cc", + "internal/ceres/stringprintf.cc", + "internal/ceres/suitesparse.cc", + "internal/ceres/trust_region_minimizer.cc", + "internal/ceres/trust_region_preprocessor.cc", + "internal/ceres/trust_region_step_evaluator.cc", + "internal/ceres/trust_region_strategy.cc", + "internal/ceres/triplet_sparse_matrix.cc", + "internal/ceres/types.cc", + "internal/ceres/visibility_based_preconditioner.cc", + "internal/ceres/visibility.cc", + "internal/ceres/wall_time.cc", + ] + glob([ + "internal/ceres/generated/schur_eliminator_*.cc", + "internal/ceres/generated/partitioned_matrix_view_*.cc", + "config/**/*.h", + "internal/**/*.h", + ]), + hdrs = glob([ + "include/ceres/*.h", + "include/ceres/internal/*.h", + ]), + copts = [ + "-fopenmp", + "-Wno-sign-compare", + ], + defines = CERES_DEFINES, + includes = [ + "config", + "include", + "internal", + ], + linkopts = [ + "-lgomp", + ], + linkstatic = 1, + visibility = ["//visibility:public"], + deps = [ + "@com_google_glog//:glog", + "@org_tuxfamily_eigen//:eigen", + ], +) diff --git a/bazel/third_party/eigen.BUILD b/bazel/third_party/eigen.BUILD new file mode 100644 index 0000000..d531a56 --- /dev/null +++ b/bazel/third_party/eigen.BUILD @@ -0,0 +1,84 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# Eigen is a C++ template library for linear algebra: vectors, +# matrices, and related algorithms. + +licenses([ + # Note: Eigen is an MPL2 library that includes GPL v3 and LGPL v2.1+ code. + # We've taken special care to not reference any restricted code. + "reciprocal", # MPL2 + "notice", # Portions BSD +]) + +exports_files(["COPYING.MPL2"]) + +# License-restricted (i.e. not reciprocal or notice) files inside Eigen/... +EIGEN_RESTRICTED_FILES = [ + "Eigen/src/OrderingMethods/Amd.h", + "Eigen/src/SparseCholesky/**", +] + +# Notable transitive dependencies of restricted files inside Eigen/... +EIGEN_RESTRICTED_DEPS = [ + "Eigen/Eigen", + "Eigen/IterativeLinearSolvers", + "Eigen/MetisSupport", + "Eigen/Sparse", + "Eigen/SparseCholesky", + "Eigen/SparseLU", +] + +EIGEN_FILES = [ + "Eigen/**", + "unsupported/Eigen/CXX11/**", + "unsupported/Eigen/FFT", + "unsupported/Eigen/KroneckerProduct", + "unsupported/Eigen/src/FFT/**", + "unsupported/Eigen/src/KroneckerProduct/**", + "unsupported/Eigen/MatrixFunctions", + "unsupported/Eigen/SpecialFunctions", + "unsupported/Eigen/src/MatrixFunctions/**", + "unsupported/Eigen/src/SpecialFunctions/**", +] + +# List of files picked up by glob but actually part of another target. +EIGEN_EXCLUDE_FILES = [ + "Eigen/src/Core/arch/AVX/PacketMathGoogleTest.cc", +] + +# Files known to be under MPL2 license. +EIGEN_MPL2_HEADER_FILES = glob( + EIGEN_FILES, + exclude = EIGEN_EXCLUDE_FILES + + EIGEN_RESTRICTED_FILES + + EIGEN_RESTRICTED_DEPS + [ + # Guarantees any file missed by excludes above will not compile. + "Eigen/src/Core/util/NonMPL2.h", + "Eigen/**/CMakeLists.txt", + ], +) + +cc_library( + name = "eigen", + hdrs = EIGEN_MPL2_HEADER_FILES, + defines = [ + # This define (mostly) guarantees we don't link any problematic + # code. We use it, but we do not rely on it, as evidenced above. + "EIGEN_MPL2_ONLY", + ], + includes = ["."], + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/expat.BUILD b/bazel/third_party/expat.BUILD new file mode 100644 index 0000000..85d21bd --- /dev/null +++ b/bazel/third_party/expat.BUILD @@ -0,0 +1,93 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# Expat is an XML parser library written in C. + +licenses(["notice"]) # MIT-style + +load("@com_github_antonovvk_bazel_rules//:config.bzl", "cc_fix_config") + +cc_fix_config( + name = "expat_config_h", + cmake = True, + files = {"expat_config.h.cmake": "expat_config.h"}, + values = { + "BYTEORDER": "1234", + "HAVE_BCOPY": "1", + "HAVE_DLFCN": "1", + "HAVE_FCNTL_H": "1", + "HAVE_GETPAGESIZE": "1", + "HAVE_INTTYPES_H": "1", + "HAVE_MEMMOVE": "1", + "HAVE_MEMORY_H": "1", + "HAVE_STDINT_H": "1", + "HAVE_STDLIB_H": "1", + "HAVE_STRINGS_H": "1", + "HAVE_STRING_H": "1", + "HAVE_SYS_PARAM_H": "1", + "HAVE_SYS_STAT_H": "1", + "HAVE_SYS_TYPES_H": "1", + "HAVE_UNISTD_H": "1", + "LT_OBJDIR": "\".libs/\"", + "PACKAGE_BUGREPORT": "expat-bugs@libexpat.org", + "PACKAGE_NAME": "expat", + "PACKAGE_STRING": "expat 2.2.4", + "PACKAGE_TARNAME": "expat", + "PACKAGE_URL": "", + "PACKAGE_VERSION": "2.2.4", + "STDC_HEADERS": "1", + "XML_CONTEXT_BYTES": "1024", + "XML_DTD": "1", + "XML_NS": "1", + }, +) + +# TODO(rodrigoq): review if we're exposing more headers than users need. +cc_library( + name = "expat", + srcs = [ + "lib/xmlparse.c", + "lib/xmlrole.c", + "lib/xmltok.c", + ], + hdrs = [ + "expat_config.h", + "lib/ascii.h", + "lib/asciitab.h", + "lib/expat.h", + "lib/expat_external.h", + "lib/iasciitab.h", + "lib/internal.h", + "lib/latin1tab.h", + "lib/nametab.h", + "lib/siphash.h", + "lib/utf8tab.h", + "lib/xmlrole.h", + "lib/xmltok.h", + "lib/xmltok_impl.c", + "lib/xmltok_impl.h", + "lib/xmltok_ns.c", + ], + copts = [ + "-DHAVE_EXPAT_CONFIG_H", + "-DXML_DEV_URANDOM", + ], + defines = ["XML_STATIC"], + includes = [ + ".", + "lib", + ], + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/fontconfig/BUILD.bazel b/bazel/third_party/fontconfig/BUILD.bazel new file mode 100644 index 0000000..bb72c8d --- /dev/null +++ b/bazel/third_party/fontconfig/BUILD.bazel @@ -0,0 +1,25 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Files required for building Fontconfig with Bazel. + +licenses(["notice"]) + +exports_files( + [ + "fontconfig.BUILD", + "config.h", + ], + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/fontconfig/config.h b/bazel/third_party/fontconfig/config.h new file mode 100644 index 0000000..3686792 --- /dev/null +++ b/bazel/third_party/fontconfig/config.h @@ -0,0 +1,372 @@ +/* + * Copyright 2018 The Cartographer Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* The normal alignment of `double', in bytes. */ +#define ALIGNOF_DOUBLE 8 + +/* The normal alignment of `void *', in bytes. */ +#define ALIGNOF_VOID_P 8 + +/* Use libxml2 instead of Expat */ +/* #undef ENABLE_LIBXML2 */ + +/* Additional font directories */ +#define FC_ADD_FONTS "yes" + +/* Architecture prefix to use for cache file names */ +#define FC_ARCHITECTURE "elf64-x86-64" + +/* System font directory */ +#define FC_DEFAULT_FONTS "/usr/share/fonts" + +/* The type of len parameter of the gperf hash/lookup function */ +#define FC_GPERF_SIZE_T unsigned int + +/* Define to nothing if C supports flexible array members, and to 1 if it does + not. That way, with a declaration like `struct s { int n; double + d[FLEXIBLE_ARRAY_MEMBER]; };', the struct hack can be used with pre-C99 + compilers. When computing the size of such an object, don't use 'sizeof + (struct s)' as it overestimates the size. Use 'offsetof (struct s, d)' + instead. Don't use 'offsetof (struct s, d[0])', as this doesn't work with + MSVC and with C++ compilers. */ +#define FLEXIBLE_ARRAY_MEMBER /**/ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +#define HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ +/* #undef HAVE_DOPRNT */ + +/* Define to 1 if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define to 1 if you have the `fstatfs' function. */ +#define HAVE_FSTATFS 1 + +/* Define to 1 if you have the `fstatvfs' function. */ +#define HAVE_FSTATVFS 1 + +/* FT_Bitmap_Size structure includes y_ppem field */ +#define HAVE_FT_BITMAP_SIZE_Y_PPEM 1 + +/* Define to 1 if you have the `FT_Get_BDF_Property' function. */ +#define HAVE_FT_GET_BDF_PROPERTY 1 + +/* Define to 1 if you have the `FT_Get_Next_Char' function. */ +#define HAVE_FT_GET_NEXT_CHAR 1 + +/* Define to 1 if you have the `FT_Get_PS_Font_Info' function. */ +#define HAVE_FT_GET_PS_FONT_INFO 1 + +/* Define to 1 if you have the `FT_Get_X11_Font_Format' function. */ +#define HAVE_FT_GET_X11_FONT_FORMAT 1 + +/* Define to 1 if you have the `FT_Has_PS_Glyph_Names' function. */ +#define HAVE_FT_HAS_PS_GLYPH_NAMES 1 + +/* Define to 1 if you have the `FT_Select_Size' function. */ +#define HAVE_FT_SELECT_SIZE 1 + +/* Define to 1 if you have the `getexecname' function. */ +/* #undef HAVE_GETEXECNAME */ + +/* Define to 1 if you have the `getopt' function. */ +#define HAVE_GETOPT 1 + +/* Define to 1 if you have the `getopt_long' function. */ +#define HAVE_GETOPT_LONG 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#define HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getprogname' function. */ +/* #undef HAVE_GETPROGNAME */ + +/* Have Intel __sync_* atomic primitives */ +#define HAVE_INTEL_ATOMIC_PRIMITIVES 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `link' function. */ +#define HAVE_LINK 1 + +/* Define to 1 if you have the `lrand48' function. */ +#define HAVE_LRAND48 1 + +/* Define to 1 if you have the `lstat' function. */ +#define HAVE_LSTAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `mkdtemp' function. */ +#define HAVE_MKDTEMP 1 + +/* Define to 1 if you have the `mkostemp' function. */ +#define HAVE_MKOSTEMP 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#define HAVE_MKSTEMP 1 + +/* Define to 1 if you have a working `mmap' system call. */ +#define HAVE_MMAP 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. */ +/* #undef HAVE_NDIR_H */ + +/* Define to 1 if you have the 'posix_fadvise' function. */ +#define HAVE_POSIX_FADVISE 1 + +/* Have POSIX threads */ +#define HAVE_PTHREAD 1 + +/* Have PTHREAD_PRIO_INHERIT. */ +#define HAVE_PTHREAD_PRIO_INHERIT 1 + +/* Define to 1 if you have the `rand' function. */ +#define HAVE_RAND 1 + +/* Define to 1 if you have the `random' function. */ +#define HAVE_RANDOM 1 + +/* Define to 1 if you have the `random_r' function. */ +#define HAVE_RANDOM_R 1 + +/* Define to 1 if you have the `rand_r' function. */ +#define HAVE_RAND_R 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SCHED_H */ + +/* Have sched_yield */ +/* #undef HAVE_SCHED_YIELD */ + +/* Have Solaris __machine_*_barrier and atomic_* operations */ +/* #undef HAVE_SOLARIS_ATOMIC_OPS */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if `d_type' is a member of `struct dirent'. */ +#define HAVE_STRUCT_DIRENT_D_TYPE 1 + +/* Define to 1 if `f_flags' is a member of `struct statfs'. */ +#define HAVE_STRUCT_STATFS_F_FLAGS 1 + +/* Define to 1 if `f_fstypename' is a member of `struct statfs'. */ +/* #undef HAVE_STRUCT_STATFS_F_FSTYPENAME */ + +/* Define to 1 if `f_basetype' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_BASETYPE */ + +/* Define to 1 if `f_fstypename' is a member of `struct statvfs'. */ +/* #undef HAVE_STRUCT_STATVFS_F_FSTYPENAME */ + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_DIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file, and it defines `DIR'. + */ +/* #undef HAVE_SYS_NDIR_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STATVFS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_VFS_H 1 + +/* Define to 1 if `usLowerOpticalPointSize' is a member of `TT_OS2'. */ +#define HAVE_TT_OS2_USLOWEROPTICALPOINTSIZE 1 + +/* Define to 1 if `usUpperOpticalPointSize' is a member of `TT_OS2'. */ +#define HAVE_TT_OS2_USUPPEROPTICALPOINTSIZE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if you have the `vprintf' function. */ +#define HAVE_VPRINTF 1 + +/* Can use #warning in C files */ +#define HAVE_WARNING_CPP_DIRECTIVE 1 + +/* Use xmlparse.h instead of expat.h */ +/* #undef HAVE_XMLPARSE_H */ + +/* Define to 1 if you have the `XML_SetDoctypeDeclHandler' function. */ +#define HAVE_XML_SETDOCTYPEDECLHANDLER 1 + +/* Define to 1 if you have the `_mktemp_s' function. */ +/* #undef HAVE__MKTEMP_S */ + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "fontconfig" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT \ + "https://bugs.freedesktop.org/enter_bug.cgi?product=fontconfig" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "fontconfig" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "fontconfig 2.11.94" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "fontconfig" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "2.11.94" + +/* Define to necessary symbol if this constant uses a non-standard name on + your system. */ +/* #undef PTHREAD_CREATE_JOINABLE */ + +/* The size of `char', as computed by sizeof. */ +/* #undef SIZEOF_CHAR */ + +/* The size of `int', as computed by sizeof. */ +/* #undef SIZEOF_INT */ + +/* The size of `long', as computed by sizeof. */ +/* #undef SIZEOF_LONG */ + +/* The size of `short', as computed by sizeof. */ +/* #undef SIZEOF_SHORT */ + +/* The size of `void*', as computed by sizeof. */ +/* #undef SIZEOF_VOIDP */ + +/* The size of `void *', as computed by sizeof. */ +#define SIZEOF_VOID_P 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Use iconv. */ +#define USE_ICONV 0 + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +#define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +#define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +#define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif + +/* Version number of package */ +#define VERSION "2.11.94" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +#if defined __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#else +#ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +#endif +#endif + +/* Enable large inode numbers on Mac OS X 10.5. */ +#ifndef _DARWIN_USE_64_BIT_INODE +#define _DARWIN_USE_64_BIT_INODE 1 +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to `int' if does not define. */ +/* #undef pid_t */ diff --git a/bazel/third_party/fontconfig/fontconfig.BUILD b/bazel/third_party/fontconfig/fontconfig.BUILD new file mode 100644 index 0000000..214397f --- /dev/null +++ b/bazel/third_party/fontconfig/fontconfig.BUILD @@ -0,0 +1,130 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# Fontconfig is a library for font customization and configuration. + +licenses(["notice"]) # BSD-like + +genrule( + name = "config_h", + srcs = ["@com_github_googlecartographer_cartographer//bazel/third_party/fontconfig:config.h"], + outs = ["fontconfig_internal/config.h"], + cmd = "cp $< $@", +) + +genrule( + name = "fcalias", + srcs = [ + "fontconfig/fontconfig.h", + "src/fcdeprecate.h", + "fontconfig/fcprivate.h", + ] + glob(["src/*.c"]), + outs = [ + "src/fcalias.h", + "src/fcaliastail.h", + ], + cmd = """./$(location src/makealias) \ + $$(dirname $(location src/makealias)) \ + $(OUTS) \ + $(location fontconfig/fontconfig.h) \ + $(location src/fcdeprecate.h) \ + $(location fontconfig/fcprivate.h)""", + tools = ["src/makealias"], +) + +genrule( + name = "fcftalias", + srcs = ["fontconfig/fcfreetype.h"] + glob(["src/*.c"]), + outs = [ + "src/fcftalias.h", + "src/fcftaliastail.h", + ], + cmd = """./$(location src/makealias) \ + $$(dirname $(location src/makealias)) \ + $(OUTS) \ + $(location fontconfig/fcfreetype.h)""", + tools = ["src/makealias"], +) + +cc_library( + name = "fontconfig", + srcs = [ + "fc-blanks/fcblanks.h", + "fc-case/fccase.h", + "fc-glyphname/fcglyphname.h", + "fc-lang/fclang.h", + "fontconfig/fcfreetype.h", + "fontconfig/fcprivate.h", + "src/fcarch.h", + "src/fcatomic.c", + "src/fcatomic.h", + "src/fcblanks.c", + "src/fccache.c", + "src/fccfg.c", + "src/fccharset.c", + "src/fccompat.c", + "src/fcdbg.c", + "src/fcdefault.c", + "src/fcdeprecate.h", + "src/fcdir.c", + "src/fcformat.c", + "src/fcfreetype.c", + "src/fcfs.c", + "src/fcftint.h", + "src/fcinit.c", + "src/fcint.h", + "src/fclang.c", + "src/fclist.c", + "src/fcmatch.c", + "src/fcmatrix.c", + "src/fcmutex.h", + "src/fcname.c", + "src/fcobjs.c", + "src/fcobjs.h", + "src/fcobjshash.h", + "src/fcpat.c", + "src/fcrange.c", + "src/fcserialize.c", + "src/fcstat.c", + "src/fcstdint.h", + "src/fcstr.c", + "src/fcweight.c", + "src/fcxml.c", + "src/ftglue.c", + "src/ftglue.h", + ":config_h", + ":fcalias", + ":fcftalias", + ], + hdrs = [ + "fontconfig/fontconfig.h", + ], + copts = [ + "-Iexternal/org_freedesktop_fontconfig/src", + "-I$(GENDIR)/external/org_freedesktop_fontconfig/src", + "-I$(GENDIR)/external/org_freedesktop_fontconfig/fontconfig_internal", + "-DFC_CACHEDIR='\"/var/cache/fontconfig\"'", + "-DFONTCONFIG_PATH='\"/etc/fonts\"'", + "-DHAVE_CONFIG_H", + "-Wno-strict-aliasing", + ], + includes = ["."], + visibility = ["//visibility:public"], + deps = [ + "@com_github_libexpat_libexpat//:expat", + "@net_zlib_zlib//:zlib", + "@org_freetype_freetype2//:freetype2", + ], +) diff --git a/bazel/third_party/freetype2.BUILD b/bazel/third_party/freetype2.BUILD new file mode 100644 index 0000000..282c134 --- /dev/null +++ b/bazel/third_party/freetype2.BUILD @@ -0,0 +1,262 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# A free font library. + +licenses(["notice"]) # BSD-style + +cc_library( + name = "freetype2", + srcs = [ + "builds/unix/ftsystem.c", + "src/autofit/autofit.c", + "src/base/ftbase.c", + "src/base/ftbbox.c", + "src/base/ftbdf.c", + "src/base/ftbitmap.c", + "src/base/ftcid.c", + "src/base/ftdebug.c", + "src/base/ftfntfmt.c", + "src/base/ftfstype.c", + "src/base/ftgasp.c", + "src/base/ftglyph.c", + "src/base/ftgxval.c", + "src/base/ftinit.c", + "src/base/ftlcdfil.c", + "src/base/ftmm.c", + "src/base/ftotval.c", + "src/base/ftpatent.c", + "src/base/ftpfr.c", + "src/base/ftstroke.c", + "src/base/ftsynth.c", + "src/base/fttype1.c", + "src/base/ftwinfnt.c", + "src/bdf/bdf.c", + "src/bzip2/ftbzip2.c", + "src/cache/ftcache.c", + "src/cff/cff.c", + "src/cid/type1cid.c", + "src/gxvalid/gxvalid.c", + "src/gzip/ftgzip.c", + "src/lzw/ftlzw.c", + "src/otvalid/otvalid.c", + "src/pcf/pcf.c", + "src/pfr/pfr.c", + "src/psaux/psaux.c", + "src/pshinter/pshinter.c", + "src/psnames/psnames.c", + "src/raster/raster.c", + "src/sfnt/sfnt.c", + "src/smooth/smooth.c", + "src/truetype/truetype.c", + "src/type1/type1.c", + "src/type42/type42.c", + "src/winfonts/winfnt.c", + ] + glob([ + "src/**/*.h", + "builds/unix/*.h", + "include/freetype/internal/**/*.h", + ]), + hdrs = glob([ + "include/freetype/*.h", + "include/freetype/config/*.h", + "include/ft2build.h", + ]) + [ + "src/autofit/afangles.c", + "src/autofit/afblue.c", + "src/autofit/afcjk.c", + "src/autofit/afdummy.c", + "src/autofit/afglobal.c", + "src/autofit/afhints.c", + "src/autofit/afindic.c", + "src/autofit/aflatin.c", + "src/autofit/aflatin2.c", + "src/autofit/afloader.c", + "src/autofit/afmodule.c", + "src/autofit/afpic.c", + "src/autofit/afranges.c", + "src/autofit/afwarp.c", + "src/autofit/afshaper.c", + "src/base/basepic.c", + "src/base/ftadvanc.c", + "src/base/ftapi.c", + "src/base/ftcalc.c", + "src/base/ftdbgmem.c", + "src/base/ftgloadr.c", + "src/base/fthash.c", + "src/base/ftmac.c", + "src/base/ftobjs.c", + "src/base/ftoutln.c", + "src/base/ftpic.c", + "src/base/ftrfork.c", + "src/base/ftsnames.c", + "src/base/ftstream.c", + "src/base/ftsystem.c", + "src/base/fttrigon.c", + "src/base/ftutil.c", + "src/base/md5.c", + "src/bdf/bdfdrivr.c", + "src/bdf/bdflib.c", + "src/cache/ftcbasic.c", + "src/cache/ftccache.c", + "src/cache/ftccmap.c", + "src/cache/ftcglyph.c", + "src/cache/ftcimage.c", + "src/cache/ftcmanag.c", + "src/cache/ftcmru.c", + "src/cache/ftcsbits.c", + "src/cff/cf2arrst.c", + "src/cff/cf2blues.c", + "src/cff/cf2error.c", + "src/cff/cf2font.c", + "src/cff/cf2ft.c", + "src/cff/cf2hints.c", + "src/cff/cf2intrp.c", + "src/cff/cf2read.c", + "src/cff/cf2stack.c", + "src/cff/cffcmap.c", + "src/cff/cffdrivr.c", + "src/cff/cffgload.c", + "src/cff/cffload.c", + "src/cff/cffobjs.c", + "src/cff/cffparse.c", + "src/cff/cffpic.c", + "src/cid/cidgload.c", + "src/cid/cidload.c", + "src/cid/cidobjs.c", + "src/cid/cidparse.c", + "src/cid/cidriver.c", + "src/gxvalid/gxvalid.c", + "src/gxvalid/gxvbsln.c", + "src/gxvalid/gxvcommn.c", + "src/gxvalid/gxvfeat.c", + "src/gxvalid/gxvfgen.c", + "src/gxvalid/gxvjust.c", + "src/gxvalid/gxvkern.c", + "src/gxvalid/gxvlcar.c", + "src/gxvalid/gxvmod.c", + "src/gxvalid/gxvmort.c", + "src/gxvalid/gxvmort0.c", + "src/gxvalid/gxvmort1.c", + "src/gxvalid/gxvmort2.c", + "src/gxvalid/gxvmort4.c", + "src/gxvalid/gxvmort5.c", + "src/gxvalid/gxvmorx.c", + "src/gxvalid/gxvmorx0.c", + "src/gxvalid/gxvmorx1.c", + "src/gxvalid/gxvmorx2.c", + "src/gxvalid/gxvmorx4.c", + "src/gxvalid/gxvmorx5.c", + "src/gxvalid/gxvopbd.c", + "src/gxvalid/gxvprop.c", + "src/gxvalid/gxvtrak.c", + "src/gzip/adler32.c", + "src/gzip/infblock.c", + "src/gzip/infcodes.c", + "src/gzip/inflate.c", + "src/gzip/inftrees.c", + "src/gzip/infutil.c", + "src/gzip/zutil.c", + "src/lzw/ftzopen.c", + "src/otvalid/otvalid.c", + "src/otvalid/otvbase.c", + "src/otvalid/otvcommn.c", + "src/otvalid/otvgdef.c", + "src/otvalid/otvgpos.c", + "src/otvalid/otvgsub.c", + "src/otvalid/otvjstf.c", + "src/otvalid/otvmath.c", + "src/otvalid/otvmod.c", + "src/pcf/pcfdrivr.c", + "src/pcf/pcfread.c", + "src/pcf/pcfutil.c", + "src/pfr/pfrcmap.c", + "src/pfr/pfrdrivr.c", + "src/pfr/pfrgload.c", + "src/pfr/pfrload.c", + "src/pfr/pfrobjs.c", + "src/pfr/pfrsbit.c", + "src/psaux/afmparse.c", + "src/psaux/psauxmod.c", + "src/psaux/psconv.c", + "src/psaux/psobjs.c", + "src/psaux/t1cmap.c", + "src/psaux/t1decode.c", + "src/pshinter/pshalgo.c", + "src/pshinter/pshglob.c", + "src/pshinter/pshmod.c", + "src/pshinter/pshpic.c", + "src/pshinter/pshrec.c", + "src/psnames/psmodule.c", + "src/psnames/pspic.c", + "src/raster/ftraster.c", + "src/raster/ftrend1.c", + "src/raster/rastpic.c", + "src/sfnt/pngshim.c", + "src/sfnt/sfdriver.c", + "src/sfnt/sfntpic.c", + "src/sfnt/sfobjs.c", + "src/sfnt/ttbdf.c", + "src/sfnt/ttcmap.c", + "src/sfnt/ttkern.c", + "src/sfnt/ttload.c", + "src/sfnt/ttmtx.c", + "src/sfnt/ttpost.c", + "src/sfnt/ttsbit.c", + "src/smooth/ftgrays.c", + "src/smooth/ftsmooth.c", + "src/smooth/ftspic.c", + "src/tools/ftrandom/ftrandom.c", + "src/tools/test_afm.c", + "src/tools/test_bbox.c", + "src/tools/test_trig.c", + "src/truetype/ttdriver.c", + "src/truetype/ttgload.c", + "src/truetype/ttgxvar.c", + "src/truetype/ttinterp.c", + "src/truetype/ttobjs.c", + "src/truetype/ttpic.c", + "src/truetype/ttpload.c", + "src/truetype/ttsubpix.c", + "src/type1/t1afm.c", + "src/type1/t1driver.c", + "src/type1/t1gload.c", + "src/type1/t1load.c", + "src/type1/t1objs.c", + "src/type1/t1parse.c", + "src/type42/t42drivr.c", + "src/type42/t42objs.c", + "src/type42/t42parse.c", + ], + copts = [ + "-Wno-covered-switch-default", + "-DFT_CONFIG_OPTION_SYSTEM_ZLIB", + "-DFT_CONFIG_CONFIG_H=", + "-DFT_CONFIG_OPTION_USE_PNG", + "-DFT2_BUILD_LIBRARY", + "-DFT_CONFIG_MODULES_H=", + "-DHAVE_UNISTD_H=1", + "-DHAVE_FCNTL_H=1", + "-DHAVE_STDINT_H=1", + "-Iexternal/org_freetype_freetype2/builds/unix", + "-Iexternal/org_freetype_freetype2/include/freetype/config", + ], + includes = ["include"], + visibility = ["//visibility:public"], + deps = [ + "@net_zlib_zlib//:zlib", + "@org_libpng_libpng//:libpng", + ], +) diff --git a/bazel/third_party/gd.BUILD b/bazel/third_party/gd.BUILD new file mode 100644 index 0000000..c351eaf --- /dev/null +++ b/bazel/third_party/gd.BUILD @@ -0,0 +1,124 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# GD is a library for the dynamic creation of images. + +load("@com_github_antonovvk_bazel_rules//:config.bzl", "cc_fix_config") + +licenses(["notice"]) # simple notice-style license + +cc_fix_config( + name = "config_h", + cmake = True, + files = {"src/config.h.cmake": "gd_internal/config.h"}, + values = { + "HAVE_DIRENT_H": "1", + "HAVE_DLFCN_H": "1", + "HAVE_ERRNO_H": "1", + "HAVE_FT2BUILD_H": "1", + "HAVE_ICONV": "1", + "HAVE_ICONV_H": "1", + "HAVE_ICONV_T_DEF": "1", + "HAVE_INTTYPES_H": "1", + "HAVE_LIBFREETYPE": "1", + "HAVE_LIBJPEG": "1", + "HAVE_LIBM": "1", + "HAVE_LIBPNG": "1", + "HAVE_LIBZ": "1", + "HAVE_LIMITS_H": "1", + "HAVE_MEMORY_H": "1", + "HAVE_PTHREAD": "1", + "HAVE_PTHREAD_PRIO_INHERIT": "1", + "HAVE_STDDEF_H": "1", + "HAVE_STDINT_H": "1", + "HAVE_STDLIB_H": "1", + "HAVE_STRINGS_H": "1", + "HAVE_STRING_H": "1", + "HAVE_SYS_STAT_H": "1", + "HAVE_SYS_TYPES_H": "1", + "HAVE_UNISTD_H": "1", + "HAVE_VISIBILITY": "1", + "ICONV_CONST": "", + "LT_OBJDIR": "\".libs/\"", + "PACKAGE": "libgd", + "PACKAGE_BUGREPORT": "https://bitbucket.org/libgd/gd-libgd/issues", + "PACKAGE_NAME": "GD", + "PACKAGE_STRING": "GD 2.2.4", + "PACKAGE_TARNAME": "libgd", + "PACKAGE_URL": "http://lib.gd", + "PACKAGE_VERSION": "2.2.4", + "STDC_HEADERS": "1", + "VERSION": "2.2.4", + }, +) + +cc_library( + name = "gd", + srcs = [ + "src/gd.c", + "src/gd_color.c", + "src/gd_gd.c", + "src/gd_gd2.c", + "src/gd_gif_in.c", + "src/gd_gif_out.c", + "src/gd_io.c", + "src/gd_io_dp.c", + "src/gd_io_file.c", + "src/gd_io_ss.c", + "src/gd_jpeg.c", + "src/gd_nnquant.c", + "src/gd_png.c", + "src/gd_security.c", + "src/gd_ss.c", + "src/gd_topal.c", + "src/gd_wbmp.c", + "src/gd_xbm.c", + "src/gdcache.c", + "src/gdfontg.c", + "src/gdfontl.c", + "src/gdfontmb.c", + "src/gdfonts.c", + "src/gdfontt.c", + "src/gdft.c", + "src/gdfx.c", + "src/gdhelpers.c", + "src/gdkanji.c", + "src/gdtables.c", + "src/gdxpm.c", + "src/wbmp.c", + "gd_internal/config.h", + ] + glob([ + "src/*.h", + ]), + hdrs = [ + "src/gd.h", + "src/gdhelpers.h", + ], + copts = [ + "-I$(GENDIR)/external/org_libgd_libgd/gd_internal", + "-DFC_CACHEDIR='\"/var/cache/fontconfig\"'", + "-DFONTCONFIG_PATH='\"/etc/fonts\"'", + "-DHAVE_CONFIG_H", + ], + includes = ["src"], + linkopts = ["-lm"], + visibility = ["//visibility:public"], + deps = [ + "@libjpeg//:jpeg", + "@net_zlib_zlib//:zlib", + "@org_freetype_freetype2//:freetype2", + "@org_libpng_libpng//:libpng", + ], +) diff --git a/bazel/third_party/libjpeg.BUILD b/bazel/third_party/libjpeg.BUILD new file mode 100644 index 0000000..cb9aa9d --- /dev/null +++ b/bazel/third_party/libjpeg.BUILD @@ -0,0 +1,103 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# The Independent JPEG Group's JPEG runtime library. + +licenses(["notice"]) # custom notice-style license, see LICENSE + +cc_library( + name = "jpeg", + srcs = [ + "cderror.h", + "cdjpeg.h", + "jaricom.c", + "jcapimin.c", + "jcapistd.c", + "jcarith.c", + "jccoefct.c", + "jccolor.c", + "jcdctmgr.c", + "jchuff.c", + "jcinit.c", + "jcmainct.c", + "jcmarker.c", + "jcmaster.c", + "jcomapi.c", + "jconfig.h", + "jcparam.c", + "jcprepct.c", + "jcsample.c", + "jctrans.c", + "jdapimin.c", + "jdapistd.c", + "jdarith.c", + "jdatadst.c", + "jdatasrc.c", + "jdcoefct.c", + "jdcolor.c", + "jdct.h", + "jddctmgr.c", + "jdhuff.c", + "jdinput.c", + "jdmainct.c", + "jdmarker.c", + "jdmaster.c", + "jdmerge.c", + "jdpostct.c", + "jdsample.c", + "jdtrans.c", + "jerror.c", + "jfdctflt.c", + "jfdctfst.c", + "jfdctint.c", + "jidctflt.c", + "jidctfst.c", + "jidctint.c", + "jinclude.h", + "jmemmgr.c", + "jmemnobs.c", + "jmemsys.h", + "jmorecfg.h", + "jquant1.c", + "jquant2.c", + "jutils.c", + "jversion.h", + "transupp.h", + ], + hdrs = [ + "jerror.h", + "jpegint.h", + "jpeglib.h", + ], + includes = ["."], + visibility = ["//visibility:public"], +) + +genrule( + name = "configure", + outs = ["jconfig.h"], + cmd = "cat <$@\n" + + "#define HAVE_PROTOTYPES 1\n" + + "#define HAVE_UNSIGNED_CHAR 1\n" + + "#define HAVE_UNSIGNED_SHORT 1\n" + + "#define HAVE_STDDEF_H 1\n" + + "#define HAVE_STDLIB_H 1\n" + + "#ifdef WIN32\n" + + "#define INLINE __inline\n" + + "#else\n" + + "#define INLINE __inline__\n" + + "#endif\n" + + "EOF\n", +) diff --git a/bazel/third_party/libpng.BUILD b/bazel/third_party/libpng.BUILD new file mode 100644 index 0000000..23d9a29 --- /dev/null +++ b/bazel/third_party/libpng.BUILD @@ -0,0 +1,47 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# libpng is the official PNG reference library. + +licenses(["notice"]) # BSD/MIT-like license + +cc_library( + name = "libpng", + srcs = [ + "png.c", + "pngerror.c", + "pngget.c", + "pngmem.c", + "pngpread.c", + "pngread.c", + "pngrio.c", + "pngrtran.c", + "pngrutil.c", + "pngset.c", + "pngtrans.c", + "pngwio.c", + "pngwrite.c", + "pngwtran.c", + "pngwutil.c", + ], + hdrs = [ + "png.h", + "pngconf.h", + ], + includes = ["."], + linkopts = ["-lm"], + visibility = ["//visibility:public"], + deps = ["@net_zlib_zlib//:zlib"], +) diff --git a/bazel/third_party/lua.BUILD b/bazel/third_party/lua.BUILD new file mode 100644 index 0000000..49284a9 --- /dev/null +++ b/bazel/third_party/lua.BUILD @@ -0,0 +1,109 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# Lua language interpreter. + +package( + default_visibility = ["//visibility:public"], +) + +licenses(["notice"]) # MIT + +cc_library( + name = "lua_includes", + hdrs = [ + "src/lauxlib.h", + "src/lua.h", + "src/lua.hpp", + "src/luaconf.h", + "src/lualib.h", + ], + includes = ["src"], +) + +cc_library( + name = "lua", + srcs = [ + # Core language + "src/lapi.c", + "src/lapi.h", + "src/lcode.c", + "src/lcode.h", + "src/lctype.c", + "src/lctype.h", + "src/ldebug.c", + "src/ldebug.h", + "src/ldo.c", + "src/ldo.h", + "src/ldump.c", + "src/lfunc.c", + "src/lfunc.h", + "src/lgc.c", + "src/lgc.h", + "src/llex.c", + "src/llex.h", + "src/llimits.h", + "src/lmem.c", + "src/lmem.h", + "src/lobject.c", + "src/lobject.h", + "src/lopcodes.c", + "src/lopcodes.h", + "src/lparser.c", + "src/lparser.h", + "src/lstate.c", + "src/lstate.h", + "src/lstring.c", + "src/lstring.h", + "src/ltable.c", + "src/ltable.h", + "src/ltm.c", + "src/ltm.h", + "src/lundump.c", + "src/lundump.h", + "src/lvm.c", + "src/lvm.h", + "src/lzio.c", + + # Standard libraries + "src/lauxlib.c", + "src/lbaselib.c", + "src/lbitlib.c", + "src/lcorolib.c", + "src/ldblib.c", + "src/linit.c", + "src/liolib.c", + "src/lmathlib.c", + "src/loadlib.c", + "src/loslib.c", + "src/lstrlib.c", + "src/ltablib.c", + "src/lzio.h", + ], + hdrs = [ + "src/lauxlib.h", + "src/lua.h", + "src/lua.hpp", + "src/luaconf.h", + "src/lualib.h", + ], + copts = ["-w"], + defines = ["LUA_USE_LINUX"], + includes = ["src"], + linkopts = [ + "-lm", + "-ldl", + ], +) diff --git a/bazel/third_party/pixman/BUILD.bazel b/bazel/third_party/pixman/BUILD.bazel new file mode 100644 index 0000000..b3c5577 --- /dev/null +++ b/bazel/third_party/pixman/BUILD.bazel @@ -0,0 +1,25 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Files required for building Pixman with Bazel. + +licenses(["notice"]) + +exports_files( + [ + "pixman.BUILD", + "config.h", + ], + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/pixman/config.h b/bazel/third_party/pixman/config.h new file mode 100644 index 0000000..8f68a1b --- /dev/null +++ b/bazel/third_party/pixman/config.h @@ -0,0 +1,193 @@ +/* + * Copyright 2018 The Cartographer Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Whether we have alarm() */ +#define HAVE_ALARM 1 + +/* Whether the compiler supports __builtin_clz */ +#define HAVE_BUILTIN_CLZ /**/ + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Whether we have feenableexcept() */ +#define HAVE_FEENABLEEXCEPT 1 + +/* Define to 1 if we have */ +#define HAVE_FENV_H 1 + +/* Whether the tool chain supports __float128 */ +#define HAVE_FLOAT128 /**/ + +/* Define to 1 if you have the `getisax' function. */ +/* #undef HAVE_GETISAX */ + +/* Whether we have getpagesize() */ +#define HAVE_GETPAGESIZE 1 + +/* Whether we have gettimeofday() */ +#define HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the `pixman-1' library (-lpixman-1). */ +/* #undef HAVE_LIBPIXMAN_1 */ + +/* Whether we have libpng */ +#define HAVE_LIBPNG 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Whether we have mmap() */ +#define HAVE_MMAP 1 + +/* Whether we have mprotect() */ +#define HAVE_MPROTECT 1 + +/* Whether we have posix_memalign() */ +#define HAVE_POSIX_MEMALIGN 1 + +/* Whether pthreads is supported */ +#define HAVE_PTHREADS /**/ + +/* Whether we have sigaction() */ +#define HAVE_SIGACTION 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if we have */ +#define HAVE_SYS_MMAN_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#define LT_OBJDIR ".libs/" + +/* Name of package */ +#define PACKAGE "pixman" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "pixman@lists.freedesktop.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "pixman" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "pixman 0.34.0" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "pixman" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "0.34.0" + +/* enable TIMER_BEGIN/TIMER_END macros */ +/* #undef PIXMAN_TIMERS */ + +/* The size of `long', as computed by sizeof. */ +#define SIZEOF_LONG 8 + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* The compiler supported TLS storage class */ +#define TLS __thread + +/* Whether the tool chain supports __attribute__((constructor)) */ +#define TOOLCHAIN_SUPPORTS_ATTRIBUTE_CONSTRUCTOR /**/ + +/* use ARM IWMMXT compiler intrinsics */ +/* #undef USE_ARM_IWMMXT */ + +/* use ARM NEON assembly optimizations */ +/* #undef USE_ARM_NEON */ + +/* use ARM SIMD assembly optimizations */ +/* #undef USE_ARM_SIMD */ + +/* use GNU-style inline assembler */ +#define USE_GCC_INLINE_ASM 1 + +/* use Loongson Multimedia Instructions */ +/* #undef USE_LOONGSON_MMI */ + +/* use MIPS DSPr2 assembly optimizations */ +/* #undef USE_MIPS_DSPR2 */ + +/* use OpenMP in the test suite */ +#define USE_OPENMP 1 + +/* use SSE2 compiler intrinsics */ +/* #undef USE_SSE2 */ + +/* use SSSE3 compiler intrinsics */ +/* #undef USE_SSSE3 */ + +/* use VMX compiler intrinsics */ +/* #undef USE_VMX */ + +/* use x86 MMX compiler intrinsics */ +/* #undef USE_X86_MMX */ + +/* Version number of package */ +#define VERSION "0.34.0" + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +#if defined __BIG_ENDIAN__ +#define WORDS_BIGENDIAN 1 +#endif +#else +#ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +#endif +#endif + +/* Define to `__inline__' or `__inline' if that's what the C compiler + calls it, or to nothing if 'inline' is not supported under any name. */ +#ifndef __cplusplus +/* #undef inline */ +#endif + +/* Define to sqrt if you do not have the `sqrtf' function. */ +/* #undef sqrtf */ diff --git a/bazel/third_party/pixman/pixman.BUILD b/bazel/third_party/pixman/pixman.BUILD new file mode 100644 index 0000000..8b1eb84 --- /dev/null +++ b/bazel/third_party/pixman/pixman.BUILD @@ -0,0 +1,87 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Description: +# pixman is a library that provides low-level pixel manipulation features. + +licenses(["notice"]) # X11/MIT + +genrule( + name = "config_h", + srcs = ["@com_github_googlecartographer_cartographer//bazel/third_party/pixman:config.h"], + outs = ["pixman_internal/config.h"], + cmd = "cp $< $@", +) + +COMMON_SRCS = [ + "pixman/pixman.c", + "pixman/pixman-access.c", + "pixman/pixman-access-accessors.c", + "pixman/pixman-arm.c", + "pixman/pixman-bits-image.c", + "pixman/pixman-combine-float.c", + "pixman/pixman-combine32.c", + "pixman/pixman-conical-gradient.c", + "pixman/pixman-edge-accessors.c", + "pixman/pixman-edge.c", + "pixman/pixman-fast-path.c", + "pixman/pixman-filter.c", + "pixman/pixman-general.c", + "pixman/pixman-glyph.c", + "pixman/pixman-gradient-walker.c", + "pixman/pixman-image.c", + "pixman/pixman-implementation.c", + "pixman/pixman-linear-gradient.c", + "pixman/pixman-matrix.c", + "pixman/pixman-mips.c", + "pixman/pixman-noop.c", + "pixman/pixman-ppc.c", + "pixman/pixman-radial-gradient.c", + "pixman/pixman-region16.c", + "pixman/pixman-region32.c", + "pixman/pixman-solid-fill.c", + "pixman/pixman-timer.c", + "pixman/pixman-trap.c", + "pixman/pixman-utils.c", + "pixman/pixman-x86.c", +] + +# TODO(rodrigoq): use MMX extensions where possible +cc_library( + name = "pixman", + srcs = COMMON_SRCS + [ + "pixman/pixman-accessor.h", + "pixman/pixman-combine32.h", + "pixman/pixman-compiler.h", + "pixman/pixman-edge-imp.h", + "pixman/pixman-inlines.h", + "pixman/pixman-private.h", + "pixman/pixman-version.h", + "pixman/pixman.h", + "pixman_internal/config.h", + ], + hdrs = [ + "pixman/pixman-access.c", + "pixman/pixman-edge.c", + "pixman/pixman-region.c", + ], + copts = [ + "-Wno-unused-const-variable", + "-Wno-unused-local-typedefs", + "-DHAVE_CONFIG_H", + "-I$(GENDIR)/external/org_cairographics_pixman/pixman_internal", + ], + includes = ["pixman"], + visibility = ["//visibility:public"], +) diff --git a/bazel/third_party/zlib.BUILD b/bazel/third_party/zlib.BUILD new file mode 100644 index 0000000..df1ce2b --- /dev/null +++ b/bazel/third_party/zlib.BUILD @@ -0,0 +1,50 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +package(default_visibility = ["//visibility:public"]) + +licenses(["notice"]) # BSD/MIT-like license (for zlib) + +cc_library( + name = "zlib", + srcs = [ + "adler32.c", + "compress.c", + "crc32.c", + "crc32.h", + "deflate.c", + "deflate.h", + "gzclose.c", + "gzguts.h", + "gzlib.c", + "gzread.c", + "gzwrite.c", + "infback.c", + "inffast.c", + "inffast.h", + "inffixed.h", + "inflate.c", + "inflate.h", + "inftrees.c", + "inftrees.h", + "trees.c", + "trees.h", + "uncompr.c", + "zconf.h", + "zutil.c", + "zutil.h", + ], + hdrs = ["zlib.h"], + includes = ["."], +) diff --git a/cartographer/BUILD.bazel b/cartographer/BUILD.bazel new file mode 100644 index 0000000..a44d8a9 --- /dev/null +++ b/cartographer/BUILD.bazel @@ -0,0 +1,96 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Top-level proto and C++ targets for Cartographer. + +load("@com_github_antonovvk_bazel_rules//:config.bzl", "cc_fix_config") + +package( + default_visibility = ["//visibility:public"], +) + +licenses(["notice"]) # Apache 2.0 + +proto_library( + name = "protos", + srcs = glob([ + "**/*.proto", + ]), + deps = [ + "@com_google_protobuf//:empty_proto", + ], +) + +cc_proto_library( + name = "cc_protos", + deps = [":protos"], +) + +cc_fix_config( + name = "common_config_h", + cmake = True, + files = {"common/config.h.cmake": "common/config.h"}, + values = { + "CARTOGRAPHER_CONFIGURATION_FILES_DIRECTORY": "todo_set_config_dir_in_cartographer.BUILD", + "PROJECT_SOURCE_DIR": "todo_set_project_source_dir_in_cartographer.BUILD", + }, + visibility = ["//visibility:private"], +) + +cc_library( + name = "cartographer", + srcs = glob( + [ + "**/*.cc", + ], + exclude = [ + "**/*_main.cc", + "**/*_test.cc", + ], + ), + hdrs = [ + "common/config.h", + ] + glob([ + "**/*.h", + ]), + includes = ["."], + deps = [ + ":cc_protos", + "@boost//:iostreams", + "@com_google_glog//:glog", + "@org_cairographics_cairo//:cairo", + "@org_ceres_solver_ceres_solver//:ceres", + "@org_lua_lua//:lua", + "@org_tuxfamily_eigen//:eigen", + ], +) + +# TODO(rodrigoq): these tests need to read the configuration files, but they're +# not able to find them. +EXCLUDED_TESTS = [ + "common/configuration_files_test.cc", + "mapping/map_builder_test.cc", +] + +[cc_test( + name = src.replace("/", "_").replace(".cc", ""), + srcs = [src], + deps = [ + ":cartographer", + "@com_google_googletest//:gtest_main", + ], +) for src in glob( + ["**/*_test.cc"], + exclude = EXCLUDED_TESTS, +)] diff --git a/tools/bazel.rc b/tools/bazel.rc new file mode 100644 index 0000000..84069c0 --- /dev/null +++ b/tools/bazel.rc @@ -0,0 +1,17 @@ +# Copyright 2018 The Cartographer Authors +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Do an optimized build by default, or otherwise Cartographer cannot run +# real-time and certain tests will timeout. +build -c opt