Skip to content

Commit

Permalink
bazel_to_cmake update: Emit include directories more like bazel.
Browse files Browse the repository at this point in the history
In emit_cc, when generating public includes, generate them more
similarly to how bazel generates the includes.

Also add additional golden tests and repair some tests.

NOTE: This still cannot match bazel since bazel constructs virtual
include directories and creates include symlinks between them, which
bazel_to_cmake does not do.
PiperOrigin-RevId: 673563783
Change-Id: I44fc90124608161fd1e15bd7af0d44e570598d6c
  • Loading branch information
laramiel authored and copybara-github committed Sep 11, 2024
1 parent 4b0f8af commit db9432e
Show file tree
Hide file tree
Showing 24 changed files with 849 additions and 340 deletions.
90 changes: 50 additions & 40 deletions tools/cmake/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ SRCS = [
"bazel_to_cmake/cmake_repository.py",
"bazel_to_cmake/cmake_target.py",
"bazel_to_cmake/emit_cc.py",
"bazel_to_cmake/emit_cc_test.py",
"bazel_to_cmake/evaluation.py",
"bazel_to_cmake/golden_test.py",
"bazel_to_cmake/main.py",
Expand Down Expand Up @@ -73,72 +74,81 @@ SRCS = [

# glob(["bazel_to_cmake/testdata/**"]),
TESTDATA = [
"bazel_to_cmake/testdata/upb_proto_library/BUILD.bazel",
"bazel_to_cmake/testdata/upb_proto_library/a.cc",
"bazel_to_cmake/testdata/upb_proto_library/c.proto",
"bazel_to_cmake/testdata/upb_proto_library/config.json",
"bazel_to_cmake/testdata/upb_proto_library/golden/build_rules.cmake",
"bazel_to_cmake/testdata/upb_proto_library/d.proto",
"bazel_to_cmake/testdata/upb_proto_library/WORKSPACE.bazel",
"bazel_to_cmake/testdata/local_mirror/BUILD.bazel",
"bazel_to_cmake/testdata/bazel_skylib/BUILD.bazel",
"bazel_to_cmake/testdata/bazel_skylib/config.json",
"bazel_to_cmake/testdata/bazel_skylib/golden/_cmake_binary_dir_/config.h",
"bazel_to_cmake/testdata/bazel_skylib/golden/build_rules.cmake",
"bazel_to_cmake/testdata/bazel_skylib/WORKSPACE.bazel",
"bazel_to_cmake/testdata/cc_includes/BUILD.bazel",
"bazel_to_cmake/testdata/cc_includes/b.cc",
"bazel_to_cmake/testdata/cc_includes/config.json",
"bazel_to_cmake/testdata/cc_includes/golden/build_rules.cmake",
"bazel_to_cmake/testdata/cc_includes/parent/child/a.h",
"bazel_to_cmake/testdata/cc_includes/parent/child/a.cc",
"bazel_to_cmake/testdata/cc_includes/parent/child/a.inc",
"bazel_to_cmake/testdata/cc_includes/parent/BUILD.bazel",
"bazel_to_cmake/testdata/cc_includes/WORKSPACE.bazel",
"bazel_to_cmake/testdata/grpc_generate_cc/a.cc",
"bazel_to_cmake/testdata/grpc_generate_cc/BUILD.bazel",
"bazel_to_cmake/testdata/grpc_generate_cc/c.proto",
"bazel_to_cmake/testdata/grpc_generate_cc/config.json",
"bazel_to_cmake/testdata/grpc_generate_cc/golden/build_rules.cmake",
"bazel_to_cmake/testdata/grpc_generate_cc/WORKSPACE.bazel",
"bazel_to_cmake/testdata/local_mirror/a.cc",
"bazel_to_cmake/testdata/local_mirror/BUILD.bazel",
"bazel_to_cmake/testdata/local_mirror/config.json",
"bazel_to_cmake/testdata/local_mirror/golden/_find_pkg_redirects_/lpm-config.cmake",
"bazel_to_cmake/testdata/local_mirror/golden/_cmake_binary_dir_/_local_mirror/lpm-src/BUILD.bazel",
"bazel_to_cmake/testdata/local_mirror/golden/_cmake_binary_dir_/_local_mirror/lpm-src/b.cc",
"bazel_to_cmake/testdata/local_mirror/golden/_cmake_binary_dir_/_local_mirror/lpm-src/b.h",
"bazel_to_cmake/testdata/local_mirror/golden/_cmake_binary_dir_/_local_mirror/lpm-src/BUILD.bazel",
"bazel_to_cmake/testdata/local_mirror/golden/_cmake_binary_dir_/_local_mirror/lpm-src/CMakeLists.txt",
"bazel_to_cmake/testdata/local_mirror/golden/_find_pkg_redirects_/lpm-config.cmake",
"bazel_to_cmake/testdata/local_mirror/golden/build_rules.cmake",
"bazel_to_cmake/testdata/local_mirror/WORKSPACE.bazel",
"bazel_to_cmake/testdata/rules_nasm/BUILD.bazel",
"bazel_to_cmake/testdata/rules_nasm/a.cc",
"bazel_to_cmake/testdata/rules_nasm/a.h",
"bazel_to_cmake/testdata/rules_nasm/a.asm",
"bazel_to_cmake/testdata/rules_nasm/config.json",
"bazel_to_cmake/testdata/rules_nasm/golden/build_rules.cmake",
"bazel_to_cmake/testdata/rules_nasm/include/b.inc",
"bazel_to_cmake/testdata/rules_nasm/WORKSPACE.bazel",
"bazel_to_cmake/testdata/bazel_skylib/BUILD.bazel",
"bazel_to_cmake/testdata/bazel_skylib/config.json",
"bazel_to_cmake/testdata/bazel_skylib/golden/_cmake_binary_dir_/config.h",
"bazel_to_cmake/testdata/bazel_skylib/golden/build_rules.cmake",
"bazel_to_cmake/testdata/bazel_skylib/WORKSPACE.bazel",
"bazel_to_cmake/testdata/native_rules/y.h",
"bazel_to_cmake/testdata/native_rules/BUILD.bazel",
"bazel_to_cmake/testdata/native_rules/.bazelrc",
"bazel_to_cmake/testdata/native_rules/a.cc",
"bazel_to_cmake/testdata/native_rules/BUILD.bazel",
"bazel_to_cmake/testdata/native_rules/c.proto",
"bazel_to_cmake/testdata/native_rules/.bazelrc",
"bazel_to_cmake/testdata/native_rules/config.json",
"bazel_to_cmake/testdata/native_rules/golden/build_rules.cmake",
"bazel_to_cmake/testdata/native_rules/subdir/BUILD.bazel",
"bazel_to_cmake/testdata/native_rules/subdir/x.cc",
"bazel_to_cmake/testdata/native_rules/subdir/z.proto",
"bazel_to_cmake/testdata/native_rules/config.json",
"bazel_to_cmake/testdata/native_rules/golden/build_rules.cmake",
"bazel_to_cmake/testdata/native_rules/x.h",
"bazel_to_cmake/testdata/native_rules/WORKSPACE.bazel",
"bazel_to_cmake/testdata/native_rules/x.h",
"bazel_to_cmake/testdata/native_rules/y.h",
"bazel_to_cmake/testdata/rules_nasm/a.asm",
"bazel_to_cmake/testdata/rules_nasm/a.cc",
"bazel_to_cmake/testdata/rules_nasm/a.h",
"bazel_to_cmake/testdata/rules_nasm/BUILD.bazel",
"bazel_to_cmake/testdata/rules_nasm/config.json",
"bazel_to_cmake/testdata/rules_nasm/golden/build_rules.cmake",
"bazel_to_cmake/testdata/rules_nasm/include/b.inc",
"bazel_to_cmake/testdata/rules_nasm/WORKSPACE.bazel",
"bazel_to_cmake/testdata/rules_proto/a.proto",
"bazel_to_cmake/testdata/rules_proto/b.proto",
"bazel_to_cmake/testdata/rules_proto/BUILD.bazel",
"bazel_to_cmake/testdata/rules_proto/c.proto",
"bazel_to_cmake/testdata/rules_proto/config.json",
"bazel_to_cmake/testdata/rules_proto/golden/build_rules.cmake",
"bazel_to_cmake/testdata/rules_proto/b.proto",
"bazel_to_cmake/testdata/rules_proto/a.proto",
"bazel_to_cmake/testdata/rules_proto/WORKSPACE.bazel",
"bazel_to_cmake/testdata/rules_proto/x.proto",
"bazel_to_cmake/testdata/grpc_generate_cc/BUILD.bazel",
"bazel_to_cmake/testdata/grpc_generate_cc/a.cc",
"bazel_to_cmake/testdata/grpc_generate_cc/c.proto",
"bazel_to_cmake/testdata/grpc_generate_cc/config.json",
"bazel_to_cmake/testdata/grpc_generate_cc/golden/build_rules.cmake",
"bazel_to_cmake/testdata/grpc_generate_cc/WORKSPACE.bazel",
"bazel_to_cmake/testdata/third_party_http_archive/BUILD.bazel",
"bazel_to_cmake/testdata/third_party_http_archive/a.cc",
"bazel_to_cmake/testdata/third_party_http_archive/BUILD.bazel",
"bazel_to_cmake/testdata/third_party_http_archive/config.json",
"bazel_to_cmake/testdata/third_party_http_archive/golden/_find_pkg_redirects_/whole-config.cmake",
"bazel_to_cmake/testdata/third_party_http_archive/golden/_find_pkg_redirects_/half-extra.cmake",
"bazel_to_cmake/testdata/third_party_http_archive/golden/_cmake_binary_dir_/third_party/CMakeLists.txt",
"bazel_to_cmake/testdata/third_party_http_archive/golden/_cmake_binary_dir_/third_party/half-proxy-CMakeLists.txt",
"bazel_to_cmake/testdata/third_party_http_archive/golden/_find_pkg_redirects_/half-extra.cmake",
"bazel_to_cmake/testdata/third_party_http_archive/golden/_find_pkg_redirects_/whole-config.cmake",
"bazel_to_cmake/testdata/third_party_http_archive/golden/build_rules.cmake",
"bazel_to_cmake/testdata/third_party_http_archive/half.BUILD.bazel",
"bazel_to_cmake/testdata/third_party_http_archive/WORKSPACE.bazel",
"bazel_to_cmake/testdata/upb_proto_library/a.cc",
"bazel_to_cmake/testdata/upb_proto_library/BUILD.bazel",
"bazel_to_cmake/testdata/upb_proto_library/c.proto",
"bazel_to_cmake/testdata/upb_proto_library/config.json",
"bazel_to_cmake/testdata/upb_proto_library/d.proto",
"bazel_to_cmake/testdata/upb_proto_library/golden/build_rules.cmake",
"bazel_to_cmake/testdata/upb_proto_library/WORKSPACE.bazel",
]

tensorstore_pytest_test(
Expand Down
Loading

0 comments on commit db9432e

Please sign in to comment.