Please enable JavaScript to view this site.

IDS peak 2.1.0 / uEye+ firmware 3.0

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)
 
project ("my_new_project")
 
message (STATUS "[${PROJECT_NAME}] Processing ${CMAKE_CURRENT_LIST_FILE}")
 
set (SAMPLE_TARGET_NAME ${PROJECT_NAME})
set (CMAKE_SCRIPTS_PATH "${CMAKE_CURRENT_SOURCE_DIR}/../../_cmake_scripts" CACHE STRING "The path of the CMake scripts directory.")
set (SAMPLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/output/bin")
 
include (${CMAKE_SCRIPTS_PATH}/cmake_detect_srchitecture.cmake)
detect_target_architecture (ARCH)
 
add_executable (${SMAPLE_TARGET_NAME}
   main.cpp
]

 

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.

hint_info

Note on genericC++/C#

Copy also the folder "<installation directory>/ids_peak/generic_sdk/samples/source/_cmake_scripts" into your working directory, so that the project folder is two levels lower than the _cmake_scripts order, e.g.:

- working_directory

 | - _cmake_scripts

 | - genericCppProjects

 |   | - my_new_project

 |   |   | - CMakeLists.txt

 |   |   | - main.cpp / Program.cs

Alternatively, copy the entire directory "<install directory>/ids_peak/generic_sdk/samples/source/" to your working directory.

1.Open the newly created folder in Visual Studio.

Fig. 228: Open folder (Visual Studio)

Fig. 228: 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>
 
#include <ids_peak_comfort_c/ids_peak_comfort_c.h>
 
int main()
{
  peak_status status = peak_Library_Init();
  if (PEAK_ERROR(status))
  {
      printf("Library could not be initialized!\n");
      return 1;
  }
 
  printf("Library successfully initialized!\n");
  (void)peak_Library_Exit();
  return 0;
}

main.cpp (genericC++)

#include <iostream>
 
#include <peak/peak.hpp>
 
int main()
{
  peak::Library::Initialize();
  std::cout << "Library successfully initialized!" << std::endl;
 
  peak::Library::Close();
  return 0;
}

Programm.cs (genericC#)

using System;
 
namespace my_new_project
{
  class Program
  {
      static void Main(string[] args)
      {
          peak.Library.Initialize();
          Console.WriteLine("IDS peak Library successfully initialized");
          peak.Library.Close();
      }
  }
}

hint_info

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.

hint_info

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".

hint_info

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.

hint_info

Note on genericC++/C#

Copy also the folder "<installation directory>/ids_peak/generic_sdk/samples/source/_cmake_scripts" into your working directory, so that the project folder is two levels lower than the _cmake_scripts order, e.g.:

- working_directory

 | - _cmake_scripts

 | - genericCppProjects

 |   | - my_new_project

 |   |   | - CMakeLists.txt

 |   |   | - main.cpp / Program.cs

Alternatively, copy the entire directory "<install directory>/ids_peak/generic_sdk/samples/source/" to your working directory.

2.Open the CMake GUI.

Fig. 229: Open the CMake GUI

Fig. 229: 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. 230: Specify paths and build directory

Fig. 230: Specify paths and build directory

4.Click on “Configure” (3).

Fig. 231: Select compiler

Fig. 231: 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. 232: Correct CMake configuration

Fig. 232: 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).

© 2022 IDS Imaging Development Systems GmbH