{"id":21764009,"url":"https://github.com/jwmcglynn/bazel-cpp20","last_synced_at":"2025-10-04T22:02:20.228Z","repository":{"id":40575176,"uuid":"289660906","full_name":"jwmcglynn/bazel-cpp20","owner":"jwmcglynn","description":"A template for building C++20 using Clang on Bazel, with GitHub and Codespaces integration.","archived":false,"fork":false,"pushed_at":"2022-05-01T14:34:05.000Z","size":28,"stargazers_count":9,"open_issues_count":1,"forks_count":4,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T04:41:40.658Z","etag":null,"topics":["bazel","clang","cpp","cpp20","template"],"latest_commit_sha":null,"homepage":"","language":"Starlark","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwmcglynn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-08-23T10:10:21.000Z","updated_at":"2024-09-26T10:16:54.000Z","dependencies_parsed_at":"2022-08-09T23:31:57.436Z","dependency_job_id":null,"html_url":"https://github.com/jwmcglynn/bazel-cpp20","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwmcglynn%2Fbazel-cpp20","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwmcglynn%2Fbazel-cpp20/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwmcglynn%2Fbazel-cpp20/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwmcglynn%2Fbazel-cpp20/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwmcglynn","download_url":"https://codeload.github.com/jwmcglynn/bazel-cpp20/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724447,"owners_count":21151557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bazel","clang","cpp","cpp20","template"],"created_at":"2024-11-26T12:17:13.210Z","updated_at":"2025-10-04T22:02:15.190Z","avatar_url":"https://github.com/jwmcglynn.png","language":"Starlark","readme":"# bazel-cpp20: Template for bazel with C++20\n\nThis template sets up a coding environment for C++20 with VSCode, GitHub, and Clang.\n\n## Requirements\n\n* Bazel\n\n### Install Bazel\n\nThe recommended way to use Bazel is to install **Bazelisk**, which will automatically download Bazel as required. To install:\n\n1. Navigate to the Bazelisk releases page: https://github.com/bazelbuild/bazelisk/releases\n2. Download the latest release, and install it as `~/bin/bazel`\n3. `chmod +x ~/bin/bazel`\n4. Update your `~/.bashrc` (or equivalent) to add this directory to your path:\n    ```\n    export PATH=$PATH:$HOME/bin\n    ```\n\n## macOS: Install XCode\n\nOn Linux, this workspace is configured to automatically download Clang and configure it as a toolchain, but that mode does not support Apple Silicon yet.  So to enable building for macOS, the system toolchain is used instead.\n\nNote that on macOS fuzzing builds are not yet supported.\n\n## That's it!\n\nVerify that you can build with\n\n```\nbazel build //...\n```\n\nAll other dependencies will be downloaded on-demand.\n\n## Running Tests\n\nThis repository is set up with gtest and a simple `cc_fuzzer` wrapper. To run tests:\n\n```\nbazel test //...\n```\n\nTo run the fuzzer:\n\n```\nbazel build --config=asan-fuzzer //sample:sample_fuzzer\nbazel-bin/sample/sample_fuzzer\n```\n\n## Code Coverage\n\nCoverage support is included based on the built-in `bazel coverage` sub-command, and a helper is included to wrap functionality and generate a coverage report.\n\nTo run it, first ensure that java and lcov are installed, and then run:\n\n```\nbuild/coverage.sh\n```\n\nThese dependencies are automatically installed in the devcontainer.  Outside of the devcontainer, this is the Ubuntu install command:\n```\nsudo apt-get openjdk-11-jdk lcov\n```\n\n### Integration with Codecov.io\n\nTo enable uploading Code Coverage to https://codecov.io, find your repositories upload token, see the instructions in the Codecov FAQ: [Where is the repository upload token found?](https://docs.codecov.com/docs/frequently-asked-questions#where-is-the-repository-upload-token-found).\n\nThen set it as a GitHub Actions Secret using the GitHub [Creating encrypted secrets for a repository](https://docs.github.com/en/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository) instructions.\n\nSee this template's code coverage report for an example: https://codecov.io/gh/jwmcglynn/bazel-cpp20\n\n## Devcontainer\n\nTo use the devcontainer, install the VSCode [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.\n\n### Command History Syncing\n\nCommand history syncing hooks, based on the [Advanced Containers: Persist bash history](https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history) docs, are included.  Final registration is required to enable them, so it is recommended to use Dotfiles and add the following registration:\n\n#### Zsh Registration\n```\n# See https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history\nif [ -d /commandhistory ]; then\n  touch /commandhistory/.zsh_history\n  export HISTFILE=\"/commandhistory/.zsh_history\"\nelse\n  echo \"Warning: Could not enable history sharing, there is no /commandhistory directory.\"\nfi\n```\n\n#### Bash Registration\n```\n# See https://code.visualstudio.com/remote/advancedcontainers/persist-bash-history\nif [ -d /commandhistory ]; then\n  touch /commandhistory/.bash_history\n  export PROMPT_COMMAND='history -a'\n  export HISTFILE=\"/commandhistory/.bash_history\"\nelse\n  echo \"Warning: Could not enable history sharing, there is no /commandhistory directory.\"\nfi\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwmcglynn%2Fbazel-cpp20","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwmcglynn%2Fbazel-cpp20","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwmcglynn%2Fbazel-cpp20/lists"}