Skip to content

Installation

Bardio edited this page Dec 15, 2023 · 13 revisions

Install-Package

Cmake

To include BardCore in cmake (for platforms outside of Windows, or because of cross compiling) use the following example:

  1. Make a CMakeLists.txt with
# Minimum CMake version
cmake_minimum_required(VERSION 3.24)

# Set C++ version
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED YES)

project(test)

include(ExternalProject)

# Install from nuget.org then unzip it in the Cmake Binary dir
ExternalProject_Add(
        BardCore
        PREFIX ${CMAKE_CURRENT_BINARY_DIR}/BardCore
        URL https://www.nuget.org/api/v2/package/BardCore/ # put version number here e.g 0.1.13 (if nothing: default latest)
        DOWNLOAD_NAME BardCore.zip
        DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/BardCore
        SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/BardCore/src/BardCore
        DOWNLOAD_EXTRACT_TIMESTAMP on
        CONFIGURE_COMMAND ""
        BUILD_COMMAND ""
        INSTALL_COMMAND ""
)

# if CMAKE_BUILD_TYPE is not set, set it to release
if(NOT CMAKE_BUILD_TYPE)
    set(CMAKE_BUILD_TYPE release)
endif()
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE)

# Set Include directories
set(BardCore_LIBRARY ${CMAKE_CURRENT_BINARY_DIR}/BardCore/src/BardCore/build/native/lib/$<IF:$<EQUAL:${CMAKE_SIZEOF_VOID_P},8>,x64,x86>/${CMAKE_BUILD_TYPE}/BardCore.lib)
set(BardCore_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/BardCore/src/BardCore/build/native/include)

include_directories(${BardCore_INCLUDE_DIR})

# Make exe
add_executable(${PROJECT_NAME} main.cpp)

# Link BardCore
target_link_libraries(${PROJECT_NAME} PUBLIC ${BardCore_LIBRARY})

add_dependencies(${PROJECT_NAME} BardCore)
  1. Add main.cpp
#include <iostream>
#include <BardCore/math/point3d.h>

int main() {
    std::cout << bardcore::point3d(1,2,3) << std::endl;
    return 0;
}
  1. Either build using an IDE or use the CLI:
  • (CLI)
mkdir build && cd build
cmake ..

Then either make on Linux or msbuild/g++ on windows

Visual Studio

To use it in visual studio (or jetbrains):

  1. Make a new c++ project in visual studio (console or otherwise).

new project

  1. Go to package manager.

package manager

  1. Type in the Browse tab the keyword BardCore to find the package.

browse bardcore

  1. Install the package for the project and you're all done!

  2. Look at the examples for usages.

  3. Enjoy!


Alternatively you could download the package manually via the nuget CLI or via the latest version of the nuget file.

Build

This is optional for developers

To clone with submodules (docs)

git clone --recursive -j8 --branch "master" https://github.com/BardoBard/bardcore.git "BardCore"

To update submodules

git submodule update --remote --merge

Clone this wiki locally