git: 77a55dca0e97 - main - graphics/opensubdiv: pet OpenMP handling (+)

From: Dima Panov <fluffy_at_FreeBSD.org>
Date: Wed, 19 Oct 2022 16:06:00 UTC
The branch main has been updated by fluffy:

URL: https://cgit.FreeBSD.org/ports/commit/?id=77a55dca0e97b714e3cf768945031732284664ac

commit 77a55dca0e97b714e3cf768945031732284664ac
Author:     Dima Panov <fluffy@FreeBSD.org>
AuthorDate: 2022-10-19 15:56:56 +0000
Commit:     Dima Panov <fluffy@FreeBSD.org>
CommitDate: 2022-10-19 16:05:01 +0000

    graphics/opensubdiv: pet OpenMP handling (+)
    
    Make OpenMP suppport OPTIONal
    Add patches to pass OpenMP flags to consumers if enabled [1]
    Mark OPENCL option as prevented to build examples
    Bump PORTREVISION to force rebuild consumers with new flags
    
    Submitted by:   Tatsuki Makino via ports ml
    Approved by:    maintainer (implicit)
---
 graphics/opensubdiv/Makefile                       | 10 ++++++++--
 .../files/patch-opensubdiv_CMakeLists.txt          | 11 +++++++++++
 .../files/patch-opensubdiv_osd_CMakeLists.txt      | 22 ++++++++++++++++++++++
 .../files/patch-regression_CMakeLists.txt          |  6 +++---
 4 files changed, 44 insertions(+), 5 deletions(-)

diff --git a/graphics/opensubdiv/Makefile b/graphics/opensubdiv/Makefile
index beeada4c14f8..a299dd239333 100644
--- a/graphics/opensubdiv/Makefile
+++ b/graphics/opensubdiv/Makefile
@@ -1,6 +1,7 @@
 PORTNAME=	opensubdiv
 DISTVERSIONPREFIX=	v
 DISTVERSION=	3_5_0
+PORTREVISION=	1
 CATEGORIES?=	graphics
 
 MAINTAINER=	FreeBSD@Shaneware.biz
@@ -22,8 +23,9 @@ USE_GL=		egl gl glu glew
 USE_LDCONFIG=	yes
 CMAKE_ON=	NO_CLEW NO_CUDA NO_DX
 
-OPTIONS_DEFINE=		DOCS EXAMPLES OPENCL PTEX TBB TEST TUTORIALS
+OPTIONS_DEFINE=		DOCS EXAMPLES OPENCL OPENMP PTEX TBB TEST TUTORIALS
 OPTIONS_DEFAULT=	TBB
+#OPTIONS_EXCLUDE=	EXAMPLES
 OPTIONS_SUB=		yes
 
 DOCS_CMAKE_BOOL_OFF=	NO_DOC
@@ -32,7 +34,8 @@ DOCS_BUILD_DEPENDS=	rst2html.py:textproc/py-docutils \
 DOCS_USES=		python:build
 DOCS_PORTDOCS=		*
 
-EXAMPLES_BROKEN=	ld: error: undefined symbol: glXGetCurrentContext
+#EXAMPLES_BROKEN=	ld: error: undefined symbol: glXGetCurrentContext
+#Examples cannot utilize the latest opencl headers
 EXAMPLES_CMAKE_BOOL_OFF=	NO_EXAMPLES
 EXAMPLES_USES=		xorg
 EXAMPLES_USE=		xorg=ice,sm,x11,xcursor,xext,xi,xinerama,xrandr,xxf86vm
@@ -42,6 +45,9 @@ OPENCL_CMAKE_BOOL_OFF=	NO_OPENCL
 OPENCL_CFLAGS=		-pthread
 OPENCL_BUILD_DEPENDS=	${LOCALBASE}/include/CL/cl.h:devel/opencl
 OPENCL_LIB_DEPENDS=	libOpenCL.so:devel/ocl-icd
+OPENCL_PREVENTS=	EXAMPLES
+
+OPENMP_CMAKE_BOOL_OFF=	NO_OMP
 
 PTEX_DESC=		ptex support
 PTEX_CMAKE_BOOL_OFF=	NO_PTEX
diff --git a/graphics/opensubdiv/files/patch-opensubdiv_CMakeLists.txt b/graphics/opensubdiv/files/patch-opensubdiv_CMakeLists.txt
new file mode 100644
index 000000000000..b47916caa6bb
--- /dev/null
+++ b/graphics/opensubdiv/files/patch-opensubdiv_CMakeLists.txt
@@ -0,0 +1,11 @@
+--- opensubdiv/CMakeLists.txt.orig	2022-09-26 18:17:44 UTC
++++ opensubdiv/CMakeLists.txt
+@@ -45,6 +45,8 @@ if (NOT NO_LIB)
+     if( OPENMP_FOUND )
+         if (CMAKE_COMPILER_IS_GNUCXX)
+             list(APPEND PLATFORM_CPU_LIBRARIES gomp)
++        else()
++            list(APPEND PLATFORM_CPU_LIBRARIES OpenMP::OpenMP_CXX)
+         endif()
+     endif()
+ 
diff --git a/graphics/opensubdiv/files/patch-opensubdiv_osd_CMakeLists.txt b/graphics/opensubdiv/files/patch-opensubdiv_osd_CMakeLists.txt
new file mode 100644
index 000000000000..8b02e0d7f6a0
--- /dev/null
+++ b/graphics/opensubdiv/files/patch-opensubdiv_osd_CMakeLists.txt
@@ -0,0 +1,22 @@
+--- opensubdiv/osd/CMakeLists.txt.orig	2022-09-26 18:17:44 UTC
++++ opensubdiv/osd/CMakeLists.txt
+@@ -76,6 +76,8 @@ if(OPENMP_FOUND )
+ 
+     if (CMAKE_COMPILER_IS_GNUCXX)
+         list(APPEND PLATFORM_CPU_LIBRARIES gomp)
++    else()
++        list(APPEND PLATFORM_CPU_LIBRARIES OpenMP::OpenMP_CXX)
+     endif()
+ endif()
+ 
+@@ -96,10 +98,6 @@ if( TBB_FOUND )
+     )
+ 
+     list(APPEND PUBLIC_HEADER_FILES ${TBB_PUBLIC_HEADERS})
+-
+-    if (CMAKE_COMPILER_IS_GNUCXX)
+-        list(APPEND PLATFORM_CPU_LIBRARIES gomp)
+-    endif()
+ 
+     list(APPEND PLATFORM_CPU_LIBRARIES
+         ${TBB_LIBRARIES}
diff --git a/graphics/opensubdiv/files/patch-regression_CMakeLists.txt b/graphics/opensubdiv/files/patch-regression_CMakeLists.txt
index 903aa9619672..f43ec0abe32f 100644
--- a/graphics/opensubdiv/files/patch-regression_CMakeLists.txt
+++ b/graphics/opensubdiv/files/patch-regression_CMakeLists.txt
@@ -1,8 +1,8 @@
---- regression/CMakeLists.txt.orig	2020-06-30 16:02:18 UTC
+--- regression/CMakeLists.txt.orig	2022-09-26 18:17:44 UTC
 +++ regression/CMakeLists.txt
-@@ -26,14 +26,16 @@ add_subdirectory(common)
+@@ -28,14 +28,16 @@ if (NOT NO_REGRESSION)
  
- if (NOT NO_REGRESSION)
+     add_subdirectory(bfr_evaluate)
  
 -    add_subdirectory(hbr_regression)
 +# uses deprecated api