Assuming you follow this guide, you will be able to use Bardrix in your project with this simple example:
#include <bardrix/vector3.h>
#include <iostream>
int main(){
std::cout << bardrix::vector3(1, 2, 3) << std::endl;
}
In order to use the project for CMake, you need to have CMake installed, or use an IDE that supports CMake, such as Visual Studio, CLion, or QtCreator.
You can add the project as a submodule to your project by running the following command:
git submodule add https://github.com/BardoBard/Bardrix.git "Bardrix"
Then we can include the project in our CMakeLists.txt file:
cmake_minimum_required(VERSION 3.27)
project(my_project)
set(CMAKE_CXX_STANDARD 17)
# Add Bardrix as a subdirectory
add_subdirectory(Bardrix)
# Add your project files
add_executable(${PROJECT_NAME} main.cpp)
# Add bardrix library
target_link_libraries(${PROJECT_NAME} Bardrix)
If you don't want to use submodules, you can use the FetchContent module to download the project:
cmake_minimum_required(VERSION 3.27)
project(my_project)
set(CMAKE_CXX_STANDARD 17)
include(FetchContent) # Include the FetchContent module
# Add Bardrix as a subdirectory
FetchContent_Declare(
Bardrix
GIT_REPOSITORY https://github.com/bardobard/Bardrix.git
# GIT_TAG v0.4.2 # Set the tag to a specific version (optional)
)
FetchContent_MakeAvailable(Bardrix)
# Add your project files
add_executable(${PROJECT_NAME} main.cpp)
# Add bardrix library
target_link_libraries(${PROJECT_NAME} Bardrix)
The git tag is optional, you can use it to specify a version of the project you want to use.
You can also use the NuGet package manager to install Bardrix, this is only available for Windows users.
You can search for Bardio.Bardrix and install it, everything will be set up for you.
Make sure the c++ version is set to 17 or higher in your project settings, you can do this by right-clicking on your project and selecting properties. Then go to C/C++ -> Language and set the C++ Language Standard to C++17 or higher.
Then click apply/ok and you are ready to use Bardrix in your project.
You can also download the source code and include it in your project manually. This is not recommended as it is harder to keep the project up to date.
Bardrix has no dependencies, only the standard library is used.