EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: [makefile] adding a library to an EPICS application
From: Martin Konrad <[email protected]>
To: [email protected]
Date: Wed, 19 Dec 2012 20:57:11 +0100
Hi Pavel,
> What is the correct way to include a library to an EPICS app?
Including 3rd party libraries into an EPICS app is not as nice as it
could be...

Another thing I don't like about the EPICS build system: In many cases
application specific build rules are mixed with stuff that deals with
libraries that are installed somewhere on the system. But why at all
edit files to add library paths if they could be detected automatically
in most cases? Finding the location of a library like GSL or boost is
not an EPICS specific task. And there are modern build tools like CMake
that help you with this step.

So if your application depends on several non-EPICS libraries you might
want to consider building your app/IOC/lib with CMake. Here is what you
have to do:

1. Create a CMakeLists.txt file in each of your source directories. For
the correct contents consult the CMake documentation or the build
configuration of an EPICS application that already can be build with
CMake (like cagateway:
http://www.aps.anl.gov/epics/tech-talk/2011/msg01717.php).
2. Use FindXXX.cmake scripts to find all your libraries. CMake comes
with a lot of these scripts. There are ready-to-use scripts that help
you find the location of EPICS base, 3rd party libs, special build tools
etc.. See https://code.launchpad.net/~mdavidsaver/epics-base/cmake for
the scripts that find EPICS stuff.
3. To build your application run the following commands in the top level
directory:
mkdir build
cd build/
cmake ..
make

If you want to use a library from a non-standard location use

cmake -DMYLIB_INCLUDE_DIR=/home/pavel/include
-DMYLIB_LIBRARIES=/home/pavel/lib ..

Building with CMake has the advantage that you can do out-of-source
builds. You can also flexibly control the way and the location libraries
and headers are installed. CMake also handles the details of shared vs.
static libs.

Cheers

Martin

-- 
Dipl. Phys. Martin Konrad
Technische Universität Darmstadt
Institut für Kernphysik
Schlossgartenstr. 9
64289 Darmstadt
Tel.: +49-6151-16-5121
Fax: +49-6151-16-4321

References:
[makefile] adding a library to an EPICS application Pavel Maslov

Navigate by Date:
Prev: devlib2 bugfix (rare string corruption) Till Straumann
Next: RE: [makefile] adding a library to an EPICS application Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: [makefile] adding a library to an EPICS application Pavel Maslov
Next: RE: [makefile] adding a library to an EPICS application Mark Rivers
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  <20122013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 18 Nov 2013 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·