4

I need to install GLog for using the SFM module in OpenCV.

I already found the link for the source code but I don't really know how to install it on my system as I dont have much experience with it.

There is also a "README.windows" file but it doesn't really help.
I am using Windows and Microsoft Visual Studio 2013.

Mario
  • 35,726
  • 5
  • 62
  • 78
Mirnyy
  • 207
  • 5
  • 11

2 Answers2

8

Glog has a .sln file and VS project files, but they are obsolete and out of maintenance. So the right way is to build using cmake.

Here's the way to build and install it. And it's not limited to glog, but applicable to most cmake-based projects.

  1. Install the right version of cmake. Usually the newest is the safest.
  2. Open cmake-gui.exe, and use it to generate VS solution.
    • At the top of it, fill in the source code folder (like D:/glog-0.3.5) and where to build (like D:/glog-0.3.5/build). The latter is where the whole VS solution files will be generated to.
    • Click "Configure" button, and it will let you select your platform. Be sure to use the right one.
    • After configuring, a list of options will be listed and probably marked as red. Don't be upset about the red. Just go through them, and modify those you want to.
    • (For glog only) You may need to specify gflags path in Ungrouped Entries/gflags_DIR or disable gflags by unchecking WITH/WITH_GFLAGS. Also, modify CMAKE/CMAKE_INSTALL_PREFIX to a non-system folder, otherwise you will need administrative privileges to run INSTALL project.
    • If you modified any items, press "Configure" again to make it work.
    • When everything is configured right, press "Generate" to generate VS solution. Then you can open it by clicking "Open Project".
  3. In the VS project, select the configuration you want to build (I mean x64/win32, Release/Debug, etc), then build ALL_BUILD to build the project. Then you can build INSTALL, this will copy the headers and libraries to CMAKE/CMAKE_INSTALL_PREFIX folder for a new project to use.
Nocturne
  • 81
  • 1
  • 3
2

I use visual studio community 2017. Just do open folder. With cmakelists.txt inside, visual studio detects this is a cmake project. Visual studio will build for you in the cmake way.

  • Other than this answer being shorter, how does it differ from the previous answer? What does this answer offer than the previous one doesn't? I'm not saying that your answer doesn't provide something useful from the other answer, only that I'm not seeing what the useful thing is and would like to identify that more easily. Thanks! – Louis Langholtz Jan 28 '18 at 19:11
  • @Louis Langholtz, the answer to your question is quite obvious. It should have never been asked. The previous answer uses cmake-gui.exe. Frederic Leroux uses Visual Studio to open cmakelists.txt directly. – Laszlo Jul 05 '22 at 13:20