7. Build Examples ==================================================== Example code on how to call the functions provided by CCAux API are found in the CCAux API documentation and in the examples directory of the CCAux API source code. Additionally, this chapter provides examples on the build process. ==================================================== 7.1 Building applications with the SDK ==================================================== This chapter provides two examples of how to build a small application that uses CCAux API functions to set the status LED color. The first example demonstrates how to build a C++ application using CMake. The second example shows how to build OpenCV using CMake. Finally, a link to UX Designer 5.01 is provided, which should be consulted when creating Qt applications. ------------------------------------------------------------------ 7.1.1 C++ Cmake example ------------------------------------------------------------------ This example shows how to build a C++ application example using Cmake. The source file example.cpp is listed below. The file consists of a simple main function calling the status LED functions. .. code-block:: C++ /** * example.cpp **/ #include #include #include using namespace CrossControl; int main(void) { printf("Setting FrontLED to blue!\r\n"); FRONTLEDHANDLE pLed = GetFrontLED(); eErr err; err = FrontLED_setStandardColor(pLed, BLUE); if(err != ERR_SUCCESS) printf("An error occurred!\r\n"); FrontLED_release(pLed); return 0; } Add the following text to the CMakeLists.txt file in the directory where example.cpp is located. .. code-block:: bash cmake_minimum_required(VERSION 3.15) # Project name and language project(example_project CXX) # Set compiler flags add_compile_definitions(LINUX) add_compile_options(-Wall) # Define the executable target add_executable(example example.cpp) # Linker flags target_link_libraries(example PRIVATE cc-aux2 pthread) To build the example, make sure the environment setup script has been sourced, and then issue the following command: .. code-block:: $ cmake . $ make ==================================================== 7.2 Qt application development ==================================================== CrossControl provides a pre-configured virtual machine with open-source Qt IDE and development Qt runtime for all CC Linux-based display computers. Best source of reference is the UX Designer Documentation. https://crosscontrol.com/manual/UX-Designer-V5.1-Online-Documentation/content/getting_started_deb.html For additional information and downloads, see https://crosscontrol.com/software-solutions/ ================================================================ 7.3 Cross Compiling additional softwares using Yocto SDK ================================================================ In addition to the CrossControl provided softwares or packages, you may build and integrate additional softwares for the platform using Yocto SDK provided by Crosscontrol. You may also build and integrate your preferred version of a particular software, instead of the version provided by CrossControl. For this manual, the target platform is V1200/V1000 is considered. This guide will assume that the location of the SDK is: .. code-block:: bash /opt/cclinux-v1x00-4.x.x.x Then the platform environment can be setup for cross compilation by sourcing the environment script from the SDK as below: .. code-block:: bash ./opt/cclinux-v1x00-4.x.x.x/environment-setup-cortexa35-poky-linux In this example, **OpenCV 4.10.0** will be built and integrated into the platform using Yocto SDK provided by CrossControl .. code-block:: bash . /opt/V1X00/environment-setup-cortexa35-poky-linux mkdir opencv wget -O opencv.zip https://github.com/opencv/opencv/archive/refs/tags/4.10.0.zip wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/refs/tags/4.10.0.zip unzip opencv.zip unzip opencv_contrib.zip mkdir build-imx8 && cd build-imx8 # Cross-Compile for IMX8 (assumes SDK is installed to /opt/V1X00 folder) cmake -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_INSTALL_PREFIX=/opt/V1X00/OpenCV-4.10.0 \ -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-4.10.0/modules \ -D WITH_OPENMP=ON \ -D WITH_OPENCL=ON \ -D WITH_TBB=ON \ -D BUILD_SHARED_LIBS=ON \ -D BUILD_OPENJPEG=ON \ ../opencv-4.10.0 cmake --build . --parallel 10 .. note:: Make sure to verify the licensing requirements for any software or packages that will be integrated.