There will be a small downtime on Friday 16.04 between 15:00 and 18:00 (Gitlab upgrade).

If necessary contact me at mateusz.gniewkowski@pwr.edu.pl

Commit 30fd750f authored by Tomasz Walkowiak's avatar Tomasz Walkowiak

Merge branch '1-fix-wraplem-installation' into 'master'

Dockerfile adjusted

Closes #1

See merge request !1
parents 8ab61d8d 64753a5e
cmake_minimum_required(VERSION 2.8)
project(polem)
if(UNIX)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=gnu++0x")
endif()
set(BUILD_SHARED_LIBS 1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/Modules")
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_INCLUDEDIR "include")
include(LibFindMacros)
find_package(JNI REQUIRED)
find_package(Java REQUIRED)
include(UseJava)
find_package(Boost COMPONENTS program_options REQUIRED)
include_directories(${Boost_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Boost_LIBRARIES})
find_package(Corpus2 REQUIRED)
include_directories(${Corpus2_INCLUDE_DIRS})
set(LIBS ${LIBS} ${Corpus2_LIBRARY})
find_package(ICU REQUIRED)
include_directories(${ICU_INCLUDE_DIRS})
set(LIBS ${LIBS} ${ICU_LIBRARIES})
set(LIBS ${LIBS} ${ICU_I18N_LIBRARIES})
find_library(WCCL_LIBRARY wccl /usr/lib/ /usr/local/lib/)
find_path(WCCL_INCLUDE_DIR libwccl /usr/lib/ /usr/local/lib)
if(WCCL_LIBRARY AND WCCL_INCLUDE_DIR)
message("-- Found WCCL libraries: " ${WCCL_LIBRARY})
include_directories(${WCCL_INCLUDE_DIR})
set(LIBS ${LIBS} ${WCCL_LIBRARY})
endif(WCCL_LIBRARY AND WCCL_INCLUDE_DIR)
find_package(Morfeusz2 REQUIRED)
include_directories(${MORFEUSZ2_INCLUDE_DIR})
set(LIBS ${LIBS} ${MORFEUSZ2_LIBRARY})
find_package(PwrUtils REQUIRED)
include_directories(${PwrUtils_INCLUDE_DIRS})
set(LIBS ${LIBS} ${PwrUtils_LIBRARIES})
set(LIBS ${LIBS} ${PwrUtils_LIBRARY})
set(SOURCE_FILES polem/main.cpp ${CMAKE_CURRENT_SOURCE_DIR}/pugixml-1.8/src/pugixml.cpp
polem/CascadeLemmatizer.cpp polem/RuleLemmatizer.cpp
polem/DictionaryLemmatizer.cpp polem/Inflection.cpp
polem/NamLivPersonLemmatizer.cpp polem/NamLocLemmatizer.cpp
polem/OrthLemmatizer.cpp polem/CascadeLemmatizer.h
polem/RuleLemmatizer.h polem/DictionaryLemmatizer.h
polem/Inflection.h polem/NamLivPersonLemmatizer.h
polem/NamLocLemmatizer.h polem/OrthLemmatizer.h
polem/InflectionRule.h polem/InflectionRule.cpp)
set(LIBRARY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pugixml-1.8/src/pugixml.cpp ${CMAKE_CURRENT_SOURCE_DIR}/polem/CascadeLemmatizer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/polem/RuleLemmatizer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/polem/DictionaryLemmatizer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/polem/Inflection.cpp ${CMAKE_CURRENT_SOURCE_DIR}/polem/NamLivPersonLemmatizer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/polem/NamLocLemmatizer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/polem/OrthLemmatizer.cpp
${CMAKE_CURRENT_SOURCE_DIR}/polem/CascadeLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/RuleLemmatizer.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/DictionaryLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/Inflection.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/NamLivPersonLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/NamLocLemmatizer.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/OrthLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/InflectionRule.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/InflectionRule.cpp)
set(PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/polem/CascadeLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/DictionaryLemmatizer.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/NamLivPersonLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/NamLocLemmatizer.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/RuleLemmatizer.h ${CMAKE_CURRENT_SOURCE_DIR}/polem/OrthLemmatizer.h
${CMAKE_CURRENT_SOURCE_DIR}/polem/Inflection.h)
set(WRAPPER_FILES ${CMAKE_CURRENT_SOURCE_DIR}/javawrap/WrapLem_wrap.cxx)
#set(WRAPPER_HEADERS "")
set(PY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/pythonwrap/WrapLem_wrap.cxx)
set(PY_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/pythonwrap/WrapLem.py)
file(GLOB DEPLOY_FILES_AND_DIRS "${PROJECT_SOURCE_DIR}/dict/*")
foreach(ITEM ${DEPLOY_FILES_AND_DIRS})
LIST( APPEND FILES_TO_DEPLOY "${ITEM}" )
endforeach()
INSTALL( FILES ${FILES_TO_DEPLOY} DESTINATION share/polem )
add_executable( polem ${SOURCE_FILES} ${LIBS})
target_link_libraries(polem ${LIBS})
install(TARGETS polem RUNTIME DESTINATION "/usr/local/bin/")
#set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
add_library(polem-dev SHARED ${LIBRARY_FILES})
set_target_properties(polem-dev PROPERTIES
PUBLIC_HEADER ${PUBLIC_HEADERS})
target_include_directories(polem-dev PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/polem)
target_include_directories(polem-dev PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
install(TARGETS polem-dev
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polem-dev)
target_link_libraries(polem-dev ${ICU_I18N_LIBRARIES})
target_link_libraries(polem-dev ${ICU_LIBRARIES})
target_link_libraries(polem-dev ${Corpus2_LIBRARY})
target_link_libraries(polem-dev ${LIBS})
install(FILES ${PUBLIC_HEADERS}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/polem-dev)
#####JAVA
FIND_PACKAGE(SWIG REQUIRED)
INCLUDE(${SWIG_USE_FILE})
include(UseSWIG)
include_directories(${JNI_INCLUDE_DIRS})
SET(CMAKE_SWIG_OUTDIR ${CMAKE_CURRENT_BINARY_DIR}/java)
SET(CMAKE_SWIG_FLAGS -package g419.polem)
set_property(SOURCE "WrapLem.i" PROPERTY CPLUSPLUS ON)
swig_add_module(
PolemJava
java
WrapLem.i
${LIBRARY_FILES}
)
TARGET_INCLUDE_DIRECTORIES(PolemJava
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
PRIVATE ${JAVA_INCLUDE_PATH}
PRIVATE ${JAVA_INCLUDE_PATH2}
)
target_link_libraries(PolemJava ${LIBS})
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/classes)
add_custom_command(TARGET PolemJava POST_BUILD
COMMAND ${Java_JAVAC_EXECUTABLE} -d classes java/*.java
COMMAND ${Java_JAR_EXECUTABLE} -cfM PolemJava.jar -C classes .
)
INSTALL(TARGETS PolemJava
DESTINATION ${CMAKE_INSTALL_LIBDIR})
####PYTHON
find_package(PythonInterp REQUIRED)
FIND_PACKAGE(PythonLibs REQUIRED)
INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_SWIG_FLAGS "")
SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_SOURCE_DIR}/WrapLem.i PROPERTIES CPLUSPLUS ON)
SWIG_ADD_MODULE(WrapLem python ${CMAKE_CURRENT_SOURCE_DIR}/WrapLem.i)
SWIG_LINK_LIBRARIES(WrapLem polem-dev ${LIBS} ${PYTHON_LIBRARIES})
#message("${PYTHON_LIBRARIES}")
#execute_process ( COMMAND python3 -c "import site; print(site.getsitepackages()[0])" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process(COMMAND python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" OUTPUT_VARIABLE PYTHON_SITE_PACKAGES OUTPUT_STRIP_TRAILING_WHITESPACE)
install(TARGETS _WrapLem
LIBRARY DESTINATION ${PYTHON_SITE_PACKAGES})
install(FILES ${PY_HEADERS}
DESTINATION ${PYTHON_SITE_PACKAGES})
FROM clarinpl/builder AS builder
WORKDIR /tmp/
RUN git clone https://github.com/gkubon/Polem
COPY ./CMakeLists.txt Polem/CMakeLists.txt
RUN rm -r /install/polem
RUN mkdir -p Polem/build && \
cd Polem/build && \
cmake .. && \
make -j && \
make install DESTDIR="/install/polem" && \
make install
FROM clarinpl/python:3.6
RUN apt-get update && apt-get install -y \
......@@ -23,25 +8,32 @@ RUN apt-get update && apt-get install -y \
libicu-dev \
libffi-dev \
libssl-dev \
libxml2-utils
libxml2-utils \
swig \
openjdk-8-jdk
WORKDIR /tmp/
RUN apt remove -y cmake && \
wget https://github.com/Kitware/CMake/releases/download/v3.16.0-rc2/cmake-3.16.0-rc2-Linux-x86_64.tar.gz && \
tar -xzf cmake*tar.gz && \
ln -s $(pwd)/cmake*/bin/cmake /usr/bin/cmake
COPY --from=builder /install/polem /
COPY --from=builder /install/corpus2 /
COPY --from=builder /install/wccl /
COPY --from=builder /usr/lib/libmorfeusz* /usr/lib
RUN ldconfig
RUN ls -la /install/python/venv2/lib
COPY --from=builder /usr/lib/libmorfeusz* /usr/lib/
RUN wget -O morf 'https://nextcloud.clarin-pl.eu/index.php/s/VVIvx4w20azcWbp/download' && \
dpkg -i ./morf && \
git clone https://github.com/gkubon/Polem && \
mkdir -p Polem/build && \
cd Polem/build && \
cmake .. && \
make -j && \
make install && \
ldconfig && \
cd / && rm -r /tmp/*
WORKDIR /home/worker
COPY requirements.txt .
RUN pip3.6 install -r requirements.txt
RUN pip3.6 install pika==0.12
RUN pip3.6 install virtualenv
WORKDIR /install/python
RUN mkdir wheels
RUN virtualenv -p python3.6 venv2
ENV PATH="/install/python/venv2/bin:$PATH"
RUN ls -la /install/python/venv2/bin
RUN mkdir /home/worker
COPY polem_lemmatizer.py .
RUN python3.6 -m pip install -r requirements.txt
CMD ["python3.6", "polem_lemmatizer.py"]
lex-ws
\ No newline at end of file
lex-ws
pika==0.12
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment