提交 99e43d1d 编写于 作者: L liaogang

Add c++11 build python binding package

上级 c6d9d040
...@@ -141,9 +141,12 @@ try: ...@@ -141,9 +141,12 @@ try:
def c_flag(self): def c_flag(self):
if self.with_coverage: if self.with_coverage:
return ["-fprofile-arcs", "-ftest-coverage", "-O0", "-g"] return [
"-fprofile-arcs", "-ftest-coverage", "-O0", "-g",
"-std=c++11"
]
else: else:
return None return ["-std=c++11"]
except ImportError: except ImportError:
class PaddleLDFlag(object): class PaddleLDFlag(object):
......
...@@ -30,8 +30,10 @@ is_lin = (system == 'linux') ...@@ -30,8 +30,10 @@ is_lin = (system == 'linux')
# The extra links will passed from COMAKE # The extra links will passed from COMAKE
# because generate paddle LDFLAGS is too complicated to do in setup.py # because generate paddle LDFLAGS is too complicated to do in setup.py
# it just read COMAKE generated LDFLAGS. # it just read COMAKE generated LDFLAGS.
extra_comps = []
extra_links = [] extra_links = []
obj = api.paddle_ld_flags.PaddleLDFlag() obj = api.paddle_ld_flags.PaddleLDFlag()
extra_comps = obj.c_flag()
ldflags = obj.ldflag_str() ldflags = obj.ldflag_str()
if ldflags is not None: if ldflags is not None:
extra_links.extend(ldflags.split(" ")) extra_links.extend(ldflags.split(" "))
...@@ -51,20 +53,15 @@ elif is_osx == True: ...@@ -51,20 +53,15 @@ elif is_osx == True:
include_dirs = [np.get_include(), "../"] # include numpy and paddle. include_dirs = [np.get_include(), "../"] # include numpy and paddle.
extra_c = obj.c_flag()
attr=dict()
if extra_c is not None:
attr["extra_compile_args"] = extra_c
setup(name="py_paddle", setup(name="py_paddle",
version="@PADDLE_VERSION@", version="@PADDLE_VERSION@",
ext_modules=[ ext_modules=[
Extension('py_paddle._swig_paddle', # Build SWIG Extension. Extension('py_paddle._swig_paddle', # Build SWIG Extension.
['Paddle_wrap.cxx'], ['Paddle_wrap.cxx'],
language = "c++",
include_dirs = include_dirs, include_dirs = include_dirs,
extra_link_args = extra_links, extra_link_args = extra_links,
**attr extra_compile_args = extra_comps
) )
], ],
packages=['py_paddle'], packages=['py_paddle'],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册