[Mod] sources of oes_gateway was changed.

This commit is contained in:
nanoric 2019-07-03 11:06:32 +08:00
parent 2125bc6a27
commit 5d555e2a46

View File

@ -16,6 +16,7 @@ other financial markets.
""" """
import ast import ast
import os
import platform import platform
import re import re
import sys import sys
@ -32,9 +33,12 @@ if platform.uname().system == "Windows":
compiler_flags = [ compiler_flags = [
"/MP", "/std:c++17", # standard "/MP", "/std:c++17", # standard
"/O2", "/Ob2", "/Oi", "/Ot", "/Oy", "/GL", # Optimization "/O2", "/Ob2", "/Oi", "/Ot", "/Oy", "/GL", # Optimization
"/wd4819" # 936 code page "/bigobj", # Better compatibility
"/wd4819", # 936 code page
"/D_CRT_SECURE_NO_WARNINGS", # suppress warning of unsafe functions like fopen, strcpy, etc
] ]
extra_link_args = [] extra_link_args = []
runtime_library_dirs = None
else: else:
compiler_flags = [ compiler_flags = [
"-std=c++17", # standard "-std=c++17", # standard
@ -42,6 +46,20 @@ else:
"-Wno-delete-incomplete", "-Wno-sign-compare", "-Wno-delete-incomplete", "-Wno-sign-compare",
] ]
extra_link_args = ["-lstdc++"] extra_link_args = ["-lstdc++"]
runtime_library_dirs = ["$ORIGIN"]
def gather_autocxxpy_generated_files(root: str):
fs = [os.path.join(root, "module.cpp")]
for root, dirs, filenames in os.walk(root):
for filename in filenames:
filebase, ext = os.path.splitext(filename)
if ext == ".cpp" and filebase.startswith("generated_functions_"):
path = os.path.join(root, filename)
fs.append(path)
print(fs)
return fs
vnctpmd = Extension( vnctpmd = Extension(
"vnpy.api.ctp.vnctpmd", "vnpy.api.ctp.vnctpmd",
@ -56,8 +74,8 @@ vnctpmd = Extension(
libraries=["thostmduserapi_se", "thosttraderapi_se", ], libraries=["thostmduserapi_se", "thosttraderapi_se", ],
extra_compile_args=compiler_flags, extra_compile_args=compiler_flags,
extra_link_args=extra_link_args, extra_link_args=extra_link_args,
runtime_library_dirs=runtime_library_dirs,
depends=[], depends=[],
runtime_library_dirs=["$ORIGIN"],
language="cpp", language="cpp",
) )
vnctptd = Extension( vnctptd = Extension(
@ -73,17 +91,15 @@ vnctptd = Extension(
libraries=["thostmduserapi_se", "thosttraderapi_se", ], libraries=["thostmduserapi_se", "thosttraderapi_se", ],
extra_compile_args=compiler_flags, extra_compile_args=compiler_flags,
extra_link_args=extra_link_args, extra_link_args=extra_link_args,
runtime_library_dirs=["$ORIGIN"], runtime_library_dirs=runtime_library_dirs,
depends=[], depends=[],
language="cpp", language="cpp",
) )
vnoes = Extension( vnoes = Extension(
"vnpy.api.oes.vnoes", name="vnpy.api.oes.vnoes",
[ sources=gather_autocxxpy_generated_files(
"vnpy/api/oes/vnoes/generated_files/classes_1.cpp", "vnpy/api/oes/vnoes/generated_files/",
"vnpy/api/oes/vnoes/generated_files/classes_2.cpp", ),
"vnpy/api/oes/vnoes/generated_files/module.cpp",
],
include_dirs=["vnpy/api/oes/include", include_dirs=["vnpy/api/oes/include",
"vnpy/api/oes/vnoes", ], "vnpy/api/oes/vnoes", ],
define_macros=[("BRIGAND_NO_BOOST_SUPPORT", "1")], define_macros=[("BRIGAND_NO_BOOST_SUPPORT", "1")],
@ -92,14 +108,14 @@ vnoes = Extension(
libraries=["oes_api"], libraries=["oes_api"],
extra_compile_args=compiler_flags, extra_compile_args=compiler_flags,
extra_link_args=extra_link_args, extra_link_args=extra_link_args,
runtime_library_dirs=["$ORIGIN"], runtime_library_dirs=runtime_library_dirs,
depends=[], depends=[],
language="cpp", language="cpp",
) )
if platform.system() == "Windows": if platform.system() == "Windows":
# use pre-built pyd for windows ( support python 3.7 only ) # use pre-built pyd for windows ( support python 3.7 only )
ext_modules = [] ext_modules = [vnoes]
elif platform.system() == "Darwin": elif platform.system() == "Darwin":
ext_modules = [] ext_modules = []
else: else: