From a45d859125482724db5fcdc7d0e9ad29ce098c9e Mon Sep 17 00:00:00 2001 From: "A. Janz" <arkadiusz.janz@pwr.edu.pl> Date: Tue, 14 Apr 2020 22:15:03 +0200 Subject: [PATCH] Gitlab CI configuration, changed project name, added cpack support for building deb packages --- .gitlab-ci.yml | 0 Dockerfile | 32 ++++++++++++++++++++++++++++++++ src/CMakeLists.txt | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 .gitlab-ci.yml create mode 100644 Dockerfile diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..e69de29 diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..6c751a1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,32 @@ +FROM clarinpl/python:3.6 + +ARG APT_USERNAME +ARG APT_PASSWORD +RUN test -n "$APT_USERNAME" +RUN test -n "$APT_PASSWORD" + +RUN apt-get update && apt-get install -y transport-https + +RUN bash -c "wget -q -O - http://apt.clarin-pl.eu/KEY.gpg | apt-key add -" +RUN bash -c "echo 'deb https://apt.clarin-pl.eu/ /' > /etc/apt/sources.list.d/clarin.list" + +# Install corpus2 +RUN apt-get update && apt-get install -y \ + corpus2-python3.6 + +RUN mkdir -p /home/install +WORKDIR /home/install +COPY ./src ./wccl + +RUN mkdir wccl/build && \ + cd wccl/build && \ + cmake .. && \ + cmake --build . && \ + cpack + +RUN apt-get install -y curl + +WORKDIR /home/install/wccl/build +COPY ./uploaddeb.sh + +RUN bash uploaddeb.sh $APT_USERNAME $APT_PASSWORD https://apt.clarin-pl.eu diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 25419d1..62f2687 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,12 +1,14 @@ -PROJECT(WCCL) +PROJECT(wccl) cmake_minimum_required(VERSION 2.8.0) set(wccl_ver_major "0") set(wccl_ver_minor "3") -set(wccl_ver_patch "2") +set(wccl_ver_patch "3") set(LIBWCCL_VERSION "${wccl_ver_major}.${wccl_ver_minor}.${wccl_ver_patch}") +set(CMAKE_INSTALL_PREFIX /usr) + # use some of our own Find* scripts set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMakeScripts) @@ -86,6 +88,33 @@ else() message(STATUS "Not building SWIG Python wrappers") endif(WCCL_BUILD_SWIG) + +# Sets a default install location for packages installed from deb - we use +# the same location as it's used when we build projects directly from source +set(CPACK_PACKAGING_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}") + +# Detect python version descriptor +if(WCCL_BUILD_SWIG) + find_package(PythonLibs) + find_package(PythonInterp) + set(PYTHON_VERSION "python${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR}") +endif(WCCL_BUILD_SWIG) + +# Requires to install dependencies +set(CPACK_DEBIAN_PACKAGE_DEPENDS "") + +# Set *.deb package name and version +if(PYTHON_VERSION) + SET(CPACK_PACKAGE_NAME "${PROJECT_NAME}-${PYTHON_VERSION}") + SET(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${LIBWCCL_VERSION}-all") +else() + SET(CPACK_PACKAGE_NAME "${PROJECT_NAME}") + SET(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${LIBWCCL_VERSION}-all") +endif(PYTHON_VERSION) + +SET(CPACK_PACKAGE_VERSION "${LIBWCCL_VERSION}") + +# Include CPack SET(CPACK_GENERATOR "DEB") -SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "arkadiusz.janz@pwr.edu.pl") +SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "g419") INCLUDE(CPack) -- GitLab