Openmvg: How to use openMVG as third party library?

Created on 18 Apr 2017  Â·  2Comments  Â·  Source: openMVG/openMVG

Hi,
I want to build a MFC or Qt application using openMVG as third party library, but I cannot understand "Using OpenMVG as a third party library dependency in cmake" in the BUILD document. Could you please clearify it?

_Here the syntax to add the variable to the cmake command line (use absolute path):
-DCMAKE_INSTALL_PREFIX:STRING="YourInstallPath"
i.e: -DCMAKE_INSTALL_PREFIX:STRING="/home/user/Dev/github/openMVG_Build/openMVG_install"

Could it done in cmake gui?

Once the library has been installed, go to your project that want use OpenMVG as an external library and add:

find_package(OpenMVG REQUIRED)
include_directories(${OPENMVG_INCLUDE_DIRS})
add_executable(main main.cpp)
target_link_libraries(main ${OPENMVG_LIBRARIES})
Is this done in my own cmake file? If is, then in which way I perform this in Cmake gui or in VS setup? My VS version is 2015.

Best regards,
Sherman

question

All 2 comments

Hi,

  1. First you must compile openMVG in release mode and then compile the InstallTarget (you must run VisualStudio as admistrator sometimes in order to be able to let Visual write the .lib inside ProgramsFiles/OpenMVG).

  2. Yes you have to add some line in your own cmake file. In order to link the OpenMVG libraries to your project and to add the OpenMVG include directories.
    You have to add some lines in your CMakeLists.txt, something like

find_package(OpenMVG REQUIRED)
include_directories(${OPENMVG_INCLUDE_DIRS})
add_executable(YOUR-PROJECT MYFILES)
target_link_libraries(YOUR-PROJECT ${OPENMVG_LIBRARIES})

OK, it seems that I should have my own cmake file for the application. I'll try it as soon as possible and see whether get feedback or not.

Was this page helpful?
0 / 5 - 0 ratings