Skip to content

Commit

Permalink
graphics/opensubdiv: sort out Makefile, pet portclippy, fix build on …
Browse files Browse the repository at this point in the history
…32bit

- Remove unnecessary libs from USE_GL and add required.
- Fix build on 32bit ARCHS, upstream issue:
PixarAnimationStudios/OpenSubdiv#1198 (comment)
- Make options OPENMP (for supported ARCHS) and PTEX default.
- EXAMPLES and OPENCL can build together without errors.
- Remove NO_GL_TESTS - upstream removed it.
- Sort options and pet portclippy.

PR:		279472
Approved by:	Shane <[email protected]> (maintainer)
  • Loading branch information
VVD committed Jun 3, 2024
1 parent 928157c commit f251a78
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 85 deletions.
51 changes: 26 additions & 25 deletions graphics/opensubdiv/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
PORTNAME= opensubdiv
DISTVERSIONPREFIX= v
DISTVERSION= 3_6_0
CATEGORIES?= graphics
PORTREVISION= 1
CATEGORIES= graphics

MAINTAINER= [email protected]
COMMENT= High performance subdivision surface libraries
Expand All @@ -12,64 +13,64 @@ LICENSE_FILE= ${WRKSRC}/LICENSE.txt

BUILD_DEPENDS= glfw>3.0.0:graphics/glfw

USES= cmake gl localbase
USES= cmake gl localbase:ldflags

USE_GITHUB= yes
GH_ACCOUNT= PixarAnimationStudios
GH_PROJECT= OpenSubdiv

USE_GL= egl gl glu glew
USE_GL= opengl
USE_LDCONFIG= yes
CMAKE_ON= NO_CLEW NO_CUDA NO_DX NO_METAL

PLIST_SUB+= LIBVERS=${PORTVERSION}

OPTIONS_DEFINE= DOCS EXAMPLES OPENCL OPENMP PTEX TBB TEST TUTORIALS
OPTIONS_DEFAULT= TBB
OPTIONS_DEFAULT= PTEX TBB
OPTIONS_DEFAULT_armv6=
OPTIONS_DEFAULT_armv7=
OPTIONS_DEFAULT_OTHER_ARCHS= OPENMP
OPTIONS_SUB= yes

DOCS_CMAKE_BOOL_OFF= NO_DOC
PTEX_DESC= ptex support
TBB_DESC= Intel threading building blocks
TUTORIALS_DESC= Install tutorial programs

DOCS_BUILD_DEPENDS= rst2html.py:textproc/py-docutils \
doxygen>=1.8.4:devel/doxygen
DOCS_USES= python:build
DOCS_CMAKE_BOOL_OFF= NO_DOC
DOCS_PORTDOCS= *

EXAMPLES_CMAKE_BOOL_OFF= NO_EXAMPLES
EXAMPLES_LIB_DEPENDS= libglfw.so:graphics/glfw
EXAMPLES_USES= xorg
EXAMPLES_USE= xorg=ice,sm,x11,xcursor,xext,xi,xinerama,xrandr,xxf86vm
EXAMPLES_LIB_DEPENDS= libglfw.so:graphics/glfw
EXAMPLES_CMAKE_BOOL_OFF= NO_EXAMPLES

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
OPENCL_USE= gl=gl
OPENCL_CMAKE_BOOL_OFF= NO_OPENCL
OPENCL_CFLAGS= -pthread
OPENCL_LDFLAGS= -lGLX

OPENMP_CMAKE_BOOL_OFF= NO_OMP

PTEX_DESC= ptex support
PTEX_CMAKE_BOOL_OFF= NO_PTEX
PTEX_CMAKE_ON= -DPTEX_LOCATION:STRING=${LOCALBASE} \
-DPTEX_INCLUDE_DIR:STRING=${LOCALBASE}/include/ptex
PTEX_LIB_DEPENDS= libPtex.so:graphics/ptex
PTEX_CMAKE_BOOL_OFF= NO_PTEX
PTEX_CMAKE_ON= -DPTEX_INCLUDE_DIR:STRING=${LOCALBASE}/include/ptex \
-DPTEX_LOCATION:STRING=${LOCALBASE}

TBB_DESC= Intel threading building blocks
TBB_CMAKE_BOOL_OFF= NO_TBB
TBB_LIB_DEPENDS= libtbb.so:devel/onetbb
TBB_CMAKE_BOOL_OFF= NO_TBB

TEST_CMAKE_BOOL_OFF= NO_REGRESSION NO_TESTS NO_GL_TESTS
TEST_LIB_DEPENDS= libglfw.so:graphics/glfw
TEST_USES= xorg
TEST_USE= xorg=ice,sm,x11,xcursor,xext,xi,xinerama,xrandr,xxf86vm
TEST_CMAKE_BOOL_OFF= NO_REGRESSION NO_TESTS

# the tutorials and tests include use of deprecated parts of the library
# using clang 10 on 32 bit fails to build all tutorials and tests
# currently 12.1 still works - 11.4 and current fail
# CMake files and pkg-plist are patched to prevent failing builds

TUTORIALS_DESC= Install tutorial programs
TUTORIALS_CMAKE_BOOL_OFF= NO_TUTORIALS

PLIST_SUB+= LIBVERS=${PORTVERSION}

post-patch:
${FIND} ${WRKSRC}/tutorials -name CMakeLists.txt -exec \
${REINPLACE_CMD} -e 's|{CMAKE_BINDIR_BASE}/tutorials|{CMAKE_INSTALL_PREFIX}/${DATADIR_REL}/tutorials|g' {} +
Expand Down
12 changes: 0 additions & 12 deletions graphics/opensubdiv/files/patch-examples_CMakeLists.txt

This file was deleted.

11 changes: 11 additions & 0 deletions graphics/opensubdiv/files/patch-opensubdiv_hbr_mesh.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- opensubdiv/hbr/mesh.h.orig 2023-09-14 19:19:06 UTC
+++ opensubdiv/hbr/mesh.h
@@ -215,7 +215,7 @@ template <class T> class HbrMesh { (public)
void SetFVarPropagateCorners(bool p) { fvarpropagatecorners = p; }

// Register routines for keeping track of memory usage
- void RegisterMemoryRoutines(void (*increment)(unsigned long bytes), void (*decrement)(unsigned long bytes)) {
+ void RegisterMemoryRoutines(void (*increment)(size_t bytes), void (*decrement)(size_t bytes)) {
m_faceAllocator.SetMemStatsIncrement(increment);
m_faceAllocator.SetMemStatsDecrement(decrement);
m_vertexAllocator.SetMemStatsIncrement(increment);
8 changes: 4 additions & 4 deletions graphics/opensubdiv/files/patch-opensubdiv_osd_CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- opensubdiv/osd/CMakeLists.txt.orig 2022-09-26 18:17:44 UTC
--- opensubdiv/osd/CMakeLists.txt.orig 2023-09-14 19:19:06 UTC
+++ opensubdiv/osd/CMakeLists.txt
@@ -76,6 +76,8 @@ if(OPENMP_FOUND )
@@ -81,6 +81,8 @@ if(OPENMP_FOUND )

if (CMAKE_COMPILER_IS_GNUCXX)
list(APPEND PLATFORM_CPU_LIBRARIES gomp)
Expand All @@ -9,7 +9,7 @@
endif()
endif()

@@ -96,10 +98,6 @@ if( TBB_FOUND )
@@ -99,10 +101,6 @@ if( TBB_FOUND )
)

list(APPEND PUBLIC_HEADER_FILES ${TBB_PUBLIC_HEADERS})
Expand All @@ -19,4 +19,4 @@
- endif()

list(APPEND PLATFORM_CPU_LIBRARIES
${TBB_LIBRARIES}
TBB::tbb
22 changes: 0 additions & 22 deletions graphics/opensubdiv/files/patch-regression_CMakeLists.txt

This file was deleted.

12 changes: 0 additions & 12 deletions graphics/opensubdiv/files/patch-tutorials_CMakeLists.txt

This file was deleted.

20 changes: 10 additions & 10 deletions graphics/opensubdiv/pkg-plist
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ include/opensubdiv/osd/glXFBEvaluator.h
include/opensubdiv/osd/glslPatchShaderSource.h
include/opensubdiv/osd/mesh.h
include/opensubdiv/osd/nonCopyable.h
@comment include/opensubdiv/osd/ompEvaluator.h
@comment include/opensubdiv/osd/ompKernel.h
%%OPENMP%%include/opensubdiv/osd/ompEvaluator.h
%%OPENMP%%include/opensubdiv/osd/ompKernel.h
%%OPENCL%%include/opensubdiv/osd/opencl.h
include/opensubdiv/osd/opengl.h
include/opensubdiv/osd/patchBasis.h
Expand Down Expand Up @@ -95,7 +95,7 @@ lib/libosdCPU.so.%%LIBVERS%%
lib/libosdGPU.a
lib/libosdGPU.so
lib/libosdGPU.so.%%LIBVERS%%
@comment %%EXAMPLES%%%%EXAMPLESDIR%%/farViewer
%%EXAMPLES%%%%EXAMPLESDIR%%/farViewer
%%EXAMPLES%%%%EXAMPLESDIR%%/glEvalLimit
%%EXAMPLES%%%%EXAMPLESDIR%%/glFVarViewer
%%EXAMPLES%%%%EXAMPLESDIR%%/glImaging
Expand All @@ -106,10 +106,10 @@ lib/libosdGPU.so.%%LIBVERS%%
%%EXAMPLES%%%%EXAMPLESDIR%%/glViewer
%%TEST%%tests/opensubdiv/bfr_evaluate
%%TEST%%tests/opensubdiv/far_perf
@comment %%TEST%%tests/opensubdiv/far_regression
@comment %%TEST%%tests/opensubdiv/hbr_baseline
@comment %%TEST%%tests/opensubdiv/hbr_regression
@comment %%TEST%%tests/opensubdiv/osd_regression
%%TEST%%tests/opensubdiv/far_regression
%%TEST%%tests/opensubdiv/hbr_baseline
%%TEST%%tests/opensubdiv/hbr_regression
%%TEST%%tests/opensubdiv/osd_regression
%%TUTORIALS%%%%DATADIR%%/tutorials/bfr_tutorial_1_1
%%TUTORIALS%%%%DATADIR%%/tutorials/bfr_tutorial_1_2
%%TUTORIALS%%%%DATADIR%%/tutorials/bfr_tutorial_1_3
Expand All @@ -131,7 +131,7 @@ lib/libosdGPU.so.%%LIBVERS%%
%%TUTORIALS%%%%DATADIR%%/tutorials/far_tutorial_5_1
%%TUTORIALS%%%%DATADIR%%/tutorials/far_tutorial_5_2
%%TUTORIALS%%%%DATADIR%%/tutorials/far_tutorial_5_3
@comment %%TUTORIALS%%%%DATADIR%%/tutorials/hbr_tutorial_0
@comment %%TUTORIALS%%%%DATADIR%%/tutorials/hbr_tutorial_1
@comment %%TUTORIALS%%%%DATADIR%%/tutorials/hbr_tutorial_2
%%TUTORIALS%%%%DATADIR%%/tutorials/hbr_tutorial_0
%%TUTORIALS%%%%DATADIR%%/tutorials/hbr_tutorial_1
%%TUTORIALS%%%%DATADIR%%/tutorials/hbr_tutorial_2
%%TUTORIALS%%%%DATADIR%%/tutorials/osd_tutorial_0

0 comments on commit f251a78

Please sign in to comment.