Getting Started
To help setting up projects, the installer sets two environment variables:
IC4PATH
points to the installation directoryPATH
is extended to includeIC4PATH%\bin
The IC Imaging Control 4 installer puts the include, library and binary files into
IC4PATH%\include
IC4PATH%\lib
IC4PATH%\bin
Setting Up the Project
To compile a C program using IC Imaging Control 4 C Library, include files and libraries have to be found by the project in some way. The specifics depend on the type of project being used.
Using CMake
Add the following line to your CMakeLists.txt
to instuct CMake to look for the ic4 library package:
find_package(ic4 REQUIRED)
Then, add ic4::core
to the target_link_libraries
section for your executable. CMake will then automatically add the proper include pathes and library options to your project.
To copy the ic4 binary files to your output directory, use the ic4_copy_runtime_to_target
function.
The minimum CMakeLists.txt for a ic4 C project looks like this:
cmake_minimum_required(VERSION 3.8)
project( hello-ic4 )
find_package( ic4 REQUIRED )
add_executable( hello-ic4
hello-ic4.c
)
target_link_libraries( hello-ic4
PRIVATE
ic4::core
)
ic4_copy_runtime_to_target( hello-ic4 )
Hello IC4!
Add this code to your main C file to check whether project setup was successful:
#include <ic4/Cic4.h>
#include <stdio.h>
int main()
{
ic4_init_library(NULL);
printf("Hello, IC4!\n");
}