-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create wheels on Windows #1015
Create wheels on Windows #1015
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1015 +/- ##
==========================================
- Coverage 85.55% 79.30% -6.26%
==========================================
Files 192 113 -79
Lines 18317 6102 -12215
Branches 2056 0 -2056
==========================================
- Hits 15672 4839 -10833
+ Misses 2119 1263 -856
+ Partials 526 0 -526
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the submission!
Uploaded Users can test installing using the command: Note: We aren't generating a source dist yet (see #988), and I explicitly didn't create one so we'll get an explicit callback if there is a platform mismatch for users. |
I think I found an issue with Python 2.7 wheels on Windows. They link against |
Windows is hard 😞 I am able to get rid of the dependency to I can import OTIO when From what I read in https://stevedower.id.au/blog/building-for-python-3-5-part-two (Steve Dower a CPython core dev and works at Microsoft) Note that when I build OpenTImelineIO with Pytho 2.7 on Windows and then try to import it, everything works. But when I take it to another VM that doesn't have the build stuff installed, then it doesn't. I do this to ensure that I install OTIO in a clean environment. I would be more than happy if someone has more experience than me with how DLLs are searched and loaded by Windows. The fact that I can import OTIO when So we either have to find how we can ship the DLL within our wheel or statically link against it (like mentioned in Steve's blog post). One odd thing is that when debugging, I found that we MSBuild compiles with the |
Ah, I think DLLs can be loaded if they are found in |
Good news, I was able to force CMake to tell MSBuild to statically link And the solution isn't too hacky: diff --git a/src/py-opentimelineio/CMakeLists.txt b/src/py-opentimelineio/CMakeLists.txt
index 01cfeb2..279b450 100644
--- a/src/py-opentimelineio/CMakeLists.txt
+++ b/src/py-opentimelineio/CMakeLists.txt
@@ -1,2 +1,14 @@
+if(MSVC AND Python_VERSION_MAJOR VERSION_LESS 3)
+ # Statically link run-time library (vcruntime and msvcp)
+ # See https://docs.microsoft.com/en-us/cpp/build/reference/md-mt-ld-use-run-time-library?view=msvc-160
+ # This allows us to compile OTIO bindings with a newer MSVC version
+ # than the one used by the interpreter where OTIO will be installed.
+ # This is only required for Python < 3 because only these are
+ # compiled with an older compiler (9.0). CPython 3.5+ uses at least
+ # Visual C++ 14.X.
+ # See https://wiki.python.org/moin/WindowsCompilers#Which_Microsoft_Visual_C.2B-.2B-_compiler_to_use_with_a_specific_Python_version_.3F
+ add_compile_options(/MT)
+endif()
+
add_subdirectory(opentime-bindings)
add_subdirectory(opentimelineio-bindings) With this change, the generated
while before it was looking like:
How does that sound? (I can now close 50 Chrome tabs 😛) |
I just pushed the necessary change. Note that I still have to test the other Windows wheels. |
I tested the Python 2.7 Windows wheels and they seem to work. I also tested the Python 3.7 wheels on Windows (just to be sure).
In the best of worlds, I would have tested the 2.7 wheels on DCCs but I don't have any DCCs at hands right now. The idea is I wanted to test that statically linking the Windows runtimes would not interfere with other runtimes (the ones used by the DCCs, etc). The latest wheels can be found here: https://github.com/PixarAnimationStudios/OpenTimelineIO/suites/3504415054/artifacts/83528771. |
I tested the x64 Windows wheels for all supported Python versions (2.7, 3.7 and 3.8) and they all work perfectly! This PR is officially ready to be merged. 🥳 🍾 . |
Fixes #667 .
Summary
This PR makes it possible to build wheels on Windows in GitHub Actions.
I also updated cibuildwheel from 1.10.0 to 1.12.0 (the last version compatible with Python 2.7) and I'm now using the GitHub Action
pypa/cibuildwheel@v1.12.0
instead of installing cibuildwheel manually.Notes to testers
Wheels have been uploaded to test.pypi.org and can be installed using:
where
python
is the interpreter you want to install the package into.We would be extremely happy if we can get some people to test them, specially the Blender community woking on Windows. You can comment in this PR if you find any issues and you can even comment if it works :) Thanks a lot in advance to everyne that will test them!