vnpy/setup.py

92 lines
3.3 KiB
Python
Raw Normal View History

2019-02-26 02:31:23 +00:00
import ast
import platform
2019-02-26 02:31:23 +00:00
import re
2019-02-18 09:40:15 +00:00
from setuptools import Extension, find_packages, setup
2019-02-26 02:31:23 +00:00
with open("vnpy/__init__.py", "rb") as f:
version_line = re.search(
r"__version__\s+=\s+(.*)", f.read().decode("utf-8")
).group(1)
version = str(ast.literal_eval(version_line))
2019-02-19 02:39:23 +00:00
if platform.uname().system == "Windows":
compiler_flags = ["/MP", "/std:c++17", # standard
"/O2", "/Ob2", "/Oi", "/Ot", "/Oy", "/GL", # Optimization
"/wd4819" # 936 code page
]
extra_link_args = []
2019-02-19 02:39:23 +00:00
else:
compiler_flags = ["-std=c++17",
"-Wno-delete-incomplete", "-Wno-sign-compare",
]
extra_link_args = ["-lstdc++"]
2019-02-19 02:39:23 +00:00
2019-02-26 02:31:23 +00:00
vnctpmd = Extension("vnpy.api.ctp.vnctpmd",
2019-02-18 09:40:15 +00:00
[
"vnpy/api/ctp/vnctp/vnctpmd/vnctpmd.cpp",
],
include_dirs=["vnpy/api/ctp/include", "vnpy/api/ctp/vnctp", ],
define_macros=[],
undef_macros=[],
library_dirs=["vnpy/api/ctp/libs", "vnpy/api/ctp"],
2019-02-18 09:40:15 +00:00
libraries=["thostmduserapi", "thosttraderapi", ],
2019-02-19 02:39:23 +00:00
extra_compile_args=compiler_flags,
extra_link_args=extra_link_args,
2019-02-18 09:40:15 +00:00
depends=[],
runtime_library_dirs=["$ORIGIN"],
2019-02-18 09:40:15 +00:00
language="cpp",
)
2019-02-26 02:31:23 +00:00
vnctptd = Extension("vnpy.api.ctp.vnctptd",
2019-02-18 09:40:15 +00:00
[
"vnpy/api/ctp/vnctp/vnctptd/vnctptd.cpp",
],
include_dirs=["vnpy/api/ctp/include", "vnpy/api/ctp/vnctp", ],
define_macros=[],
undef_macros=[],
library_dirs=["vnpy/api/ctp/libs", "vnpy/api/ctp"],
2019-02-18 09:40:15 +00:00
libraries=["thostmduserapi", "thosttraderapi", ],
2019-02-19 02:39:23 +00:00
extra_compile_args=compiler_flags,
extra_link_args=extra_link_args,
runtime_library_dirs=["$ORIGIN"],
2019-02-18 09:40:15 +00:00
depends=[],
language="cpp",
)
vnoes = Extension("vnpy.api.oes.vnoes",
[
"vnpy/api/oes/vnoes/generated_files/classes_1.cpp",
"vnpy/api/oes/vnoes/generated_files/classes_2.cpp",
"vnpy/api/oes/vnoes/generated_files/module.cpp",
],
include_dirs=["vnpy/api/oes/include", "vnpy/api/oes/vnoes", ],
define_macros=[("BRIGAND_NO_BOOST_SUPPORT", "1")],
undef_macros=[],
library_dirs=["vnpy/api/oes/libs"],
libraries=["oes_api"],
extra_compile_args=compiler_flags,
extra_link_args=extra_link_args,
depends=[],
language="cpp",
)
2019-02-18 09:40:15 +00:00
if platform.uname().system == "Windows":
# use pre-built pyd for windows ( support python 3.7 only )
2019-02-26 02:47:19 +00:00
ext_modules = []
else:
ext_modules = [vnctptd, vnctpmd, vnoes]
2019-02-19 02:39:23 +00:00
pkgs = find_packages()
setup(
2019-02-18 09:40:15 +00:00
name="vnpy",
2019-02-26 02:31:23 +00:00
version=version,
2019-02-19 02:39:23 +00:00
include_package_data=True,
packages=pkgs,
2019-02-26 02:31:23 +00:00
package_data={"": [
"*.json", "*.md", "*.ico", "*.ini",
2019-02-26 06:46:45 +00:00
"*.dll", "*.so", "*.pyd"
2019-02-19 02:39:23 +00:00
]},
2019-02-26 02:31:23 +00:00
install_requires=[],
ext_modules=ext_modules
2019-02-18 09:40:15 +00:00
)