visual_studio.rst 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. .. _doc_configuring_an_ide_vs:
  2. Visual Studio
  3. =============
  4. `Visual Studio Community <https://visualstudio.microsoft.com>`__ is a Windows-only IDE
  5. by `Microsoft <https://microsoft.com>`_ that's free for individual use or non-commercial use within organizations.
  6. It has many useful features, such as memory view, performance view, source
  7. control and more.
  8. Importing the project
  9. ---------------------
  10. Visual Studio requires a solution file to work on a project. While Godot does not come
  11. with the solution file, it can be generated using SCons.
  12. - Navigate to the Godot root folder and open a Command Prompt or PowerShell window.
  13. - | Run ``scons platform=windows vsproj=yes dev_build=yes`` to generate the solution with debug symbols.
  14. | The ``vsproj`` parameter signals that you want Visual Studio solution generated.
  15. | The ``dev_build`` parameter makes sure the debug symbols are included, allowing to e.g. step through code using breakpoints.
  16. - You can now open the project by double-clicking on the ``godot.sln`` in the project root
  17. or by using the **Open a project or solution** option inside of the Visual Studio.
  18. - Use the **Build** top menu to build the project.
  19. .. warning:: Visual Studio must be configured with the C++ package. It can be selected
  20. in the installer:
  21. .. figure:: img/vs_1_install_cpp_package.png
  22. :align: center
  23. Debugging the project
  24. ---------------------
  25. Visual Studio features a powerful debugger. This allows the user to examine Godot's
  26. source code, stop at specific points in the code, inspect the current execution context,
  27. and make live changes to the codebase.
  28. You can launch the project with the debugger attached using the **Debug > Start Debugging**
  29. option from the top menu. However, unless you want to debug the Project Manager specifically,
  30. you'd need to configure debugging options first. This is due to the fact that when the Godot
  31. Project Manager opens a project, the initial process is terminated and the debugger gets detached.
  32. - To configure the launch options to use with the debugger use **Project > Properties**
  33. from the top menu:
  34. .. figure:: img/vs_2_project_properties.png
  35. :align: center
  36. - Open the **Debugging** section and under **Command Arguments** add two new arguments:
  37. the ``-e`` flag opens the editor instead of the Project Manager, and the ``--path`` argument
  38. tells the executable to open the specified project (must be provided as an *absolute* path
  39. to the project root, not the ``project.godot`` file; if the path contains spaces be sure to pass it inside double quotation marks).
  40. .. figure:: img/vs_3_debug_command_line.webp
  41. :align: center
  42. To learn more about command line arguments, refer to the
  43. :ref:`command line tutorial <doc_command_line_tutorial>`.
  44. Even if you start the project without a debugger attached it can still be connected to the running
  45. process using **Debug > Attach to Process...** menu.
  46. To check that everything is working, put a breakpoint in ``main.cpp`` and press :kbd:`F5` to
  47. start debugging.
  48. .. figure:: img/vs_4_debugging_main.png
  49. :align: center
  50. If you run into any issues, ask for help in one of
  51. `Godot's community channels <https://godotengine.org/community>`__.