-
Notifications
You must be signed in to change notification settings - Fork 3
/
setup.py
56 lines (50 loc) · 1.56 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
from setuptools import setup, Extension
from pybind11.setup_helpers import Pybind11Extension, build_ext
class my_build_ext(build_ext):
def build_extensions(self):
if self.compiler.compiler_type == "unix":
for e in self.extensions:
e.extra_compile_args = ["-std=c++17", "-msse4.2", "-mavx2"]
elif self.compiler.compiler_type == "msvc":
for e in self.extensions:
e.extra_compile_args = ["/std:c++17", "/arch:AVX2"]
build_ext.build_extensions(self)
ext_modules = [
Pybind11Extension(
"cmajiang._cmajiang",
[
"src_cpp/cmajiang.cpp",
"src_cpp/game.cpp",
"src_cpp/he.cpp",
"src_cpp/hule.cpp",
"src_cpp/shan.cpp",
"src_cpp/shoupai.cpp",
"src_cpp/xiangting.cpp",
"src_cpp/feature.cpp",
"src_cpp/random.cpp",
"src_cpp/paipu.cpp",
"src_cpp/svg.cpp",
"src_cpp/tinyxml2.cpp",
],
language="c++",
include_dirs=[
"src_cpp",
],
)
]
setup(
name="cmajiang",
version="0.0.1",
packages=["cmajiang"],
ext_modules=ext_modules,
cmdclass={"build_ext": my_build_ext},
author="Tadao Yamaoka",
url="https://github.com/TadaoYamaoka/cmajiang",
description="A fast Python mahjong library",
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
install_requires=["pybind11"],
)