{"id":29945024,"url":"https://github.com/tdjastrzebski/vscode-cppbuild","last_synced_at":"2025-09-11T07:38:19.749Z","repository":{"id":42983092,"uuid":"215386960","full_name":"tdjastrzebski/vscode-cppbuild","owner":"tdjastrzebski","description":"Build++ VS Code Multi-Step Incremental Build Extension","archived":false,"fork":false,"pushed_at":"2022-03-24T20:15:26.000Z","size":182,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-27T01:12:51.897Z","etag":null,"topics":["build","build-automation","build-tool","build-tools","c","c-plus-plus","cpp","vscode","vscode-extension"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tdjastrzebski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-15T20:07:00.000Z","updated_at":"2024-08-09T19:27:48.000Z","dependencies_parsed_at":"2022-09-19T17:00:36.677Z","dependency_job_id":null,"html_url":"https://github.com/tdjastrzebski/vscode-cppbuild","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/tdjastrzebski/vscode-cppbuild","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdjastrzebski%2Fvscode-cppbuild","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdjastrzebski%2Fvscode-cppbuild/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdjastrzebski%2Fvscode-cppbuild/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdjastrzebski%2Fvscode-cppbuild/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tdjastrzebski","download_url":"https://codeload.github.com/tdjastrzebski/vscode-cppbuild/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tdjastrzebski%2Fvscode-cppbuild/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274595724,"owners_count":25314018,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["build","build-automation","build-tool","build-tools","c","c-plus-plus","cpp","vscode","vscode-extension"],"created_at":"2025-08-03T04:44:21.610Z","updated_at":"2025-09-11T07:38:19.725Z","avatar_url":"https://github.com/tdjastrzebski.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is it?\n* **Build++** is **VS Code** multi-step incremental build tool extension based on JSON, string templates and [glob syntax](https://en.wikipedia.org/wiki/Glob_(programming)).  \n* **Build++** can build C/C++ projects using [vscode-cpptools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools) `includePath`, `defines` and `forcedInclude` variables combined with its own build steps but it is not limited to C/C++ builds.  \n* **Build++** runs [cppbuild](https://github.com/tdjastrzebski/cppbuild/) command line utility using tasks it creates 'on the fly'.\n\n# How to use it?\n1. Install command line **cppbuild** tool: `npm install cppbuild -g`\n1. Modify created `c_cpp_build.json` file according to your needs.  \n1. Go to menu **Terminal** and choose **Run Task...** option.  \nYou should see additional build tasks available.  \n1. Build can be run from terminal window as well:  \n`cppbuild \u003cconfig name\u003e [build type] -w`  \ne.g. `cppbuild gcc debug -w`  \n`-w` switch with no path tells **cppbuild** to use the current VS Code workspace.  \nAdd `-d` switch to output executed commands, `-c` switch to continue on errors or `-f` switch to force rebuild of all files.  \n\nRun `cppbuild --help` for more options.  \n\n# The idea\nSample build type:\n```yaml\n{\n  \"name\": \"debug\",\n  \"params\": { \"buildTypeParams\": \"-O0 -g\" }\n}\n```\n\nSample build step:\n```yaml\n{\n  \"name\": \"C++ Compile\",\n  \"filePattern\": \"**/*.cpp\",\n  \"outputFile\": \"build/${buildTypeName}/${fileDirectory}/${fileName}.o\",\n  \"command\": \"g++ -c ${buildTypeParams} (-I[$${includePath}]) (-D$${defines}) [${filePath}] -o [${outputFile}]\"\n}\n```\nHere is how it works:\n1. **command** (here g++ compiler) is run for every file matching **filePattern** (**/*.cpp).\n1. `(-I[$${includePath}])` and `(-D$${defines})` define sub-templates repeated for every **includePath** and **defines** value listed in corresponding configuration from **c_cpp_properties.json** file.\n1. `${fileName}`, `${filePath}` and `${fileDirectory}` are substituted by the name, path and relative directory of the file being processed.\n1. `${outputFile}` value is built as defined by **outputFile** template. Note that **outputFile** can be build using relative path of the file being processed. As a result, inside the output **build** folder directory structure will resemble the input directory structure. Required directory will be created if it does not exists.\n1. `${buildTypeParams}` is defined in **build type** section. For DEBUG build type `-O0 -g` switches will be added.\n1. Strings in `[]` are treated as file paths and will be quoted if path contains whitespace. Path separators may be modified depending on the OS.\n1. Be default, if **outputFile** already exists and is more recent than the processed input file, build for this file will not be performed. As a result, only modified files will be built (incremental build).\n\n# Build file syntax\n1. Build step `command` is repeated for every file matching **filePattern** - if **filePattern** is specified.  \n`${fileDirectory}`, `${filePath}` and `${fileName}` variables can be used in command.\n1. In contrast, **fileList** defines `$${fileDirectory}`, `$${filePath}` and `$${fileName}` multi-valued variables, `command` is not repeated. \n1. **filePattern** and **fileList** are mutually exclusive and they use full **glob syntax**, e.g. exclusions can be specified.\n1. Standard `${name}` variable syntax is used. `$${name}` denotes multi-valued variable. Environment variables `${env:name}` can be used as well.\n1. `()` define sub-template. Sub-template can contain only one multi-valued variable.\n1. Strings in `[]` are treated as paths and will be quoted if path contains whitespace. Path separators (\\\\ /) may be modified if needed.  \n`[]` containing multi-valued variable is treated as sub-template as well.\n1. Other variables available: **workspaceRoot**/**workspaceFolder**, **workspaceRootFolderName**, **outputDirectory**, **buildTypeName**, **configName**, **includePath**, **defines** and **forcedInclude**. The last three are populated from `c_cpp_properties.json` file.\n1. Additional variables can be defined almost anywhere using `params` property. Variables defined on lower level take precedence.\n1. Variable values and **outputFile**/**outputDirectory** properties can contain other variables. Example: **outputFile**/**outputDirectory** variable can contain `${fileDirectory}`. As a result, inside the output **build** folder directory structure will resemble the input directory structure.\n1. Be default, if **outputFile** already exists and is more recent than the processed input file, build for this file will not be performed. As a result, only modified files will be built (incremental build).\n\n# Predefined variables\nThe following variables have been predefined:\n1. **workspaceRoot**/**workspaceFolder** (full folder path) and **workspaceRootFolderName** (just the folder name)\n1. **configName** - selected build configuration name\n1. **buildTypeName** - selected build type name (optional)\n1. **filePath** (relative file path), **fileDirectory** (relative file directory), **fileName** (file name without extension), **fullFileName** (file name with extension), **fileExtension** (without .)  \nThe above variables are available when **filePattern** or **fileList** build step property is defined. When **filePattern** is defined, variables have single values and `command` is executed for every file matching the specified pattern. When **fileList** is defined, variables have multiple values but build step `command` is executed just once.\n1. **outputDirectory** - output directory, available when build step **outputDirectory** template is specified\n1. **includePath**, **defines** and **forcedInclude** - multi-valued variables populated from `c_cpp_properties.json` (if used)\n1. **outputFile** - available only when **filePattern** is specified.\n\n# Notes\n1. Executing tasks **VS Code** uses current or default terminal. Therefore, using shell-specific commands in build steps make sure correct terminal shell is active or selected as default.\n1. Build can be run from command line as well. Example: `cppbuild GCC debug`\n1. If used with **vscode-cpptools** `c_cpp_build.json`, file must contain configurations named exactly as those defined in `c_cpp_properties.json` file.\n1. **cppbuild** is not limited to C/C++ builds and can be run without `c_cpp_properties.json` file. Use `-p` option with no file name, which requires **cppbuild** version 1.1.0 or later.\n1. For more options use `cppbuild --help`.\n\n# Why?\nWhile working on C/C++ for embedded devices in VS Code I wanted to simplify multi-step build process configuration and maintenance. Also, I wanted to eliminate setting duplication (include paths and defines) between `c_cpp_properties.json` and widely used MAKE/CMake files.  \nAlthough these tools are industry standard, I am not a big fan of them. All that led me to the development of a completely new build tool.  \nSince **vscode-cpptools** extension is popular and widely used, I adjusted to the status quo and used `c_cpp_properties.json` as it was, instead of supplying my own settings via [vscode-cpptools-api](https://github.com/Microsoft/vscode-cpptools-api).\n\n# Improvements and fixes\nAny improvements, fixes or suggestions are more than welcome on GitHub:  \nhttps://github.com/tdjastrzebski/cppbuild/  \nhttps://github.com/tdjastrzebski/vscode-cppbuild\n\n# Known issues\n1. Although created tasks are marked as Build tasks, they do not appear in **Build Tasks** group. It is not clear whether this is a bug or not.  \nFor details refer to [VS Code issue \\#83378](https://github.com/microsoft/vscode/issues/83378#issuecomment-548838702).\n\n# Release notes\n* 1.0 Initial release\n* 1.1 `params` can be added on all levels, tool can work without C/C++ extension and `c_cpp_properties.json` file.\n* 1.2 Added support for incremental builds and `outputFile` build step property.\n* 1.3 **cppbuild** updated to significantly improved [version 1.3.0](https://github.com/tdjastrzebski/cppbuild#release-notes).\n* 1.3.13 `Tasks unexpectedly provided a task of type \"shell\"` fix.\n* 1.3.16 cppbuild updated to improved version 1.3.16.\n* 1.3.17 lodash updated to ver 4.17.20 to eliminate known vulnerabilities\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdjastrzebski%2Fvscode-cppbuild","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftdjastrzebski%2Fvscode-cppbuild","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftdjastrzebski%2Fvscode-cppbuild/lists"}