From b7382611244c589ecf0c731515888b700fadd04a Mon Sep 17 00:00:00 2001 From: Webster Sheets Date: Fri, 8 Sep 2023 15:15:26 -0400 Subject: [PATCH] VSCode new user experience --- .gitignore | 3 +- CMakePresets.json | 240 ++++++++++++++++++++++++++------- COMPILING.txt | 35 +++++ pioneer-default.code-workspace | 119 ++++++++++++++++ 4 files changed, 344 insertions(+), 53 deletions(-) create mode 100644 pioneer-default.code-workspace diff --git a/.gitignore b/.gitignore index 314cbc078b0..47844fe26ec 100644 --- a/.gitignore +++ b/.gitignore @@ -91,12 +91,13 @@ CMakeUserPresets.json compile # IDEs make their local configurations shouldn't be tracked -.vscode/ +.vscode/* .vs/ .project .cproject *.VC.db *.code-workspace +!pioneer-default.code-workspace .idea # Core dumps shouldn't be tracked by git. diff --git a/CMakePresets.json b/CMakePresets.json index 721d0e7b80b..dfc0fd93b81 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -1,54 +1,190 @@ { - "version": 2, - "configurePresets": [ - { - "name": "x64-Debug", - "displayName": "Windows x64 Debug", - "description": "Target Windows with the Visual Studio development environment.", - "generator": "Ninja", - "binaryDir": "${sourceDir}/out/build/${presetName}", - "architecture": { - "value": "x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Debug", - "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" - }, - "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } - }, - { - "name": "x64-Release", - "displayName": "Windows x64 Release", - "description": "Target Windows with the Visual Studio development environment.", - "generator": "Ninja", - "binaryDir": "${sourceDir}/out/build/${presetName}", - "architecture": { - "value": "x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release", - "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" - }, - "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } - }, - { - "name": "x64-Profiling", - "displayName": "Windows x64 Profiling", - "description": "Target Windows with the Visual Studio development environment.", - "generator": "Ninja", - "binaryDir": "${sourceDir}/out/build/${presetName}", - "architecture": { - "value": "x64", - "strategy": "external" - }, - "cacheVariables": { - "CMAKE_BUILD_TYPE": "RelWithDebInfo", - "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", - "PROFILER_ENABLED": "1" - }, - "vendor": { "microsoft.com/VisualStudioSettings/CMake/1.0": { "hostOS": [ "Windows" ] } } - } - ] + "version": 2, + "configurePresets": [ + { + "name": "x64-Debug", + "displayName": "Windows x64 Debug", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "x64-Release", + "displayName": "Windows x64 Release", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "x64-Profiling", + "displayName": "Windows x64 Profiling", + "description": "Target Windows with the Visual Studio development environment.", + "generator": "Ninja", + "binaryDir": "${sourceDir}/out/build/${presetName}", + "architecture": { + "value": "x64", + "strategy": "external" + }, + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "PROFILER_ENABLED": "1" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Windows" + ] + } + } + }, + { + "name": "x64-Linux-Debug", + "displayName": "Linux x64 Debug", + "description": "Use system compiler; Profiler=yes", + "binaryDir": "${sourceDir}/build/", + "generator": "Unix Makefiles", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_BUILD_TYPE": "Debug", + "PROFILER_ENABLED": "1" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + } + } + }, + { + "name": "x64-Linux-Profiler", + "displayName": "Linux x64 Profiling", + "description": "Use system compiler; Profiler=yes", + "binaryDir": "${sourceDir}/build/", + "generator": "Unix Makefiles", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "PROFILER_ENABLED": "1" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + } + } + }, + { + "name": "x64-Linux-RelWithDebInfo", + "displayName": "Linux x64 Release", + "description": "Use system compiler; Profiler=no", + "binaryDir": "${sourceDir}/build/", + "generator": "Unix Makefiles", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_BUILD_TYPE": "RelWithDebInfo" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + } + } + }, + { + "name": "x64-Linux-Debug-Clang", + "displayName": "Linux x64 Debug (Clang)", + "description": "CC=clang CXX=clang++; Profiler=yes", + "binaryDir": "${sourceDir}/build/", + "generator": "Unix Makefiles", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_C_COMPILER": "/usr/bin/clang", + "CMAKE_CXX_COMPILER": "/usr/bin/clang++", + "PROFILER_ENABLED": "1" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + } + } + }, + { + "name": "x64-Linux-Profiler-Clang", + "displayName": "Linux x64 Profiling (Clang)", + "description": "CC=clang CXX=clang++; Profiler=yes", + "binaryDir": "${sourceDir}/build/", + "generator": "Unix Makefiles", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_C_COMPILER": "/usr/bin/clang", + "CMAKE_CXX_COMPILER": "/usr/bin/clang++", + "PROFILER_ENABLED": "1" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + } + } + }, + { + "name": "x64-Linux-RelWithDebInfo-Clang", + "displayName": "Linux x64 Release (Clang)", + "description": "CC=clang CXX=clang++; Profiler=no", + "binaryDir": "${sourceDir}/build/", + "generator": "Unix Makefiles", + "cacheVariables": { + "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}", + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CMAKE_C_COMPILER": "/usr/bin/clang", + "CMAKE_CXX_COMPILER": "/usr/bin/clang++" + }, + "vendor": { + "microsoft.com/VisualStudioSettings/CMake/1.0": { + "hostOS": [ + "Linux" + ] + } + } + } + ] } diff --git a/COMPILING.txt b/COMPILING.txt index 5737f33780e..bc3960d70d4 100644 --- a/COMPILING.txt +++ b/COMPILING.txt @@ -2,6 +2,7 @@ Table of Contents ================= 1 How to compile Pioneer 1.1 Linux - CMake + 1.1a Linux - VSCode + CMake 1.2 Windows - MSVC 1.3 Windows - CMake and MSYS2 (and MinGW-w64) 1.4 Windows - CMake and MSVC @@ -73,6 +74,40 @@ questions are welcome anytime. 4. Run `./pioneer` to start the game! +1.1a Linux - VSCode + CMake +--------- + +1. Install the required libraries as for '1.1 Linux - CMake'. + + You'll want to install several VSCode extensions for best results: + + CMake Tools (ms-vscode.cmake-tools) + C/C++ (ms-vscode.cpptools) + clangd (llvm-vs-code-extensions.vscode-clangd) + Code LLDB (vadimcn.vscode-lldb) + Lua (sumneko.lua) + Git Graph (mhutchie.git-graph) + + Of these extensions, only CMake Tools is required to compile the game from + within VSCode. All other extensions help to improve the development process + if you intend on making changes to the game's files. + +2. Copy ./pioneer-default.code-workspace to ./pioneer.code-workspace and + open it. This provides a quick-start workspace setup with useful workflow + defaults pre-configured. This file is ignored by Git and you can configure + the workspace to your liking from there. + +3. From the bottom bar, select a configure preset for your platform. 'Release' + is recommended unless you're in the process of debugging a specific issue. + This will generate CMake files in the 'build/' folder. + +4. Click the build button on the bottom toolbar, or execute the Run Build Task + command from the command pallette (Ctrl+Shift+P), selecting 'Build Pioneer'. + If all goes well, Pioneer should successfully compile. + +5. Click the triangle ("launch") button in the bottom toolbar and select + 'pioneer' as the active launch target. + 1.2 Windows - MSVC ------------------ diff --git a/pioneer-default.code-workspace b/pioneer-default.code-workspace new file mode 100644 index 00000000000..3e4f44dcb20 --- /dev/null +++ b/pioneer-default.code-workspace @@ -0,0 +1,119 @@ +{ + "folders": [ + { + "path": "." + } + ], + "settings": { + "editor.insertSpaces": false, + "editor.detectIndentation": false, + "editor.tabSize": 4, + "files.exclude": {}, + "files.trimFinalNewlines": true, + "files.trimTrailingWhitespace": true, + "files.insertFinalNewline": true, + "Lua.diagnostics.disable": [ + "empty-block" + ], + "Lua.runtime.path": [ + "?.lua", + "?/init.lua", + "data/libs/?.lua", + "data/libs/?/init.lua", + "data/?.lua", + "data/?/init.lua" + ], + "Lua.runtime.plugin": "", + "Lua.workspace.library": [ + "data/meta" + ], + "Lua.runtime.special": { + "package.reimport": "require" + }, + "Lua.runtime.version": "Lua 5.2", + "Lua.diagnostics.globals": [ + "f", + "fixed", + "v", + "CustomSystem", + "CustomSystemBody", + "Faction", + "Color", + ], + "Lua.workspace.checkThirdParty": false, + "cmake.configureOnOpen": true, + "cmake.buildTask": false, + "cmake.debugConfig": { + "cwd": "${workspaceFolder}" + }, + "cmake.buildDirectory": "${workspaceFolder}/build", + "cmake.exportCompileCommandsFile": true + }, + "tasks": { + "version": "2.0.0", + "tasks": [ + { + "type": "cmake", + "label": "Build Pioneer", + "command": "build", + "targets": [ + "all" + ], + "preset": "${command:cmake.activeBuildPresetName}", + "group": { + "kind": "build", + "isDefault": true + }, + "problemMatcher": [], + "detail": "Build Pioneer with current CMake settings" + }, + { + "type": "cmake", + "label": "Build Data", + "command": "build", + "targets": [ + "build-data" + ], + "preset": "${command:cmake.activeBuildPresetName}", + "problemMatcher": [], + "detail": "Build SGM model cache" + }, + { + "label": "Run Unit Tests", + "type": "process", + "command": "${command:cmake.buildDirectory}/unittest", + "group": { + "kind": "test", + "isDefault": true + }, + "dependsOn": [ + "Build Pioneer" + ], + "problemMatcher": [] + }, + ] + }, + "launch": { + "version": "0.2.0", + "configurations": [ + { + "name": "Debug", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.buildDirectory}/pioneer", + "args": [], + "environment": [], + "cwd": "${workspaceRoot}", + }, + { + "name": "Debug (Model Editor)", + "type": "cppdbg", + "request": "launch", + "program": "${command:cmake.buildDirectory}/editor", + "args": [ "--mv" ], + "environment": [], + "cwd": "${workspaceRoot}", + }, + ] + } +}