irayparser_web_logo

IRay300Parser C++ library

v1.1.3

Table of contents

Overview

IRay300Parser C++ library is designed to encode (prepare) control commands for long wave infrared camera module FT II. The library includes method for preparing commands (encoding) and decode responses (decoding). It uses C++17 standard and is compatible with Windows and Linux operating systems. The library provides simple interface and doesn’t have third party dependencies to be installed in OS. Also, the library provides test application to control camera via serial port. Test application depends on open source SerialPort (provides methods to work with serial ports, source code included, Apache 2.0 license).

Versions

Table 1 - Library versions.

Version Release date What’s new
1.0.0 20.03.2024 First version.
1.1.0 27.03.2024 - Code reviewed.
- Documentation updated.
- Interface changed.
1.1.1 24.04.2024 - Documentation updated.
1.1.2 30.07.2024 - CMake structure updated.
1.1.3 08.10.2024 - Add AF_START command to run autofocus algorithm.

Library files

The library supplied by source code only. The user would be given a set of files in the form of a CMake project (repository). The repository structure is shown below:

CMakeLists.txt ----------------- Main CMake file of the library.
src ---------------------------- Folder with library source code.
    CMakeLists.txt ------------- CMake file of the library.
    IRay300Parser.h ------------ Main library header file.
    IRay300Parser.cpp ---------- C++ implementation file.
    IRay300ParserVersion.h ----- Header file with library version.
    IRay300ParserVersion.h.in -- File for CMake to generate version header.
test --------------------------- Folder for test application files.
    3rdaprty ------------------- Folder with third-party libraries for test application.
        CMakeLists.txt --------- CMake file for to include third-party libraries.
        SerialPort ------------- Folder with SerialPort library source code.
    CMakeLists.txt ------------- CMake file for test application.
    main.cpp ------------------- Source C++ file of test application.

IRay300Parser class description

IRay300Parser Class declaration

IRay300Parser.h file contains IRay300Parser class declaration.

class IRay300Parser
{
public:
    
    /// Get library version.
    static std::string getVersion();
    
    /// Encode IRay300 command.
    bool getCommand(uint8_t* data,
                    int& size,
                    IRay300Command id,
                    int arg1 = 0,
                    int arg2 = 0);

	/// Decode IRay300 response.
    IRay300Response decodeResponse(uint8_t nextByte, 
                                   int &arg1, 
                                   int &arg2);

	/// Get response arguments.
    void getResponseArgs(int &arg1, int &arg2);
}

getCommand method

The getCommand(…) method encodes (prepares data) control command or request for camera. The camera does not send data on its own, but only responds to requests. Method declaration:

bool getCommand(uint8_t* data, 
                int& size, IRay300Command id,
                int arg1 = 0,
                int arg2 = 0);
Parameter Description
data Pointer to buffer for encoded data.
size Size of encoded command.
id Command ID according to IRay300Command enum.
arg1 First command argument. The value of argument depends on command ID (IRay300Command enum). Some commands don’t have arguments.
arg2 Second command argument. The value of argument depends on command ID (IRay300Command enum). Some commands don’t have arguments.

Returns: TRUE if command is prepared or FALSE if not.

decodeResponse method

The decodeResponse (…) decodes response from camera. See the Decoding example. Once the data from the serial port has been read the user must pass it to the method byte-by-byte (each byte separately in sequence). The library has an internal ring buffer. When the user passes another byte to the method, the library shifts the ring buffer by one byte and copies the new byte to the end of the buffer. If the library detects a valid response in the ring buffer, it returns the response ID (see IRay300Response) and returns the response arguments. In all other cases, the library returns a NONE identifier. Method declaration:

IRay300Response decodeResponse(uint8_t nextByte, int &arg1, int &arg2);
Parameter Description
nextByte Byte from serial port.
arg1 Response argument 1. The value of argument depends on response ID (see IRay300Response enum). Some responses don’t have arguments.
arg2 Response argument 2. The value of argument depends on response ID (see IRay300Response enum). Some responses don’t have arguments.

Returns: Response ID according to IRay300Response enum if response detected or NONE ID if not.

getVersion method

The getVersion() method returns string of current version of IRay300Parser class. Method declaration:

static std::string getVersion();

Method can be used without IRay300Parser class instance. Example:

cout << "IRay300Parser version: " << cr::lens::IRay300Parser::getVersion();

Console output:

IRay300Parser version: 1.1.2

Data structures

IRay300Command enum

enum class IRay300Command
{
    /// Set zoom motor reversed.
    /// Arguments :
    /// arg1:   0x00 - not reversed.
    ///         0x01 - is reversed.
    SET_ZOOM_MOTOR_REVERSED,
    /// Get zoom motor reversed.
    GET_ZOOM_MOTOR_REVERSED,
    /// Set zoom motor rotation type.
    /// Arguments :
    /// arg1:   0x01 - short focus.
    ///         0x02 - long focus.
    /// arg2:   0x00 - no tuning.
    ///         0x01 - fine tuning.
    SET_ZOOM_MOTOR_ROTATION_TYPE,
    /// Zoom motor shutoff.
    ZOOM_MOTOR_SHUTOFF,
    /// Get zoom position.
    GET_ZOOM_MOTOR_POSITION,
    /// Set zoom motor speed.
    /// arg1:   speed value 0x00 - 0x20.
    SET_ZOOM_MOTOR_SPEED,
    /// Get zoom motor speed.
    GET_ZOOM_MOTOR_SPEED,
    /// Get zoom motor route.
    GET_ZOOM_MOTOR_ROUTE,
    /// Set focus motor reversed.
    /// Arguments :
    /// arg1:   0x00 - not reversed.
    ///         0x01 - is reversed.
    SET_FOCUS_MOTOR_REVERSED,
    /// Get focus motor reversed.
    GET_FOCUS_MOTOR_REVERSED,
    /// Set focus motor rotation type.
    /// Arguments :
    /// arg1:   0x01 - short focus.
    ///         0x02 - long focus. 
    /// arg2:   0x00 - no tuning.
    ///         0x01 - fine tuning.
    SET_FOCUS_MOTOR_ROTATION_TYPE,
    /// Focus motor shutoff.
    FOCUS_MOTOR_SHUTOFF,
    /// Get focus position.
    GET_FOCUS_MOTOR_POSITION,
    /// Set focus motor speed.
    /// arg1:   speed value 0x00 - 0x20.
    SET_FOCUS_MOTOR_SPEED,
    /// Get focus motor speed.
    GET_FOCUS_MOTOR_SPEED,
    /// Get focus motor route.
    GET_FOCUS_MOTOR_ROUTE,
    /// Set shutter correction mode.
    /// Arguments :
    /// arg1:   0x00 - manual.
    ///         0x01 - auto.
    SET_SHUTTER_CORRECTION_MODE,
    /// Set timeout for auto shutter correction mode.
    /// Arguments :
    /// arg1: timeout min. 
    SET_SHUTTER_CORRECTION_TIMEOUT,
    /// Set Freeze video.
    SET_FREEZE,
    /// Set unfreeze video.
    SET_UNFREEZE,
    /// Set Image mode.
    /// Arguments :
    /// arg1:   0x00 - manual.
    ///         0x01 - auto.
    ///         0x02 - manual 1.
    SET_IMAGE_MODE,
    /// Set video mode.
    /// Arguments :
    /// arg1:   0x00 - NTSC.
    ///         0x01 - PAL.
    SET_VIDEO_MODE,
    /// Do NUC.
    DO_SHUTTER_CORRECTION,
    /// Set focus mode. arg1: 0 - manual, 1 - auto.
    SET_FOCUS_MODE,
    /// Set the position of focal Length. arg1: 0 - 300 mm.
    SET_FOCAL_LENGTH_POSITION,

    /// CAMERA COMMANDS

    /// Set palette. arg1 - palette ID:
    /// 0  - Whitehot
    /// 1  - Blackhot
    /// 2  - Rainbow
    /// 3  - Rainbow HC
    /// 4  - Iron
    /// 5  - Lava
    /// 6  - Sky
    /// 7  - Mid-gray
    /// 8  - Gray-red
    /// 9  - Purple-orange
    /// 10 - Special
    /// 11 - Warning red
    /// 12 - Icefire
    /// 13 - Cyanred
    /// 14 - Special 2
    /// 15 - Gradient red
    /// 16 - Gradient green
    /// 17 - Gradient blue
    /// 18 - Warning green
    /// 19 - Warning blue
    SET_PALETTE,
    /// Set brightness. arg1: 0 - 100%.
    SET_BRIGHTNESS,
    /// Set contrast. arg1: 0 - 100%.
    SET_CONTRAST,
    /// Set zoom position. arg1 - zoom position.
    SET_ZOOM_POSITION,
    /// Set focus position. arg1 - focus position.
    SET_FOCUS_POSITION,
    /// Run AF.
    AF_START
};

Table 2 - IRay300Command enum class description.

Parameter Description Argument 1 Argument 2
SET_ZOOM_MOTOR_REVERSED Set zoom motor reversed. 0x00 - not reversed.
0x01 - is reversed.
Not used.
GET_ZOOM_MOTOR_REVERSED Request zoom motor reversed value. Not used. Not used.
SET_ZOOM_MOTOR_ROTATION_TYPE Set zoom motor rotation type. 0x01 - short focus.
0x02 - long focus.
0x00 - no tuning.
0x01 - fine tuning.
ZOOM_MOTOR_SHUTOFF Zoom motor shutoff. Not used. Not used.
GET_ZOOM_MOTOR_POSITION Request zoom position. Not used. Not used.
SET_ZOOM_MOTOR_SPEED Set zoom motor speed. Value: 0x00 - 0x20. Not used.
GET_ZOOM_MOTOR_SPEED Request zoom motor speed value. Not used. Not used.
GET_ZOOM_MOTOR_ROUTE Request zoom motor route value. Not used. Not used.
SET_FOCUS_MOTOR_REVERSED Set focus motor reversed. 0x00 - not reversed.
0x01 - is reversed.
Not used.
GET_FOCUS_MOTOR_REVERSED Request focus motor reversed value. Not used. Not used.
SET_FOCUS_MOTOR_ROTATION_TYPE Set focus motor rotation type. 0x01 - short focus.
0x02 - long focus.
0x00 - no tuning.
0x01 - fine tuning.
FOCUS_MOTOR_SHUTOFF Focus motor shutoff. Not used. Not used.
GET_FOCUS_MOTOR_POSITION Request focus position. Not used. Not used.
SET_FOCUS_MOTOR_SPEED Set focus motor speed. Value: 0x00 - 0x20. Not used.
GET_FOCUS_MOTOR_SPEED Request Not used. Not used.
GET_FOCUS_MOTOR_ROUTE Request Not used. Not used.
SET_SHUTTER_CORRECTION_MODE Set shutter correction mode. 0x00 - manual.
0x01 - auto.
Not used.
SET_SHUTTER_CORRECTION_TIMEOUT Set timeout for auto shutter correction mode. Value: minutes. Not used.
SET_FREEZE Set freeze video. Not used. Not used.
SET_UNFREEZE Set unfreeze video. Not used. Not used.
SET_IMAGE_MODE Set Image mode. 0x00 - manual.
0x01 - auto.
0x02 - manual 1.
Not used.
SET_VIDEO_MODE Set video mode. 0x00 - NTSC.
0x01 - PAL.
Not used.
DO_SHUTTER_CORRECTION Do NUC. Not used. Not used.
SET_FOCUS_MODE Set focus mode. 0 - manual.
1 - auto.
Not used.
SET_FOCAL_LENGTH_POSITION Set the position of focal Length. Value: 0 - 300 (mm). Not used.
SET_PALETTE Set palette. 0 - Whitehot.
1 - Blackhot.
2 - Rainbow.
3 - Rainbow HC.
4 - Iron.
5 - Lava.
6 - Sky.
7 - Mid-gray.
8 - Gray-red.
9 - Purple-orange.
10 - Special.
11 - Warning red.
12 - Icefire.
13 - Cyanred.
14 - Special 2.
15 - Gradient red.
16 - Gradient green.
17 - Gradient blue.
18 - Warning green.
19 - Warning blue.
Not used.
SET_BRIGHTNESS Set brightness. Value: 0 - 100 (%). Not used.
SET_CONTRAST Set contrast. Value: 0 - 100 (%). Not used.
SET_ZOOM_POSITION Set zoom position. Range depends on lens. Not used.
SET_FOCUS_POSITION Set focus position. Range depends on lens. Not used.
AF_START Start auto focus algorithm. Not used. Not used.

IRay300Response enum

enum class IRay300Response
{
    // No response detected.
    NONE,
    /// status of SET_ZOOM_MOTOR_REVERSED command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_ZOOM_MOTOR_REVERSED_STATUS,
    /// value of GET_ZOOM_MOTOR_REVERSED command.
    /// data1:  0x00 - not reversal.
    ///         0x01 - reversal.
    GET_ZOOM_MOTOR_REVERSED_VALUE,
    /// status of SET_ZOOM_MOTOR_ROTATION command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_ZOOM_MOTOR_ROTATION_TYPE_STATUS,
    /// status of ZOOM_MOTOR_SHUTOFF command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    ZOOM_MOTOR_SHUTOFF_STATUS,
    /// value of GET_ZOOM_MOTOR_POSITION command.
    /// data1: value.
    GET_ZOOM_MOTOR_POSITION_VALUE,
    /// status of SET_ZOOM_MOTOR_SPEED command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_ZOOM_MOTOR_SPEED_STATUS,
    /// value of GET_ZOOM_MOTOR_SPEED command.
    /// data1: value.
    GET_ZOOM_MOTOR_SPEED_VALUE,
    /// value of GET_ZOOM_MOTOR_ROUTE command.
    /// data1: Zoom HW wide limit.
    /// data2: Zoom HW tele limit.
    GET_ZOOM_MOTOR_ROUTE_VALUE,
    /// status of SET_FOCUS_MOTOR_REVERSED command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_FOCUS_MOTOR_REVERSED_STATUS,
    /// value of GET_FOCUS_MOTOR_REVERSED command.
    /// data1:  0x00 - not reversal.
    ///         0x01 - reversal.
    GET_FOCUS_MOTOR_REVERSED_VALUE,
    /// status of SET_FOCUS_MOTOR_ROTATION command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_FOCUS_MOTOR_ROTATION_TYPE_STATUS,
    /// status of FOCUS_MOTOR_SHUTOFF command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    FOCUS_MOTOR_SHUTOFF_STATUS,
    /// value of GET_FOCUS_MOTOR_POSITION command.
    /// data1: value.
    GET_FOCUS_MOTOR_POSITION_VALUE,
    /// status of SET_FOCUS_MOTOR_SPEED command.
    /// data1: 0x00 - Fail.
    ///        0x01 - Succeed.
    SET_FOCUS_MOTOR_SPEED_STATUS,
    /// value of GET_FOCUS_MOTOR_SPEED command.
    /// data1: value.
    GET_FOCUS_MOTOR_SPEED_VALUE,
    /// value of GET_FOCUS_MOTOR_ROUTE command.
    /// data1: Focus HW near limit.
    /// data2: Focus HW near limit.
    GET_FOCUS_MOTOR_ROUTE_VALUE,
    /// status of communication protocol wrong.
    /// data1:  0xF1 - Command sending overtime.
    ///         0xFB - None of CW.
    ///         0xFD - DRC Parity Byte error.
    ///         0xFF - Packet start 0xAA error.
    ERROR_COMMUNICATION,
    /// status of SET_SHUTTER_CORRECTION_MODE command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_SHUTTER_CORRECTION_MODE_STATUS,
    /// status of SET_SHUTTER_CORRECTION_TIMEOUT command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_SHUTTER_CORRECTION_TIMEOUT_STATUS,
    /// status of SET_FREEZE command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_FREEZE_STATUS,
    /// status of SET_UNFREEZE command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_UNFREEZE_STATUS,
    /// status of SET_IMAGE_MODE command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_IMAGE_MODE_STATUS,
    /// status of SET_VIDEO_MODE command.
    /// data1:  0x00 - Fail.
    ///         0x01 - Succeed.
    SET_VIDEO_MODE_STATUS,
    /// no defined error.
    ERROR_GENERAL
};

Table 3 - IRay300Response enum class description.

Parameter Description arg 1 arg 2
NONE No response detected. Not used. Not used.
SET_ZOOM_MOTOR_REVERSED_STATUS Status of SET_ZOOM_MOTOR_REVERSED command 0x00 - Fail.
0x01 - Succeed.
Not used.
GET_ZOOM_MOTOR_REVERSED_VALUE Value of GET_ZOOM_MOTOR_REVERSED command. 0x00 - Not reversal.
0x01 - Reversal.
Not used.
SET_ZOOM_MOTOR_ROTATION_TYPE_STATUS Status of SET_ZOOM_MOTOR_ROTATION command. 0x00 - Fail.
0x01 - Succeed.
Not used.
ZOOM_MOTOR_SHUTOFF_STATUS Status of ZOOM_MOTOR_SHUTOFF command. 0x00 - Fail.
0x01 - Succeed.
Not used.
GET_ZOOM_MOTOR_POSITION_VALUE Value of GET_ZOOM_MOTOR_POSITION command. Value. Not used.
SET_ZOOM_MOTOR_SPEED_STATUS Status of SET_ZOOM_MOTOR_SPEED command. 0x00 - Fail.
0x01 - Succeed.
Not used.
GET_ZOOM_MOTOR_SPEED_VALUE Value of GET_ZOOM_MOTOR_SPEED command. Value. Not used.
GET_ZOOM_MOTOR_ROUTE_VALUE Value of GET_ZOOM_MOTOR_ROUTE command. Zoom HW wide limit. Zoom HW tele limit.
SET_FOCUS_MOTOR_REVERSED_STATUS Status of SET_FOCUS_MOTOR_REVERSED command. 0x00 - Fail.
0x01 - Succeed.
Not used.
GET_FOCUS_MOTOR_REVERSED_VALUE Value of GET_FOCUS_MOTOR_REVERSED command. 0x00 - Not reversal.
0x01 - Reversal.
Not used.
SET_FOCUS_MOTOR_ROTATION_TYPE_STATUS Status of SET_FOCUS_MOTOR_ROTATION command. 0x00 - Fail.
0x01 - Succeed.
Not used.
FOCUS_MOTOR_SHUTOFF_STATUS Status of FOCUS_MOTOR_SHUTOFF command. 0x00 - Fail.
0x01 - Succeed.
Not used.
GET_FOCUS_MOTOR_POSITION_VALUE Value of GET_FOCUS_MOTOR_POSITION command. Value. Not used.
SET_FOCUS_MOTOR_SPEED_STATUS Status of SET_FOCUS_MOTOR_SPEED command. 0x00 - Fail.
0x01 - Succeed.
Not used.
GET_FOCUS_MOTOR_SPEED_VALUE Value of GET_FOCUS_MOTOR_SPEED command. Value. Not used.
GET_FOCUS_MOTOR_ROUTE_VALUE Value of GET_FOCUS_MOTOR_ROUTE command. Focus HW near limit. Focus HW near limit.
ERROR_COMMUNICATION Status of communication protocol wrong. 0xF1 - Command sending overtime.
0xFB - None of CW.
0xFD - DRC Parity Byte error.
0xFF - Packet start 0xAA error.
Not used.
SET_SHUTTER_CORRECTION_MODE_STATUS Status of SET_SHUTTER_CORRECTION_MODE command. 0x00 - Fail.
0x01 - Succeed.
Not used.
SET_SHUTTER_CORRECTION_TIMEOUT_STATUS Status of SET_SHUTTER_CORRECTION_TIMEOUT command. 0x00 - Fail.
0x01 - Succeed.
Not used.
SET_FREEZE_STATUS Status of SET_FREEZE command. 0x00 - Fail.
0x01 - Succeed.
Not used.
SET_UNFREEZE_STATUS Status of SET_UNFREEZE command. 0x00 - Fail.
0x01 - Succeed.
Not used.
SET_IMAGE_MODE_STATUS Status of SET_IMAGE_MODE command. 0x00 - Fail.
0x01 - Succeed.
Not used.
SET_VIDEO_MODE_STATUS Status of SET_VIDEO_MODE command. 0x00 - Fail.
0x01 - Succeed.
Not used.
ERROR_GENERAL Undefined error. Not used. Not used.

Examples

Command encoding example

Below is an example of the platform zoom to position command.

uint8_t command[32];
int size = 0;
IRay300Parser parser;
if (!parser.getCommand(command, size, IRay300Command::SET_ZOOM_POSITION, 20))
    cout << " ERROR: Can't encode command" << endl;

Response decoding example

Below is an example of receiving data from serial port and getting zoom position.

// Get data from serial port.
uint8_t buffer[128];
int bytes = serialPort.readData(buffer, 128);
int data1, data2;

// Decoding response byte-by-byte.
for (int i = 0; i < bytes; ++i)
{
    // Put next byte to parser.
    IRay300Response response = parser.decodeResponse(buffer[i], data1, data2);

    // Check result.
    switch (response)
    {
    case IRay300Response::GET_ZOOM_MOTOR_POSITION_VALUE:
        cout << "Zoom position : " << data1 << endl;
        break;
        
        ///...
    }
}

Test application

Folder IRay300Command/test contains the test application files. The test application allows you to generate any command, send it to the camera over the serial port, receive and decode the response. Once started, the user must enter the serial port name (full name for Linux or just the port number for Windows), baud rate (default 9600):

================================================
IRay300 tester v1.1.3
================================================

Set serial port name: /dev/ttyS5
Set baudrate (default : 9600): 9600
==========================================

After user can chose command (enter command ID). If no necessary command has been displayed use can set ID according to IRay300Command enum (test application supports all commands, but shown few, if your need all commands you can set necessary ID):

Commands:
1 - EXIT
2 - SET_ZOOM_MOTOR_REVERSED
3 - GET_ZOOM_MOTOR_REVERSED
4 - SET_ZOOM_MOTOR_ROTATION_TYPE
5 - ZOOM_MOTOR_SHUTOFF
6 - GET_ZOOM_MOTOR_POSITION
7 - SET_ZOOM_MOTOR_SPEED
8 - GET_ZOOM_MOTOR_SPEED
9 - GET_ZOOM_MOTOR_ROUTE
10 - SET_FOCUS_MOTOR_REVERSED
11 - GET_FOCUS_MOTOR_REVERSED
12 - SET_FOCUS_MOTOR_ROTATION_TYPE
13 - FOCUS_MOTOR_SHUTOFF
14 - GET_FOCUS_MOTOR_POSITION
15 - SET_FOCUS_MOTOR_SPEED
16 - GET_FOCUS_MOTOR_SPEED
17 - GET_FOCUS_MOTOR_ROUTE
18 - SET_SHUTTER_CORRECTION_MODE
19 - SET_SHUTTER_CORRECTION_TIMEOUT
20 - SET_FREEZE
21 - SET_UNFREEZE
22 - SET_IMAGE_MODE
23 - SET_VIDEO_MODE
24 - DO_SHUTTER_CORRECTION
25 - SET_FOCUS_MODE
26 - SET_FOCAL_LENGTH_POSITION
27 - SET_PALETTE
28 - SET_BRIGHTNESS
29 - SET_CONTRAST
30 - SET_ZOOM_POSITION
31 - SET_FOCUS_POSITION

For rest of commands check IRay300Parser.h file

Choose command:

Then, corresponding command will be generated and sent to camera. Camera will return related response.

Build and connect to your project

Typical commands to build IRay300Parser library:

cd IRay300Parser
mkdir build
cd build
cmake ..
make

If you want to connect IRay300Parser library to your CMake project as source code, you can do the following. For example, if your repository has structure:

CMakeLists.txt
src
    CMakeList.txt
    yourLib.h
    yourLib.cpp

Create 3rdparty folder in your repository and copy folder of IRay300Parser repository there. The new structure of your repository will be as follows:

CMakeLists.txt
src
    CMakeList.txt
    yourLib.h
    yourLib.cpp
3rdparty
    IRay300Parser

Create CMakeLists.txt file in 3rdparty folder. CMakeLists.txt should be containing:

cmake_minimum_required(VERSION 3.13)

################################################################################
## 3RD-PARTY
## dependencies for the project
################################################################################
project(3rdparty LANGUAGES CXX)

################################################################################
## SETTINGS
## basic 3rd-party settings before use
################################################################################
# To inherit the top-level architecture when the project is used as a submodule.
SET(PARENT ${PARENT}_YOUR_PROJECT_3RDPARTY)
# Disable self-overwriting of parameters inside included subdirectories.
SET(${PARENT}_SUBMODULE_CACHE_OVERWRITE OFF CACHE BOOL "" FORCE)

################################################################################
## CONFIGURATION
## 3rd-party submodules configuration
################################################################################
SET(${PARENT}_SUBMODULE_IRAY300_PARSER                  ON  CACHE BOOL "" FORCE)
if (${PARENT}_SUBMODULE_IRAY300_PARSER)
    SET(${PARENT}_IRAY300_PARSER                        ON  CACHE BOOL "" FORCE)
    SET(${PARENT}_IRAY300_PARSER_TEST                   OFF CACHE BOOL "" FORCE)
endif()

################################################################################
## INCLUDING SUBDIRECTORIES
## Adding subdirectories according to the 3rd-party configuration
################################################################################
if (${PARENT}_SUBMODULE_IRAY300_PARSER)
    add_subdirectory(IRay300Parser)
endif()

File 3rdparty/CMakeLists.txt adds folder IRay300Parser to your project and excludes test applications and examples from compiling (by default test applications and example are excluded from compiling if FujiSxParser is included as sub-repository). The new structure of your repository:

CMakeLists.txt
src
    CMakeList.txt
    yourLib.h
    yourLib.cpp
3rdparty
    CMakeLists.txt
    IRay300Parser

Next, you need to include the ‘3rdparty’ folder in the main CMakeLists.txt file of your repository. Add the following string at the end of your main CMakeLists.txt:

add_subdirectory(3rdparty)

Next, you have to include IRay300Parser library in your src/CMakeLists.txt file:

target_link_libraries(${PROJECT_NAME} IRay300Parser)

Done!