original from https://gist.github.com/1387512
Created
May 27, 2012 14:44
-
-
Save clijiac/2814517 to your computer and use it in GitHub Desktop.
A simple C++ builder for Sublime Text 2. (use cl)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: Assumptions: | |
:: - Sublime Text has set the working directory and both the source and executable files | |
:: are in that directory | |
:: - The script is only capable of handling simple C# apps that do not reference 3rd-party | |
:: libraries | |
:: Inputs from Sublime Text | |
:: %1 - The full path and filename of the source file to build | |
:: %2 - The name of the executable file | |
@SET SRC_FILE="%1" | |
@SET EXE_NAME="%2" | |
:: Set up build environment. Change this as necessary depending on the version | |
:: of Visual Studio you wish to use. | |
@CALL "vsvars32.bat" | |
cl /O2 /GL /W3 /TP /EHsc %SRC_FILE% | |
@IF errorlevel 1 GOTO end | |
del *.obj | |
:: Execute compiled binary if build was successful. | |
@ECHO. | |
@ECHO Executing %EXE_NAME%: | |
@ECHO. | |
@%EXE_NAME% | |
::end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cmd": ["g++ -Wall ${file} -o ${file_base_name} && ./${file_base_name}"], "working_dir": "${file_path}", | |
"selector": "source.c++", | |
"shell": true, | |
"windows": | |
{ | |
"cmd": ["$packages\\User\\buildC.bat", "$file", "${file/\\.cpp/\\.exe/}"], | |
"working_dir": "${file_path}", | |
"file_regex": "^(...*?)[(]([0-9]*),([0-9]*)[)]", | |
"shell": true, | |
"encoding": "gb2312" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For mingw use