Building a Project Using the SDK

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 building the C++ SDK Library.

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(I3cCCCs)

# Source Files Declaration
set(SOURCES main.cpp)
set(TARGET_NAME i3c_cccs)

# Target Definition, Properties, and Commands
add_executable(${TARGET_NAME} ${SOURCES})
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME sample_app)

# Include needed headers
target_include_directories(${TARGET_NAME} PRIVATE 
    ${CMAKE_SOURCE_DIR}/include
    .
)

# Link against needed libraries
target_link_libraries(${TARGET_NAME} bmc_sdk nlohmann_json::nlohmann_json)

# Installation instructions
install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${STAGING_DIR}/examples/${TARGET_NAME})
install(FILES ${SOURCES} DESTINATION ${STAGING_DIR}/examples/${TARGET_NAME})

Below is a modified version of the CMakeLists.txt file for binding the BMC C++ SDK as a static library:

cmake_minimum_required(VERSION 3.5)
project(I3cCCCs)

include(FetchContent)

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

# Source Files Declaration
set(SOURCES main.cpp)
set(TARGET_NAME i3c_cccs)

# Installation Directory Variable
set(
  BMC_SDK_INSTALL_DIR
  "C:/Program Files (x86)/BinhoMissionControlSDK" # Replace with the actual installation directory
)

# Target Definition, Properties, and Commands
add_executable(${TARGET_NAME} ${SOURCES})
set_target_properties(${TARGET_NAME} PROPERTIES OUTPUT_NAME sample_app)

# Include needed headers
target_include_directories(${TARGET_NAME} PRIVATE 
    ${BMC_SDK_INSTALL_DIR}/include
    .
)

# Link against needed libraries
target_compile_definitions(${TARGET_NAME} PRIVATE USE_STATIC_LIBS)
target_link_libraries(${TARGET_NAME} ${BMC_SDK_INSTALL_DIR}/bmc_sdk_static.lib nlohmann_json::nlohmann_json)

Last updated