Problems building Ogre by cmake ExternalProject_add

Problems building or running the engine, queries about how to use features etc.
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Problems building Ogre by cmake ExternalProject_add

Post by jauthu »

Did anyone succeeded with that? I try to build static Ogre (1.8.1) by using cmake's ExternalProject_add command like this:

Code: Select all

  ExternalProject_add(ogre
    DEPENDS ogredeps
    SOURCE_DIR "${CMAKE_SOURCE_DIR}/contrib/ogre"
    CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/contrib
    -DOGRE_STATIC=Yes
    -DOGRE_BUILD_SAMPLES=No
    )
but before building ogre I install dependencies to the directory "/home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/Dependencies" (the first in --Search path: in the output below) so when I actually run make ogre, I get surprising output:

Code: Select all

-- Search path: /home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/Dependencies;/home/v/projects/dev/sf/contrib/ogre/Dependencies;/home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/../Dependencies;/home/v/projects/dev/sf/contrib/ogre/../Dependencies
-- Looking for ZLIB...
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.28") 
-- checking for module 'zzip-zlib-config'
--   found zzip-zlib-config, version 1.2.8
-- Found ZLIB: optimized;/usr/lib64/libz.so;debug;/usr/lib64/libz.so
-- Looking for ZZip...
-- checking for module 'zziplib'
--   found zziplib, version 0.13.62
-- Found ZZip: optimized;/usr/lib64/libzzip.so;debug;/usr/lib64/libzzip.so
-- Looking for FreeImage...
-- checking for module 'freeimage'
--   package 'freeimage' not found
-- Found FreeImage: optimized;/usr/lib64/libfreeimage.so;debug;/usr/lib64/libfreeimage.so
-- Looking for FREETYPE...
-- checking for module 'freetype2'
--   found freetype2, version 16.2.10
-- CMAKE_PREFIX_PATH: /home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/Dependencies;/home/v/projects/dev/sf/contrib/ogre/Dependencies;/home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/../Dependencies;/home/v/projects/dev/sf/contrib/ogre/../Dependencies;/usr/local;/usr/lib/x86_64-linux-gnu
-- CMAKE_PREFIX_PATH: /home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/Dependencies;/home/v/projects/dev/sf/contrib/ogre/Dependencies;/home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/../Dependencies;/home/v/projects/dev/sf/contrib/ogre/../Dependencies;/usr/local;/usr/lib/x86_64-linux-gnu
...
...
-- Found OIS: optimized;/home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/Dependencies/lib/libOIS.so;debug;/home/v/projects/dev/sf/build/src/ogre-prefix/src/ogre-build/Dependencies/lib/libOIS.so
as you can see, it does not take the installed dependencies I put there while it finds some from my system. What can be wrong? Is there any option I can pass to Ogre?

Looks like some find_package command do not take in account those search paths ogre added.

Also OIS was built dynamically which is yet another topic...

Any ideas there?
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Re: Problems building Ogre by cmake ExternalProject_add

Post by jauthu »

I tried to do the same stuff with manually building Ogre from a separate build directory and it found everything but freeimage properly. Seems like it is cmake bug (or misuse). Working further...

EDIT: it finds freeimage properly if I rename it from libFreeImage.a to libfreeimage.a
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Re: Problems building Ogre by cmake ExternalProject_add

Post by jauthu »

With this code it works:

Code: Select all

  ExternalProject_add(ogredeps
    SOURCE_DIR "${CMAKE_SOURCE_DIR}/contrib/ogre/deps"
    PREFIX ${CMAKE_BINARY_DIR}/ogredeps
    INSTALL_DIR ${CMAKE_BINARY_DIR}/contrib/ogre/dist/Dependencies
    CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/contrib/ogre/build/Dependencies
    )
  ExternalProject_Add_Step(ogredeps FIX_FREEIMAGE
    COMMAND mv lib/libFreeImage.a lib/libfreeimage.a
    COMMENT "fixing freeimage library name..."
    DEPENDEES install
    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/contrib/ogre/build/Dependencies
    )                                                                                         
                                                                                              
  ExternalProject_add(ogre
    DEPENDS ogredeps
    SOURCE_DIR ${CMAKE_SOURCE_DIR}/contrib/ogre
    BINARY_DIR ${CMAKE_BINARY_DIR}/contrib/ogre/build
    CMAKE_ARGS
    -DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/contrib/ogre/dist
    -DOGRE_STATIC=Yes
    -DOGRE_BUILD_SAMPLES=No
    )
Probably there were some mistakes or typos in my code.
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Re: Problems building Ogre by cmake ExternalProject_add

Post by jauthu »

Now I get this:

Code: Select all

terminate called after throwing an instance of 'Ogre::ItemIdentityException'
  what():  OGRE EXCEPTION(5:ItemIdentityException): Can not find codec for 'png' image format.
There are no formats supported (no codecs registered). in Codec::getCodec at /home/v/projects/dev/sf/contrib/ogre/OgreMain/src/OgreCodec.cpp (line 69)

Code: Select all

05:01:34: FreeImage version: 3.15.3
05:01:34: This program uses FreeImage, a free, open source image library supporting all common bitmap formats. See http://freeimage.sourceforge.net for details
05:01:34: Supported formats: bmp,ico,jpg,jif,jpeg,jpe,jng,koa,iff,lbm,mng,pbm,pbm,pcd,pcx,pgm,pgm,png,ppm,ppm,ras,tga,targa,tif,tiff,wap,wbmp,wbm,psd,cut,xbm,xpm,gif,hdr,g3,sgi,exr,j2k,j2c,jp2,pfm,pct,pict,pic
jauthu
Gnoblar
Posts: 15
Joined: Fri Apr 22, 2011 11:06 pm
x 1

Re: Problems building Ogre by cmake ExternalProject_add

Post by jauthu »

fixed using this:
http://www.ogre3d.org/forums/viewtopic. ... 05#p507805
brendor wrote:I had similar problem using statically linked Ogre libraries, solved it by using the following code before initializing root. Dynamically linked Ogre worked fine, so I'm not sure what was different in the static build that prevented codecs from loading.

Code: Select all

    FreeImage_Initialise();
    Ogre::DDSCodec::startup();
    Ogre::FreeImageCodec::startup();
EDIT: I'm using Ogre 1.9