Closed rsharris closed 5 years ago
The right way to do it is to use pkg-config
. The installer should have created a file ${HOME}/lib/pkgconfig/jellyfish-2.0.pc
with the proper path to compile against Jellyfish.
Do: export PKG_CONFIG_PATH=${HOME}/lib/pkgconfig
.
Then add $(shell pkg-config --cflags jellyfish2.0)
and $(shell pkg-config --libs jellyfish-2.0)
in your CFLAGS
and LIBS
variable of your Makefile to get the proper flags. If you use autotools, pkgconfig
is also directly supported.
Hope this helps.
Cool, thanks!
@gmarcais Shouldn't that be pkg-config --cflags-only-I jellyfish2.0
? @kiwifb what would you say?
@mmokrejs Sure, maybe. The point is you should use pkg-config
to get this information, as the information is the most correct one (created by the installer). Now, which switch or pkg-config you actually use for a given variable in your particular build system, that's up to you.
I am at a conf will look later.
Yes @mmokrejs that is right. At least if you only want the include file, --cflags
may give you more stuff like macros (-D...
) or specific flags (-pthread
) if necessary. I would only consider --cflags-only-I
for very specific usage like feeding a distutils toolchain in python.
I distribute a C++ package that links with the jellyfish library. I don't understand the proper way to access the .hpp files, as there seems to be an unusual extra layer in the path hierarchy.
After installing jellyfish, I find that the .h files are in ${HOME}/includes/jellyfish-2.2.10/jellyfish/*.hpp . For other packages, the paradigm is for installation to put them in ${HOME}/includes/some_package/*.hpp
If I add the usual -I${HOME}/includes to my compile command line, compilation (of MY package) fails at #include <jellyfish/mer_dna.hpp> because the path isn't right. I could make that <jellyfish-2.2.10 .jellyfish/mer_dna.hpp> and I assume that would work, but it seems like the wrong thing to do.
What I've been doing, after installation, is to make a symlink to hop past the jellyfish-2.2.10 level. This also seems like the wrong thing to do. Especially since anyone trying to build my package will also be expected to do that.
Nor do I really want to hardcode a jellyfish version number in my Makefile.
So my question is, what's the right way to do this?