Rewrite python binding CMake configuration and CI checks#483
Conversation
8e25911 to
995fd43
Compare
|
@cary-ilm I'll be glad to submit a fix for these minor issues, but I think it might be best to keep that for a separate PR after this is merged. |
|
@Treata11, here's the log of what was installed, from the log of the job that builds the framework: The |
|
I only checked the installed artifacts in the build-dir at first & didn't look at |
This does three things:
1. Complete rewrite of the CMake configuration for the python
bindings. This drops support for Python2, and it eliminates
src/python/config/ModuleDefine.cmake altogether and moves the CMake
code directly into PyImath, PyImathNumpy, etc. It's more direct and
easier to follow this way.
2. Add CI checks to build and test the python bindings on macOS and
Windows, previously not done. The python bindings require
boost.python, which is now installed via conan. A few caveats on
Windows:
a. The Windows Debug build does not currently work. It stubbornly
requires the debug library python39_d.lib, and I can't figure
out how to redirect it to python39.lib. None of the suggested
strategies seem to work, so the build is disabled for now. This
is left as a TODO.
b. The python and pybind11 bindings build successfully on Windows,
but they don't currently execute properly, the "import" checks
fail. I suspect a link/symbol error, but the message is unhelpful. The
PATH and PYTHONPATH appear to be set correctly and as far as I
can tell the necessary dlls are in place. This is left as a TODO
(several TODO's actually).
3. Configure PyImath as a COMPONENT of Imath, to address AcademySoftwareFoundation#360 and
AcademySoftwareFoundation#395. Downstream projects that require PyImath must now specify:
find_package(Imath COMPONENTS PyImath)
whereas projects that simply say:
find_package(Imath)
will no longer generate a dependency on PyImath. Previously, the
only way to avoid this dependency was to build/install Imath with
the python bindings disabled. AcademySoftwareFoundation#360 was based on the hope/assumption
that optional downstream dependence on the python bindings could be
configured at Imath build/install time, but the desired behavior
can only be accomplished by introducing a new downstream
configuration option.
The CI validates this by building the ImathTest and PyImathTest
projects as standalone applications linked against the
just-installed Imath/PyImath build, confirming both that they
compile/link and that they have the proper dependencies.
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
Signed-off-by: Cary Phillips <cary@ilm.com>
c740782 to
14134a8
Compare
|
Merging as is, we can follow up later as needed. |
[NOTE: Reminder that the WIP rewrite of the python bindings using pybind11 are in parallel with the existing boost.python bindings, in
src/pybind11andsrc/pythonrespectively, with the plan to retire thesrc/pythonboost-based bindings when the pybind11 implementation is complete. This configuration rewrite applies to both.]This does four things:
Complete rewrite of the CMake configuration for the python bindings. This drops support for Python2, and it eliminates src/python/config/ModuleDefine.cmake altogether and moves the CMake code directly into PyImath, PyImathNumpy, etc. It's more direct and easier to follow this way.
Add CI checks to build and test the python bindings on macOS and Windows, previously not done. The python bindings require boost.python, which is now installed via conan. A few caveats on Windows:
a. The Windows Debug build does not currently work. It stubbornly requires the debug library python39_d.lib, and I can't figure out how to redirect it to python39.lib. None of the suggested strategies seem to work, so the build is disabled for now. This is left as a TODO.
b. The python and pybind11 bindings build successfully on Windows, but they don't currently execute properly, the "import" checks fail. I suspect a link/symbol error, but the message is unhelpful. The PATH and PYTHONPATH appear to be set correctly and as far as I can tell the necessary dlls are in place. This is left as a TODO (several TODO's actually).
Configure PyImath as a COMPONENT of Imath, to address Please consider making the python bindings optional #360 and Alembic Windows compilation Python3.9.10
called with non-existent target "Imath::PyImath_Python3_9".#395. Downstream projects that require PyImath must now specify:find_package(Imath COMPONENTS PyImath)
whereas projects that simply say:
find_package(Imath)
will no longer generate a dependency on PyImath. Previously, the only way to avoid this dependency was to build/install Imath with the python bindings disabled. Please consider making the python bindings optional #360 was based on the hope/assumption that optional downstream dependence on the python bindings could be configured at Imath build/install time, but the desired behavior can only be accomplished by introducing a new downstream configuration option.
The CI validates this by building the ImathTest and PyImathTest projects as standalone applications linked against the just-installed Imath/PyImath build, confirming both that they compile/link and that they have the proper dependencies.
Fixes the Apple Framework iOS cross-compilation option, and adds that to the CI as well.