On 2019/06/13 10:34, [email protected] wrote:
> These two patches fix cmake's ability to find OpenMP with
> base-clang and ports-gcc as patched earlier.  This patch
> is a no-op without those.  Tested on amd64.
> 
> John
> 
> ? patches/patch-Modules_FindOpenMP_cmake
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/devel/cmake/Makefile,v
> retrieving revision 1.173
> diff -u -p -r1.173 Makefile
> --- Makefile  24 Apr 2019 16:26:54 -0000      1.173
> +++ Makefile  13 Jun 2019 15:50:38 -0000
> @@ -6,7 +6,7 @@ COMMENT =     portable build system
>  
>  VER =                3.10.2
>  EPOCH =              0
> -REVISION =   2
> +REVISION =   3
>  DISTNAME =   cmake-${VER}
>  CATEGORIES = devel
>  
> 
> --- /dev/null Thu Jun 13 10:22:18 2019
> +++ patches/patch-Modules_FindOpenMP_cmake    Thu Jun 13 08:12:07 2019
> @@ -0,0 +1,26 @@
> +$OpenBSD$
> +Add libs and paths.  Ensure the lib is used for the C case.
> +
> +Index: Modules/FindOpenMP.cmake
> +--- Modules/FindOpenMP.cmake.orig
> ++++ Modules/FindOpenMP.cmake
> +@@ -82,8 +82,8 @@ function(_OPENMP_FLAG_CANDIDATES LANG)
> +   if(NOT OpenMP_${LANG}_FLAG)
> +     unset(OpenMP_FLAG_CANDIDATES)
> + 
> +-    set(OMP_FLAG_GNU "-fopenmp")
> +-    set(OMP_FLAG_Clang "-fopenmp=libomp" "-fopenmp=libiomp5" "-fopenmp")
> ++    set(OMP_FLAG_GNU "-fopenmp -lgomp")
> ++    set(OMP_FLAG_Clang "-fopenmp -I/usr/local/include 
> -Wl,-L/usr/local/lib,-lomp" )

This patch needs to use ${LOCALBASE} rather than hardcoded /usr/local,
and added to the list of files passed through ${SUBST_CMD} in pre-configure.

Doesn't OMP_FLAG_GNU need include/linker paths too?

> +     set(OMP_FLAG_HP "+Oopenmp")
> +     if(WIN32)
> +       set(OMP_FLAG_Intel "-Qopenmp")
> +@@ -124,7 +124,7 @@ set(OpenMP_C_CXX_TEST_SOURCE
> + #include <omp.h>
> + int main() {
> + #ifdef _OPENMP
> +-  return 0;
> ++  return 0*omp_get_num_threads();
> + #else
> +   breaks_on_purpose
> + #endif
> 

Reply via email to