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 gives two examples on how to build a small example application which uses CCAux API functions to set the color of the status LED. The first example shows how to build a C++ application using Cmake. Second example builds opencv with cmake. Finally, there is a link to UX Designer 5.01 which should be referred upon Qt application creation. ------------------------------------------------------------------ 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 following text to CMakeLists.txt on directory you have example.cpp. .. code-block:: 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 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. Also, you may build and integrate preferred version of particular software apart from CrossControl provided version of the software. For this manual, the target platform is V1200/V1000 is considered. This guide will assume that the location of the SDK is: .. code-block:: /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:: ./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:: . /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 with licensing requirements for the softwares or packages that is going to be integrated !!!