# DeviceAtlas C API and Unix #
A how-to guide to compile and run the DeviceAtlas C API on Unix systems.
### Requirements ###
- A C compiler
- CMake 2.6 (or above)
- PCRE 6.x (or above). For best performance v8.21 (or above) is recommended.
**Important** - There are two major versions of the PCRE library: PCRE and
PCRE2. PCRE2 is not compatible and should not be used.
The following compilers have been tested and are able to compile all
components:
- GCC (3.4 or above (4.x versions are recommended))
- Clang/LLVM (3.0 or above)
- Sun Pro family (12.x or above)
### CMake ###
By default CMake should find all necessary components if they are installed
with a package manager. This section describes setting cmake variables to
handle components installed in custom locations.
** PCRE library and headers **
If the PCRE library and headers are located in a custom location, the
following cmake environment variables may be set:
- PCRELIB=<path to the pcre library>
- PCRE_INCLUDE_DIR=<path to the pcre headers folder>
(For Red Hat based operating systems, the required packages are pcre-devel;
for Debian, the names are libpcre3-dev; otherwise, please check pcre and
zlib development packages with your package manager).
For example:
```shell
cmake -DPCRELIB=/home/test/pcre/lib/libpcre.so -DPCRE_INCLUDE_DIR=/home/test/pcre/include
```
Compatibility: For older PCRE versions it is possible to disable the PCRE Study
feature with cmake -DPCRE_STUDY=0. It is highly recommended to NOT disable
PCRE Study for better performance.
** Custom compiler location **
- CMAKE_C_COMPILER=<full path to the C compiler executable>
For example:
```shell
cmake -DCMAKE_C_COMPILER=/home/test/gcc-4.8.3/bin/gcc -DCMAKE_CXX_COMPILER=/home/test/gcc-4.8.3/bin/g++
```
NB: For a static API version used with another shared library it is possible to
use CFLAGS/CXXFLAGS with -fPIC/fpic compilation flag.
### Building the API ###
1. Unpack the API
2. Change to the API directory
3. Run cmake command
4. Run make
```shell
% cmake .
% make
```
### Sample applications ###
There are multiple examples in the /Examples folder to test the API.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
_ Copyright (c) DeviceAtlas Limited 2021. All Rights Reserved. _
https://deviceatlas.com