In this post I will show you how to install a cmake style project in the same way.
For this example I'm going to use alembic as the target library to build and it will be installed in the directory $(HOME)/
First we will download the alembic source
hg clone https://code.google.com/p/alembic/ cd alembicNow we need to configure cmake to use the correct path for our local install this is done with the -DCMAKE_INSTALL_PREFIX:PATH= command as follows where the = is followed by where you want to install alembic
cmake -DCMAKE_INSTALL_PREFIX:PATH=/home/jmacey/ make -j 4 make installIn the case of the current version of Alembic this will install to the directory alembic-1.1.2
Testing
A simple test program to read alembic files from the command line and write out the contents has been created as follows
#include <Alembic/AbcGeom/All.h> #include <Alembic/AbcCoreAbstract/All.h> #include <Alembic/AbcCoreHDF5/All.h> #include <Alembic/Abc/ErrorHandler.h> #include <iostream> #include <cstdlib> using namespace Alembic::AbcGeom; // Contains Abc, AbcCoreAbstract int main(int argc, char **argv) { if(argc <2 ) { std::cerr <<"usage Alembic [filename]\n"; exit(EXIT_FAILURE); } IArchive archive( Alembic::AbcCoreHDF5::ReadArchive(), argv[1] ); std::cout<<"traversing archive for elements\n"; IObject obj=archive.getTop(); unsigned int numChildren=obj.getNumChildren(); std::cout<< "found "<<numChildren<<" children in file\n"; for(int i=0; i<numChildren; ++i) { std::cout<<obj.getChildHeader(i).getFullName()<<"\n"; IObject child(obj,obj.getChildHeader(i).getName()); std::cout<<"Children "<<child.getNumChildren()<<"\n"; const MetaData &md = child.getMetaData(); std::cout<<md.serialize() <<"\n"; for(int x=0; x<child.getNumChildren(); x++) { IObject child2(child,child.getChildHeader(x).getName()); const MetaData &md2 = child2.getMetaData(); if( IPolyMeshSchema::matches( md2 ) || ISubDSchema::matches( md2 )) { std::cout<<"Found a mesh "<<child2.getName()<<"\n"; } } } return EXIT_SUCCESS; }To compile this I have created a QMAKE project which sets the paths to point to the correct install of alembic
TARGET=Alembic DESTDIR=./ CONFIG += console CONFIG -= app_bundle SOURCES+=read.cpp INCLUDEPATH+=/home/jmacey/alembic-1.1.2/include/ INCLUDEPATH+=/usr/local/include/OpenEXR ALEMBIC_DIR=/home/jmacey/alembic-1.1.2 ALEMBIC_LIB=/home/jmacey/alembic-1.1.2/lib/static LIBS+= -L$$ALEMBIC_LIB LIBS+= -lAbcWFObjConvert LIBS+= -lAlembicAbcCollection LIBS+= -lAlembicAbcCoreHDF5 LIBS+= -lAlembicAbc LIBS+= -lAlembicAbcCoreAbstract LIBS+= -lAlembicAbcGeom LIBS+= -lAlembicUtil LIBS+=-lImath LIBS+=-lHalf LIBS+=-lIex LIBS+=-lhdf5 LIBS+=-lhdf5_hlIn the university labs most of these libs will be in the paths but you will need to change the ALEMBIC_DIR to the correct path for your install. Finally the LD_LIBRARY_PATH needed to be amended to point to the correct OpenEXR files by adding the following export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/ to my .bashrc, this may not be needed on your own versions.