git: 12078e8d3ea8 - main - x11-toolkits/nanogui: Update to the successor fork @ mitsuba-renderer/nanogui

From: Yuri Victorovich <yuri_at_FreeBSD.org>
Date: Tue, 29 Mar 2022 16:04:04 UTC
The branch main has been updated by yuri:

URL: https://cgit.FreeBSD.org/ports/commit/?id=12078e8d3ea8f1467d121b3ae5ee7e4f4b69702a

commit 12078e8d3ea8f1467d121b3ae5ee7e4f4b69702a
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2022-03-29 16:02:55 +0000
Commit:     Yuri Victorovich <yuri@FreeBSD.org>
CommitDate: 2022-03-29 16:04:02 +0000

    x11-toolkits/nanogui: Update to the successor fork @ mitsuba-renderer/nanogui
    
    Reported by:    Hiroo Ono (小野寛生) <hiroo.ono+freebsd@gmail.com>
---
 x11-toolkits/nanogui/Makefile                   |  40 +++++---
 x11-toolkits/nanogui/distinfo                   |  16 ++-
 x11-toolkits/nanogui/files/patch-CMakeLists.txt | 126 ++++--------------------
 x11-toolkits/nanogui/pkg-plist                  |  35 ++++---
 4 files changed, 72 insertions(+), 145 deletions(-)

diff --git a/x11-toolkits/nanogui/Makefile b/x11-toolkits/nanogui/Makefile
index b184a6e91ca8..0af92116fc15 100644
--- a/x11-toolkits/nanogui/Makefile
+++ b/x11-toolkits/nanogui/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	nanogui
-DISTVERSION=	g20190922
-PORTREVISION=	3
+DISTVERSION=	g20220215
 CATEGORIES=	x11-toolkits
 
 MAINTAINER=	yuri@FreeBSD.org
@@ -9,19 +8,23 @@ COMMENT=	Minimalistic GUI library for OpenGL
 LICENSE=	BSD3CLAUSE
 LICENSE_FILE=	${WRKSRC}/LICENSE.txt
 
-LIB_DEPENDS=	libfontconfig.so:x11-fonts/fontconfig \
-		libfreetype.so:print/freetype2 \
-		libglfw.so:graphics/glfw
-
-USES=		cmake compiler:c++14-lang eigen:3,build,run gl xorg
-USE_GITHUB=	yes
-GH_ACCOUNT=	wjakob
-GH_TAGNAME=	e9ec8a1a9861cf578d9c6e85a6420080aa715c03
-GH_TUPLE=	wjakob:nanovg:50826f7bf0d910962e6aba2c3310ede889726917:wjakob_nanovg/ext/nanovg
+USES=		cmake compiler:c++17-lang eigen:3,build,run gl xorg
 USE_GL=		gl
 USE_XORG=	x11 xcursor xi xinerama xrandr xxf86vm
 USE_LDCONFIG=	yes
-CMAKE_OFF=	NANOGUI_BUILD_EXAMPLE GLFW_BUILD_EXAMPLES
+
+USE_GITHUB=	yes
+GH_ACCOUNT=	mitsuba-renderer
+GH_TAGNAME=	c6505300bb3036ec87ac68f5f1699c434c3d7fc6
+GH_TUPLE=	wjakob:nanovg:bf2320d1175122374a9b806d91e9e666c9336375:wjakob_nanovg/ext/nanovg \
+		wjakob:nanovg_metal:075b04f16c579728c693b46a2ce408f2325968cf:wjakob_nanovg_metal/ext/nanovg_metal \
+		wjakob:glfw:e130e55a990998c78fd323f21076e798e0efe8a4:wjakob_glfw/ext/glfw \
+		pybind:pybind11:8de7772cc72daca8e947b79b83fea46214931604:pybind_pybind11/ext/pybind11 \
+
+CMAKE_ARGS=	-DCMAKE_INSTALL_INCLUDEDIR=${LOCALBASE}/include \
+		-DCMAKE_INSTALL_DATAROOTDIR=${LOCALBASE}/lib
+CMAKE_ON=	NANOGUI_BUILD_GLFW
+CMAKE_OFF=	NANOGUI_BUILD_EXAMPLES
 
 OPTIONS_DEFINE=		PYTHON
 OPTIONS_DEFAULT=	PYTHON
@@ -29,14 +32,19 @@ OPTIONS_SUB=		yes
 
 PYTHON_CMAKE_BOOL=	NANOGUI_BUILD_PYTHON
 PYTHON_USES=		python
-PYTHON_BUILD_DEPENDS=	${LOCALBASE}/include/pybind11/pybind11.h:devel/pybind11
-PYTHON_RUN_DEPENDS=	pybind11>0:devel/pybind11
+PYTHON_CMAKE_ON=	-DFREEBSD_PYTHON_DISTVERSION=${PYTHON_DISTVERSION}
 
-post-install:
-	${INSTALL_DATA} ${WRKSRC}/ext/nanovg/src/*.h ${STAGEDIR}${PREFIX}/include/nanogui/  # bundled dependency headers aren't installed
+post-install: # workaround for https://github.com/mitsuba-renderer/nanogui/issues/116
+	@${RM} -r ${STAGEDIR}${PREFIX}/include/GLFW
 
 post-install-PYTHON-on:
 	@${MKDIR} ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 	${MV} ${STAGEDIR}${PREFIX}/lib/nanogui*.so ${STAGEDIR}${PYTHONPREFIX_SITELIBDIR}
 
+do-test:
+	@cd ${BUILD_WRKSRC} && \
+		${SETENV} ${CONFIGURE_ENV} ${CMAKE_BIN} ${CMAKE_ARGS} -DNANOGUI_BUILD_EXAMPLES:BOOL=ON ${CMAKE_SOURCE_PATH} && \
+		${SETENV} ${MAKE_ENV} ${MAKE_CMD} ${MAKE_ARGS} ${ALL_TARGET} && \
+		./example1 && ./example2 && ./example3 && ./example4 && ./example_icons
+
 .include <bsd.port.mk>
diff --git a/x11-toolkits/nanogui/distinfo b/x11-toolkits/nanogui/distinfo
index 1aca7172c808..16a9a76351b9 100644
--- a/x11-toolkits/nanogui/distinfo
+++ b/x11-toolkits/nanogui/distinfo
@@ -1,5 +1,11 @@
-TIMESTAMP = 1588186460
-SHA256 (wjakob-nanogui-g20190922-e9ec8a1a9861cf578d9c6e85a6420080aa715c03_GH0.tar.gz) = 6cf060f9cc6b568115fa1523580c303cb813e7f6eeec113a1d26ef9b230384a7
-SIZE (wjakob-nanogui-g20190922-e9ec8a1a9861cf578d9c6e85a6420080aa715c03_GH0.tar.gz) = 2769973
-SHA256 (wjakob-nanovg-50826f7bf0d910962e6aba2c3310ede889726917_GH0.tar.gz) = 2d60ff81eaa3f68bf64c8f0028b4c0231935cc7e91214e09a59803d1d92400b3
-SIZE (wjakob-nanovg-50826f7bf0d910962e6aba2c3310ede889726917_GH0.tar.gz) = 2016516
+TIMESTAMP = 1648566703
+SHA256 (mitsuba-renderer-nanogui-g20220215-c6505300bb3036ec87ac68f5f1699c434c3d7fc6_GH0.tar.gz) = c621cbba97e8ff16454c869db74c83f927c92c19cda3af0f6fd1ace21e39a5b3
+SIZE (mitsuba-renderer-nanogui-g20220215-c6505300bb3036ec87ac68f5f1699c434c3d7fc6_GH0.tar.gz) = 2911192
+SHA256 (wjakob-nanovg-bf2320d1175122374a9b806d91e9e666c9336375_GH0.tar.gz) = 3e16aece01492a1fc2b398d6f2ad5aeef27a1810bf2b38de635b2e23aa7f0ecb
+SIZE (wjakob-nanovg-bf2320d1175122374a9b806d91e9e666c9336375_GH0.tar.gz) = 2023990
+SHA256 (wjakob-nanovg_metal-075b04f16c579728c693b46a2ce408f2325968cf_GH0.tar.gz) = e1b2642d56a3bae45ab75dfdcb24113ccac66e1bd81518cd3fb405585148b301
+SIZE (wjakob-nanovg_metal-075b04f16c579728c693b46a2ce408f2325968cf_GH0.tar.gz) = 159456
+SHA256 (wjakob-glfw-e130e55a990998c78fd323f21076e798e0efe8a4_GH0.tar.gz) = 17343211b79421f6d2b92947915acadebf082d1c16c7ddb757555660d044c5b1
+SIZE (wjakob-glfw-e130e55a990998c78fd323f21076e798e0efe8a4_GH0.tar.gz) = 784260
+SHA256 (pybind-pybind11-8de7772cc72daca8e947b79b83fea46214931604_GH0.tar.gz) = 53cd43ce8ade975225c2fd99325c2d3e42190b317fcabd6e13c6406972427bd0
+SIZE (pybind-pybind11-8de7772cc72daca8e947b79b83fea46214931604_GH0.tar.gz) = 648390
diff --git a/x11-toolkits/nanogui/files/patch-CMakeLists.txt b/x11-toolkits/nanogui/files/patch-CMakeLists.txt
index 3b926c7cda1f..690e8bffbd12 100644
--- a/x11-toolkits/nanogui/files/patch-CMakeLists.txt
+++ b/x11-toolkits/nanogui/files/patch-CMakeLists.txt
@@ -1,112 +1,20 @@
---- CMakeLists.txt.orig	2018-03-18 12:10:05 UTC
+--- CMakeLists.txt.orig	2022-02-15 15:25:41 UTC
 +++ CMakeLists.txt
-@@ -11,11 +11,11 @@ if (POLICY CMP0058)
-   cmake_policy(SET CMP0058 NEW)
- endif()
+@@ -1,6 +1,8 @@
+ cmake_minimum_required (VERSION 3.13..3.18)
+ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
  
--if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw/src")
--  message(FATAL_ERROR "The NanoGUI dependency repositories (GLFW, etc.) are missing! "
--    "You probably did not clone the project with --recursive. It is possible to recover "
--    "by calling \"git submodule update --init --recursive\"")
--endif()
-+#if (NOT IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw/src")
-+#  message(FATAL_ERROR "The NanoGUI dependency repositories (GLFW, etc.) are missing! "
-+#    "You probably did not clone the project with --recursive. It is possible to recover "
-+#    "by calling \"git submodule update --init --recursive\"")
-+#endif()
- 
- if (WIN32)
-   set(NANOGUI_USE_GLAD_DEFAULT ON)
-@@ -23,6 +23,8 @@ else()
-   set(NANOGUI_USE_GLAD_DEFAULT OFF)
- endif()
- 
-+include_directories(${CMAKE_INSTALL_PREFIX}/include/eigen3)
++include(CMakePackageConfigHelpers)
 +
- option(NANOGUI_BUILD_EXAMPLE "Build NanoGUI example application?" ON)
- option(NANOGUI_BUILD_SHARED  "Build NanoGUI as a shared library?" ON)
- option(NANOGUI_BUILD_PYTHON  "Build a Python plugin for NanoGUI?" ON)
-@@ -78,13 +80,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang
-   set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-deprecated-declarations")
- endif()
- 
--add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw" "ext_build/glfw")
-+#add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw" "ext_build/glfw")
- # Two targets have now been defined: `glfw_objects`, which will be merged into
- # NanoGUI at the end, and `glfw`.  The `glfw` target is the library itself
- # (e.g., libglfw.so), but can be skipped as we do not need to link against it
- # (because we merge `glfw_objects` into NanoGUI).  Skipping is required for
- # XCode, but preferable for all build systems (reduces build artifacts).
--set_target_properties(glfw PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
-+#set_target_properties(glfw PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
- 
- # Python support: add NANOGUI_PYTHON flag to all targets
- if (NANOGUI_BUILD_PYTHON)
-@@ -218,7 +220,7 @@ if (NANOGUI_USE_GLAD)
- endif()
- 
- list(APPEND NANOGUI_EXTRA_INCS
--  "${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw/include"
-+  #"${CMAKE_CURRENT_SOURCE_DIR}/ext/glfw/include"
-   "${CMAKE_CURRENT_SOURCE_DIR}/ext/nanovg/src"
- )
- 
-@@ -254,6 +256,9 @@ elseif(CMAKE_SYSTEM MATCHES "Linux" OR C
-   if(CMAKE_SYSTEM MATCHES "Linux")
-     list(APPEND NANOGUI_EXTRA_LIBS dl)
-   endif()
-+  if(CMAKE_SYSTEM MATCHES "FreeBSD")
-+    list(APPEND NANOGUI_EXTRA_LIBS glfw)
-+  endif()
- endif()
- 
- include_directories(${NANOGUI_EIGEN_INCLUDE_DIR} ext/glfw/include ext/nanovg/src include ${CMAKE_CURRENT_BINARY_DIR})
-@@ -293,7 +298,7 @@ else()
-   set(NANOGUI_LIBRARY_TYPE "STATIC")
- endif()
- 
--if (APPLE OR CMAKE_SYSTEM MATCHES "Linux")
-+if (APPLE OR CMAKE_SYSTEM MATCHES "Linux|FreeBSD")
-   # Include coroutine support for running the mainloop in detached mode
-   add_definitions(-DCORO_SJLJ)
-   include_directories(ext/coro)
-@@ -368,7 +373,7 @@ if (CMAKE_GENERATOR STREQUAL Xcode)
- else()
-   add_library(nanogui ${NANOGUI_LIBRARY_TYPE}
-     $<TARGET_OBJECTS:nanogui-obj>
--    $<TARGET_OBJECTS:glfw_objects>
-+    #$<TARGET_OBJECTS:glfw_objects>
-   )
- endif()
- 
-@@ -441,7 +446,7 @@ if (NANOGUI_BUILD_PYTHON)
-   # Detect Python
- 
-   # Try to autodetect Python (can be overridden manually if needed)
--  list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/ext/pybind11/tools")
-+  list(APPEND CMAKE_MODULE_PATH "${CMAKE_INSTALL_PREFIX}/share/cmake/pybind11/")
-   set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 3.4)
-   find_package(PythonLibsNew ${NANOGUI_PYTHON_VERSION})
-   if (NOT PYTHONLIBS_FOUND)
-@@ -456,7 +461,7 @@ endif()
- if (NANOGUI_BUILD_PYTHON)
-   # Need PIC code in libnanogui even when compiled as a static library
-   set_target_properties(nanogui-obj PROPERTIES POSITION_INDEPENDENT_CODE ON)
--  set_target_properties(glfw_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
-+  #set_target_properties(glfw_objects PROPERTIES POSITION_INDEPENDENT_CODE ON)
- 
-   include_directories("ext/pybind11/include" ${PYTHON_INCLUDE_DIR})
-   add_library(nanogui-python-obj OBJECT
-@@ -515,9 +520,9 @@ if (NANOGUI_BUILD_PYTHON)
-     endif()
-   elseif(UNIX)
-     # Optimize for size
--    if (U_CMAKE_BUILD_TYPE MATCHES REL)
--      set_property(TARGET nanogui-python-obj APPEND PROPERTY COMPILE_OPTIONS "-Os")
--    endif()
-+    #if (U_CMAKE_BUILD_TYPE MATCHES REL)
-+    #  set_property(TARGET nanogui-python-obj APPEND PROPERTY COMPILE_OPTIONS "-Os")
-+    #endif()
- 
-     # Strip unnecessary sections of the binary on Linux/Mac OS
-     if(APPLE)
+ # Extract project version from source
+ file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/include/nanogui/common.h"
+   nanogui_version_defines REGEX "#define NANOGUI_VERSION_(MAJOR|MINOR|PATCH) ")
+@@ -580,7 +582,7 @@ if (NANOGUI_BUILD_PYTHON)
+         list(APPEND CMAKE_PREFIX_PATH "${_tmp_dir}")
+       find_package(pybind11 CONFIG REQUIRED)
+     else()
+-      find_package(Python COMPONENTS Interpreter Development REQUIRED)
++      find_package(Python3 ${FREEBSD_PYTHON_DISTVERSION} EXACT REQUIRED COMPONENTS Interpreter Development REQUIRED)
+ 
+       # Allow overriding the pybind11 library used to compile NanoGUI
+       set(NANOGUI_PYBIND11_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ext/pybind11"
diff --git a/x11-toolkits/nanogui/pkg-plist b/x11-toolkits/nanogui/pkg-plist
index 5436d37f3877..1b0f4f7c53e7 100644
--- a/x11-toolkits/nanogui/pkg-plist
+++ b/x11-toolkits/nanogui/pkg-plist
@@ -1,45 +1,50 @@
 include/nanogui/button.h
+include/nanogui/canvas.h
 include/nanogui/checkbox.h
 include/nanogui/colorpicker.h
 include/nanogui/colorwheel.h
 include/nanogui/combobox.h
 include/nanogui/common.h
-include/nanogui/entypo.h
-include/nanogui/fontstash.h
 include/nanogui/formhelper.h
-include/nanogui/glcanvas.h
-include/nanogui/glutil.h
 include/nanogui/graph.h
+include/nanogui/icons.h
 include/nanogui/imagepanel.h
 include/nanogui/imageview.h
 include/nanogui/label.h
 include/nanogui/layout.h
 include/nanogui/messagedialog.h
+include/nanogui/metal.h
 include/nanogui/nanogui.h
-include/nanogui/nanovg.h
-include/nanogui/nanovg_gl.h
-include/nanogui/nanovg_gl_utils.h
 include/nanogui/object.h
 include/nanogui/opengl.h
 include/nanogui/popup.h
 include/nanogui/popupbutton.h
 include/nanogui/progressbar.h
 include/nanogui/python.h
+include/nanogui/renderpass.h
 include/nanogui/screen.h
-include/nanogui/serializer/core.h
-include/nanogui/serializer/opengl.h
-include/nanogui/serializer/sparse.h
+include/nanogui/shader.h
 include/nanogui/slider.h
-include/nanogui/stackedwidget.h
-include/nanogui/stb_image.h
-include/nanogui/stb_truetype.h
-include/nanogui/tabheader.h
 include/nanogui/tabwidget.h
+include/nanogui/textarea.h
 include/nanogui/textbox.h
+include/nanogui/texture.h
 include/nanogui/theme.h
 include/nanogui/toolbutton.h
+include/nanogui/traits.h
+include/nanogui/vector.h
 include/nanogui/vscrollpanel.h
 include/nanogui/widget.h
 include/nanogui/window.h
+include/nanovg/fontstash.h
+include/nanovg/nanovg.h
+include/nanovg/nanovg_gl.h
+include/nanovg/nanovg_gl_utils.h
+include/nanovg/stb_image.h
+include/nanovg/stb_truetype.h
+lib/cmake/nanogui/nanoguiConfig.cmake
+lib/cmake/nanogui/nanoguiConfigVersion.cmake
+lib/cmake/nanogui/nanoguiTargets-%%CMAKE_BUILD_TYPE%%.cmake
+lib/cmake/nanogui/nanoguiTargets.cmake
 lib/libnanogui.so
-%%PYTHON%%%%PYTHON_SITELIBDIR%%/nanogui%%PYTHON_EXT_SUFFIX%%.so
+%%PYTHON%%%%PYTHON_SITELIBDIR%%/nanogui_ext%%PYTHON_EXT_SUFFIX%%.so