36 lines
1.6 KiB
Text
36 lines
1.6 KiB
Text
|
|
{
|
||
|
|
// Sublime expands BOTH ${var} and $var in cmd/shell_cmd/working_dir.
|
||
|
|
// Any $ meant for bash MUST be escaped as \$ -- see
|
||
|
|
// https://www.sublimetext.com/docs/build_systems.html
|
||
|
|
// Below, ${file} is Sublime's; every \$ is bash's.
|
||
|
|
"shell_cmd": "make --no-print-directory -C __PROJECT_ROOT__",
|
||
|
|
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
|
||
|
|
"working_dir": "__PROJECT_ROOT__",
|
||
|
|
"selector": "source.c++",
|
||
|
|
|
||
|
|
"variants":
|
||
|
|
[
|
||
|
|
{
|
||
|
|
"name": "Build all + Run this file",
|
||
|
|
"shell_cmd": "test -n \"${file}\" || { echo 'Click into a .cpp tab, then build.'; exit 1; }; make --no-print-directory -C __PROJECT_ROOT__ && \"\\$(dirname \"${file}\")/\\$(basename \"${file}\" .cpp)\""
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "Build all + Run this file (with stdin)",
|
||
|
|
"shell_cmd": "test -n \"${file}\" || { echo 'Click into a .cpp tab, then build.'; exit 1; }; make --no-print-directory -C __PROJECT_ROOT__ && \"\\$(dirname \"${file}\")/\\$(basename \"${file}\" .cpp)\"",
|
||
|
|
"interactive": true
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "Run this file only (no rebuild of others)",
|
||
|
|
"shell_cmd": "test -n \"${file}\" || { echo 'Click into a .cpp tab, then build.'; exit 1; }; clang++ \\$(cat \"${file_path}/compile_flags.txt\" 2>/dev/null) \"${file}\" -o \"${file_path}/${file_base_name}\" && \"${file_path}/${file_base_name}\""
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "Clean",
|
||
|
|
"shell_cmd": "make --no-print-directory -C __PROJECT_ROOT__ clean && echo cleaned"
|
||
|
|
},
|
||
|
|
{
|
||
|
|
"name": "DIAGNOSTIC - show Sublime variables",
|
||
|
|
"shell_cmd": "echo \"file = [${file}]\"; echo \"file_path = [${file_path}]\"; echo \"base_name = [${file_base_name}]\"; echo \"folder = [${folder}]\""
|
||
|
|
}
|
||
|
|
]
|
||
|
|
}
|