Remove dependencies for build (CMake).

Anything and everything that's related to OGRE or the wider graphics field that doesn't fit into the other forums.
Post Reply
Zewrak
Gnoblar
Posts: 5
Joined: Mon Nov 23, 2009 6:40 am

Remove dependencies for build (CMake).

Post by Zewrak »

Elo'

I am trying to build a static build of Ogre without dependencies. Unfortunally CMake and I do not agree at all. It wants to force me to use the dependency directory and the dependency files. I have all the dependencies in a nice and clean structure on the harddrive and want to use them. Ontop of that I want to generate the project without using hardcoded paths.

I tried to set all the paths manually and use a macro that is used in Visual Studio, but CMake bails on the lost files. Is there any way to remove the check for the dependencies without touching the CMakeLists.txt files? I really do not want to ruin/edit the SVN checkedout files. Is there any switch I have missed somewhere, which forces CMake to overlook that the dependencies are not available?

My directorytree is something like this;

Code: Select all

...
F:/SDK/CEGui/0.7.1
F:/SDK/CEGui/include
F:/SDK/CEGui/lib
...
F:/SDK/Ogre/include
F:/SDK/Ogre/lib
F:/SDK/Ogre/svn
...
F:/SDK/zlib/1.2.3
F:/SDK/zlib/lib
F:/SDK/zlib/include
...
My problem is as follows, I got one environmental variable %SDK_HOME% which I set to "F:/SDK" in this case. This in turn lets me use $(SDK_HOME) as macro for the SDK's in Visual Studio. So basically, what I would want is for CMake to skip checking if the dependencies are installed and to be able to enter $(SDK_HOME) as the root of all the dependencies. Obviously, CMake does not recognise $(SDK_HOME) for filesystem searches. But my hopes is that I can enter all the paths manually in CMake.

I hope I have made my question clear enough. And yes, I know I could copy files around etc. But I would rather not have copies of the same files on different locations etc. If it was only for Ogre, it would be ok. But for example, zlib which I have in other projects, I dont want one copy in the Ogre tree, one in libpng tree etc.

Thanks in advance.
Last edited by Zewrak on Mon Nov 23, 2009 5:12 pm, edited 1 time in total.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Remove dependencies for build.

Post by jacmoe »

Why not?
I mean, disc space is cheap.
What you're saying makes sense for larger dependencies, like Ogre itself, Qt, wxWidgets, etc.
But not for small utility libraries. IMO.

As for non hardcoded paths: that's the way CMake works. There's no way around that.
Once it has generated a set of build scripts, you can't move the directory. :wink:

However, CABAListic hasn't commented on this yet, so let's wait for what he's to say.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Zewrak
Gnoblar
Posts: 5
Joined: Mon Nov 23, 2009 6:40 am

Re: Remove dependencies for build.

Post by Zewrak »

Well, I am trying to automate a build of a complete "SDK", which Ogre is a part of. And I do not want old stuff lying around. If I am building CEGUI for example, and that depends on one version of zlib, I do not want to mix another version of zlib into it. It gets messy when you start doing static builds.

Right now every library in the tree compiles with eachother. Except for Ogre so far. Well, it does, except, I have to install dependencies, generate the Visual Studio project and edit it and then compile. I want to be able to just generate the project and then do a build/clean from a script. The path problem I can live with, but it would be sweet if I could turn of the check of the dependencies, since after all, you can edit all the paths to them manually anyways. And since you can do that, and I enter the paths in manually, why should it bail on not being able to find them in the Ogre/Dependencies directory?

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Remove dependencies for build (CMake).

Post by jacmoe »

Are you on Vista or Windows 7 ?

If you are, you could try making symbolic links.
I didn't know about this until just now, but apparently you can create Unix-like symbolic links in Windows now (from Vista onwards), using the mklink tool.
-> http://en.wikipedia.org/wiki/Symbolic_l ... bolic_link
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Remove dependencies for build (CMake).

Post by jacmoe »

To be frank, I don't really get it.

You are making a SDK with Ogre in it, or an SDK which requires the Ogre SDK.
And you want Ogre to use your libs, instead of it's own dependency libs?
Why?
They are statically linked in, they are tailored to fit Ogre, they work fine.

Why not just install a prebuilt Ogre SDK, and be done with it?
Just do an xcopy on the sdk directory in your Cthugha build directory.
And that's it - I guess.

The only two libs you'd want to override is OIS and CG, both of them are (IIRC) easily configurable through the Ogre CMake script.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Zewrak
Gnoblar
Posts: 5
Joined: Mon Nov 23, 2009 6:40 am

Re: Remove dependencies for build (CMake).

Post by Zewrak »

I don't want to use binary distributions. I want it all to be a big happy sourcetree. Think Freebsd ports kinda thing. When one source is updated, be it SVN Ogre is updated. It should be recompiled and all that depends on it (CEGUI Ogre renderer springs to mind) should be recompiled aswell. Or when Boost is updated all boost dependencies should be updated. If you have used ports sometime, you know what I mean. :) This is mostly for fun and to learn something about distribution.

The idea is to have the same tools on every platform I sit down at by just issuing some make commands.

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Remove dependencies for build (CMake).

Post by jacmoe »

Zewrak wrote:The idea is to have the same tools on every platform I sit down at by just issuing some make commands.
That's basically the general idea behind CMake.
The binary dependency download for Windows is due to the limitations of that particular platform.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

Zewrak
Gnoblar
Posts: 5
Joined: Mon Nov 23, 2009 6:40 am

Re: Remove dependencies for build (CMake).

Post by Zewrak »

Indeed. And thats all dandy. I think you misunderstand what I mean though. Ogre is not the main part of the "sdk", it is one part of it. There is plenty of stuff in it, some that might be used for some projects and some that wont. It inlcudes all kinds of libraries and tools that are multiplatform with all bells and whistles.

When I go into that directory and issue my make commands. I want it to build the libraries with my settings. There are for example some libraries that have default settings of /MTd or /MDd which makes them render some silly errors or warnings later on when I use them.

Now, when I use my scripts, all libraries with their dependencies are built with the same settings, my own defines, my own everything. Basically, I pass all defines and such from my script to the libraries make systems. Telling them to use eachother etc. Thats what I want to do with Ogre aswell. When I call Ogres CMake from my script, I want to tell it "Hey! I have my own custombuilt dependencies, please use them instead of the original ones.

Just as I tell CEGui, "Hey! I want you to use my version of Ogre when you compile OgreRenderer. I want you to use my FreeImage, with my settings!"

There are 40 or so libraries in the whole collection by now, all depending on eachother etc. When I get them all to build properly against eachother. I will get going with yet another part, which is to either use SVN or some ftp fetching of the sources.

And thats why, I would like to be able to override the dependencies in the CMake, if they are already installed to the system.
The end goal is to install the scripts in a directory. Issue a "fetch" command a "make" command and go grab quite a bit of coffee, come back and have a complete "sdk" installed. ;) Issuing a "fetch" later should check if there is updates and if so fire off a new build on all dependencies. A little boolean that says "I already got dependencies installed."

User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: Remove dependencies for build (CMake).

Post by jacmoe »

I think you only need to modify two files:
cthugha/CMake/Dependencies.cmake for the dependency find.
cthugha/Dependencies/OgreInstallDependencies.cmake for the dependency install.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.

dermont
Bugbear
Posts: 808
Joined: Thu Dec 09, 2004 2:51 am
x 42

Re: Remove dependencies for build (CMake).

Post by dermont »

Maybe you should take a look at the cmake External project module and/or the "--build" option. I'm sure it must be of some use on Windows, your CMake scripts could
automatically checkout/copy/install the libs/headers/source to suit your build.

http://www.kitware.com/news/home/browse/CMake
http://www.cmake.org/cmake/help/cmake-2 ... nalProject

CABAListic
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 2903
Joined: Thu Jan 18, 2007 2:48 pm
x 57
Contact:

Re: Remove dependencies for build (CMake).

Post by CABAListic »

Exactly what is your problem? Ogre's CMake scripts do not require you to use the precompiled dependencies, but unless your self-compiled dependencies reside in a system directory, you will have to tell CMake where to find them. There is one global CMake variable, OGRE_DEPENDENCIES_DIR, which you can set if all the dependencies are in a shared folder with the following structure:

OGRE_DEPENDENCIES_DIR
  • include - Include files for all the dependencies
  • lib - .lib files for all dependencies
Otherwise, there is a CMake variable for each dependency, which is named DEPENDENCY_HOME. For example, for FreeImage it's FREEIMAGE_HOME etc.. Set all of them accordingly, and CMake should be able to pick them up. If even that fails, you will need to set the actual dependency variables directly, i.e. set FREEIMAGE_INCLUDE_DIR to the include directory of FreeImage, FREEIMAGE_LIBRARY_REL to the release build library of FreeImage etc..

Post Reply