Pkg-Config misses Ogre dependency

mohij

31-01-2009 21:19:22

The MyGUI.pc pkg-config file generated by MyGUI misses the followning line. This line also includes the pkg-config paramters for Ogre (this is required since MyGUI uses #include "Ogre.h" and not "OGRE/Ogre.h" and probably also links against Ogre).
Requires: OGRE
This line can also be refined to point to the exact version that is required, eg.
Requires: OGRE >= 1.6.0

Altren

31-01-2009 21:35:03

Here's check that we haveAC_DEFUN([MYGUI_CHECK_OGRE], [
PKG_CHECK_MODULES(OGRE, [OGRE >= 1.4.0], have_ogre=yes, have_ogre=no)
if test $have_ogre = no
then
AC_MSG_ERROR([*** Unable to find OGRE! ***])
fi
AC_SUBST(OGRE_CFLAGS)
AC_SUBST(OGRE_LIBS)
])
As you can see we have Ogre version here and everything compiles fine. Can you explain what's wrong.

mohij

31-01-2009 21:52:34

Well, MyGUI compiles fine. The check you mentioned there probably works fine.
The problem arrises when using MyGUI. Any program/lib that uses MyGUI and only uses the flags provided by MyGUI.pc fails to build with errors like "file Ogre.h not found" since -I/usr/local/include/OGRE is missing. MyGUI.pc does not provide this line. Simply stating in the MyGUI.pc file
Requires: OGRE >= 1.4.0
would tell pkg-config to also include the OGRE.pc file automatically.

Altren

31-01-2009 22:28:24

MyGUI.pc.inprefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@

Name: MyGUI
Description: A fast and simple OGRE GUI
Version: @VERSION@
Libs: -L${libdir} -lmygui
Cflags: -I${includedir}/@PACKAGE@ -I${includedir}
Requires: OGRE >= 1.4.0
Just added last line. Right?

mohij

31-01-2009 22:45:51

Yes, that should be just fine.

Even though it might be easier to maintain, to parse that parameter, too.
Something like:
Requires: @OGRE_REQUIREMENTS@
And set that variable in one of those build files (I'm not familiar with autotools).