Browse Source

Add VS configuration for building in WSL using GCC

This is mainly to help me test code builds under GCC faster than pushing to the remote and letting the build server do it. If someone without WSL installed selects the build target they'll get an error in their IDE, but no harmful impact other than that. The variables should be populated for any WSL2 installation. No idea about WSL1.

The whitespace in this file is showing significant changes because visual studio regenerates the whole file when a change is made, I didn't think it was worth reverting since it'll happen again next time someone makes a change (seems it defaults to spaces...). Added an entry to .editorconfig documenting the format used.
pull/3452/head
ephphatha 4 years ago committed by Anders Jenbo
parent
commit
38de1359a7
  1. 2
      .editorconfig
  2. 148
      CMakeSettings.json
  3. 8
      docs/building.md

2
.editorconfig

@ -48,7 +48,7 @@ end_of_line = crlf
[AppRun] [AppRun]
end_of_line = lf end_of_line = lf
[CMakeLists.txt] [{CMakeLists.txt,CMakeSettings.json}]
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
end_of_line = crlf end_of_line = crlf

148
CMakeSettings.json

@ -1,68 +1,82 @@
{ {
"configurations": [ "configurations": [
{ {
"name": "x64-Debug", "name": "x64-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}", "buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"inheritEnvironments": [ "msvc_x64" ], "inheritEnvironments": [ "msvc_x64" ],
"intelliSenseMode": "windows-msvc-x64", "intelliSenseMode": "windows-msvc-x64",
"enableClangTidyCodeAnalysis": true "enableClangTidyCodeAnalysis": true
}, },
{ {
"name": "x64-Debug-UnitTests", "name": "x64-Debug-UnitTests",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}", "buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"inheritEnvironments": [ "msvc_x64" ], "inheritEnvironments": [ "msvc_x64" ],
"intelliSenseMode": "windows-msvc-x64", "intelliSenseMode": "windows-msvc-x64",
"cmakeCommandArgs": "-DRUN_TESTS=ON", "cmakeCommandArgs": "-DRUN_TESTS=ON",
"enableClangTidyCodeAnalysis": true "enableClangTidyCodeAnalysis": true
}, },
{ {
"name": "x64-Release", "name": "x64-Release",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Release", "configurationType": "Release",
"buildRoot": "${workspaceRoot}\\build\\${name}", "buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-DBINARY_RELEASE=ON", "cmakeCommandArgs": "-DBINARY_RELEASE=ON",
"inheritEnvironments": [ "msvc_x64" ], "inheritEnvironments": [ "msvc_x64" ],
"intelliSenseMode": "windows-msvc-x64", "intelliSenseMode": "windows-msvc-x64",
"enableClangTidyCodeAnalysis": true "enableClangTidyCodeAnalysis": true
}, },
{ {
"name": "x86-Debug", "name": "x86-Debug",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}", "buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"inheritEnvironments": [ "msvc_x86" ], "inheritEnvironments": [ "msvc_x86" ],
"intelliSenseMode": "windows-msvc-x86", "intelliSenseMode": "windows-msvc-x86",
"enableClangTidyCodeAnalysis": true "enableClangTidyCodeAnalysis": true
}, },
{ {
"name": "x86-Debug-UnitTests", "name": "x86-Debug-UnitTests",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Debug", "configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}", "buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"inheritEnvironments": [ "msvc_x86" ], "inheritEnvironments": [ "msvc_x86" ],
"intelliSenseMode": "windows-msvc-x86", "intelliSenseMode": "windows-msvc-x86",
"cmakeCommandArgs": "-DRUN_TESTS=ON", "cmakeCommandArgs": "-DRUN_TESTS=ON",
"enableClangTidyCodeAnalysis": true "enableClangTidyCodeAnalysis": true
}, },
{ {
"name": "x86-Release", "name": "x86-Release",
"generator": "Ninja", "generator": "Ninja",
"configurationType": "Release", "configurationType": "Release",
"buildRoot": "${workspaceRoot}\\build\\${name}", "buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeCommandArgs": "-DBINARY_RELEASE=ON", "cmakeCommandArgs": "-DBINARY_RELEASE=ON",
"inheritEnvironments": [ "msvc_x86" ], "inheritEnvironments": [ "msvc_x86" ],
"intelliSenseMode": "windows-msvc-x86", "intelliSenseMode": "windows-msvc-x86",
"enableClangTidyCodeAnalysis": true "enableClangTidyCodeAnalysis": true
} },
] {
} "name": "WSL-GCC-x64-Debug",
"generator": "Ninja",
"configurationType": "Debug",
"buildRoot": "${workspaceRoot}\\build\\${name}",
"installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}",
"cmakeExecutable": "cmake",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "linux_x64" ],
"wslPath": "${defaultWSLPath}",
"variables": []
}
]
}

8
docs/building.md

@ -143,7 +143,13 @@ The location of this tool will need to be [added to the system's PATH environmen
* **Through Open->CMake in Visual Studio** * **Through Open->CMake in Visual Studio**
1. Go to `File -> Open -> CMake`, select `CMakeLists.txt` from the project root. 1. Go to `File -> Open -> CMake`, select `CMakeLists.txt` from the project root.
2. Select `Build devilution.exe` from the `Build` menu. 2. Select the `x64-Release` configuration (or `x86` for 32 bit builds, `-Debug` for debug builds).
3. Select `Build devilution.exe` from the `Build` menu.
* **Through GCC/WSL in Visual Studio**
1. Ensure the WSL environment has the build pre-requisites for both devilutionX (see "Installing Dependencies on Debian and Ubuntu" under the "Linux" section above) and [WSL remote development](https://docs.microsoft.com/en-us/cpp/linux/connect-to-your-remote-linux-computer?view=msvc-160#connect-to-wsl).
2. Select the `WSL-GCC-x64-Debug` configuration.
3. Select `Build devilution` from the `Build` menu.
* **Through cmake-gui** * **Through cmake-gui**

Loading…
Cancel
Save