Ask Your Question
0

pkg-config for Windows 7

asked 2014-02-09 08:56:23 -0600

ADarkDividedGem gravatar image

I am wanting to compile an open source project that makes use of OpenCV and part of the make file includes the following lines.

INCS = `pkg-config --cflags opencv` 
LIBS = `pkg-config --libs opencv`

I have downloaded OpenCV but cant find the pkg-config executable. It looks like I will need to compile OpenCV and add pkg-config to my path for the make file to work.

What do I need to compile to get the pkg-config executable for Windows 7?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-04-06 08:26:00 -0600

ADarkDividedGem gravatar image

updated 2014-04-06 08:28:12 -0600

After having a search around in the source files I found the following entry in CMakeList.text

# Generate opencv.pc for pkg-config command
include(cmake/OpenCVGenPkgconfig.cmake)

Looking in OpenCVGenPkgconfig.cmake has the following comment

#  The package name specified on the pkg-config command line is defined to
#      be the name of the metadata file, minus the .pc extension.

After compiling OpenCV with Visual Studio 2012 by following the instructions found in Installation in Windows tutorial the opencv.pc was found in the unix-install which might explain why its not available for window. It looks like opencv.pc contains the information returned by the pkg-config command line

# Package Information for pkg-config

prefix=C:/OpencCV/builds/install
exec_prefix=${prefix}
libdir=
includedir_old=${prefix}/include/opencv
includedir_new=${prefix}/include

Name: OpenCV
Description: Open Source Computer Vision Library
Version: 2.4.8
Libs:  ${exec_prefix}/x86/vc11/lib/opencv_calib3d248.dll ...
Cflags: -I${includedir_old} -I${includedir_new}

After editing the Cflags and Libs properties to include the full file path I used that in my Open Source project.

INCS = -IC:/OpencCV/builds/install/include/opencv -IC:/OpencCV/builds/install/include
LIBS = C:/OpencCV/builds/install/x86/vc11/lib/opencv_calib3d248.dll ...

Now it compiles correctly.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2014-02-09 08:56:23 -0600

Seen: 5,891 times

Last updated: Apr 06 '14