C++ Development This section explains how to build an application with the ZED SDK on Windows and Linux platforms. Setting Up a Project We will build a simple tutorial application Hello ZED using the ZED SDK and CMake. CMake is a cross-platform project generation tool. It provides an easy way to build project files that can be used in the compiler environment of your choice. For example, a CMake script can produce Visual Studio project and solution files. Download and install the latest ZED SDK. Download the ZED Examples sample code available on our GitHub page. You can also browse our GitHub for additional plugins and sample codes. Open the Tutorials/Tutorial 1 - Hello ZED folder to find the code we will build. The following files should be in the directory: CMakeLists.txt main.cpp Readme.md Building on Windows On Windows, building an application with the ZED SDK requires Cmake (3.5.0+) and Visual Studio 2015 or higher. Applications must be compiled for 64-bit. Note: When installing Visual Studio, make sure to select Visual C++ option. Open cmake-gui. In “Where is the source code“, enter the path of the project folder where the CMakeLists.txt is located. Here we created a project folder “ZED_Tutorial_1” in Documents. In “Where to build the binaries“, enter the previous path and add: /build. Click on the “Configure” button. A dialog window asks you if CMake can create the “build” folder. Say yes. Another dialog window will ask you to specify a generator for your project. Choose Visual Studio in Win64 and click on “Finish”. CMake may take a few seconds to configure the project. Click on the “Generate” button to build the Visual Studio project files. CMake has now generated your project in the build directory. Close the cmake-gui window and open the build folder. A Visual Studio solution has been generated. Open Project.sln. If you don’t need the debugging tool, set the project in release mode for better performance. To run the builds from the Build menu or from keyboard shortcuts, set the ZED_Tutorial_1 target as the startup project. You can now edit and compile your program in the Visual Studio IDE. Hit the Ctrl+F5 key to launch the program. Building on Linux and Jetson On Linux, compiling an application with the ZED SDK requires a toolchain with GCC (5, 6) and CMake (3.5.0 minimum). To install both, type: sudo apt-get install build-essential cmake Now let’s build the Hello ZED tutorial. Open your terminal and go to the tutorial folder. cd path/to/your/project/ZED_Tutorial_1 Create a build folder. mkdir build && cd build Generate your project with CMake by pointing to the CMakeLists.txt folder (the parent folder). $ cmake .. ... -- Configuring done -- Generating done -- Build files have been written to: path/to/your/project/ZED_Tutorial_1/build Use the ls command to check the content of the build directory: $ ls CMakeCache.txt CMakeFiles cmake_install.cmake Makefile Compile the application using the make command. make The application is now compiled. To launch it, run this command: ./ZED_Tutorial_1 The application will display your camera serial number in the terminal. Dynamic / static linking On Linux the ZED SDK is available as static and dynamic libraries. The default is dynamic, reducing the application size but forcing the application user to install all the dependencies. The static linking will package all the dependencies into the final executable. To switch between the mode simply enables this option when running the cmake configuration : cmake -DLINK_SHARED_ZED=OFF .. Then rebuilt the program : make The size will significantly increase but the ease of deployment will be greatly improved!