- CMake (>3.25)
- C++ compiler (supporting C++20). We use MSVC on windows, GCC on Linux, and CLang on macOS
- vcpkg
- Clone the repository.
- Run the bootstrap script (bootstrap-vcpkg.bat on windows or bootstrap-vcpkg.sh on unix)
- Set the VCPKG_ROOT environment variable to vcpkg root folder.
- Python (>3.7)
- Ninja build system
- git. It is highly recommended that you use a visual git client, as we have had many problems with people using the cmd line interface.
- Linux-specific System packages:
zip ninja-build libxinerama-dev libxcursor-dev xorg-dev libglu1-mesa-dev pkg-config libgl1-mesa-dev libx11-dev libxrandr-dev
We are actively testing on Windows and macOS, but other systems that meet the requirements should theoretically work fine.
You should be able to generate build scripts and build the project using one of the CMake presets in CMakePresets.json. But as we primarily use Visual Studio Code as our IDEs. The rest of this readme focuses on them.
We have a set of recommended VS Code extensions in .vscode/extensions.json. You should get a popup to install them when you open the project. If not, be sure to do it manually.
- Clone this repo, including its submodules.
- Open tyr.code-workspace in VS Code.
- Select the desired CMake preset using the CMake: Select Configure Preset command.
- Use [platform-name]-debug during development
- Use [platform-name]-release for testing on real robots
- Build the project using CMake: Build.
If everything goes well, you should then see the following line in the CMake/Build output:
[build] Build finished with exit code 0
In the CMake tab, select the desired launch target and run it using the play button at the bottom of the screen.
We use cppbestpractices by Jason Turner as the basis for our standard.
.clang-tidy file contains the current naming convention we use. In addition, file and folder names should be lower_case. C++ files should have a .cpp extension, C files .c, and header files .h.
.clang-format file contains the current formatting style we use.
Both .clang-tidy and .clang-format are supported in most IDEs, and can help validate your code according to the standards, and even make necessary changes to be conformant.
Indent with 4 spaces.
Add spaces after C-style casts. Do not add spaces within angle brackets for template parameters.
Place opening braces on the line after control statements, classes, enums, functions, namespaces, structs, unions, and extern blocks.
Use compact namespaces (A::B
) when possible.
Group include directives into categories and order them as follows:
- Corresponding include (file.h for file.cpp) (
"..."
) - System includes (
<...>
) - Dependency includes (
<...>
) - Other includes (
"..."
)
- Align consecutive assignments and declarations.
- Align operands when breaking expressions.
Ensure consistency and readability by following these naming conventions throughout codebase:
- Use lower_case for file and folder names.
- Use CamelCase for namespaces. Root namespace is
Tyr
.
- Use CamelCase for struct, class, enum, union, typedef, and type alias names.
- Use camelBack naming convention for function names, including global functions.
- Main-like functions can be ignored.
- Use lower_case for member variables.
- Use
m_
prefix for private and protected member variables.
- Use CamelCase for both scoped and non-scoped enum constant names.
- Use lower_case for variables.
- Use
g_
prefix for global variables. - Use
s_
prefix for static variables.
- Use lower_case with
t_
prefix for function parameters.
- Use CamelCase for all constant (member, static, local, global, constexpr) variables with
k
prefix.
- Use UPPER_CASE for macro definitions.
We use Github flow as our branching strategy. Direct commits to the main
branch are disabled, the goal is to keep it stable and usable.
- Create a new branch from main named
dev/your-awesome-dev-task
. - Commit changes to your new branch.
- Open a pull request when you're done.
- After your PR is approved and all checks are passed, merge it into the main branch.
- Delete your dev branch.
This project is licensed under the terms of the GNU GPLv3.