-
Notifications
You must be signed in to change notification settings - Fork 1
Installation
Bardio edited this page Dec 15, 2023
·
13 revisions
To include BardCore in cmake (for platforms outside of Windows, or because of cross compiling) use the following example:
- 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)- Add main.cpp
#include <iostream>
#include <BardCore/math/point3d.h>
int main() {
std::cout << bardcore::point3d(1,2,3) << std::endl;
return 0;
}- Either build using an IDE or use the CLI:
- (CLI)
mkdir build && cd buildcmake ..Then either make on Linux or msbuild/g++ on windows
To use it in visual studio (or jetbrains):
- Make a new c++ project in visual studio (console or otherwise).
- Go to package manager.
- Type in the
Browsetab the keywordBardCoreto find the package.
-
Install the package for the project and you're all done!
-
Look at the examples for usages.
-
Enjoy!
Alternatively you could download the package manually via the nuget CLI or via the latest version of the nuget file.
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- Home
- Introduction
-
Installation
- Install-Package
- Build (Optional for developers)
- Examples
- Design (For developers)


