Skip to content

Commit

Permalink
Fix build pymodules on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
syershov authored and Roman Kuznetsov committed Aug 3, 2017
1 parent 0f63abb commit a02c033
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 12 deletions.
15 changes: 9 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -125,19 +125,22 @@ if (PYBINDINGS)
endif()
find_package(PythonLibs ${PYTHON_VERSION} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
set(SKIP_DESKTOP ON)
endif()

if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID AND NOT PYBINDINGS)
if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID)
find_package(Qt5Core)
if (NOT Qt5Core_FOUND)
message(FATAL_ERROR "Qt5 cmake files were not found, please set QT_PATH environment variable")
endif()
find_package(Qt5Network REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5Svg REQUIRED)
if(NOT SKIP_DESKTOP)
find_package(Qt5Gui REQUIRED)
find_package(Qt5OpenGL REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5Xml REQUIRED)
find_package(Qt5Svg REQUIRED)
endif()
endif()

if (PLATFORM_LINUX)
Expand Down
13 changes: 13 additions & 0 deletions generator/mwm_diff/pymwm_diff/bindings.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
#include "generator/mwm_diff/diff.hpp"

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreorder"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif

#include <boost/python.hpp>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#pragma GCC diagnostic pop

using namespace std;

BOOST_PYTHON_MODULE(pymwm_diff)
Expand Down
13 changes: 13 additions & 0 deletions local_ads/pylocal_ads/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,26 @@
// hence the error. See https://bugs.python.org/issue10910
#include <locale>

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wreorder"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#if defined(__clang__)
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-local-typedef"
#endif

#include "pyhelpers/vector_uint8.hpp"
#include "pyhelpers/vector_list_conversion.hpp"

#include <boost/python.hpp>
#include <boost/python/enum.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>

#if defined(__clang__)
#pragma clang diagnostic pop
#endif
#pragma GCC diagnostic pop

using namespace local_ads;

namespace
Expand Down
30 changes: 30 additions & 0 deletions pyhelpers/specs/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
PROJECT=$1
VERSION=$2
RELEASE=$3
if [ -z "$PROJECT" ]; then
echo "Specify project as first parameter"
exit 1
fi
if [ -z "$VERSION" ]; then
echo "Specify version as second parameter"
exit 1
fi
if [ -z "$RELEASE" ]; then
RELEASE=1
fi

basedir=`dirname $0`
PROJECT=$PROJECT VERSION=$VERSION RELEASE=$RELEASE rpmbuild -ba python35-mapsme-modules.spec
if [ $? -ne 0 ]; then
echo "Build failed!"
exit
fi

#rsync -av $HOME/rpmbuild/RPMS/noarch/$PROJECT.maps.me-{meta,front,devel}-$VERSION-$RELEASE.el6.noarch.rpm [email protected]::c6-mapsme-noarch
#rsync -av $HOME/rpmbuild/RPMS/x86_64/$PROJECT.maps.me-$VERSION-$RELEASE.el6.x86_64.rpm [email protected]::c6-mapsme-x64

#echo "c6-mapsme-noarch" | nc pkg.corp.mail.ru 12222 | grep -v '^* c'
#echo "c6-mapsme-x64" | nc pkg.corp.mail.ru 12222 | grep -v '^* c'
#echo
echo "$PROJECT packages version $VERSION-$RELEASE build done, ready to deploy"
14 changes: 8 additions & 6 deletions pyhelpers/specs/python35-mapsme-modules.spec
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
%{!?__jar_repack:/usr/lib/rpm/redhat/brp-java-repack-jars} \
%{nil}

%define unmangled_version 0.1.7
%define version %{unmangled_version}
%define release 1
%define tag py-modules-%{unmangled_version}
%define version %(echo $VERSION)
%define release %(echo $RELEASE)
%define tag py-modules-%{version}

Name: python35-mapsme-modules
Version: %{version}
Expand All @@ -35,7 +34,7 @@ Vendor: Mail.Ru Group

Group: Development/Languages/Python
URL: https://github.com/mapsme/omim
Source: omim-py-modules-%{unmangled_version}.tar.gz
Source: omim-py-modules-%{version}.tar.gz

BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
Expand Down Expand Up @@ -82,18 +81,21 @@ cd ..
%{__mkdir_p} build && cd build
# TODO(mgergio, yershov): Why should we stills specify PYTHON_LIBRARY and
# PYTHON_INCLUDE_DIR manually?
%{__cmake3} -DPYTHON_LIBRARY=/usr/local/python35/lib/libpython3.so -DPYTHON_INCLUDE_DIR=/usr/local/python35/include/python3.5m/ -DPYTHON_VERSION=3.5 -DBOOST_INCLUDEDIR=/usr/local/boost_1.54.0/include/ -DPYBINDINGS=ON ../omim
%{__cmake3} -DPYTHON_LIBRARY=/usr/local/python35/lib/libpython3.so -DPYTHON_INCLUDE_DIR=/usr/local/python35/include/python3.5m/ -DPYTHON_VERSION=3.5 -DBOOST_INCLUDEDIR=/usr/local/boost_1.54.0/include/ -DPYBINDINGS=ON -DSKIP_DESKTOP=ON ../omim
%{__make} %{?_smp_mflags} pylocal_ads
%{__make} %{?_smp_mflags} pymwm_diff

%install
%{__install} -m 755 -D %{_builddir}/%{name}-%{version}/build/pylocal_ads.so %{buildroot}/%{python_sitelib}/pylocal_ads.so
%{__install} -m 755 -D %{_builddir}/%{name}-%{version}/build/pymwm_diff.so %{buildroot}/%{python_sitelib}/pymwm_diff.so

%clean
rm -rf %{buildroot}

%files -n python35-pylocal_ads
%defattr(-,root,root)
%{python_sitelib}/pylocal_ads.so
%{python_sitelib}/pymwm_diff.so

%changelog
* Wed Apr 26 2017 Magidovich Sergey <[email protected]> - 0.1b-1
Expand Down

0 comments on commit a02c033

Please sign in to comment.