From 53ab650609ae9b256ed119363a87b890dc3d7721 Mon Sep 17 00:00:00 2001 From: Praveen Date: Sat, 28 Mar 2020 00:53:11 +0530 Subject: [PATCH] Support for MinGW in windows --- templates/project/files.json | 11 +++++++++++ templates/project/mingw/Makefile | 23 +++++++++++++++++++++++ templates/project/mingw/launch.json | 26 ++++++++++++++++++++++++++ templates/project/mingw/tasks.json | 26 ++++++++++++++++++++++++++ 4 files changed, 86 insertions(+) create mode 100644 templates/project/mingw/Makefile create mode 100644 templates/project/mingw/launch.json create mode 100644 templates/project/mingw/tasks.json diff --git a/templates/project/files.json b/templates/project/files.json index 04fb2dd..90d00ec 100644 --- a/templates/project/files.json +++ b/templates/project/files.json @@ -30,6 +30,17 @@ "src/main.cpp" ] }, + "[MinGW] MinGW for windows": { + "files": { + "mingw/Makefile": "Makefile", + "mingw/tasks.json": ".vscode/tasks.json", + "mingw/launch.json": ".vscode/launch.json", + "hello-world/main.cpp": "src/main.cpp" + }, + "openFiles":[ + "src/main.cpp" + ] + }, "[WSL] Windows Subsystem for Linux": { "files": { "shared/Makefile": "Makefile", diff --git a/templates/project/mingw/Makefile b/templates/project/mingw/Makefile new file mode 100644 index 0000000..c1ba5d8 --- /dev/null +++ b/templates/project/mingw/Makefile @@ -0,0 +1,23 @@ +CXX := g++ +CXX_FLAGS := -Wall -Wextra -std=c++11 -ggdb + +BIN := bin +SRC := src +INCLUDE := include +LIB := lib + +LIBRARIES := +EXECUTABLE := main.exe + + +all: $(BIN)/$(EXECUTABLE) + +run: clean all + cls + ./$(BIN)/$(EXECUTABLE) + +$(BIN)/$(EXECUTABLE): $(SRC)/*.cpp + $(CXX) $(CXX_FLAGS) -I$(INCLUDE) -L$(LIB) $^ -o $@ $(LIBRARIES) + +clean: + rm $(BIN)/* diff --git a/templates/project/mingw/launch.json b/templates/project/mingw/launch.json new file mode 100644 index 0000000..44e06ea --- /dev/null +++ b/templates/project/mingw/launch.json @@ -0,0 +1,26 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "C++ Debug (gdb)", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/bin/main.exe", + "preLaunchTask": "Build C++ project", + "args": [], + "stopAtEntry": false, + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": true, + "MIMode": "gdb", + "miDebuggerPath": "gdb.exe", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + ] +} \ No newline at end of file diff --git a/templates/project/mingw/tasks.json b/templates/project/mingw/tasks.json new file mode 100644 index 0000000..4cacf62 --- /dev/null +++ b/templates/project/mingw/tasks.json @@ -0,0 +1,26 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Build C++ project", + "type": "shell", + "group": { + "kind": "build", + "isDefault": true + }, + "command": "mingw32-make" + }, + { + "label": "Build & run C++ project", + "type": "shell", + "group": { + "kind": "test", + "isDefault": true + }, + "command": "mingw32-make", + "args": [ + "run" + ] + } + ] +} \ No newline at end of file