Building the C++ SDK Library

For ease of use, we recommend using the provided build scripts to compile the C++ SDK library and stage the output files. Depending on your platform, use either the build_and_stage.sh script for macOS/Linux or build_and_stage.bat for Windows. These scripts automate the process of setting up, building, and staging the SDK along with its examples.

However, if you'd prefer to build the SDK manually, jump to the Manual Build Instructions below.

Automated Build with Script

  • For macOS/Linux: Run the build_and_stage.sh script:

    ./build_and_stage.sh
  • For Windows: Run the build_and_stage.bat script:

    build_and_stage.bat

These scripts will handle the build process, including cleaning up previous builds, creating the necessary directories, running CMake, and building both the library and example applications. After running the script, your build output will be placed in the staging directory, as shown below:

macOS Staging Directory Example:

staging/
├── docs/
├── examples/
│   ├── i3c_cccs/
│   ├── i3c_ibis/
│   ├── i3c_ICM42605/
│   ├── list_devices/
│   ├── mock_notifications/
│   ├── nova_breathing_leds/
│   ├── sample_app_using_sample_library/
│   ├── sample_library/
│   ├── supernova_101/
│   ├── supernova_i2c/
│   ├── supernova_i2c_benchmark/
│   └── supernova_spi/
├── include/
│   ├── bridge_reader.h
│   ├── BridgeReader_windows.h
│   ├── CommandDispatcher.h
│   ├── CommandManager.h
│   ├── CommandRequest.h
│   ├── CommandResponse.h
│   └── definitions.h
└── lib/
    ├── libbmc_sdk_static.a
    ├── libbmc_sdk.1.1.0.dylib
    ├── libbmc_sdk.1.dylib
    ├── libbmc_sdk.dylib

Manual Build Instructions

Prerequisites:

  • CMake: Ensure CMake is installed on your system.

    • On macOS: brew install cmake

    • On Linux: Use your package manager (apt-get, yum, etc.) to install CMake, e.g., sudo apt-get install cmake.

    • On Windows: Download and install CMake from here.

  • Bridge Executable: Ensure the bridge executable is installed and accessible in your system's PATH. If it's not available, follow the installation guide for Bridge in the documentation.

  • Visual Studio (Windows only): You must have Visual Studio 2022 or a similar version installed with C++ development tools.

macOS & Linux Instructions:

  1. Clone the Repository Start by cloning the SDK repository from GitHub:

    git clone https://github.com/binhollc/MissionControlTowerSDK.git
    cd MissionControlTowerSDK
  2. Clean Previous Builds (if any) If you have previously built the SDK, it's recommended to clean up old build files before starting a new build.

    • If the build directory exists, remove it:

      rm -rf build
    • If the staging directory exists, remove it:

      rm -rf staging
  3. Create Staging and Build Directories

    • Create the staging directory to store the built library:

      mkdir staging
    • Create a new build directory where the compilation process will occur:

      mkdir build
      cd build
  4. Run CMake to Configure the Build Use CMake to generate the necessary build files. Specify the build type as Release:

    cmake -DCMAKE_BUILD_TYPE=Release ..
  5. Build the C++ SDK Library After configuring, initiate the build process:

    cmake --build . --config Release --target install
  6. Return to the Project Directory After the build is complete, navigate back to the root directory:

    cd ..

Windows Instructions:

  1. Clone the Repository Open the Command Prompt and clone the SDK repository:

    git clone https://github.com/binhollc/MissionControlTowerSDK.git
    cd MissionControlTowerSDK
  2. Set Up Staging and Clean Previous Builds (if any) If a previous build exists, clean it:

    • Remove the staging directory if it exists:

      rmdir /S /Q staging
      mkdir staging
    • Remove the build directory if it exists:

      rmdir /S /Q build
      mkdir build
  3. Change to the Build Directory Navigate into the newly created build directory:

    cd build
  4. Run CMake to Configure the Build Configure the build using CMake with Visual Studio as the generator. Set the platform (win32 or x64), defaulting to win32 if none is provided:

    • For win32 builds:

      cmake -DCMAKE_BUILD_TYPE=Release .. -G "Visual Studio 17 2022" -A win32
    • For x64 builds:

      cmake -DCMAKE_BUILD_TYPE=Release .. -G "Visual Studio 17 2022" -A x64
  5. Build the C++ SDK Library Once configured, compile the SDK library:

    cmake --build . --config Release --target install
  6. Return to the Project Directory After building, return to the project root directory:

    cd ..

Output:

After following these steps, the compiled SDK library and example applications will be stored in the staging directory on all platforms. You can now link this library to your projects or distribute it as needed.

Last updated