From aed3109987eb9d8e0ead2a52625256f8282bfd01 Mon Sep 17 00:00:00 2001 From: Michael Hofmann Date: Sat, 16 Nov 2019 12:46:35 +0100 Subject: [PATCH] Add Ubuntu Azure Pipelines jobs. Add some caching. --- .azure-pipelines/macos_clone_vcpkg.sh | 8 + .azure-pipelines/macos_install_vcpkg_deps.sh | 18 + .../ubuntu-18.04_build_project.sh | 105 +++++ .azure-pipelines/ubuntu-18.04_clone_vcpkg.sh | 8 + .../ubuntu-18.04_install_vcpkg_deps.sh | 18 + azure-pipelines.yml | 413 ++++++++++++++---- benchmark/CMakeLists.txt | 4 +- benchmark/image_convolution.cpp | 6 +- conanfile.txt | 6 +- 9 files changed, 494 insertions(+), 92 deletions(-) create mode 100755 .azure-pipelines/macos_clone_vcpkg.sh create mode 100755 .azure-pipelines/macos_install_vcpkg_deps.sh create mode 100755 .azure-pipelines/ubuntu-18.04_build_project.sh create mode 100755 .azure-pipelines/ubuntu-18.04_clone_vcpkg.sh create mode 100755 .azure-pipelines/ubuntu-18.04_install_vcpkg_deps.sh diff --git a/.azure-pipelines/macos_clone_vcpkg.sh b/.azure-pipelines/macos_clone_vcpkg.sh new file mode 100755 index 0000000..c4e535b --- /dev/null +++ b/.azure-pipelines/macos_clone_vcpkg.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +vcpkg_base_dir=$1 +vcpkg_tag=$2 + +cd ${vcpkg_base_dir} +git clone https://github.com/Microsoft/vcpkg.git +git -C ${vcpkg_base_dir}/vcpkg checkout ${vcpkg_tag} diff --git a/.azure-pipelines/macos_install_vcpkg_deps.sh b/.azure-pipelines/macos_install_vcpkg_deps.sh new file mode 100755 index 0000000..e93c0ce --- /dev/null +++ b/.azure-pipelines/macos_install_vcpkg_deps.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +vcpkg_base_dir=$1 +shift +vcpkg_libraries=$@ + +echo "vcpkg_base_dir=${vcpkg_base_dir}" +echo "vcpkg_libraries=${vcpkg_libraries}" + +export BOOST_MODULAR_CMAKE="${vcpkg_base_dir}/vcpkg/ports/boost-modular-build-helper/CMakeLists.txt" +export LN=$(grep -n "WORKING_DIRECTORY" ${BOOST_MODULAR_CMAKE} | awk -F ":" '{print $1}') +gsed -i "${LN}i\ cxxstd=17" ${BOOST_MODULAR_CMAKE} + +${vcpkg_base_dir}/vcpkg/bootstrap-vcpkg.sh +${vcpkg_base_dir}/vcpkg/vcpkg install ${vcpkg_libraries} +rm -rf ${vcpkg_base_dir}/vcpkg/buildtrees +rm -rf ${vcpkg_base_dir}/vcpkg/downloads +rm -rf ${vcpkg_base_dir}/vcpkg/packages diff --git a/.azure-pipelines/ubuntu-18.04_build_project.sh b/.azure-pipelines/ubuntu-18.04_build_project.sh new file mode 100755 index 0000000..a62faba --- /dev/null +++ b/.azure-pipelines/ubuntu-18.04_build_project.sh @@ -0,0 +1,105 @@ +#!/usr/bin/env bash + +set -e +selene_dir=$(pwd) + +echo "--------------------------------------------------" +echo "COMMIT $(git rev-parse HEAD)" +echo "--------------------------------------------------" +echo "CC = ${CC}" +echo "CXX = ${CXX}" +echo "CXXFLAGS = ${CXXFLAGS}" +echo "LDFLAGS = ${LDFLAGS}" +echo "" +echo "VCPKG_DIR = ${VCPKG_DIR}" +echo "BUILD_TYPE = " ${BUILD_TYPE} +echo "ASAN = ${ASAN}" +echo "--------------------------------------------------" +cmake --version; +echo "--------------------------------------------------" +${CC} --version; +echo "--------------------------------------------------" +${CXX} --version; +echo "--------------------------------------------------" + +local_build_benchmarks="-DSELENE_BUILD_BENCHMARKS=OFF" + +if [[ -n "${VCPKG_DIR}" ]]; then + echo "Building using vcpkg..." + local_vcpkg_toolchain="-DCMAKE_TOOLCHAIN_FILE=${VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake" + full_vcpkg_dir=${VCPKG_DIR} + local_build_benchmarks="-DSELENE_BUILD_BENCHMARKS=ON" +fi + +if [[ -n "${BUILD_TYPE}" ]]; then + echo "Build type: ${BUILD_TYPE}" + local_build_type="-DCMAKE_BUILD_TYPE=${BUILD_TYPE}" +fi + +if [[ -n "${ASAN}" ]]; then + echo "Building with AddressSanitizer enabled..." + local_enable_sanitizers="-DSELENE_ENABLE_SANITIZERS=ON" +fi + +# CMake invocation +rm -rf build && mkdir -p build && cd build +cmake -G Ninja \ + ${local_vcpkg_toolchain} \ + ${local_build_type} \ + ${local_enable_sanitizers} \ + -DSELENE_BUILD_TESTS=ON \ + -DSELENE_BUILD_EXAMPLES=ON \ + ${local_build_benchmarks} \ + -DSELENE_WARNINGS_AS_ERRORS=ON \ + .. + +echo "--------------------------------------------------" +echo "Build all targets..." + +cmake --build . -j +export SELENE_DATA_PATH=${selene_dir}/data + +echo "--------------------------------------------------" +echo "Run tests..." + +./test/selene_tests -d yes + +echo "--------------------------------------------------" +echo "Run all example binaries..." + +# Run all example binaries +# https://stackoverflow.com/questions/4458120/unix-find-search-for-executable-files +example_binaries=$(find -L ./examples/ -maxdepth 1 -type f \( -perm -u=x -o -perm -g=x -o -perm -o=x \)) +for file in ${example_binaries} +do + echo "EXECUTING ${file}..." + ${file} +done + +echo "--------------------------------------------------" + +if [[ -n "${VCPKG_DIR}" ]]; then + echo "Build an example project using a vcpkg-installed version of Selene..." + echo "- Copying portfiles" + cp ${selene_dir}/package/vcpkg/* ${full_vcpkg_dir}/ports/selene + + echo "- Removing selene (shouldn't exist)" + ${full_vcpkg_dir}/vcpkg remove selene + echo "- Installing selene from HEAD" + ${full_vcpkg_dir}/vcpkg install --head selene + + echo "- Invoking CMake on test project" + cd ${selene_dir}/package/test_vcpkg + rm -rf build && mkdir -p build && cd build + cmake -G Ninja ${local_vcpkg_toolchain} .. + + echo "- Building test project" + cmake --build . -j + + echo "- Running test project" + ./example +fi + +echo "--------------------------------------------------" + +echo "FINISHED." diff --git a/.azure-pipelines/ubuntu-18.04_clone_vcpkg.sh b/.azure-pipelines/ubuntu-18.04_clone_vcpkg.sh new file mode 100755 index 0000000..c4e535b --- /dev/null +++ b/.azure-pipelines/ubuntu-18.04_clone_vcpkg.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +vcpkg_base_dir=$1 +vcpkg_tag=$2 + +cd ${vcpkg_base_dir} +git clone https://github.com/Microsoft/vcpkg.git +git -C ${vcpkg_base_dir}/vcpkg checkout ${vcpkg_tag} diff --git a/.azure-pipelines/ubuntu-18.04_install_vcpkg_deps.sh b/.azure-pipelines/ubuntu-18.04_install_vcpkg_deps.sh new file mode 100755 index 0000000..44168ac --- /dev/null +++ b/.azure-pipelines/ubuntu-18.04_install_vcpkg_deps.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash + +vcpkg_base_dir=$1 +shift +vcpkg_libraries=$@ + +echo "vcpkg_base_dir=${vcpkg_base_dir}" +echo "vcpkg_libraries=${vcpkg_libraries}" +echo "CC=${CC}" +echo "CXX=${CXX}" +echo "CXXFLAGS=${CXXFLAGS}" +echo "LDFLAGS=${LDFLAGS}" + +CC=gcc-8 CXX=g++-8 CXXFLAGS="" LDFLAGS="" ${vcpkg_base_dir}/vcpkg/bootstrap-vcpkg.sh +${vcpkg_base_dir}/vcpkg/vcpkg install ${vcpkg_libraries} +rm -rf ${vcpkg_base_dir}/vcpkg/buildtrees +rm -rf ${vcpkg_base_dir}/vcpkg/downloads +rm -rf ${vcpkg_base_dir}/vcpkg/packages diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 78faa76..47c7e83 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -2,125 +2,337 @@ # The Docker based jobs require specially prepared Docker images, where either # the respective libraries are pre-installed via apt (test_apt) or vcpkg -# (test_vcpkg). These Docker images are based on 'ubuntu:rolling' (currently -# Ubuntu 19.10), to provide GCC 9 and Clang 9 out of the box. +# (test_vcpkg). These Docker images are based on 'ubuntu:19.10' (currently), +# to provide GCC 9 and Clang 9 out of the box. # # See https://github.com/kmhofmann/selene_ci_docker on how they are created. +# *************************************************** +# TODO: Add OpenCV to tested dependencies on Windows. +# *************************************************** + +variables: + vcpkg_tag: "2019.10" + vcpkg_base_dir_bionic: "/tmp" + vcpkg_base_dir_macos: "/tmp" + vcpkg_libraries_bionic: "libjpeg-turbo libpng tiff opencv benchmark" + vcpkg_libraries_windows: "libjpeg-turbo libpng tiff opencv benchmark" + vcpkg_libraries_macos: "libjpeg-turbo libpng tiff opencv benchmark boost-filesystem" + brew_libraries: "libjpeg-turbo libpng libtiff opencv google-benchmark boost ninja" + jobs: - - job: Docker_Ubuntu_base_GCC_libstdcxx + + - job: Ubuntu_bionic_apt_GCC_seven_libstdcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_base - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + ninja-build g++ libjpeg-turbo8-dev libpng-dev libtiff-dev libopencv-dev + displayName: 'Install system dependencies' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_base bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Debug' + CC=gcc CXX=g++ BUILD_TYPE=Debug ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Release" kmhofmann/selene_test_base bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Release' + CC=gcc CXX=g++ BUILD_TYPE=Release ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' + +# ---------- - - job: Docker_Ubuntu_apt_GCC_libstdcxx + - job: Ubuntu_bionic_apt_Clang_seven_libstdcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_apt - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + ninja-build libstdc++-7-dev clang libjpeg-turbo8-dev libpng-dev libtiff-dev libopencv-dev + displayName: 'Install system dependencies' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Debug' + CC=clang CXX=clang++ BUILD_TYPE=Debug ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Release" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Release' + CC=clang CXX=clang++ BUILD_TYPE=Release ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' + - script: | + CC=clang CXX=clang++ ASAN=1 ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, sanitizers' + +# ---------- - - job: Docker_Ubuntu_apt_Clang_libstdcxx + - job: Ubuntu_bionic_base_GCC_eight_libstdcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_apt - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + ninja-build g++-8 + displayName: 'Install system dependencies' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Debug' + CC=gcc-8 CXX=g++-8 BUILD_TYPE=Debug ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "BUILD_TYPE=Release" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Release' + CC=gcc-8 CXX=g++-8 BUILD_TYPE=Release ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' - - job: Docker_Ubuntu_apt_ASAN_Clang_libstdcxx +# ---------- + + - job: Ubuntu_bionic_apt_GCC_eight_libstdcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_apt - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + ninja-build g++-8 libjpeg-turbo8-dev libpng-dev libtiff-dev libopencv-dev + displayName: 'Install system dependencies' + - script: | + CC=gcc-8 CXX=g++-8 BUILD_TYPE=Debug ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' - script: | - docker run --cap-add SYS_PTRACE -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "ASAN=1" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, ASAN' + CC=gcc-8 CXX=g++-8 BUILD_TYPE=Release ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' + # DISABLED -- TAKES TOO LONG TO BUILD + #- script: | + # CC=gcc-8 CXX=g++-8 ASAN=1 ./.azure-pipelines/ubuntu-18.04_build_project.sh + # displayName: 'Build and run project, sanitizers' - - job: Docker_Ubuntu_vcpkg_GCC_libstdcxx +# ---------- + + - job: Ubuntu_bionic_apt_Clang_eight_libstdcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_vcpkg - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + ninja-build libstdc++-8-dev clang-8 libjpeg-turbo8-dev libpng-dev libtiff-dev libopencv-dev + displayName: 'Install system dependencies' + - script: | + CC=clang-8 CXX=clang++-8 BUILD_TYPE=Debug ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "VCPKG_DIR=vcpkg" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Debug' + CC=clang-8 CXX=clang++-8 BUILD_TYPE=Release ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "VCPKG_DIR=vcpkg" -e "BUILD_TYPE=Release" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Release' + CC=clang-8 CXX=clang++-8 ASAN=1 ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, sanitizers' - - job: Docker_Ubuntu_vcpkg_Clang_libcxx +# ---------- + + - job: Ubuntu_bionic_vcpkg_GCC_eight_libstdcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_vcpkg - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + wget curl unzip tar ninja-build g++-8 + displayName: 'Install system dependencies' + - script: | + ./.azure-pipelines/ubuntu-18.04_clone_vcpkg.sh $(vcpkg_base_dir_bionic) $(vcpkg_tag) + displayName: 'Clone vcpkg' + - task: CacheBeta@1 + inputs: + key: '"$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Agent.JobName)" | "$(vcpkg_tag)" | "$(vcpkg_libraries_bionic)" | "v00"' + path: $(vcpkg_base_dir_bionic)/vcpkg + cacheHitVar: VCPKG_CACHE_RESTORED + displayName: 'Cache vcpkg' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "CXXFLAGS=\"-stdlib=libc++\"" -e "LDFLAGS=\"-stdlib=libc++\"" -e "VCPKG_DIR=vcpkg-libcxx" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Debug' + ./.azure-pipelines/ubuntu-18.04_install_vcpkg_deps.sh $(vcpkg_base_dir_bionic) $(vcpkg_libraries_bionic) + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') + displayName: 'Bootstrap vcpkg and install dependencies' - script: | - docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "CXXFLAGS=\"-stdlib=libc++\"" -e "LDFLAGS=\"-stdlib=libc++\"" -e "VCPKG_DIR=vcpkg-libcxx" -e "BUILD_TYPE=Release" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" - displayName: 'Run Docker image, Release' + CC=gcc-8 CXX=g++-8 BUILD_TYPE=Debug VCPKG_DIR=$(vcpkg_base_dir_bionic)/vcpkg \ + ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' + - script: | + CC=gcc-8 CXX=g++-8 BUILD_TYPE=Release VCPKG_DIR=$(vcpkg_base_dir_bionic)/vcpkg \ + ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' + +# ---------- - - job: Docker_Ubuntu_Android_NDK + - job: Ubuntu_bionic_vcpkg_Clang_eight_libcxx pool: vmImage: 'Ubuntu 18.04' steps: - script: | - docker pull kmhofmann/selene_test_vcpkg_android - displayName: 'Pull Docker image' + DEBIAN_FRONTEND=noninteractive sudo apt-get update + DEBIAN_FRONTEND=noninteractive sudo apt-get -y install \ + wget curl unzip tar ninja-build g++-8 clang-8 libc++-8-dev libc++abi-8-dev + displayName: 'Install system dependencies' + - script: | + ./.azure-pipelines/ubuntu-18.04_clone_vcpkg.sh $(vcpkg_base_dir_bionic) $(vcpkg_tag) + displayName: 'Clone vcpkg' + - task: CacheBeta@1 + inputs: + key: '"$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Agent.JobName)" | "$(vcpkg_tag)" | "$(vcpkg_libraries_bionic)" | "v00"' + path: $(vcpkg_base_dir_bionic)/vcpkg + cacheHitVar: VCPKG_CACHE_RESTORED + displayName: 'Cache vcpkg' + - script: | + CC=clang-8 CXX=clang++-8 CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" \ + ./.azure-pipelines/ubuntu-18.04_install_vcpkg_deps.sh $(vcpkg_base_dir_bionic) $(vcpkg_libraries_bionic) + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') + displayName: 'Bootstrap vcpkg and install dependencies' - script: | - docker run -v$(pwd):/home/selene/ -e "BUILD_TYPE=Debug" kmhofmann/selene_test_vcpkg_android bash -c "./selene/.azure-pipelines/build_project_android.sh" - displayName: 'Run Docker image, Debug' + CC=clang-8 CXX=clang++-8 CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" BUILD_TYPE=Debug VCPKG_DIR=$(vcpkg_base_dir_bionic)/vcpkg \ + ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, debug' - script: | - docker run -v$(pwd):/home/selene/ -e "BUILD_TYPE=Release" kmhofmann/selene_test_vcpkg_android bash -c "./selene/.azure-pipelines/build_project_android.sh" - displayName: 'Run Docker image, Release' + CC=clang-8 CXX=clang++-8 CXXFLAGS="-stdlib=libc++" LDFLAGS="-stdlib=libc++" BUILD_TYPE=Release VCPKG_DIR=$(vcpkg_base_dir_bionic)/vcpkg \ + ./.azure-pipelines/ubuntu-18.04_build_project.sh + displayName: 'Build and run project, release' - - job: Windows_vcpkg_VS2017_x64 +# ---------- + + #- job: Ubuntu_Docker_base_GCC_libstdcxx + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_base + # displayName: 'Pull Docker image' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_base bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Debug' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Release" kmhofmann/selene_test_base bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Release' + +# ---------- + + #- job: Ubuntu_Docker_apt_GCC_libstdcxx + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_apt + # displayName: 'Pull Docker image' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Debug' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "BUILD_TYPE=Release" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Release' + +# ---------- + + #- job: Ubuntu_Docker_apt_Clang_libstdcxx + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_apt + # displayName: 'Pull Docker image' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Debug' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "BUILD_TYPE=Release" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Release' + +# ---------- + + #- job: Ubuntu_Docker_apt_ASAN_Clang_libstdcxx + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_apt + # displayName: 'Pull Docker image' + # - script: | + # docker run --cap-add SYS_PTRACE -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "ASAN=1" kmhofmann/selene_test_apt bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, ASAN' + +# ---------- + + #- job: Ubuntu_Docker_vcpkg_GCC_libstdcxx + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_vcpkg + # displayName: 'Pull Docker image' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "VCPKG_DIR=vcpkg" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Debug' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=gcc" -e "CXX=g++" -e "VCPKG_DIR=vcpkg" -e "BUILD_TYPE=Release" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Release' + +# ---------- + + #- job: Ubuntu_Docker_vcpkg_Clang_libcxx + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_vcpkg + # displayName: 'Pull Docker image' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "CXXFLAGS=\"-stdlib=libc++\"" -e "LDFLAGS=\"-stdlib=libc++\"" -e "VCPKG_DIR=vcpkg-libcxx" -e "BUILD_TYPE=Debug" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Debug' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "CC=clang" -e "CXX=clang++" -e "CXXFLAGS=\"-stdlib=libc++\"" -e "LDFLAGS=\"-stdlib=libc++\"" -e "VCPKG_DIR=vcpkg-libcxx" -e "BUILD_TYPE=Release" kmhofmann/selene_test_vcpkg bash -c "./selene/.azure-pipelines/build_project.sh" + # displayName: 'Run Docker image, Release' + +# ---------- + + #- job: Ubuntu_Docker_Android_NDK + # pool: + # vmImage: 'Ubuntu 18.04' + # steps: + # - script: | + # docker pull kmhofmann/selene_test_vcpkg_android + # displayName: 'Pull Docker image' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "BUILD_TYPE=Debug" kmhofmann/selene_test_vcpkg_android bash -c "./selene/.azure-pipelines/build_project_android.sh" + # displayName: 'Run Docker image, Debug' + # - script: | + # docker run -v$(pwd):/home/selene/ -e "BUILD_TYPE=Release" kmhofmann/selene_test_vcpkg_android bash -c "./selene/.azure-pipelines/build_project_android.sh" + # displayName: 'Run Docker image, Release' + +# ---------- + + - job: Windows_vcpkg_VS2019_x64 + timeoutInMinutes: 120 pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' steps: + - task: CacheBeta@1 + inputs: + key: '"$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Agent.JobName)" | "$(vcpkg_tag)" | "$(vcpkg_libraries_windows)" | "v00"' + path: ../vcpkg + cacheHitVar: VCPKG_CACHE_RESTORED + displayName: 'Cache vcpkg' - script: | + ls .. git clone https://github.com/Microsoft/vcpkg.git ../vcpkg + git -C ../vcpkg checkout $(vcpkg_tag) ..\vcpkg\bootstrap-vcpkg.bat + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') displayName: 'Bootstrap vcpkg' - - script: ..\vcpkg\vcpkg.exe install libjpeg-turbo libpng tiff --triplet x64-windows - displayName: 'Install vcpkg dependencies' - script: | - mkdir build + ..\vcpkg\vcpkg.exe install $(vcpkg_libraries_windows) --triplet x64-windows + rd /s /q ..\vcpkg\buildtrees + rd /s /q ..\vcpkg\downloads + rd /s /q ..\vcpkg\packages + ..\vcpkg\vcpkg.exe list + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') + displayName: 'Install vcpkg dependencies' + + - script: mkdir build displayName: 'Create build directory' - task: CMake@1 inputs: workingDirectory: 'build' - cmakeArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -DSELENE_BUILD_TESTS=ON -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON -DSELENE_WARNINGS_AS_ERRORS=ON ..' + cmakeArgs: '-A x64 -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -DSELENE_BUILD_ALL=ON -DSELENE_USE_OPENCV=OFF -DSELENE_WARNINGS_AS_ERRORS=ON ..' displayName: 'Run CMake' + - task: MSBuild@1 inputs: solution: 'build/ALL_BUILD.vcxproj' @@ -131,6 +343,7 @@ jobs: cd build .\test\Debug\selene_tests.exe -d yes displayName: 'Run tests, debug' + - task: MSBuild@1 inputs: solution: 'build/ALL_BUILD.vcxproj' @@ -142,6 +355,7 @@ jobs: cd build .\test\Release\selene_tests.exe -d yes displayName: 'Run tests, release' + - script: | cp .\package\vcpkg\CONTROL ..\vcpkg\ports\selene cp .\package\vcpkg\portfile.cmake ..\vcpkg\ports\selene @@ -165,24 +379,43 @@ jobs: .\package\test_vcpkg\build\Debug\example displayName: 'Run vcpkg example' - - job: Windows_vcpkg_VS2017_x86 +# ---------- + + - job: Windows_vcpkg_VS2019_x86 + timeoutInMinutes: 120 pool: - vmImage: 'vs2017-win2016' + vmImage: 'windows-2019' steps: + - task: CacheBeta@1 + inputs: + key: '"$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Agent.JobName)" | "$(vcpkg_tag)" | "$(vcpkg_libraries_windows)" | "v00"' + path: ../vcpkg + cacheHitVar: VCPKG_CACHE_RESTORED + displayName: 'Cache vcpkg' - script: | + ls .. git clone https://github.com/Microsoft/vcpkg.git ../vcpkg + git -C ../vcpkg checkout $(vcpkg_tag) ..\vcpkg\bootstrap-vcpkg.bat + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') displayName: 'Bootstrap vcpkg' - - script: ..\vcpkg\vcpkg.exe install libjpeg-turbo libpng tiff - displayName: 'Install vcpkg dependencies' - script: | - mkdir build + ..\vcpkg\vcpkg.exe install $(vcpkg_libraries_windows) + rd /s /q ..\vcpkg\buildtrees + rd /s /q ..\vcpkg\downloads + rd /s /q ..\vcpkg\packages + ..\vcpkg\vcpkg.exe list + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') + displayName: 'Install vcpkg dependencies' + + - script: mkdir build displayName: 'Create build directory' - task: CMake@1 inputs: workingDirectory: 'build' - cmakeArgs: '-DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -DSELENE_BUILD_TESTS=ON -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON -DSELENE_WARNINGS_AS_ERRORS=ON ..' + cmakeArgs: '-DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake -DSELENE_BUILD_ALL=ON -DSELENE_USE_OPENCV=OFF -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON -DSELENE_WARNINGS_AS_ERRORS=ON ..' displayName: 'Run CMake' + - task: MSBuild@1 inputs: solution: 'build/ALL_BUILD.vcxproj' @@ -193,6 +426,7 @@ jobs: cd build .\test\Debug\selene_tests.exe -d yes displayName: 'Run tests, debug' + - task: MSBuild@1 inputs: solution: 'build/ALL_BUILD.vcxproj' @@ -204,6 +438,7 @@ jobs: cd build .\test\Release\selene_tests.exe -d yes displayName: 'Run tests, release' + - script: | cp .\package\vcpkg\CONTROL ..\vcpkg\ports\selene cp .\package\vcpkg\portfile.cmake ..\vcpkg\ports\selene @@ -227,6 +462,8 @@ jobs: .\package\test_vcpkg\build\Debug\example displayName: 'Run vcpkg example' +# ---------- + - job: MacOS_vcpkg pool: vmImage: 'macOS-10.14' @@ -241,25 +478,28 @@ jobs: # Remove conflicting headers (e.g. png.h) sudo rm -rf /Library/Frameworks/Mono.framework/Headers displayName: 'Install brew dependencies' + - script: | - git clone https://github.com/Microsoft/vcpkg.git ../vcpkg - # Make sure Boost is compiled in C++17 mode; - # see e.g. https://github.com/Microsoft/vcpkg/issues/4476#issuecomment-430175834 - export BOOST_MODULAR_CMAKE="../vcpkg/ports/boost-modular-build-helper/CMakeLists.txt" - export LN=$(grep -n "WORKING_DIRECTORY" ${BOOST_MODULAR_CMAKE} | awk -F ":" '{print $1}') - gsed -i "${LN}i\ cxxstd=17" ${BOOST_MODULAR_CMAKE} - ../vcpkg/bootstrap-vcpkg.sh - displayName: 'Bootstrap vcpkg' + ./.azure-pipelines/macos_clone_vcpkg.sh $(vcpkg_base_dir_macos) $(vcpkg_tag) + displayName: 'Clone vcpkg' + + - task: CacheBeta@1 + inputs: + key: '"$(Agent.OS)" | "$(Agent.OSArchitecture)" | "$(Agent.JobName)" | "$(vcpkg_tag)" | "$(vcpkg_libraries_macos)" | "v00"' + path: $(vcpkg_base_dir_macos)/vcpkg + cacheHitVar: VCPKG_CACHE_RESTORED + displayName: 'Cache vcpkg' + - script: | - ../vcpkg/vcpkg install libjpeg-turbo libpng tiff boost-filesystem - displayName: 'Install vcpkg dependencies' + ./.azure-pipelines/macos_install_vcpkg_deps.sh $(vcpkg_base_dir_macos) $(vcpkg_libraries_macos) + condition: ne(variables.VCPKG_CACHE_RESTORED, 'true') + displayName: 'Bootstrap vcpkg and install dependencies' + - script: | - pwd mkdir build-debug && cd build-debug cmake -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DCMAKE_BUILD_TYPE=Debug \ - -DSELENE_BUILD_TESTS=ON -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON .. + -DCMAKE_TOOLCHAIN_FILE=$(vcpkg_base_dir_macos)/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DCMAKE_BUILD_TYPE=Debug -DSELENE_BUILD_ALL=ON .. displayName: 'Run CMake, debug' - script: | cd build-debug && ninja @@ -267,13 +507,12 @@ jobs: - script: | cd build-debug && ./test/selene_tests -d yes displayName: 'Run tests, debug' + - script: | - pwd mkdir build-release && cd build-release cmake -G Ninja \ - -DCMAKE_TOOLCHAIN_FILE=../../vcpkg/scripts/buildsystems/vcpkg.cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DSELENE_BUILD_TESTS=ON -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON .. + -DCMAKE_TOOLCHAIN_FILE=$(vcpkg_base_dir_macos)/vcpkg/scripts/buildsystems/vcpkg.cmake \ + -DCMAKE_BUILD_TYPE=Release -DSELENE_BUILD_ALL=ON .. displayName: 'Run CMake, release' - script: | cd build-release && ninja @@ -282,22 +521,26 @@ jobs: cd build-release && ./test/selene_tests -d yes displayName: 'Run tests, release' +# ---------- + - job: MacOS_brew pool: vmImage: 'macOS-10.14' steps: - script: | - brew update - brew install ninja libjpeg-turbo libpng libtiff boost # Remove conflicting headers (e.g. png.h) sudo rm -rf /Library/Frameworks/Mono.framework/Headers + displayName: Clean-up conflicting headers + - script: | + brew update + brew install $(brew_libraries) displayName: Install brew dependencies + - script: | mkdir build-debug && cd build-debug cmake -G Ninja \ -DCMAKE_PREFIX_PATH="/usr/local/opt/jpeg-turbo;/usr/local" \ - -DCMAKE_BUILD_TYPE=Debug \ - -DSELENE_BUILD_TESTS=ON -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON .. + -DCMAKE_BUILD_TYPE=Debug -DSELENE_BUILD_ALL=ON .. displayName: 'Run CMake, debug' - script: | cd build-debug && ninja @@ -305,12 +548,12 @@ jobs: - script: | cd build-debug && ./test/selene_tests -d yes displayName: 'Run tests, debug' + - script: | mkdir build-release && cd build-release cmake -G Ninja \ -DCMAKE_PREFIX_PATH="/usr/local/opt/jpeg-turbo;/usr/local" \ - -DCMAKE_BUILD_TYPE=Release \ - -DSELENE_BUILD_TESTS=ON -DSELENE_BUILD_EXAMPLES=ON -DSELENE_NO_OPENCV=ON .. + -DCMAKE_BUILD_TYPE=Release -DSELENE_BUILD_ALL=ON .. displayName: 'Run CMake, release' - script: | cd build-release && ninja diff --git a/benchmark/CMakeLists.txt b/benchmark/CMakeLists.txt index c0e9805..2d5d638 100644 --- a/benchmark/CMakeLists.txt +++ b/benchmark/CMakeLists.txt @@ -28,7 +28,7 @@ target_sources(benchmark_image_convolution PRIVATE target_compile_options(benchmark_image_convolution PRIVATE ${SELENE_COMPILE_OPTIONS}) target_compile_definitions(benchmark_image_convolution PRIVATE ${SELENE_COMPILE_DEFINITIONS}) target_include_directories(benchmark_image_convolution PRIVATE ${SELENE_DIR}/examples) -target_link_libraries(benchmark_image_convolution selene selene_wrapper_fs benchmark::benchmark) +target_link_libraries(benchmark_image_convolution selene selene_wrapper_fs selene_test_utils benchmark::benchmark) if (OPENCV_IMGPROC_FOUND) - target_link_libraries(benchmark_image_convolution selene_test_utils opencv_core opencv_imgproc) + target_link_libraries(benchmark_image_convolution opencv_core opencv_imgproc) endif() diff --git a/benchmark/image_convolution.cpp b/benchmark/image_convolution.cpp index e3feb3d..a24a43f 100644 --- a/benchmark/image_convolution.cpp +++ b/benchmark/image_convolution.cpp @@ -153,14 +153,15 @@ void image_convolution_x_floating_point_kernel_rgb(benchmark::State& state) { im void image_convolution_y_floating_point_kernel_rgb(benchmark::State& state) { image_convolution_y_floating_point_kernel(state); } void image_convolution_x_integer_kernel_rgb(benchmark::State& state) { image_convolution_x_integer_kernel(state); } void image_convolution_y_integer_kernel_rgb(benchmark::State& state) { image_convolution_y_integer_kernel(state); } +#if defined(SELENE_WITH_OPENCV) void image_convolution_x_opencv_rgb(benchmark::State& state) { image_convolution_x_opencv(state); } void image_convolution_y_opencv_rgb(benchmark::State& state) { image_convolution_y_opencv(state); } +#endif // SELENE_IMG_OPENCV_HPP BENCHMARK(image_convolution_x_floating_point_kernel_rgb); BENCHMARK(image_convolution_y_floating_point_kernel_rgb); BENCHMARK(image_convolution_x_integer_kernel_rgb); BENCHMARK(image_convolution_y_integer_kernel_rgb); - #if defined(SELENE_WITH_OPENCV) BENCHMARK(image_convolution_x_opencv_rgb); BENCHMARK(image_convolution_y_opencv_rgb); @@ -170,14 +171,15 @@ void image_convolution_x_floating_point_kernel_y(benchmark::State& state) { imag void image_convolution_y_floating_point_kernel_y(benchmark::State& state) { image_convolution_y_floating_point_kernel(state); } void image_convolution_x_integer_kernel_y(benchmark::State& state) { image_convolution_x_integer_kernel(state); } void image_convolution_y_integer_kernel_y(benchmark::State& state) { image_convolution_y_integer_kernel(state); } +#if defined(SELENE_WITH_OPENCV) void image_convolution_x_opencv_y(benchmark::State& state) { image_convolution_x_opencv(state); } void image_convolution_y_opencv_y(benchmark::State& state) { image_convolution_y_opencv(state); } +#endif // SELENE_IMG_OPENCV_HPP BENCHMARK(image_convolution_x_floating_point_kernel_y); BENCHMARK(image_convolution_y_floating_point_kernel_y); BENCHMARK(image_convolution_x_integer_kernel_y); BENCHMARK(image_convolution_y_integer_kernel_y); - #if defined(SELENE_WITH_OPENCV) BENCHMARK(image_convolution_x_opencv_y); BENCHMARK(image_convolution_y_opencv_y); diff --git a/conanfile.txt b/conanfile.txt index 32380e1..9f5fa05 100644 --- a/conanfile.txt +++ b/conanfile.txt @@ -1,11 +1,11 @@ [requires] -libjpeg-turbo/[>=1.5.0]@bincrafters/stable +libjpeg-turbo/[>=2.0.0]@bincrafters/stable libpng/[>=1.2.0]@bincrafters/stable libtiff/[>=4.0.9]@bincrafters/stable +benchmark/[>=1.5.0]@_/_ +# opencv/[>4.0.0]@conan/stable # Does not seem to be working (Eigen3 package resolution errors during CMake invocation). # boost/[>1.66.0]@conan/stable # Only required if standard library filesystem support is missing. -# opencv/[>3.0.0]@conan/stable # This seems buggy. Leads to: "'/lib/libz.a', needed by 'test/selene/selene_tests', missing and no known rule to make it" -# google-benchmark/1.4.1@mpusz/stable # conan remote add conan-mpusz https://api.bintray.com/conan/mpusz/conan-mpusz [generators] cmake_find_package