Add public CMake, Visual Studio, and compile database improvements - #1
Merged
Merged
Conversation
…targets Adds a vs_solution tool that scans cc_binary/cc_library/cc_test targets and writes a Visual Studio solution at the workspace root (<name>.sln plus one .vcxproj/.vcxproj.filters per target under vs_projects/) for opening a Bazel workspace in full Visual Studio. - NMake/Makefile projects: Build/Rebuild/Clean shell out to bazel; Debug maps to -c dbg, Release to -c opt. - IntelliSense (include paths, defines, forced includes, compiler options) is sourced from compile_commands.json; build-only flags are stripped and every IntelliSense-relevant flag is forwarded. The sibling compile_commands target is refreshed first automatically (refresh_compile_commands, default on). - cc_binary/cc_test get NMakeOutput + LocalDebuggerCommand pointing at the bazel-bin executable for F5 debugging. - Each target's direct external-dependency headers are listed under an "External Dependencies\<repo>" filter in Solution Explorer. Wired into the cc_devtools bundle and the @devtools extension, exposing a vs_solution_name configure attribute.
…gets Adds a cmake tool that reads cc_library/cc_binary/cc_test build attributes (bazel query --output=xml) and emits a standalone CMakeLists.txt for Bazel-native projects whose users or community consume them via CMake. - cc_library -> add_library (STATIC, or INTERFACE when header-only); cc_binary/cc_test -> add_executable. - strip_include_prefix/includes -> target_include_directories; copts -> compiler-guarded target_compile_options (GCC/Clang vs MSVC); defines -> target_compile_definitions. - intra-repo deps -> target_link_libraries; implicit toolchain deps dropped; curated external deps (googletest) -> find_package-or-FetchContent; cc_test -> CTest with gtest_discover_tests. - No silent gaps: genrules and generated headers, select() branches lost to the current platform, and unmapped external deps are emitted as # TODO(bazel2cmake) comments and reported on the console — the output is a starting point a maintainer finishes, not a guaranteed build. Wired into the cc_devtools bundle and the @devtools extension.
…ge-consumable Public cc_library targets now get install(TARGETS ... EXPORT) with GNUInstallDirs destinations, install(DIRECTORY <include>/), an install(EXPORT) under a <proj>:: namespace, and a generated <proj>Config.cmake.in + version file via CMakePackageConfigHelpers. target_include_directories gains an INSTALL_INTERFACE, and project() carries VERSION read from MODULE.bazel. Downstream consumers can now find_package(<proj>) and link <proj>::<lib>. External deps that exported libraries expose are emitted as find_dependency() in the config.
…ror (#7) Co-authored-by: onur <onurpaca@gmail.com> Co-committed-by: onur <onurpaca@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
compile_commands.jsonwith probed toolchain system include pathsformat_all --fixwithout forwarding an invalid flagWhy
The public GitHub repository was behind the general-purpose improvements developed downstream. This brings over only reusable behavior; SPGM registry, Gitea publishing, internal network configuration, and organization-specific hooks are intentionally excluded.
Root cause of the build failure
cc_devtools.bzlloaded the newcmake.bzlandvs_solution.bzlmodules, butdocs/BUILD.bazeldid not declare theirbzl_librarynodes as Stardoc dependencies. Bazel therefore rejected//docs:allduring analysis.Validation
bazel test //tests:all --test_output=errors: 2/2 targets passedbazel build //:all //cc:all //format_all:all //lint_all:all: 31 targets passed on Windowsgit diff --checkpassedStardoc now passes analysis locally. Its action execution is Linux-only in CI because the upstream Stardoc Maven rules invoke Bash and the local Windows machine has no WSL.