On Wednesday, May 18, 2011 02:50:02 PM Claus Christmann wrote:
> Hi,
> 
> I am trying to combine a personal project of mine with FlightGear.  In
> order to do that, I am writing some C++ code to interact with Matlab (to
> be precise, with the Matlab engine). However, I run into trouble when
> trying to compile/link my stuff in FG - hence my question on how to do it
> "properly"
> 
> Here is what I want to do:
> 
> * I need to include some Matlab specific headers in
> /usr/local/MATLAB/R2010b/extern/include
> * I need to link against some Matlab libraries in
> /usr/local/MATLAB/bin/glnxa64
> 
> Here is my setup:
> 
> * I put my sources (*.cxx and *.hxx) in a new folder in $FG/src/ETP
> * I made a new $FG/src/ETP/Makefile.am : http://pastebin.com/2iGgdWAP
> * I altered $FG/src/Main/gf_init.cxx to load my new subsystem:
> http://pastebin.com/nWNHGX81
> * I altered $FG/src/Main/Makefile.am to reflect that change :
> http://pastebin.com/8cS50Xd4
> * I have the path to the matlab libraries (/usr/local/MATLAB/bin/glnxa64)
> in my LD_LIBRARY_PATH via my ~/.bashrc:
> export
> LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/MATLAB/R2010b/bin/glnxa64
> 
> I would like to use the sequence
> 
> :$FG> make distclean
> :$FG> ./autogen.sh
> :$FG> ./configure
> :$FG> make
> 
> However, autogen already spits out errors: http://pastebin.com/feCvty3b .
> Fixing those, however, does't seem to fix my problem:
> http://pastebin.com/wLbBPTFk
> 
> Obviously, ignoring those errors results in not-linked in Matlab libraries,
> as the linker will tell me when it tries to link the project: all the
> Matlab specific commands used in my sources are unrecognized...
> 
> So could somebody point me to a Makefile.am that includes/links in some
> external libraries? Or even better, point me to a (preferably brief)
> writeup on how to write Makefile.am s for FG?
> 
> Thanks for any efforts spend...
> 
> Claus

So to answer my own post, here is a (as I find very hacked) solution:

a) do not include the external libraries into the new sub project. I used this 
Makefile.am : http://pastebin.com/Pw8EeLrp 

b) do the linking in the binary, i.e. in ../src/Main. I modified the 
Makefile.am there to look like this: http://pastebin.com/RfJ5MQRx

So the solution is to inlcude the external libraries via -lxxx where you also 
would include the subprojects libXXX.a and alter the _LDFLAGS to s.t. a direct 
path to the external libraries is given... (i.e. add -L/where/ever/libs)

Although this works, (and as of now I don't intend to change it), I would be 
interested how to do this "properly"...

Regards,

Claus

-- 
Claus Christmann, M.S.
Graduate Research Assistant

Georgia Institute of Technology
270 Ferst Dr NW
Atlanta, GA 30332-0150

http://uav.ae.gatech.edu

------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to