From 61308d5712fcd2063d2ae4539bfc14c64718e53c Mon Sep 17 00:00:00 2001 From: Stefan Date: Tue, 7 Jun 2022 12:58:06 +0200 Subject: [PATCH] chore(CPP/CI): setup CI for cmake build Linux docker build Extra: add build configuration fixes for rest of the platforms fixes: 5998 --- app/README.md | 33 ++++++++------ ci/Jenkinsfile.linux-cpp | 70 +++++++++++++++++++++++++++++ cmake/platform_specific.cmake | 2 + cmake/platform_specific/linux.cmake | 3 ++ 4 files changed, 94 insertions(+), 14 deletions(-) create mode 100644 ci/Jenkinsfile.linux-cpp create mode 100644 cmake/platform_specific/linux.cmake diff --git a/app/README.md b/app/README.md index 4b3a0ff353f..474670ceacf 100644 --- a/app/README.md +++ b/app/README.md @@ -23,30 +23,29 @@ conan profile update settings.compiler.libcxx=libstdc++11 default ### 2. Install dependencies -```bash -conan install . --profile= -s build_type=Release --build=missing -if=build/conan -``` - Platform specific conan profile - Macos: - - Intel: `vendor/conan-configs/apple-arm64.ini` - - Apple silicon: `vendor/conan-configs/apple-x86_64.ini` + - Intel: `conan install . --profile=vendor/conan-configs/apple-arm64.ini -s build_type=Release --build=missing -if=build/conan` + - Apple silicon: `conan install . --profile=vendor/conan-configs/apple-x86_64.ini -s build_type=Release --build=missing -if=build/conan` - Windows: TODO -- Linux: TODO +- Linux: `conan install . -s build_type=Release --build=missing -if=build/conan` -## Buid, test & run -Platform specific Qt prefix path +## Buid, test & run -- Macos: `$HOME/Qt/6.3.0/macos` -- Windows: TODO -- Linux: TODO +Update `CMake` to the [Latest Release](https://cmake.org/download/) ### Build with conan ```bash -CMAKE_PREFIX_PATH= conan build . -if=build/conan -bf=build +# linux +CMAKE_PREFIX_PATH="$HOME/Qt/6.4.0/gcc_64" conan build . -if=build/conan -bf=build + +# MacOS: CMAKE_PREFIX_PATH="$HOME/Qt/6.4.0/macos" conan build . -if=build/conan -bf=build + +# Windows: CMAKE_PREFIX_PATH="$HOME/Qt/6.4.0/mingw_64" conan build . -if=build/conan -bf=build + ctest -VV -C Release ./status-desktop ``` @@ -54,6 +53,12 @@ ctest -VV -C Release ### Build with cmake ```bash -cmake -B build -S . -DCMAKE_PREFIX_PATH= -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake +# linux +cmake -B build -S . -DCMAKE_PREFIX_PATH="$HOME/Qt/6.4.0/gcc_64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake + +# MacOS: cmake -B build -S . -DCMAKE_PREFIX_PATH="$HOME/Qt/6.4.0/macos" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake + +# Windows: cmake -B build -S . -DCMAKE_PREFIX_PATH="$HOME/Qt/6.4.0/mingw_64" -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=build/conan/conan_toolchain.cmake + cmake --build build --config Release ``` diff --git a/ci/Jenkinsfile.linux-cpp b/ci/Jenkinsfile.linux-cpp new file mode 100644 index 00000000000..e5726ed61bb --- /dev/null +++ b/ci/Jenkinsfile.linux-cpp @@ -0,0 +1,70 @@ +library 'status-jenkins-lib@v1.3.4' + +pipeline { + agent { + docker { + label 'linux' + image 'stateoftheartio/qt6:6.3-gcc-aqt' + /* allows jenkins use cat and mounts '/dev/fuse' for linuxdeployqt */ + args '-v ${PWD}:/home/user/project:ro -v ${PWD}/build:/home/user/build:rw --entrypoint="" --cap-add SYS_ADMIN --security-opt apparmor:unconfined --device /dev/fuse sh -c "sudo apt update; sudo apt install -y libgl-dev libvulkan-dev"' + } + } + + parameters { + booleanParam( + name: 'RELEASE', + description: 'Decides whether binaries are built with debug symbols.', + defaultValue: params.RELEASE ?: false + ) + } + + options { + timestamps() + /* Prevent Jenkins jobs from running forever */ + timeout(time: 20, unit: 'MINUTES') + /* manage how many builds we keep */ + buildDiscarder(logRotator( + numToKeepStr: '10', + daysToKeepStr: '30', + artifactNumToKeepStr: '3', + )) + } + + environment { + TARGET = 'linux' + } + + stages { + stage('Cmake Build') { + steps { sh 'qt-cmake /home/user/project -G Ninja -B /home/user/build; cmake --build /home/user/build; linuxdeploy --plugin qt -e "$(find /home/user/build -maxdepth 1 -type f -executable)" --appdir /home/user/build/deploy' } + } + + // stage('Package') { + // steps { script { + // linux.bundle('tgz-linux') + // } } + // } + + // stage('Parallel Upload') { + // parallel { + // stage('Upload') { + // steps { script { + // env.PKG_URL = s3.uploadArtifact(env.STATUS_CLIENT_TARBALL) + // jenkins.setBuildDesc(AppImage: env.PKG_URL) + // } } + // } + // stage('Archive') { + // steps { script { + // archiveArtifacts("${env.STATUS_CLIENT_TARBALL}*") + // } } + // } + // } + // } + } + + post { + success { script { github.notifyPR(true) } } + failure { script { github.notifyPR(false) } } + always { cleanWs() } + } +} diff --git a/cmake/platform_specific.cmake b/cmake/platform_specific.cmake index b4dd4e3ee4e..637c29e0e75 100644 --- a/cmake/platform_specific.cmake +++ b/cmake/platform_specific.cmake @@ -2,4 +2,6 @@ if(WIN32) include(${CMAKE_CURRENT_LIST_DIR}/platform_specific/windows.cmake) elseif(APPLE) include(${CMAKE_CURRENT_LIST_DIR}/platform_specific/macos.cmake) +else() + include(${CMAKE_CURRENT_LIST_DIR}/platform_specific/linux.cmake) endif() \ No newline at end of file diff --git a/cmake/platform_specific/linux.cmake b/cmake/platform_specific/linux.cmake new file mode 100644 index 00000000000..12752a6425b --- /dev/null +++ b/cmake/platform_specific/linux.cmake @@ -0,0 +1,3 @@ +function(configure_app_os_specific TARGET_ARG URL_ORGANIZATION_NAME DOMAIN_ARG VERSION_MAJOR VERSION_MINOR VERSION_PATCH) + # Noting here for now; helps simplifying main setup by removing platform if/else conditions +endfunction() \ No newline at end of file