From 96a57f65ddeb1bae4d6ac1b4b4fd59ec0e599724 Mon Sep 17 00:00:00 2001 From: Ben Clayton Date: Tue, 30 Mar 2021 20:10:08 +0000 Subject: [PATCH] .vscode/tasks.json: Make build & configure work for windows. Have this use the gn build, as the CMake approach with ninja would require finding the vcvarsall.bat, which is not easily locatable. Change-Id: Ia88194890d13f4abde6f0fc4b99f3e0da134bc4b Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/46340 Commit-Queue: Ben Clayton Kokoro: Kokoro Reviewed-by: Antonio Maiorano --- .vscode/tasks.json | 72 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 53 insertions(+), 19 deletions(-) diff --git a/.vscode/tasks.json b/.vscode/tasks.json index a00b39520e..35738ad87b 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -17,27 +17,37 @@ "isDefault": true }, "type": "shell", - "command": "sh", "osx": { + "command": "sh", "args": [ "-c", "cmake --build . && echo Done" - ] + ], + "options": { + "cwd": "${workspaceRoot}/build", + }, }, "linux": { + "command": "sh", "args": [ "-c", "cmake --build . && echo Done" - ] + ], + "options": { + "cwd": "${workspaceRoot}/build", + }, }, "windows": { + // Invokes ninja in the 'out/active' directory, which is created + // with the 'generate' task (see below). + "command": "cmd", "args": [ - "-c", - "cmake --build . && echo Done" - ] - }, - "options": { - "cwd": "${workspaceRoot}/build", + "/C", + "ninja && echo Done" + ], + "options": { + "cwd": "${workspaceRoot}/out/active", + }, }, "presentation": { "echo": false, @@ -61,16 +71,40 @@ } }, { - "label": "cmake", + "label": "configure", "type": "shell", - "command": "cmake", - "args": [ - "..", - "-GNinja", - "-DCMAKE_BUILD_TYPE=${input:buildType}", - ], - "options": { - "cwd": "${workspaceRoot}/build" + "osx": { + "command": "cmake", + "args": [ + "..", + "-GNinja", + "-DCMAKE_BUILD_TYPE=${input:buildType}", + ], + "options": { + "cwd": "${workspaceRoot}/build" + }, + }, + "linux": { + "command": "cmake", + "args": [ + "..", + "-GNinja", + "-DCMAKE_BUILD_TYPE=${input:buildType}", + ], + "options": { + "cwd": "${workspaceRoot}/build" + }, + }, + "windows": { + // Generates a GN build directory at 'out/' with the + // is_debug argument set to to true iff the build-type is Debug. + // A symbolic link to this build directory is created at 'out/active' + // which is used to track the active build directory. + "command": "cmd", + "args": [ + "/C", + "(IF \"${input:buildType}\" == \"Debug\" ( gn gen 'out\\${input:buildType}' --args=is_debug=true ) ELSE ( gn gen 'out\\${input:buildType}' --args=is_debug=false )) && (IF EXIST 'out\\active' rmdir 'out\\active' /q /s) && (mklink /j 'out\\active' 'out\\${input:buildType}')", + ], }, "problemMatcher": [], }, @@ -103,4 +137,4 @@ "description": "The type of build", }, ] -} +} \ No newline at end of file