Review fixes.

This commit is contained in:
Yuri Gorshenin 2016-09-02 14:40:01 +03:00
parent ad9015965a
commit f3d2e6a5d4
4 changed files with 65 additions and 6 deletions

View file

@ -0,0 +1,37 @@
This document describes how to use this module.
1. How to build?
To build the module you need Python2.7 and Boost Python. Also, you
need Qt5.5 (or higher), but you need it in any case, if you're
planning to build the project. On MacOS, Python2.7 should be
installed by default, to get Boost via Brew just type in the shell:
brew update
brew install boost --with-python
brew install boost-python
On Debian, type in the shell:
sudo apt-get install libboost-*
Note that on MacOS Boost is built by default with libc++, on Debian
Boost is built by default with libstdc++. Therefore, you can use
only macx-clang and linux-clang specs correspondingly. It's wrong
to use linux-clang-libc++ because it's generally a bad idea to have
two implementations of the C++ standard library in the same
application.
Then, invoke qmake from the shell, for example:
qmake CONFIG+=search_engine_pylib path-to-omim.pro
make -k -j8 all
2. How to use?
As search_engine_pylib is a custom Python module, all that you need
is to customize PYTHONPATH environment variable before running your
scripts. For example:
PYTHONPATH=path-to-the-directory-with-search_engine_pylib.so \
./search/search_engine_pylib/run_search_engine.py

View file

@ -78,7 +78,7 @@ struct LatLon
string ToString() const
{
ostringstream os;
os << "lat:" << m_lat << ", lon:" << m_lon;
os << "lat: " << m_lat << ", lon: " << m_lon;
return os.str();
}
@ -168,7 +168,7 @@ struct SearchEngineProxy
{
SearchEngineProxy()
{
CHECK(g_storage.get() != nullptr, ("init() is not called."));
CHECK(g_storage.get() != nullptr, ("init() was not called."));
auto & platform = GetPlatform();
auto infoGetter = storage::CountryInfoReader::CreateCountryInfoReader(platform);
infoGetter->InitAffiliationsInfo(&g_storage->GetAffiliations());
@ -208,6 +208,7 @@ struct SearchEngineProxy
results.append(Result(result));
return results;
}
shared_ptr<search::tests_support::TestSearchEngine> m_engine;
};
} // namespace

View file

@ -8,8 +8,8 @@ import search_engine_pylib as search
DIR = os.path.dirname(__file__)
RESOURCE_PATH = os.path.realpath(os.path.join(DIR, '..', 'data'))
MWM_PATH = os.path.realpath(os.path.join(DIR, '..', 'data'))
RESOURCE_PATH = os.path.realpath(os.path.join(DIR, '..', '..', 'data'))
MWM_PATH = os.path.realpath(os.path.join(DIR, '..', '..', 'data'))
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('-r', metavar='RESOURCE_PATH', default=RESOURCE_PATH, help='Path to resources directory.')

View file

@ -18,11 +18,32 @@ INCLUDEPATH -= $$ROOT_DIR/3party/boost
# We do not support search_engine_pylib for other combinations of
# OS and c++ standard library.
macx-clang {
INCLUDEPATH += /System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7
LIBS += -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib -lpython2.7
QMAKE_LFLAGS_PLUGIN += -bundle
LIBRARY_PYTHON=/Library/Frameworks/Python.framework/Versions/2.7
SYSTEM_LIBRARY_PYTHON=/System/Library/Frameworks/Python.framework/Versions/2.7
exists($$LIBRARY_PYTHON) {
INCLUDEPATH += $$LIBRARY_PYTHON/include/python2.7
LIBS += -L$$LIBRARY_PYTHON/lib -lpython2.7
} else:exists($$SYSTEM_LIBRARY_PYTHON) {
INCLUDEPATH += $$SYSTEM_LIBRARY_PYTHON/include/python2.7
LIBS += -L$$SYSTEM_LIBRARY_PYTHON/lib -lpython2.7
} else {
error("Can't find Python2.7")
}
LIBS *= "-framework IOKit"
LIBS *= "-framework SystemConfiguration"
LIBS *= -L/usr/local/opt/qt5/lib
LIBS *= "-framework QtCore"
LIBS *= "-framework QtNetwork"
INCLUDEPATH += /usr/local/include
LIBS += -L/usr/local/lib -lboost_python
INCLUDEPATH += /usr/local/opt/qt5/include
} else:linux-clang {
INCLUDEPATH += /usr/include
LIBS += -L/usr/lib/x86_64-linux-gnu/ -lboost_python