Commit ff1f0719 authored by Dónal Murray's avatar Dónal Murray

Merge branch 'fix-gitlab-ci' into 'master'

Fix hev-display build

See merge request !5
parents 9cdd43f8 8b7966f5
Pipeline #1476 canceled with stage
stages:
- build
- release
build:raspi4-qmake:
stage: build
image: etalian/qt-raspi4
script:
- /raspi/qt5/bin/qmake
- make
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}~git${CI_COMMIT_SHORT_SHA}"
paths:
- hev-display
build:raspi4-cmake:
stage: release
image: etalian/qt-raspi4
before_script:
- mkdir -p "${CI_PROJECT_DIR}/binaries"
script:
- mkdir /tmp/${CI_PROJECT_NAME} && cd "$_"
- cmake --config Release
-DCMAKE_TOOLCHAIN_FILE=/raspi/gcc-linaro-arm-linux-gnueabihf-raspbian-x64.cmake
-DCPACK_PACKAGE_SUFFIX=-pi4 -DCPACK_SYSTEM_NAME=raspbian10 -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armhf
"${CI_PROJECT_DIR}/hev-display"
- make
- cpack -G DEB && cp -v *.deb "${CI_PROJECT_DIR}/binaries"
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}~git${CI_COMMIT_SHORT_SHA}"
paths:
- binaries/
build:raspi1-qmake:
stage: build
image: etalian/qt-raspi1
script:
- cd "${CI_PROJECT_DIR}/hev-display"
- /raspi/qt5/bin/qmake
- make
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}~git${CI_COMMIT_SHORT_SHA}"
paths:
- hev-display
build:raspi1-cmake:
stage: release
image: etalian/qt-raspi1
before_script:
- mkdir -p "${CI_PROJECT_DIR}/binaries"
script:
- mkdir /tmp/${CI_PROJECT_NAME} && cd "$_"
- cmake --config Release
-DCMAKE_TOOLCHAIN_FILE=/raspi/gcc-linaro-arm-linux-gnueabihf-raspbian-x64.cmake
-DCPACK_PACKAGE_SUFFIX=-pi1 -DCPACK_SYSTEM_NAME=raspbian10 -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armhf
-DCPACK_PACKAGE_SUFFIX=-pi4 -DCPACK_SYSTEM_NAME=raspbian10 -DCPACK_DEBIAN_PACKAGE_ARCHITECTURE=armhf
"${CI_PROJECT_DIR}/hev-display"
- make
- cpack -G DEB && cp -v *.deb "${CI_PROJECT_DIR}/binaries"
artifacts:
name: "${CI_JOB_NAME}-${CI_COMMIT_REF_SLUG}~git${CI_COMMIT_SHORT_SHA}"
paths:
- hev-display
- binaries/
cmake_minimum_required (VERSION 3.1.0)
project (hev-display)
configure_file (
${PROJECT_SOURCE_DIR}/extras/cmake/cmake_uninstall.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake @ONLY)
add_custom_target (uninstall
COMMAND ${CMAKE_COMMAND} -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
# Configure packaging
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "HEV native display")
set (CPACK_PACKAGE_VENDOR "CERN, Riga Technical University and University of Liverpool")
set (CPACK_PACKAGE_CONTACT "The High Energy Ventilator Project <https://hev.web.cern.ch/>")
set (CPACK_STRIP_FILES "hev-display")
set (CPACK_PACKAGE_EXECUTABLES "hev-display")
# Calculate version identifiers from git tags
include (${PROJECT_SOURCE_DIR}/extras/cmake/CPackGit.cmake)
add_definitions (-DVERSION="${CPACK_PACKAGE_VERSION}")
# Configure Qt
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
set (CMAKE_AUTOUIC ON)
if (CMAKE_VERSION VERSION_LESS "3.7.0")
set (CMAKE_INCLUDE_CURRENT_DIR ON)
endif ()
find_package (Qt5 5.12 COMPONENTS Core Quick QuickControls2 Svg Charts Network Concurrent LinguistTools REQUIRED)
set (SOURCES sources/main.cpp sources/datasource.cpp sources/localization.cpp)
set (RESOURCES assets/resources.qrc languages/translations.qrc)
set (TS_FILES
languages/translation-qml_en.ts
languages/translation-qml_es.ts
languages/translation-qml_fr.ts
languages/translation-qml_de.ts
languages/translation-qml_lv.ts
languages/translation-qml_it.ts
languages/translation-qml_sk.ts
)
set_source_files_properties (${TS_FILES} PROPERTIES OUTPUT_LOCATION ${CMAKE_SOURCE_DIR}/languages)
qt5_add_translation (QM_FILES ${TS_FILES})
# Main executable
add_executable (hev-display
${SOURCES}
${RESOURCES}
${QM_FILES}
)
target_link_libraries (hev-display Qt5::Core Qt5::Quick Qt5::QuickControls2 Qt5::Svg Qt5::Charts Qt5::Network Qt5::Concurrent)
install (TARGETS hev-display RUNTIME DESTINATION bin)
# Raspbian-specific packaging
if (CPACK_SYSTEM_NAME MATCHES "raspbian.*")
# QT5_BASEDIR must match the path Qt was compiled to use, RPATH adjustments do not help as
# Qt will still look for plugins and qml modules in the location configured initially
set (QT5_BASEDIR "/usr/local/qt5pi")
get_target_property (qt5_core_location Qt5::Core LOCATION)
get_filename_component (qt5_lib_dir ${qt5_core_location} DIRECTORY)
file (GLOB qt5_sos "${qt5_lib_dir}/lib*.so*")
foreach (qt5_so ${qt5_sos})
install (FILES "${qt5_so}" DESTINATION "${QT5_BASEDIR}/lib")
endforeach ()
install (DIRECTORY "${qt5_lib_dir}/../plugins" DESTINATION "${QT5_BASEDIR}/")
install (DIRECTORY "${qt5_lib_dir}/../qml" DESTINATION "${QT5_BASEDIR}/")
# Not all libraries autodetect the host rpath, RPATH still required for libQt5Core and a few others
set_target_properties (hev-display PROPERTIES INSTALL_RPATH "${QT5_BASEDIR}/lib:/opt/vc/lib:")
endif ()
set (CPACK_PROJECT_CONFIG_FILE "${PROJECT_SOURCE_DIR}/extras/cmake/CPackConfig.cmake")
# CPackConfig.cmake is stored in the source dir so that upstream tarballs automatically have a copy of it
# (it contains variables computed from git tags, and git history is not available in an upstream tarball)
if (NOT EXISTS "${CPACK_PROJECT_CONFIG_FILE}")
find_package (Git REQUIRED)
execute_process (
COMMAND ${GIT_EXECUTABLE} --git-dir "${PROJECT_SOURCE_DIR}/.git" describe --always
OUTPUT_VARIABLE GIT_HASH)
execute_process (
COMMAND ${GIT_EXECUTABLE} --git-dir "${PROJECT_SOURCE_DIR}/.git" rev-list --count ${GIT_HASH}
OUTPUT_VARIABLE COMMIT_COUNT)
execute_process (
COMMAND ${GIT_EXECUTABLE} --git-dir "${PROJECT_SOURCE_DIR}/.git" tag
OUTPUT_VARIABLE LATEST_TAG)
set (GIT_DESCRIBE "v0.0.0-284-g${GIT_HASH}")
message ("Git describe: ${GIT_DESCRIBE}")
string (REGEX MATCH "v([0-9]+).([0-9]+).([0-9]+)-([0-9]+)-g([0-9a-f]+)" match ${GIT_DESCRIBE})
if (NOT match)
string (REGEX MATCH "v([0-9]+).([0-9]+).([0-9]+)" match ${GIT_DESCRIBE})
endif ()
if (NOT match)
message (WARNING "Version '${GIT_DESCRIBE}' from git cannot be recognized as a valid version string")
endif ()
set (CMAKE_PROJECT_VERSION_MAJOR ${CMAKE_MATCH_1})
set (CMAKE_PROJECT_VERSION_MINOR ${CMAKE_MATCH_2})
set (CMAKE_PROJECT_VERSION_PATCH ${CMAKE_MATCH_3})
set (CMAKE_PROJECT_VERSION_TWEAK ${CMAKE_MATCH_4})
set (GIT_SHA_SHORT ${CMAKE_MATCH_5})
configure_file ("${CPACK_PROJECT_CONFIG_FILE}.in" "${CPACK_PROJECT_CONFIG_FILE}" @ONLY)
endif ()
include (${CPACK_PROJECT_CONFIG_FILE})
# include CPack module once all variables are set
include (CPack)
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