Skip to content

Commit c04bdd4

Browse files
committed
msvc fixes
1 parent 9aeae20 commit c04bdd4

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

Diff for: python/BuildStandalone.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Python_add_library(
2020
${KENLM_PYTHON_STANDALONE_SRCS} python/kenlm.cpp
2121
)
2222

23+
set_property(TARGET kenlm PROPERTY CXX_STANDARD 11)
2324
target_include_directories(kenlm PRIVATE ${PROJECT_SOURCE_DIR})
2425
target_compile_definitions(kenlm PRIVATE KENLM_MAX_ORDER=${KENLM_MAX_ORDER})
2526

Diff for: setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
from setuptools import setup, Extension
22
from setuptools.command.build_ext import build_ext as _build_ext
3-
import glob
43
import platform
54
import subprocess
65
import os
@@ -40,7 +39,6 @@ def run(self):
4039
"-DBUILD_SHARED_LIBS=ON",
4140
"-DBUILD_PYTHON_STANDALONE=ON",
4241
f"-DKENLM_MAX_ORDER={max_order}",
43-
f"-DPYTHON_EXECUTABLE={sys.executable}",
4442
f"-DCMAKE_PROJECT_VERSION={VERSION}",
4543
]
4644
cfg = "Debug" if self.debug else "Release"
@@ -55,8 +53,9 @@ def run(self):
5553
]
5654
if sys.maxsize > 2**32:
5755
cmake_args += ["-A", "x64"]
56+
# build_args += ["--", "/m"]
5857
else:
59-
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]
58+
cmake_args.append(f"-DCMAKE_BUILD_TYPE={cfg}")
6059

6160
env = os.environ.copy()
6261
env["CXXFLAGS"] = '{} -fPIC -DVERSION_INFO=\\"{}\\"'.format(

Diff for: util/read_compressed.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ class GZip {
168168

169169
void SetOutput(void *to, std::size_t amount) {
170170
stream_.next_out = static_cast<Bytef*>(to);
171-
stream_.avail_out = std::min<std::size_t>(std::numeric_limits<uInt>::max(), amount);
171+
stream_.avail_out = std::min<std::size_t>((std::numeric_limits<uInt>::max)(), amount);
172172
}
173173

174174
void SetInput(const void *base, std::size_t amount) {
175-
assert(amount < static_cast<std::size_t>(std::numeric_limits<uInt>::max()));
175+
assert(amount < static_cast<std::size_t>((std::numeric_limits<uInt>::max)()));
176176
stream_.next_in = const_cast<Bytef*>(static_cast<const Bytef*>(base));
177177
stream_.avail_in = amount;
178178
}
@@ -225,7 +225,7 @@ class BZip {
225225

226226
void SetOutput(void *base, std::size_t amount) {
227227
stream_.next_out = static_cast<char*>(base);
228-
stream_.avail_out = std::min<std::size_t>(std::numeric_limits<unsigned int>::max(), amount);
228+
stream_.avail_out = std::min<std::size_t>((std::numeric_limits<unsigned int>::max)(), amount);
229229
}
230230

231231
void SetInput(const void *base, std::size_t amount) {

0 commit comments

Comments
 (0)