Skip to content

Commit a7f19cd

Browse files
Peter Wangfacebook-github-bot
Peter Wang
authored andcommitted
Build pyvrs oss for Windows (#41)
Summary: Pull Request resolved: #41 Build pyvrs oss for Windows Reviewed By: kiminoue7 Differential Revision: D56352466 fbshipit-source-id: 3f5a41c56fa7dd386ab9d70488f6b2013a738fdb
1 parent af3afa0 commit a7f19cd

File tree

4 files changed

+50
-7
lines changed

4 files changed

+50
-7
lines changed

cmake/FindLz4.cmake

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
# Lz4_FOUND - True if Lz4 found.
2121

2222
find_path(Lz4_INCLUDE_DIRS NAMES lz4.h)
23-
find_library(Lz4_LIBRARIES NAMES lz4)
23+
find_library(Lz4_LIBRARIES NAMES lz4 liblz4)
2424
mark_as_advanced(Lz4_LIBRARIES Lz4_INCLUDE_DIRS)
2525

2626
include(FindPackageHandleStandardArgs)

csrc/utils/PyUtils.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616

1717
#include "PyUtils.h"
1818

19+
#include <algorithm>
20+
1921
#define DEFAULT_LOG_CHANNEL "PyUtils"
2022
#include <logging/Log.h>
2123

@@ -39,13 +41,13 @@ string typeName(const DataPiece* piece, const char* suffix) {
3941

4042
string lowercaseTypeName(Record::Type type) {
4143
string typeName = toString(type);
42-
transform(typeName.begin(), typeName.end(), typeName.begin(), ::tolower);
44+
std::transform(typeName.begin(), typeName.end(), typeName.begin(), ::tolower);
4345
return typeName;
4446
}
4547

4648
string toupper(const string& s) {
4749
string t{s};
48-
transform(t.begin(), t.end(), t.begin(), ::toupper);
50+
std::transform(t.begin(), t.end(), t.begin(), ::toupper);
4951
return t;
5052
}
5153

pixi.toml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[project]
2+
name = "pyvrs"
3+
version = "0.1.0"
4+
description = "pyvrs is a Python interface for C++ library VRS using pybind11."
5+
channels = ["conda-forge"]
6+
platforms = ["win-64"]
7+
8+
[tasks]
9+
10+
install_pyvrs = "python -m pip install -e ."
11+
clean = "rm -rf ./build ./wheels vrs.egg-info/"
12+
13+
[build-dependencies]
14+
cmake = "3.28.3"
15+
cxx-compiler = "1.6.0.*"
16+
ninja = "1.11.1"
17+
18+
[dependencies]
19+
gtest = "1.14.0"
20+
21+
boost = "1.84.0"
22+
fmt = "10.1.1"
23+
libjpeg-turbo = "2.1.4.*"
24+
libpng = "1.6.39.*"
25+
lz4 = "4.3.2.*"
26+
portaudio = "19.6.0.*"
27+
xxhash = "0.8.2"
28+
zlib = "1.2.13.*"
29+
30+
# Install Python dependencies
31+
python = "3.11.*"
32+
pip = "*"

setup.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
import os
1717
import re
18+
import shutil
1819
import subprocess
1920
import sys
2021
from pathlib import Path
@@ -79,16 +80,18 @@ def build_extension(self, ext):
7980
f"-DCMAKE_BUILD_TYPE={cfg}",
8081
f"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY={extdir}",
8182
f"-DPYTHON_EXECUTABLE={sys.executable}",
82-
"-GCodeBlocks",
8383
]
8484
build_args = ["--target", os.path.basename(ext.name)]
8585

8686
if "CMAKE_ARGS" in os.environ:
8787
cmake_args += [item for item in os.environ["CMAKE_ARGS"].split(" ") if item]
8888

89-
# Default to Ninja
90-
if "CMAKE_GENERATOR" not in os.environ:
91-
cmake_args += ["-GNinja"]
89+
if sys.platform.startswith("win"):
90+
build_args += ["--config", "Release"]
91+
else:
92+
# Default to Ninja
93+
if "CMAKE_GENERATOR" not in os.environ:
94+
cmake_args += ["-GNinja"]
9295

9396
if sys.platform.startswith("darwin"):
9497
# Cross-compile support for macOS - respect ARCHFLAGS if set
@@ -105,6 +108,12 @@ def build_extension(self, ext):
105108
["cmake", "--build", "."] + build_args, cwd=self.build_temp
106109
)
107110

111+
if sys.platform.startswith("win"):
112+
[
113+
shutil.copy(os.path.join(f"{extdir}/Release/", f), extdir)
114+
for f in os.listdir(f"{extdir}/Release/")
115+
]
116+
108117

109118
def main():
110119
with open(os.path.join(ROOT_DIR, "README.md"), encoding="utf-8") as f:

0 commit comments

Comments
 (0)