Re: Patch to cmake detect OpenMP

2016-09-20 Thread Otacílio de Araújo Ramos Neto
Em ter, 20 de set de 2016 04:04, Matthieu Volat 
escreveu:

> On Tue, 20 Sep 2016 00:55:44 -0300
> Otacílio  wrote:
>
> > I'm trying to port flann (http://www.cs.ubc.ca/research/flann/) to
> > FreeBSD, but I need that cmake detects OpenMP. Unhappy, cmake do not
> > detects OpenMP even when devel/openmp is installed,  so I did this patch
> > to cmake port. What you guys think about? Can I open a bug report with
> > patch?
> >
> > []'s
> >
>
> Hi, are you planning to submit this patch for cmake in ports or the
> upstream 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
> specific 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+=  compiler:openmp
>   CFLAGS+= -I${LOCALBASE}/include
>   LDFLAGS+= -L${LOCALBASE}/lib -lomp -lm
>
> I did not test how this behave on older release yet... And if you need to
> build cmake-based projects outside ports, here's the flags I use:
>
>  -DCMAKE_REQUIRED_INCLUDES="/usr/local/include" \
>  -DCMAKE_REQUIRED_LIBRARIES="-L/usr/local/lib -lomp -lm" \
>  -DCMAKE_EXE_LINKER_FLAGS="-L/usr/local/lib -lomp -lm" \
>  -DCMAKE_MODULE_LINKER_FLAGS="-L/usr/local/lib -lomp -lm" \
>  -DCMAKE_SHARED_LINKER_FLAGS="-L/usr/local/lib -lomp -lm"
>
> -- Matthieu Volat 
>

Hi Matthieu.

I was planning to submit this patch in ports but, after yours appointments,
I have declined from the idea. My motivation was  that if cmake proposes
find OpenMP it must find OpenMP. But, my patch is not the right procedure
to do it.

[]'s
-Otacilio

>
___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"

Re: Patch to cmake detect OpenMP

2016-09-20 Thread Matthieu Volat
On Tue, 20 Sep 2016 00:55:44 -0300
Otacílio  wrote:

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

Hi, are you planning to submit this patch for cmake in ports or the upstream 
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 specific 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+=  compiler:openmp 
  CFLAGS+= -I${LOCALBASE}/include
  LDFLAGS+= -L${LOCALBASE}/lib -lomp -lm

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

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

-- Matthieu Volat 


pgpPnOxTm0Xcz.pgp
Description: OpenPGP digital signature


Patch to cmake detect OpenMP

2016-09-19 Thread Otacílio
I'm trying to port flann (http://www.cs.ubc.ca/research/flann/) to 
FreeBSD, but I need that cmake detects OpenMP. Unhappy, cmake do not 
detects OpenMP even when devel/openmp is installed,  so I did this patch 
to cmake port. What you guys think about? Can I open a bug report with 
patch?


[]'s

-Otacilio

--- Modules/FindOpenMP.cmake.orig2016-09-20 03:52:10 UTC
+++ Modules/FindOpenMP.cmake
@@ -134,8 +134,8 @@ if(CMAKE_C_COMPILER_LOADED)
   endif()

   foreach(FLAG IN LISTS OpenMP_C_FLAG_CANDIDATES)
-set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
-set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+set(SAFE_CMAKE_REQUIRED_FLAGS "-I/usr/local/include 
-L/usr/local/lib -lm ${CMAKE_REQUIRED_FLAGS}")
+set(CMAKE_REQUIRED_FLAGS "-I/usr/local/include -L/usr/local/lib -lm 
${FLAG}")

 unset(OpenMP_FLAG_DETECTED CACHE)
 if(NOT CMAKE_REQUIRED_QUIET)
   message(STATUS "Try OpenMP C flag = [${FLAG}]")
@@ -148,7 +148,7 @@ if(CMAKE_C_COMPILER_LOADED)
 endif()
   endforeach()

-  set(OpenMP_C_FLAGS "${OpenMP_C_FLAGS_INTERNAL}"
+  set(OpenMP_C_FLAGS "-I/usr/local/include ${OpenMP_C_FLAGS_INTERNAL}"
 CACHE STRING "C compiler flags for OpenMP parallization")

   list(APPEND _OPENMP_REQUIRED_VARS OpenMP_C_FLAGS)
@@ -170,8 +170,8 @@ if(CMAKE_CXX_COMPILER_LOADED)
   endif()

   foreach(FLAG IN LISTS OpenMP_CXX_FLAG_CANDIDATES)
-set(SAFE_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
-set(CMAKE_REQUIRED_FLAGS "${FLAG}")
+set(SAFE_CMAKE_REQUIRED_FLAGS "-I/usr/local/include 
-L/usr/local/lib ${CMAKE_REQUIRED_FLAGS}")
+set(CMAKE_REQUIRED_FLAGS "-I/usr/local/include -L/usr/local/lib 
${FLAG}")

 unset(OpenMP_FLAG_DETECTED CACHE)
 if(NOT CMAKE_REQUIRED_QUIET)
   message(STATUS "Try OpenMP CXX flag = [${FLAG}]")
@@ -184,7 +184,7 @@ if(CMAKE_CXX_COMPILER_LOADED)
 endif()
   endforeach()

-  set(OpenMP_CXX_FLAGS "${OpenMP_CXX_FLAGS_INTERNAL}"
+  set(OpenMP_CXX_FLAGS "-I/usr/local/include ${OpenMP_CXX_FLAGS_INTERNAL}"
 CACHE STRING "C++ compiler flags for OpenMP parallization")

   list(APPEND _OPENMP_REQUIRED_VARS OpenMP_CXX_FLAGS)

___
freebsd-ports@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-ports
To unsubscribe, send any mail to "freebsd-ports-unsubscr...@freebsd.org"