Skip to content

Instantly share code, notes, and snippets.

@xxMrPHDxx
Created May 9, 2020 03:09
Show Gist options
  • Save xxMrPHDxx/964a2b0a54750d67d6020d595199c6af to your computer and use it in GitHub Desktop.
Save xxMrPHDxx/964a2b0a54750d67d6020d595199c6af to your computer and use it in GitHub Desktop.
{
"shell_cmd": "sfml \"${file_path}\"",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c++",
"variants": [
{
"name": "Run",
"shell_cmd": "sfml \"${file_path}\" run"
}
]
}
@echo off
set INCLUDE_DIR="-ID:\\SFML-2.5.1\\include"
set LIBRARY_DIR="-LD:\\SFML-2.5.1\\lib"
set OPTIONS=-O0 -g3 -Wall -c -fmessage-length=0
for /F "usebackq delims=\" %%a in ('%1\.') do set FOLDER=%%~nxa
rem Store all cpp files path in a text file
dir "%FOLDER%" /S /B *.cpp > sources.txt
for /F "delims=. tokens=1,2" %%a in (sources.txt) do g++ %INCLUDE_DIR% %OPTIONS% -o "%%a.o" "%%a.%%b"
del sources.txt
dir "%FOLDER%" /S /B *.o > compiled.txt
setlocal EnableDelayedExpansion
set OBJ_FILES=
for /F "delims=;" %%a in (compiled.txt) do set OBJ_FILES="%%a" !OBJ_FILES!
setlocal DisableDelayedExpansion
del compiled.txt
set LIBRARIES=-lsfml-graphics -lsfml-window -lsfml-system
g++ %LIBRARY_DIR% -o %FOLDER%.exe %OBJ_FILES% %LIBRARIES%
del /S /Q *.o > NUL
if %2==run %FOLDER%.exe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment