Binho Customer Support
  • Customer Support Portal
  • User Guide
    • Binho Nova
    • Binho Supernova
    • Hardware Comparison Table
    • Safety Notice
    • Compliance & Legal
    • System Requirements
    • Updating Firmware
    • Protocols and Interfaces
      • I3C Common Command Codes
      • Bridge 1.1 API
        • Bridge 1.1 API - Basic I3C Commands
        • Bridge 1.1 API - I3C Common Command Codes
        • Bridge 1.1 API - I2C Commands
        • Bridge 1.1 API - SPI Commands
        • Bridge 1.1 API - UART Commands
        • Bridge 1.1 API - GPIO Commands
  • Getting Started
    • Hardware Setup
      • Binho Nova
      • Binho Supernova
    • Binho Mission Control
      • Overview
      • Download & Installation
      • Interactive Tour
        • App Layout
        • Protocol Activation
        • Command Panel
        • Transaction Log View
      • Updating Binho Mission Control Software
      • Simulators
      • Communication Protocols
        • SPI
        • UART
        • I2C
        • I3C
        • 1-WIRE
        • GPIO
      • Settings
    • Python SDKs
      • SupernovaController
      • Nova SDK
    • C++ SDK
      • Installation
      • Environment Setup
      • Building the C++ SDK Library
      • Building a Project Using the SDK
      • Example Applications
      • Using the Library
    • Software Releases
  • Examples
    • SupernovaController
    • Other Examples
  • Troubleshooting
    • Solving USB Connection Issues on Linux
  • FAQ
    • What is a host adapter?
    • What protocols are supported?
    • Can multiple devices be used at the same time?
    • Where can I find the product datasheet?
    • Is there a GUI available?
    • Is the ADC calibrated?
    • Is the DAC calibrated?
  • Returns & Warranty
    • 90-Day Return Policy
    • 2-Year Warranty
  • Dropping Legacy Terminology
  • Contact Us
  • Orders & Shipping
    • Place an Order
    • Requesting a Quotation
    • Placing a Purchase Order
    • Shipping Policy
    • International Shipping
    • Tax Exemption
    • Discounts
    • Distributors
Powered by GitBook
On this page
  • Overview
  • Step by Step Guide
  • CMake Example for Building Applications
  1. Getting Started
  2. C++ SDK

Building a Project Using the SDK

PreviousBuilding the C++ SDK LibraryNextExample Applications

Last updated 6 months ago

Overview

The provided example applications can serve as a guide for creating a new project using the BMC C++ SDK. The examples are located in the examples directory, and the instructions to build and execute them are similar to those related with .

Step by Step Guide

Here is a step-by-step guide on how to build a project that uses the library:

  1. Navigate to the directory containing the project that uses the BMC C++ SDK.

  2. Ensure that the development environment is properly set up. To do this, follow the instructions in the section of our guide.

  3. Create a CMakeLists.txt file in the root directory of the project. An example of this file can be found .

  4. Create a build directory inside the project.

  5. Navigate to the build directory.

  6. Configure CMake:

    • Linux/macOS

      cmake -DLIBRARY_PATH=[Path to the dir containing the library] -DINCLUDE_PATH=[Path to the dir containing the include files] ..
    • Windows 64

      cmake -DLIBRARY_PATH=[Path to the dir containing the library] -DINCLUDE_PATH=[Path to the dir containing the include files] .. -G "Visual Studio 17 2022" -A x64
    • Windows 32

      cmake -DLIBRARY_PATH=[Path to the dir containing the library] -DINCLUDE_PATH=[Path to the dir containing the include files] .. -G "Visual Studio 17 2022" -A win32
  7. Build with CMake:

    cmake --build . --config Release
  8. On Windows, verify that within the build directory, there is a Release (or Debug ) directory containing the project's executable. On Linux/macOS, look for the executable in the build directory.

CMake Example for Building Applications

Below is an example of a CMakeLists.txt file for building a sample application (i3c_cccs) that uses the BMC C++ SDK as a dynamic library:

cmake_minimum_required(VERSION 3.5)
project(MyProject)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Accept library path as an argument
set(LIBRARY_PATH "" CACHE PATH "Path to the static library")

# Accept include path as an argument
set(INCLUDE_PATH "" CACHE PATH "Path to the include directory")

if(NOT LIBRARY_PATH)
  message(FATAL_ERROR "LIBRARY_PATH is empty")
endif()

if(NOT INCLUDE_PATH)
  message(FATAL_ERROR "INCLUDE_PATH is empty")
endif()

include(FetchContent)

FetchContent_Declare(json URL https://github.com/nlohmann/json/releases/download/v3.11.2/json.tar.xz)
FetchContent_MakeAvailable(json)

# ---
# Target Definition, Properties and Commands
# ---

add_executable(my_project
  main.cpp
)

set_target_properties(my_project PROPERTIES OUTPUT_NAME my_app)

# Include needed headers
target_include_directories(my_project PRIVATE 
  ${INCLUDE_PATH}
)

# Link against needed libraries
if(WIN32)
  target_link_libraries(my_project 
    nlohmann_json::nlohmann_json
    ${LIBRARY_PATH}/bmc_sdk.lib
  )
  # To link against the static library on Windows, use the following line instead:
  # target_link_libraries(my_project ${LIBRARY_PATH}/bmc_sdk_static.lib)
elseif(APPLE)
  target_link_libraries(my_project 
    nlohmann_json::nlohmann_json
    ${LIBRARY_PATH}/libbmc_sdk.dylib
  )
  # To link against the static library on macOS, use the following line instead:
  # target_link_libraries(my_project ${LIBRARY_PATH}/libbmc_sdk_static.a)
else()
  target_link_libraries(my_project 
    nlohmann_json::nlohmann_json
    ${LIBRARY_PATH}/libbmc_sdk.so
  )
  # To link against the static library on Linux, use the following line instead:
  # target_link_libraries(my_project ${LIBRARY_PATH}/libbmc_sdk_static.a)
endif()

building the C++ SDK Library
Environment Setup
below