Skip to content

Folder hierarchy and root folder key files

PixelRain edited this page Mar 5, 2024 · 8 revisions

Pasted image 20231028124059 orlac's godot-roguelite root folder structure as of 28-Oct-2023

.gdignore (optional)

You can add an empty .gdignore file to your extension folder so that it isn't read by Godot (some contents can cause errors since they are automatically read by Godot).

Note: An alternative (better) approach to using .gdignore is moving your project to a lower sup folder for the project: /project

This way you'll have all your Godot project's files tidy, and won't need to use .gdignore to avoid Godot reading what it shouldn't.

.clang-format

This file defines a set of rules which are later applied by CMake with clang, through CMakeLists.txt in order to better format our translation units and also optimize them for building.

.gitignore

The .gitignore file is meant to have a list of for paths and file types for git to ignore when pushing to remote.

.gitmodules

This file provides a way of cloning and updating submodules.

/cmake

Contains various .cmake build setup script files which are run (by include) from CMakeLists.txt

/extern (folder and submodules):

The extern folder contains:

  • godot-cpp: This is the project with which we can build the static library necessary for our C++ gdextension code.
  • godot-engine: The entire Godot engine is built so that we can reference it's in VS's intellisense.
  • vcpkg: This is a library used in CMake in order to locate and link to 3rd party libraries with ease (examples in CMakeLists.txt).

"Submodules" are essentially github repositories placed under our own github project. The submodules are setup in cmake/godot-dev-configuration.cmake which is run from the root folder's CMakeLists.txt

/project

Contains all Godot project related files.

/src

Contains the C++ source code for the gdextension library.

CMakeLists.txt

This defines the procedure and configuration for when a build is executed in visual studio community.

More on: CMake.

CMakePresets.json

This file defines various configurations for each compiler.

The compiler configuration is chosen automatically depending on which compiler we ran for our build. In Visual Studio's case, since Visual Studio uses it's own compiler (msvc), the config for it for either MSVC_Debug or MSVC_Release will be chosen from this .json

Debug or Release compiler modes for MSVC can be chosen in one of VS's tabs:

Pasted image 20231028190017

clang can also be used as compiler and displayed among these options by removing the "condition" entry in the "clang" base entry.

vcpkg.json

This .json file is used by vcpkg (a dependency manager setup at cmake/vcpkg-init.cmake) to locate package dependencies, you can later include. You can check available packages here https://vcpkg.io/en/packages which you can then list by their name in the "dependencies" list within this file. You can later use "find_package"in the 3rd party library setup/configuration section of CMakeLists.txt and reference that package for linking in "target_link_libraries"