Intel® Distribution of OpenVINO™ Toolkit
Community support and discussions about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all things computer vision-related on Intel® platforms.
5962 Discussions

How to integrate OpenVINO with an existing C++ project (find_package, include_dir)

adammpolak
New Contributor I
657 Views

- Working through hello_classification example

- Would like to integrate hello_classification example into existing C++ project

- I must incorporate CMakeLists.txt needs of OpenVINO to run the project

- There is no explanation online of what you need to incorporate into an existing CMakeLists.txt

 

From /cpp/CMakeLists.txt, what is important to incorporate to run OpenVINO samples in an existing C++ project?

 

To find the InferenceEngine the current CMakeLists.txt has: 

set(InferenceEngine_DIR "${CMAKE_BINARY_DIR}")

What is this instead if it is being incorporated in another project?

 

Also trying to build this issue occurs where it is not able to locate the header files, do I need to specify an include directory?

fatal error: inference_engine.hpp: No such file or directory
12 | #include <inference_engine.hpp>

0 Kudos
1 Solution
adammpolak
New Contributor I
587 Views

Hello Iffa!

 

Thank you for your response!

 

So I followed the instruction and even with setting the variables and including what was included in the documentation, it was still not able to find the header files.

 

What is missing from the documentation is:

```
include_directories(${InferenceEngine_INCLUDE_DIRS})
include_directories(${InferenceEngine_INCLUDE_DIRS}/../samples/cpp/common/utils/include)
```

 

This will allow the samples to be run in other C++ projects, hope this helps anyone else that got stuck!

View solution in original post

3 Replies
Iffa_Intel
Moderator
615 Views

Hi,


You will need to carefully follow this guide :

https://docs.openvinotoolkit.org/latest/openvino_docs_IE_DG_Integrate_with_customer_application_new_...


It is not as straightforward as you will need to change code/script accordingly to incorporate your requirements.


The most crucial thing is to Include Inference Engine, nGraph and OpenCV libraries in project/CMakeLists.txt.

OpenCV integration is needed mostly for pre-processing input data and ngraph for more complex applications using ngraph API. Please help to refer to the documentation for further details.


Sincerely,

Iffa


adammpolak
New Contributor I
588 Views

Hello Iffa!

 

Thank you for your response!

 

So I followed the instruction and even with setting the variables and including what was included in the documentation, it was still not able to find the header files.

 

What is missing from the documentation is:

```
include_directories(${InferenceEngine_INCLUDE_DIRS})
include_directories(${InferenceEngine_INCLUDE_DIRS}/../samples/cpp/common/utils/include)
```

 

This will allow the samples to be run in other C++ projects, hope this helps anyone else that got stuck!

Iffa_Intel
Moderator
567 Views

Glad you had found the solution for that.

Thanks for the information.

That would help others who might be facing the same issue.



Intel will no longer monitor this thread since this issue has been resolved. If you need any additional information from Intel, please submit a new question. 



Sincerely,

Iffa


Reply