Skip to content
Open
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
5 changes: 2 additions & 3 deletions bindings/pycldmodule.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ static PyObject *
detect(PyObject *self, PyObject *args, PyObject *kwArgs)
{
const char *bytes;
int numBytes;

CLD2::CLDHints cldHints;
cldHints.tld_hint = 0;
Expand Down Expand Up @@ -89,10 +88,9 @@ detect(PyObject *self, PyObject *args, PyObject *kwArgs)

if (!PyArg_ParseTupleAndKeywords(args,
kwArgs,
"s#|izzzziiiiiiii",
"s|izzzziiiiiiii",
(char **) kwList,
&bytes,
&numBytes,
&isPlainText,
&cldHints.tld_hint,
&hintLanguage,
Expand All @@ -108,6 +106,7 @@ detect(PyObject *self, PyObject *args, PyObject *kwArgs)
&flagBestEffort)) {
return NULL;
}
int numBytes = strlen(bytes);

int flags = 0;
if (flagScoreAsQuads != 0) {
Expand Down
12 changes: 9 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
#

import io
import re
from os import path

import platform
import re
import setuptools

HERE = path.abspath(path.dirname(__file__))
Expand Down Expand Up @@ -66,6 +66,12 @@

include_dirs = [path.join(CLD2_PATH, "internal"), path.join(CLD2_PATH, "public")]

compile_args = ["-w", "-O2", "-fPIC"]
if platform.machine() == 'x86_64':
compile_args.append('-m64')
elif platform.machine() == 'aarch64' or platform.machine() == 'arm64':
compile_args.append('-march=armv8-a')

module = setuptools.Extension(
# First arg (name) is the full name of the extension, including
# any packages - ie. not a filename or pathname, but Python dotted
Expand All @@ -75,7 +81,7 @@
include_dirs=include_dirs,
language="c++",
# TODO: -m64 may break 32 bit builds
extra_compile_args=["-w", "-O2", "-m64", "-fPIC"],
extra_compile_args=compile_args,
)

# We define version as PYCLD2_VERSION in the C++ module.
Expand Down