Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Sep 2016 09:04:05 +0200
From:      Matthieu Volat <mazhe@alkumuna.eu>
To:        freebsd-ports@freebsd.org
Subject:   Re: Patch to cmake detect OpenMP
Message-ID:  <20160920090405.221a4611@freedom.alkumuna.eu>
In-Reply-To: <029185d0-d810-247d-d0c5-cdd8bc4a53ac@bsd.com.br>
References:  <029185d0-d810-247d-d0c5-cdd8bc4a53ac@bsd.com.br>

next in thread | previous in thread | raw e-mail | index | archive | help
--Sig_/+oS+Ac1V8lQfdWb8N29w8FN
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Tue, 20 Sep 2016 00:55:44 -0300
Otac=C3=ADlio <otacilio.neto@bsd.com.br> wrote:

> I'm trying to port flann (http://www.cs.ubc.ca/research/flann/) to=20
> FreeBSD, but I need that cmake detects OpenMP. Unhappy, cmake do not=20
> detects OpenMP even when devel/openmp is installed,  so I did this patch=
=20
> to cmake port. What you guys think about? Can I open a bug report with=20
> patch?
>=20
> []'s
>=20

Hi, are you planning to submit this patch for cmake in ports or the upstrea=
m project?

This is not a really good idea to hardcode /usr/local like that, for there =
can be may more providers for libomp (lang/clangXY ports, if you need a spe=
cific to workaround bugs for example... or even maybe base in the future?).=
 Also, it would break cmake with GCC.

Without changing any upstream code in either cmake or flann, for FreeBSD 11=
+, you can just set :

  USES+=3D          compiler:openmp=20
  CFLAGS+=3D -I${LOCALBASE}/include
  LDFLAGS+=3D -L${LOCALBASE}/lib -lomp -lm

I did not test how this behave on older release yet... And if you need to b=
uild cmake-based projects outside ports, here's the flags I use:

 -DCMAKE_REQUIRED_INCLUDES=3D"/usr/local/include" \
 -DCMAKE_REQUIRED_LIBRARIES=3D"-L/usr/local/lib -lomp -lm" \
 -DCMAKE_EXE_LINKER_FLAGS=3D"-L/usr/local/lib -lomp -lm" \
 -DCMAKE_MODULE_LINKER_FLAGS=3D"-L/usr/local/lib -lomp -lm" \
 -DCMAKE_SHARED_LINKER_FLAGS=3D"-L/usr/local/lib -lomp -lm"

-- Matthieu Volat <mazhe@alkumuna.eu>

--Sig_/+oS+Ac1V8lQfdWb8N29w8FN
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlfg32YACgkQ+ENDeYKZi35A5gCfdJ0zTyUN+bEtE+FlMwxgN2J9
ZNgAn2SwpURaxWwfzS5+0YpaNsPlfTwE
=aHwX
-----END PGP SIGNATURE-----

--Sig_/+oS+Ac1V8lQfdWb8N29w8FN--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20160920090405.221a4611>