Build systems, Makefile, and a setup script that reproduces this environment on another machine. - CP.sublime-build: incremental make-based build, clang++, flags shared with clangd via compile_flags.txt - compete_CPP.sublime-build: competitive-programming workflow, runs against inputf.in and diffs the result against expectedf.out - Makefile: builds every .cpp in the tree into a binary beside its source - setup.sh: export/install/check, path-neutral payload, idempotent - README: setup notes, the Sublime $-expansion trap, and the -MMD -MP header-dependency limitation to fix later The .sublime-workspace is deliberately excluded: it holds Sublime's global recent-file history and absolute paths. Only the pane layout is portable, extracted to sublime/layout.json. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KCtkkFDkSGi868JWuinwcF
35 lines
1.6 KiB
Text
35 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}]\""
|
|
}
|
|
]
|
|
}
|