Skip to content
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

Merged
merged 19 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,20 @@ jobs:
- name: cp39-musllinux_x86_64
os: ubuntu-22.04

# Windows builds
- name: cp37-win_amd64
os: windows-2022
- name: cp38-win_amd64
os: windows-2022
- name: cp39-win_amd64
os: windows-2022
- name: cp310-win_amd64
os: windows-2022
- name: cp311-win_amd64
os: windows-2022
- name: cp312-win_amd64
os: windows-2022

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 on Linux, macOS and Windows.

To install an older version or download the prebuilt `whl` package, check the
project homepage on PyPI [here][16].
Expand All @@ -35,8 +35,10 @@ To manually build a package for distribution, follow the steps below.

### Requirements

* A C++ compiler that supports C++20 and `std::span` (e.g. `clang++` >= 7 or
`g++` >= 10).
* A C++ compiler that supports C++20 and `std::span`, e.g:
* `clang++` >= 7
* `g++` >= 10
* `MSVC` >= 1930 (included in Visual Studio 2022)
* python3
* python3-dev
* python3-venv
Expand Down
6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ musllinux-x86_64-image = "musllinux_1_2"
skip = "pp*"

test-command = [
"cd {package}/tests",
"python -m unittest -fv",
"python -m unittest discover --failfast --verbose --start-directory={package}/tests"
]
test-requires = [
"smart_open==6.4.0"
Expand All @@ -68,6 +67,9 @@ archs = ["auto", "aarch64"]
[tool.cibuildwheel.macos]
archs = ["x86_64", "universal2", "arm64"]

[tool.cibuildwheel.windows]
archs = ["AMD64"]

[tool.docformatter]
make-summary-multi-line = true
pre-summary-newline = true
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
f"{clp_ffi_py_src_root}/utils.cpp",
],
extra_compile_args=[
"/std:c++20",
"/O2,"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not O3?

Copy link
Member Author

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.

Copy link
Member

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!

] if "nt" == os.name else [
"-std=c++20",
"-O3",
],
Expand Down
Loading