Skip to content

Commit 99e43d1

Browse files
committed
Add c++11 build python binding package
1 parent c6d9d04 commit 99e43d1

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

paddle/api/paddle_ld_flags.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,9 +141,12 @@ def cmake_bool(cmake_str):
141141

142142
def c_flag(self):
143143
if self.with_coverage:
144-
return ["-fprofile-arcs", "-ftest-coverage", "-O0", "-g"]
144+
return [
145+
"-fprofile-arcs", "-ftest-coverage", "-O0", "-g",
146+
"-std=c++11"
147+
]
145148
else:
146-
return None
149+
return ["-std=c++11"]
147150
except ImportError:
148151

149152
class PaddleLDFlag(object):

paddle/setup.py.in

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ is_lin = (system == 'linux')
3030
# The extra links will passed from COMAKE
3131
# because generate paddle LDFLAGS is too complicated to do in setup.py
3232
# it just read COMAKE generated LDFLAGS.
33+
extra_comps = []
3334
extra_links = []
3435
obj = api.paddle_ld_flags.PaddleLDFlag()
36+
extra_comps = obj.c_flag()
3537
ldflags = obj.ldflag_str()
3638
if ldflags is not None:
3739
extra_links.extend(ldflags.split(" "))
@@ -51,20 +53,15 @@ elif is_osx == True:
5153

5254
include_dirs = [np.get_include(), "../"] # include numpy and paddle.
5355

54-
extra_c = obj.c_flag()
55-
56-
attr=dict()
57-
if extra_c is not None:
58-
attr["extra_compile_args"] = extra_c
59-
6056
setup(name="py_paddle",
6157
version="@PADDLE_VERSION@",
6258
ext_modules=[
6359
Extension('py_paddle._swig_paddle', # Build SWIG Extension.
6460
['Paddle_wrap.cxx'],
61+
language = "c++",
6562
include_dirs = include_dirs,
6663
extra_link_args = extra_links,
67-
**attr
64+
extra_compile_args = extra_comps
6865
)
6966
],
7067
packages=['py_paddle'],

0 commit comments

Comments
 (0)