-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add support for building the library on Windows using MSVC. #56
Conversation
.gitmodules
Outdated
@@ -1,3 +1,4 @@ | |||
[submodule "src/clp"] | |||
path = src/clp | |||
url = https://github.com/y-scope/clp.git | |||
url = https://github.com/junhaoliao/clp.git |
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.
These shall not be merged
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.
The PR is merged with the latest CLP code: #55
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.
Some comments:
- Can u try to run the unit tests under the Windows dev environment?
- To properly build for Windows, we should also configure
cibuildwheel
to build the library for different Python versions. We can delay this to the next PR if u want, but can u try if we can executecibuildwheel
locally?
@@ -37,6 +37,9 @@ | |||
"src/clp_ffi_py/utils.cpp", | |||
], | |||
extra_compile_args=[ | |||
"/std:c++20", | |||
"/O2," |
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.
Why not O3
?
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.
O3
isn't a valid option for MSVC.
MSVC's /O2
, which "sets a combination of optimizations that optimizes code for maximum speed", is roughly the equivalent of GCC's -O3
.
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.
kk, good to know that, thx!
|
|
pyproject.toml
Outdated
[tool.cibuildwheel.windows] | ||
archs = ["AMD64"] | ||
test-command = [ | ||
"cd /d {package}\\tests", |
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.
The /d
option must be specified or this error message gets reported: The system cannot find the path specified.
That is because the project is synced into D:\
drive in GitHub Action workflows, which is a non-system (non-C:\
) drive.
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.
Also the \
needs to be escaped. /
might also work though.
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.
Can you test if "python -m unittest discover -s {package}/tests -fv"
works on its own (rather than cd
+ unittest
)?
README.md
Outdated
@@ -19,7 +19,7 @@ python3 -m pip install --upgrade clp-ffi-py | |||
Note: | |||
|
|||
- Python 3.7 or higher is required. | |||
- Only Linux and macOS are supported at present. | |||
- Tested only on Linux, macOS and Windows. |
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.
Do we still need work "only", lol
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.
lol i was thinking about Solaris and FreeBSD when i wrote this, but yeah the word seems a bit unnecessary here
@@ -37,6 +37,9 @@ | |||
"src/clp_ffi_py/utils.cpp", | |||
], | |||
extra_compile_args=[ | |||
"/std:c++20", | |||
"/O2," |
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.
kk, good to know that, thx!
.gitmodules
Outdated
@@ -1,3 +1,4 @@ | |||
[submodule "src/clp"] | |||
path = src/clp | |||
url = https://github.com/y-scope/clp.git | |||
url = https://github.com/junhaoliao/clp.git |
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.
The PR is merged with the latest CLP code: #55
…install # Conflicts: # src/clp
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.
Final comments
Co-authored-by: Lin Zhihao <[email protected]>
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.
How about the following commit message:
Add support for building the library on Windows using MSVC. (#56)
Can I help release a new version on PyPI? I assume we also need to update clp-loglib-py, right? |
Sure, I will do it shortly |
References
Internally, it was found installing
clp-ffi-py
on Windows 11 gave errors. It was determined that the following needs to be added to support installation on Windows:Extension.extra_compile_args
in setup.py.bswap
implementations.std::from_chars
in<clp-repo-root>/components/core/src/string_utils.inc
:convert_string_to_int
.Interdependent PR
y-scope/clp#341
Description
cibuildwheel
on Windows (AMD64) in GitHub Actions.Validation performed
Python 3.11.1 (tags/v3.11.1:a7a450f, Dec 6 2022, 19:58:39) [MSC v.1934 64 bit (AMD64)] on win32
.cd e:\; git clone --recursive -b windows-install https://github.com/junhaoliao/clp-ffi-py.git
pip install E:\clp-ffi-py
.