diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000000..b9124798785 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,78 @@ +{ + "version": 3, + "configurePresets": [ + { + "name": "base", + "hidden": true, + "generator": "Ninja", + "binaryDir": "${sourceDir}/build/${presetName}", + "cacheVariables": { + "CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", + "DISCORD_INTEGRATION": "ON", + "DEVILUTIONX_SYSTEM_BZIP2": "OFF" + } + }, + { + "name": "x64-debug", + "displayName": "x64 Debug", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug" + } + }, + { + "name": "x64-release", + "displayName": "x64 Release", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CPACK": "ON" + } + }, + { + "name": "x64-relwithdebinfo", + "displayName": "x64 RelWithDebInfo", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "RelWithDebInfo", + "CPACK": "ON" + } + }, + { + "name": "x86-debug", + "displayName": "x86 Debug", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Debug", + "CMAKE_GENERATOR_PLATFORM": "Win32" + } + }, + { + "name": "x86-release", + "displayName": "x86 Release", + "inherits": "base", + "cacheVariables": { + "CMAKE_BUILD_TYPE": "Release", + "CPACK": "ON", + "CMAKE_GENERATOR_PLATFORM": "Win32" + } + }, + { + "name": "x64-debug-translations", + "displayName": "x64 Debug (Translations)", + "inherits": "x64-debug", + "cacheVariables": { + "USE_GETTEXT_FROM_VCPKG": "ON" + } + }, + { + "name": "x64-debug-sdl1", + "displayName": "x64 Debug (SDL1)", + "inherits": "x64-debug", + "cacheVariables": { + "USE_SDL1": "ON" + } + } + ] +} diff --git a/CMakeSettings.json b/CMakeSettings.json deleted file mode 100644 index 56456356e04..00000000000 --- a/CMakeSettings.json +++ /dev/null @@ -1,152 +0,0 @@ -{ - "configurations": [ - { - "name": "x64-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "inheritEnvironments": [ "msvc_x64" ], - "intelliSenseMode": "windows-msvc-x64", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x64-Debug-Translations", - "generator": "Ninja", - "configurationType": "Debug", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "inheritEnvironments": [ "msvc_x64" ], - "intelliSenseMode": "windows-msvc-x64", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - }, - { - "name": "USE_GETTEXT_FROM_VCPKG", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x64-Debug-SDL1", - "generator": "Ninja", - "configurationType": "Debug", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "inheritEnvironments": [ "msvc_x64" ], - "intelliSenseMode": "windows-msvc-x64", - "cmakeCommandArgs": "-DUSE_SDL1=ON", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x64-Release", - "generator": "Ninja", - "configurationType": "Release", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DCPACK=ON", - "inheritEnvironments": [ "msvc_x64" ], - "intelliSenseMode": "windows-msvc-x64", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x64-RelWithDebInfo", - "generator": "Ninja", - "configurationType": "RelWithDebInfo", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DCPACK=ON", - "inheritEnvironments": [ "msvc_x64" ], - "intelliSenseMode": "windows-msvc-x64", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x86-Debug", - "generator": "Ninja", - "configurationType": "Debug", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "inheritEnvironments": [ "msvc_x86" ], - "intelliSenseMode": "windows-msvc-x86", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x86-Release", - "generator": "Ninja", - "configurationType": "Release", - "buildRoot": "${workspaceRoot}\\build\\${name}", - "installRoot": "${env.USERPROFILE}\\CMakeBuilds\\${workspaceHash}\\install\\${name}", - "cmakeCommandArgs": "-DCPACK=ON", - "inheritEnvironments": [ "msvc_x86" ], - "intelliSenseMode": "windows-msvc-x86", - "enableClangTidyCodeAnalysis": true, - "variables": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - }, - { - "name": "x64-Debug-WSL-GCC", - "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": [ - { - "name": "DISCORD_INTEGRATION", - "value": "True", - "type": "BOOL" - } - ] - } - ] -} diff --git a/docs/building.md b/docs/building.md index 61cd3c42f2c..e5902c1c4cf 100644 --- a/docs/building.md +++ b/docs/building.md @@ -289,11 +289,12 @@ The location of this tool will need to be [added to the system's PATH environmen ### Compiling -* **Through Open->CMake in Visual Studio** +* **Through CMake Presets in Visual Studio (Recommended)** -1. Go to `File -> Open -> CMake`, select `CMakeLists.txt` from the project root. -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. +1. Go to `File -> Open -> Folder` and select the devilutionx root folder. CMake will automatically detect the project and load the CMakePresets.json file. This may take several minutes. +2. Select a configuration from the configuration dropdown (e.g., `x64 Debug`). +3. Select `devilutionx.exe` from the Startup Item dropdown. +4. Select `Build devilutionx.exe` from the `Build` menu. * **Through GCC/WSL in Visual Studio** diff --git a/vcpkg.json b/vcpkg.json index eecfd48956d..9849b861b98 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -2,8 +2,6 @@ "name": "devilutionx", "version-string": "1.6.0", "dependencies": [ - "fmt", - "bzip2", "lua", "magic-enum" ],