IDS Peak comfortSDK, genericSDK, IPL, and AFL developer manuals are external documents. Please contact us if you need them.
If you use Visual Studio, you have several options to create a project:
•Opening a C-Make project folder directly (from Visual Studio 2017 on)
•Creating a Visual Studio project folder with CMake GUI (all Visual Studio versions)
•Configuring a Visual Studio project folder manually
Opening a C-Make project folder directly (from Visual Studio 2017 on)
The CMake support is directly integrated since Visual Studio 2017. This way, you can open folders with a CMakeLists.txt file directly via "File > Open > Folder". You will find more information at https://docs.microsoft.com/de-de/cpp/build/cmake-projects-in-visual-studio. Select the appropriate Visual Studio version.
Start with a pre-configured CMakeLists.txt file from the examples. For this, copy e.g. the folder "<installation directory>/ids_peak/comfort_sdk/samples/source/c/walkthrough/" (comfortC) or ".../ids_peak/generic_sdk/samples/source/cpp/open_camera/" (genericC++) into your working directory. If desired, adjust the folder name and project name in the CMakeLists.txt file.
CMakeLists.txt |
---|
cmake_minimum_required(VERSION 3.2 FATAL_ERROR) |
Alternatively, you can create an empty folder, copy the CMakeLists.txt file and customize the project name. In this case, you should create an empty main.c, main.cpp or Program.cs file next to the CMakeLists.txt.
1.Open the newly created folder in Visual Studio.
Fig. 261: Open folder (Visual Studio)
2.Test the configuration with the copied sample code or a short test code, e.g.
main.c (comfortC) |
---|
#include <stdio.h> |
main.cpp (genericC++) |
---|
#include <iostream> |
Programm.cs (genericC#) |
---|
using System; |
Note on genericC++/C# By right-clicking on the main.cpp/Program.cs in project folder explorer, define for this file "Set As Startup Item”. So the correct process is made known to Visual Studio to be able to start the execution automatically, e.g. for the shortcut F5. |
Note on genericC# You may still need to correct the CMake generator. For this, open the CMake settings via right-click on the CMakeLists.txt file. Via "Show advanced settings", you have the option to change the CMake generator, e.g. to "Visual Studio 16 2019 Win64". |
Note on projects with Qt If you have a project with Qt, correct the Qt5_DIR variable. See Notes on projects using Qt for Windows. |
Creating a Visual Studio project folder with CMake GUI (all Visual Studio versions)
For all Visual Studio versions ≤ 2015 without direct CMake support, it is possible to create Visual Studio projects via the CMake GUI. Proceed as follows:
1.Copy one or more samples to your working directory for which you have write permissions.
2.Open the CMake GUI.
Fig. 262: Open the CMake GUI
3.Specify the path to the folder containing the CMakeLists.txt file (1) and a build directory (2) for which you have write permissions.
Fig. 263: Specify paths and build directory
4.Click on “Configure” (3).
Fig. 264: Select compiler
5.Click on “Finish”.
Now CMake configures the project. For this, CMake searches e.g. the paths to the required components.
6.If not all components are found, an error message is displayed. Mostly, it is sufficient to click on "Configure" again. If you have a project with Qt , correct the Qt5_DIR variable, see Notes on projects with Qt for Windows.
7.Click on “Configure” again.
Fig. 265: Correct CMake configuration
8.When CMake has found all the components needed, click "Generate" (4) to create the Visual Studio project. Afterwards the project can be opened directly in Visual Studio via "Open Project" (5).
The required project files are created in the build directory, including the Visual Studio Solution (*.sln). The source files (*.c, *.cpp, ...) are still located in the source directory (1).