提交 57bc6238 编写于 作者: Y Yu Yang 提交者: gangliao

enable swig unittest in travis-ci (#394)

* Init

* Add numpy deps

* Refine
上级 f06f4dfb
......@@ -38,6 +38,7 @@ addons:
- curl
- lcov
- graphviz
- swig
before_install:
- |
if [ ${JOB} == "BUILD_AND_TEST" ]; then
......@@ -51,7 +52,7 @@ before_install:
fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo paddle/scripts/travis/before_install.linux.sh; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then paddle/scripts/travis/before_install.osx.sh; fi
- pip install wheel protobuf sphinx breathe recommonmark
- pip install wheel protobuf sphinx breathe recommonmark virtualenv numpy
script:
- paddle/scripts/travis/main.sh
notifications:
......
......@@ -16,3 +16,4 @@ GFLAGS_LOCATION="@GFLAGS_LOCATION@"
CBLAS_LIBRARIES="@CBLAS_LIBS@"
CUDA_LIBRARIES="@CUDA_LIBRARIES@"
WITH_COVERALLS="@ON_COVERALLS@"
......@@ -48,6 +48,7 @@ try:
self.glog_libs = LIBGLOG_LIBRARY
self.with_gflags = PaddleLDFlag.cmake_bool(WITH_GFLAGS)
self.with_coverage = PaddleLDFlag.cmake_bool(WITH_COVERALLS)
self.gflags_libs = GFLAGS_LIBRARIES
self.gflags_location = GFLAGS_LOCATION
self.cblas_libs = CBLAS_LIBRARIES
......@@ -97,6 +98,8 @@ try:
libs.append(self.normalize_flag(self.gflags_libs))
if self.with_gpu:
libs.append(self.normalize_flag(self.curt))
if self.with_coverage:
libs.append("-fprofile-arcs")
return " ".join(filter(lambda l: len(l) != 0, libs))
def normalize_flag(self, cmake_flag):
......@@ -133,8 +136,14 @@ try:
return False
else:
return True
def c_flag(self):
if self.with_coverage:
return ["-fprofile-arcs", "-ftest-coverage", "-O0", "-g"]
else:
return None
except ImportError:
class PaddleLDFlag(object):
def ldflag_str(self):
pass
def c_flag(self):
pass
......@@ -3,6 +3,8 @@ source ./common.sh
CMAKE_EXTRA=""
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
CMAKE_EXTRA="-DPYTHON_LIBRARY=/usr/local/Cellar/python/2.7.12_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib"
else
CMAKE_EXTRA="-DWITH_SWIG_PY=ON"
fi
......
......@@ -31,8 +31,8 @@ is_lin = (system == 'linux')
# because generate paddle LDFLAGS is too complicated to do in setup.py
# it just read COMAKE generated LDFLAGS.
extra_links = []
ldflags = api.paddle_ld_flags.PaddleLDFlag()
ldflags = ldflags.ldflag_str()
obj = api.paddle_ld_flags.PaddleLDFlag()
ldflags = obj.ldflag_str()
if ldflags is not None:
extra_links.extend(ldflags.split(" "))
......@@ -51,13 +51,20 @@ elif is_osx == True:
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",
version="@PADDLE_VERSION@",
ext_modules=[
Extension('py_paddle._swig_paddle', # Build SWIG Extension.
['Paddle_wrap.cxx'],
include_dirs = include_dirs,
extra_link_args = extra_links
extra_link_args = extra_links,
**attr
)
],
packages=['py_paddle'],
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册