Skip to content

Instantly share code, notes, and snippets.

@minhducsun2002
Last active July 23, 2018 08:44
Show Gist options
  • Save minhducsun2002/f75b10e659522f244d2505fa7c1d714a to your computer and use it in GitHub Desktop.
Save minhducsun2002/f75b10e659522f244d2505fa7c1d714a to your computer and use it in GitHub Desktop.
Sublime Text build system for GNU/Linux
{
// Sublime Text build system for GNU/Linux
"cmd": ["g++ \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\""],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
// "selector": "source.c, source.c++, source.cpp",
"selector": "source.c",
"shell": true,
"variants":
[
{
"name": "Build with C++11",
"cmd": ["g++ -std=c++11 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", built with C++11"],
"shell": true
},
{
"name": "Build with C++14",
"cmd": ["g++ -std=c++14 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", built with C++14"],
"shell": true
},
{
"name": "Build with C++17",
"cmd": ["g++ -std=c++17 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", built with C++17"],
"shell": true
},
{
"name": "Invoke compiled binary",
"cmd": ["\"${file_path}\/${file_base_name}\""],
"shell": true
},
{
"name": "Build with C++11 and debugging enabled",
"cmd": ["g++ -g -std=c++11 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", debugging build, built with C++11"],
"shell": true
},
{
"name": "Build with C++14 and debugging enabled",
"cmd": ["g++ -g -std=c++14 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", debugging build, built with C++14"],
"shell": true
},
{
"name": "Build with C++17 and debugging enabled",
"cmd": ["g++ -g -std=c++17 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", debugging build, built with C++17"],
"shell": true
},
{
"name": "Build with C++14 and POSIX multithreading enabled",
"cmd": ["g++ -pthread -std=c++14 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", built with C++14 and POSIX thread"],
"shell": true
},
{
"name": "Build with C++14 and ENG defined",
"cmd": ["g++ -DENG -std=c++14 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", defined ENG using compiler flags, built with C++14"],
"shell": true
},
{
"name": "Build with C++17 and ENG defined",
"cmd": ["g++ -DENG -std=c++17 \"${file}\" -o \"${file_path}\/${file_base_name}\" && echo \"Target binary is at \"\"${file_path}\/${file_base_name}\", ENG defined using compiler flags, built with C++17"],
"shell": true
},
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment