@@ -0,0 +1,64 @@
|
||||
# default build for all distros
|
||||
# only create artifacts of the build directory when something fails (for cmake logs)
|
||||
# cache the ccache/ directory for each job separately
|
||||
.build_template: &distro_build
|
||||
script:
|
||||
- python3 ci/test_build.py
|
||||
artifacts:
|
||||
when: on_failure
|
||||
paths:
|
||||
- build/
|
||||
cache:
|
||||
key: "$CI_JOB_NAME"
|
||||
paths:
|
||||
- ccache/
|
||||
|
||||
Fedora:
|
||||
image: fedora:28
|
||||
before_script:
|
||||
- dnf -y --refresh install gcc-c++ clang cmake make ccache expat-devel zlib-devel libssh-devel libcurl-devel gtest-devel which dos2unix
|
||||
<<: *distro_build
|
||||
|
||||
Debian:
|
||||
image: debian:9
|
||||
before_script:
|
||||
- apt-get update
|
||||
- apt-get install -y cmake g++ clang make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libgtest-dev libxml2-utils
|
||||
- ./ci/debian_build_gtest.sh
|
||||
<<: *distro_build
|
||||
|
||||
Archlinux:
|
||||
image: base/archlinux
|
||||
before_script:
|
||||
- pacman --noconfirm -Sy
|
||||
- pacman --noconfirm -S gcc clang cmake make ccache expat zlib libssh curl gtest python dos2unix
|
||||
<<: *distro_build
|
||||
|
||||
Ubuntu:
|
||||
image: ubuntu:18.04
|
||||
before_script:
|
||||
- apt-get update
|
||||
- apt-get install -y cmake g++ clang make ccache python3 libexpat1-dev zlib1g-dev libssh-dev libcurl4-openssl-dev libgtest-dev google-mock libxml2-utils
|
||||
- ./ci/debian_build_gtest.sh
|
||||
<<: *distro_build
|
||||
|
||||
CentOS:
|
||||
image: centos:7
|
||||
before_script:
|
||||
- yum -y install yum-plugin-copr epel-release
|
||||
# enable copr for gtest
|
||||
- yum -y copr enable defolos/devel
|
||||
- yum clean all
|
||||
- yum -y install gcc-c++ clang cmake3 make ccache expat-devel zlib-devel libssh-devel libcurl-devel gtest-devel which python36 dos2unix
|
||||
# symlink up to date versions of python & cmake to 'default' names
|
||||
- ln -s /usr/bin/python36 /usr/bin/python3
|
||||
- mv /bin/cmake /bin/.cmake.old
|
||||
- ln -s /bin/cmake3 /bin/cmake
|
||||
<<: *distro_build
|
||||
|
||||
OpenSUSE:
|
||||
image: opensuse:tumbleweed
|
||||
before_script:
|
||||
- zypper --non-interactive refresh
|
||||
- zypper --non-interactive install gcc-c++ clang cmake make ccache libexpat-devel zlib-devel libssh-devel libcurl-devel gtest which dos2unix libxml2-tools
|
||||
<<: *distro_build
|
||||
+2
-2
@@ -22,8 +22,8 @@ env:
|
||||
#- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_XMP=OFF -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_LENSDATA=OFF" # All disabled
|
||||
#- CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_ENABLE_CURL=OFF -DEXIV2_ENABLE_SSH=OFF" # WebReady without SSH nor CURL
|
||||
|
||||
install: ./.travis/install.sh
|
||||
script: ./.travis/run.sh
|
||||
install: ./ci/install.sh
|
||||
script: ./ci/run.sh
|
||||
|
||||
cache:
|
||||
ccache: true
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
[](https://travis-ci.org/Exiv2/exiv2)
|
||||
[](https://ci.appveyor.com/project/piponazo/exiv2-wutfp/branch/master)
|
||||
[](https://gitlab.com/D4N/exiv2/commits/master)
|
||||
|
||||
|
||||
<pre><code>
|
||||
|
||||
Executable
+13
@@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Debian & derivatives don't provide binary packages of googletest
|
||||
# => have to build them ourselves
|
||||
#
|
||||
# This script builds a shared library of googletest (not googlemock!) and copies
|
||||
# it to usr/lib/
|
||||
|
||||
mkdir gtest_build && cd gtest_build
|
||||
cmake -DBUILD_SHARED_LIBS=1 /usr/src/googletest/googletest
|
||||
make
|
||||
cp libgtest* /usr/lib/
|
||||
cd ..
|
||||
@@ -0,0 +1,81 @@
|
||||
#!/usr/bin/python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import itertools
|
||||
import multiprocessing
|
||||
import os
|
||||
import shlex
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
#: -DEXIV2_BUILD_SHARED_LIBS options
|
||||
SHARED_LIBS = ["ON", "OFF"]
|
||||
|
||||
#: C & C++ compiler as tuples
|
||||
CCS = ["gcc", "clang"]
|
||||
|
||||
#: -DCMAKE_BUILD_TYPE options
|
||||
BUILD_TYPES = ["Debug", "Release"]
|
||||
|
||||
#: Additional parameters for cmake
|
||||
CMAKE_OPTIONS = os.getenv("CMAKE_OPTIONS") or \
|
||||
"-DEXIV2_TEAM_EXTRA_WARNINGS=ON -DEXIV2_ENABLE_VIDEO=ON "\
|
||||
"-DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON "\
|
||||
"-DBUILD_WITH_CCACHE=ON "
|
||||
|
||||
#: cpu count
|
||||
NCPUS = multiprocessing.cpu_count()
|
||||
|
||||
|
||||
def call_wrapper(*args, **kwargs):
|
||||
"""
|
||||
Wrapper around subprocess.call which terminates the program on non-zero
|
||||
return value.
|
||||
"""
|
||||
return_code = subprocess.call(*args, **kwargs)
|
||||
if return_code != 0:
|
||||
sys.exit(return_code)
|
||||
|
||||
|
||||
# create build & ccache directory (ccache could already exist in the CI's cache)
|
||||
os.mkdir("build")
|
||||
if not os.path.exists('ccache'):
|
||||
os.mkdir("ccache")
|
||||
|
||||
root_dir = os.path.abspath(os.getcwd())
|
||||
|
||||
for params in itertools.product(SHARED_LIBS, CCS, BUILD_TYPES):
|
||||
|
||||
lib_type, cc, build_type = params
|
||||
|
||||
cxx = {"gcc": "g++", "clang": "clang++"}[cc]
|
||||
|
||||
cwd = os.path.abspath(os.path.join("build", "_".join(params)))
|
||||
os.mkdir(cwd)
|
||||
|
||||
cmake = "cmake {!s} -DCMAKE_BUILD_TYPE={build_type} "\
|
||||
"-DBUILD_SHARED_LIBS={lib_type} ../.."\
|
||||
.format(CMAKE_OPTIONS, build_type=build_type, lib_type=lib_type)
|
||||
make = "make -j " + str(NCPUS)
|
||||
make_tests = "make tests"
|
||||
unit_tests = os.path.join(cwd, "bin", "unit_tests")
|
||||
|
||||
# set up environment
|
||||
env_copy = os.environ.copy()
|
||||
env_copy["CC"] = cc
|
||||
env_copy["CXX"] = cxx
|
||||
env_copy["CCACHE_BASEDIR"] = root_dir
|
||||
env_copy["CCACHE_DIR"] = os.path.join(root_dir, "ccache")
|
||||
|
||||
# location of the binaries for the new test suite:
|
||||
env_copy["EXIV2_PATH"] = os.path.join(cwd, "bin")
|
||||
|
||||
kwargs = {"env": env_copy, "cwd": cwd}
|
||||
|
||||
def run(cmd):
|
||||
call_wrapper(shlex.split(cmd), **kwargs)
|
||||
|
||||
run(cmake)
|
||||
run(make)
|
||||
run(make_tests)
|
||||
run(unit_tests)
|
||||
@@ -33,11 +33,16 @@ if ( MINGW OR UNIX ) # MINGW, Linux, APPLE, CYGWIN
|
||||
" -Wuseless-cast"
|
||||
" -Wpointer-arith" # This warning is also enabled by -Wpedantic
|
||||
" -Wformat=2"
|
||||
" -Warray-bounds=2"
|
||||
#" -Wold-style-cast"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0 )
|
||||
string(CONCAT EXTRA_COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
|
||||
" -Warray-bounds=2"
|
||||
)
|
||||
endif ()
|
||||
|
||||
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0 )
|
||||
string(CONCAT EXTRA_COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
|
||||
" -Wduplicated-cond"
|
||||
@@ -56,11 +61,9 @@ if ( MINGW OR UNIX ) # MINGW, Linux, APPLE, CYGWIN
|
||||
# https://clang.llvm.org/docs/DiagnosticsReference.html
|
||||
# These variables are at least available since clang 3.9.1
|
||||
string(CONCAT EXTRA_COMPILE_FLAGS "-Wextra"
|
||||
" -Wdouble-promotion"
|
||||
" -Wshadow"
|
||||
" -Wassign-enum"
|
||||
" -Wmicrosoft"
|
||||
" -Wcomma"
|
||||
" -Wcomments"
|
||||
" -Wconditional-uninitialized"
|
||||
" -Wdirect-ivar-access"
|
||||
@@ -72,6 +75,18 @@ if ( MINGW OR UNIX ) # MINGW, Linux, APPLE, CYGWIN
|
||||
#" -Wconversion"
|
||||
#" -Wold-style-cast"
|
||||
)
|
||||
# -Wdouble-promotion flag is not available in clang 3.4.2
|
||||
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.4.2 )
|
||||
string(CONCAT EXTRA_COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
|
||||
" -Wdouble-promotion"
|
||||
)
|
||||
endif ()
|
||||
# -Wcomma flag is not available in clang 3.8.1
|
||||
if ( CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.8.1 )
|
||||
string(CONCAT EXTRA_COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS}
|
||||
" -Wcomma"
|
||||
)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
|
||||
|
||||
+13
-13
@@ -1,6 +1,6 @@
|
||||
// ********************************************************* -*- C++ -*-
|
||||
/*
|
||||
* Copyright (C) 2004-2017 Exiv2 maintainers
|
||||
* Copyright (C) 2004-2018 Exiv2 maintainers
|
||||
*
|
||||
* This program is part of the Exiv2 distribution.
|
||||
*
|
||||
@@ -218,13 +218,13 @@ namespace Safe
|
||||
* The intrinsics are documented here:
|
||||
* https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html#Integer-Overflow-Builtins
|
||||
*/
|
||||
#define SPECIALIZE_builtin_add_overflow(type, builtin_name) \
|
||||
/* Full specialization of builtin_add_overflow for type using the */ \
|
||||
/* builtin_name intrinsic */ \
|
||||
template <> \
|
||||
bool builtin_add_overflow<type>(type summand_1, type summand_2, type & result) \
|
||||
{ \
|
||||
return builtin_name(summand_1, summand_2, &result); \
|
||||
#define SPECIALIZE_builtin_add_overflow(type, builtin_name) \
|
||||
/* Full specialization of builtin_add_overflow for type using the */ \
|
||||
/* builtin_name intrinsic */ \
|
||||
template <> \
|
||||
inline bool builtin_add_overflow<type>(type summand_1, type summand_2, type & result) \
|
||||
{ \
|
||||
return builtin_name(summand_1, summand_2, &result); \
|
||||
}
|
||||
|
||||
SPECIALIZE_builtin_add_overflow(int, __builtin_sadd_overflow);
|
||||
@@ -255,11 +255,11 @@ namespace Safe
|
||||
* The intrinsics are documented here:
|
||||
* https://msdn.microsoft.com/en-us/library/windows/desktop/ff516460(v=vs.85).aspx
|
||||
*/
|
||||
#define SPECIALIZE_builtin_add_overflow_WIN(type, builtin_name) \
|
||||
template <> \
|
||||
bool builtin_add_overflow(type summand_1, type summand_2, type& result) \
|
||||
{ \
|
||||
return builtin_name(summand_1, summand_2, &result) != S_OK; \
|
||||
#define SPECIALIZE_builtin_add_overflow_WIN(type, builtin_name) \
|
||||
template <> \
|
||||
inline bool builtin_add_overflow(type summand_1, type summand_2, type& result) \
|
||||
{ \
|
||||
return builtin_name(summand_1, summand_2, &result) != S_OK; \
|
||||
}
|
||||
|
||||
SPECIALIZE_builtin_add_overflow_WIN(unsigned int, UIntAdd);
|
||||
|
||||
Reference in New Issue
Block a user