1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-23 09:10:43 +00:00

- Switch appleseed.studio build to Python 3.x and enable by default

- Register missing dependency on the `graphics/opencolorio' port
This commit is contained in:
Alexey Dokuchaev 2021-03-14 09:02:35 +00:00
parent 1ac61e52d9
commit c192f78167
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=568372
8 changed files with 223 additions and 5 deletions

View File

@ -3,7 +3,7 @@
PORTNAME= appleseed
DISTVERSION= 2.1.0-beta
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= graphics
MAINTAINER= danfe@FreeBSD.org
@ -17,6 +17,7 @@ LIB_DEPENDS= libboost_thread.so:devel/boost-libs \
libpng.so:graphics/png \
libIlmImf.so:graphics/openexr \
libIlmThread.so:graphics/ilmbase \
libOpenColorIO.so:graphics/opencolorio \
libOpenImageIO.so:graphics/openimageio \
libxerces-c.so:textproc/xerces-c3 \
liboslexec.so:graphics/openshadinglanguage
@ -30,8 +31,7 @@ ONLY_FOR_ARCHS_REASON= not ported to it yet
USES= cmake compiler:c++11-lang shebangfix
SHEBANG_FILES= scripts/*.py
CMAKE_ARGS= -DWITH_STUDIO:BOOL=OFF \
-DWITH_PYTHON2_BINDINGS:BOOL=OFF \
CMAKE_ARGS= -DWITH_PYTHON2_BINDINGS:BOOL=OFF \
-DWITH_DOXYGEN:BOOL=OFF \
-DINSTALL_HEADERS:BOOL=OFF \
-DINSTALL_TESTS:BOOL=OFF \
@ -49,16 +49,25 @@ PLIST_SUB= APPHOME=${CMAKE_INSTALL_PREFIX}
SUB_FILES= pkg-message
SUB_LIST:= ${PLIST_SUB}
OPTIONS_DEFINE= PYTHON
OPTIONS_DEFAULT= PYTHON
OPTIONS_DEFINE= PYTHON STUDIO
OPTIONS_DEFAULT= PYTHON STUDIO
OPTIONS_SUB= yes
PYTHON_USES= gl python:3.5+,build,run
PYTHON_USE= GL=gl
PYTHON_CMAKE_ON= -DWITH_PYTHON3_BINDINGS:BOOL=ON
STUDIO_DESC= Build appleseed.studio (Qt-based)
STUDIO_LIB_DEPENDS= ${PY_BOOST}
STUDIO_USES= qt:5
STUDIO_USE= QT=buildtools_build,qmake_build,concurrent,core,gui,opengl,widgets
STUDIO_CMAKE_OFF= -DWITH_STUDIO:BOOL=OFF
STUDIO_IMPLIES= PYTHON
post-patch:
@${RMDIR} ${WRKSRC}/sandbox/docs/api
@${RM} ${WRKSRC}/sandbox/share/cmake/Modules/FindOpenImageIO.cmake
.include <bsd.port.mk>
PATCH_ARGS+= -l

View File

@ -1,5 +1,16 @@
--- CMakeLists.txt.orig 2019-08-31 15:49:01 UTC
+++ CMakeLists.txt
@@ -681,8 +681,8 @@ if (WITH_PYTHON2_BINDINGS OR WITH_PYTHON3_BINDINGS)
endif ()
if (WITH_STUDIO)
- if (NOT WITH_PYTHON2_BINDINGS)
- message (FATAL_ERROR "Option WITH_PYTHON2_BINDINGS should be \"ON\" to build appleseed.studio.")
+ if (NOT WITH_PYTHON3_BINDINGS)
+ message (FATAL_ERROR "Option WITH_PYTHON3_BINDINGS should be \"ON\" to build appleseed.studio.")
endif ()
add_subdirectory (src/appleseed.studio)
endif ()
@@ -732,15 +732,27 @@ install (
sandbox/share
sandbox/stylesheets

View File

@ -0,0 +1,62 @@
--- src/appleseed.studio/CMakeLists.txt.orig 2019-08-31 15:49:01 UTC
+++ src/appleseed.studio/CMakeLists.txt
@@ -33,18 +33,13 @@
#--------------------------------------------------------------------------------------------------
# Boost.
-if (NOT PYTHON_MAJOR_VERSION STREQUAL "2")
- message (FATAL_ERROR "Python 2.x needed.")
-else ()
- if (Boost_VERSION GREATER_EQUAL 106700)
- find_package (Boost 1.61 REQUIRED COMPONENTS python27)
- else ()
- find_package (Boost 1.61 REQUIRED COMPONENTS python)
- endif ()
-endif ()
+find_package (Boost 1.61 REQUIRED COMPONENTS python)
# OpenGL.
find_package (OpenGL REQUIRED)
+
+# Python 3.
+find_package (Python3 REQUIRED)
# Qt 5.
find_package (Qt5 REQUIRED COMPONENTS Concurrent Core OpenGL Widgets)
@@ -475,7 +470,7 @@ QT5_ADD_RESOURCES (appleseed.studio_resource_files
add_executable (appleseed.studio
${appleseed.studio_sources}
- $<TARGET_OBJECTS:appleseed.py2.obj>
+ $<TARGET_OBJECTS:appleseed.py3.obj>
${appleseed.studio_generated_ui_files}
${appleseed.studio_generated_moc_h_files}
${appleseed.studio_resource_files}
@@ -505,7 +500,7 @@ include_directories (
.
../appleseed.shared
${OPENCOLORIO_INCLUDE_DIRS}
- ${PYTHON_INCLUDE_DIRS}
+ ${PYTHON_INCLUDE_DIR}
)
@@ -533,8 +528,8 @@ target_link_libraries (appleseed.studio
Qt5::Concurrent
Qt5::OpenGL
Qt5::Widgets
- ${OPENGL_LIBRARY}
- ${PYTHON_LIBRARIES}
+ ${OPENGL_gl_LIBRARY}
+ glad ${PYTHON_LIBRARY}
)
if (WITH_DISNEY_MATERIAL)
@@ -589,5 +584,5 @@ install (DIRECTORY ../../sandbox/studio
DESTINATION .
)
-install (DIRECTORY ../../sandbox/lib/python/site-packages DESTINATION "lib/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}")
-install (DIRECTORY python/studio DESTINATION "lib/python${PYTHON_MAJOR_VERSION}.${PYTHON_MINOR_VERSION}/appleseed")
+install (DIRECTORY ../../sandbox/lib/python/site-packages DESTINATION "../lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}")
+install (DIRECTORY python/studio DESTINATION "../lib/python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}/site-packages/appleseed")

View File

@ -0,0 +1,44 @@
--- src/appleseed.studio/main/main.cpp.orig 2019-08-31 15:49:01 UTC
+++ src/appleseed.studio/main/main.cpp
@@ -29,8 +29,9 @@
// appleseed.studio headers.
#include "commandlinehandler.h"
-#include "mainwindow/mainwindow.h"
+// XXX: must be included before Qt headers because of `slot' redefine
#include "python/pythoninterpreter.h"
+#include "mainwindow/mainwindow.h"
#include "utility/miscellaneous.h"
// appleseed.shared headers.
@@ -141,7 +142,7 @@ namespace
bf::path python_path = bf::path(Application::get_root_path()) / "python27";
#else
// On Linux, Python's standard libraries are located in lib/python2.7/.
- bf::path python_path = bf::path(Application::get_root_path());
+ bf::path python_path = bf::path(Application::get_root_path()) / "..";
#endif
if (bf::is_directory(python_path))
@@ -159,18 +160,18 @@ namespace
"will use Python installation expected to exist in %s.",
python_home);
- Py_SetPythonHome(python_home);
+ Py_SetPythonHome(Py_DecodeLocale(python_home, nullptr));
}
else
{
const string python_path_str = python_path.make_preferred().string();
QMessageBox msgbox;
- msgbox.setWindowTitle("Python 2.7 Installation Not Found");
+ msgbox.setWindowTitle("Python Installation Not Found");
msgbox.setIcon(QMessageBox::Critical);
msgbox.setText(
QString(
- "No Python 2.7 installation could be found in %1 where appleseed.studio expects one "
+ "No Python installation could be found in %1 where appleseed.studio expects one "
"to be, and the PYTHONHOME environment variable is not defined or is empty. "
"appleseed.studio may not work satisfactorily.").arg(QString::fromStdString(python_path_str)));
msgbox.setStandardButtons(QMessageBox::Ok);

View File

@ -0,0 +1,29 @@
--- src/appleseed.studio/mainwindow/mainwindow.cpp.orig 2019-08-31 15:49:01 UTC
+++ src/appleseed.studio/mainwindow/mainwindow.cpp
@@ -27,6 +27,9 @@
// THE SOFTWARE.
//
+// XXX: must be included before Qt headers because of `slot' redefine
+#include "mainwindow/pythonconsole/pythonconsolewidget.h"
+
// Interface header.
#include "mainwindow.h"
@@ -39,7 +42,6 @@
#include "mainwindow/minimizebutton.h"
#include "mainwindow/project/attributeeditor.h"
#include "mainwindow/project/projectexplorer.h"
-#include "mainwindow/pythonconsole/pythonconsolewidget.h"
#include "mainwindow/rendering/lightpathstab.h"
#include "mainwindow/rendering/materialdrophandler.h"
#include "mainwindow/rendering/renderwidget.h"
@@ -684,7 +686,7 @@ void MainWindow::build_log_panel()
void MainWindow::build_python_console_panel()
{
- char* python_home = Py_GetPythonHome();
+ char* python_home = Py_EncodeLocale(Py_GetPythonHome(), nullptr);
if (python_home == nullptr)
RENDERER_LOG_INFO("Python home not set.");
else RENDERER_LOG_INFO("Python home set to %s.", python_home);

View File

@ -0,0 +1,16 @@
--- src/appleseed.studio/python/module.cpp.orig 2019-08-31 15:49:01 UTC
+++ src/appleseed.studio/python/module.cpp
@@ -26,10 +26,12 @@
// THE SOFTWARE.
//
+// XXX: must be included before Qt headers because of `slot' redefine
+#include "python/pythoninterpreter.h"
+
// appleseed.studio headers.
#include "mainwindow/mainwindow.h"
#include "mainwindow/minimizebutton.h"
-#include "python/pythoninterpreter.h"
// appleseed.foundation headers.
#include "foundation/core/exceptions/exception.h"

View File

@ -0,0 +1,22 @@
--- src/appleseed.studio/python/pythoninterpreter.cpp.orig 2019-08-31 15:49:01 UTC
+++ src/appleseed.studio/python/pythoninterpreter.cpp
@@ -62,7 +62,7 @@ BOOST_PYTHON_MODULE(_appleseedpythonbuiltin)
}
// Generated by BOOST_PYTHON_MODULE() declarations in module.cpp files.
-extern "C" void init_appleseedstudio();
+extern "C" PyObject* PyInit__appleseedstudio();
namespace appleseed {
namespace studio {
@@ -177,8 +177,8 @@ void PythonInterpreter::initialize(OutputRedirector re
// from e.g. renderer::Project to appleseedpython.Project.
//
- PyImport_AppendInittab("_appleseedpythonbuiltin", init_appleseedpythonbuiltin);
- PyImport_AppendInittab("_appleseedstudio", init_appleseedstudio);
+ PyImport_AppendInittab("_appleseedpythonbuiltin", PyInit__appleseedpythonbuiltin);
+ PyImport_AppendInittab("_appleseedstudio", PyInit__appleseedstudio);
Py_Initialize();
bpy::object main_module = bpy::import("__main__");

View File

@ -9,14 +9,19 @@ share/cmake/Modules/FindXerces.cmake
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/__init__.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/_appleseedpython3.so
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/logtarget.py
%%STUDIO%%%%PYTHON_SITELIBDIR%%/appleseed/studio/__init__.py
%%STUDIO%%%%PYTHON_SITELIBDIR%%/appleseed/studio/plugins.py
%%STUDIO%%%%PYTHON_SITELIBDIR%%/appleseed/studio/ui.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/test/runtests.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/test/testbasis.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/test/testdict2dict.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/test/testentitymap.py
%%PYTHON%%%%PYTHON_SITELIBDIR%%/appleseed/test/testentityvector.py
%%STUDIO%%%%PYTHON_SITELIBDIR%%/Qt.py
@cwd %%APPHOME%%
bin/animatecamera
bin/appleseed.cli
%%STUDIO%%bin/appleseed.studio
bin/cleanmany.py
bin/convertmany.py
bin/convertmeshfile
@ -114,6 +119,25 @@ icons/rendertab_toggle_pixel_inspector.png
icons/rendertab_toggle_pixel_inspector_hover.png
lib/libappleseed.shared.so
lib/libappleseed.so
%%STUDIO%%ocio/config.ocio
%%STUDIO%%ocio/luts/alexalogc.spi1d
%%STUDIO%%ocio/luts/cineon.spi1d
%%STUDIO%%ocio/luts/panalog.spi1d
%%STUDIO%%ocio/luts/ploglin.spi1d
%%STUDIO%%ocio/luts/rec709.spi1d
%%STUDIO%%ocio/luts/redlog.spi1d
%%STUDIO%%ocio/luts/slog.spi1d
%%STUDIO%%ocio/luts/srgb.spi1d
%%STUDIO%%ocio/luts/srgbf.spi1d
%%STUDIO%%ocio/luts/viperlog.spi1d
%%STUDIO%%seexpr/clouds/blue_clouds.se
%%STUDIO%%seexpr/geometric/checkers.se
%%STUDIO%%seexpr/geometric/dots.se
%%STUDIO%%seexpr/gradients/horizontal.se
%%STUDIO%%seexpr/gradients/vertical.se
%%STUDIO%%seexpr/noise/fbm.se
%%STUDIO%%seexpr/noise/noise.se
%%STUDIO%%seexpr/noise/turbulence.se
schemas/project.xsd
schemas/settings.xsd
settings/appleseed.cli.xml
@ -283,4 +307,5 @@ share/mitsuba2appleseed.py
share/rfmdisneypresets2appleseed.py
share/substancepainter_presets/appleseed UDIM.spexp
share/substancepainter_presets/appleseed.spexp
%%STUDIO%%@dir studio/plugins
stylesheets/default.qss