From 7276880fdfb3b800efc3defe434771d94fbb4ecb Mon Sep 17 00:00:00 2001 From: Balazs Benics Date: Sun, 28 Jul 2019 14:43:07 +0200 Subject: [PATCH] fix non stdc++17 buildbots --- .travis.yml | 23 ----------------------- appveyor.yml | 18 +++++++++--------- conanfile.py | 34 +++++++++++++++++++++++++++++----- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/.travis.yml b/.travis.yml index 4941ec8..f0b6512 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,15 +24,6 @@ osx: &osx matrix: include: - # - <<: *linux - # env: CONAN_GCC_VERSIONS=4.9 CONAN_DOCKER_IMAGE=conanio/gcc49 - - # - <<: *linux - # env: CONAN_GCC_VERSIONS=5 CONAN_DOCKER_IMAGE=conanio/gcc5 - - # - <<: *linux - # env: CONAN_GCC_VERSIONS=6 CONAN_DOCKER_IMAGE=conanio/gcc6 - - <<: *linux env: CONAN_GCC_VERSIONS=7 CONAN_DOCKER_IMAGE=conanio/gcc7 @@ -42,12 +33,6 @@ matrix: - <<: *linux env: CONAN_GCC_VERSIONS=9 CONAN_DOCKER_IMAGE=conanio/gcc9 - # - <<: *linux - # env: CONAN_CLANG_VERSIONS=3.9 CONAN_DOCKER_IMAGE=conanio/clang39 - - - <<: *linux - env: CONAN_CLANG_VERSIONS=4.0 CONAN_DOCKER_IMAGE=conanio/clang40 - - <<: *linux env: CONAN_CLANG_VERSIONS=5.0 CONAN_DOCKER_IMAGE=conanio/clang50 @@ -60,14 +45,6 @@ matrix: - <<: *linux env: CONAN_CLANG_VERSIONS=8 CONAN_DOCKER_IMAGE=conanio/clang8 - - <<: *osx - osx_image: xcode7.3 - env: CONAN_APPLE_CLANG_VERSIONS=7.3 - - - <<: *osx - osx_image: xcode8.3 - env: CONAN_APPLE_CLANG_VERSIONS=8.1 - - <<: *osx osx_image: xcode9.2 env: CONAN_APPLE_CLANG_VERSIONS=9.0 diff --git a/appveyor.yml b/appveyor.yml index 85b4596..1144398 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,18 +4,18 @@ environment: PYTHON: "C:\\Python37" matrix: - - MINGW_CONFIGURATIONS: '4.9@x86_64@seh@posix, 5@x86_64@seh@posix, 6@x86_64@seh@posix, 7@x86_64@seh@posix' - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 + - MINGW_CONFIGURATIONS: '7@x86_64@seh@posix, 7@x86@seh@posix, 8@x86_64@seh@posix, 8@x86@seh@posix' + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CONAN_VISUAL_VERSIONS: 15 CONAN_BUILD_TYPES: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - CONAN_VISUAL_VERSIONS: 14 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + CONAN_VISUAL_VERSIONS: 15 CONAN_BUILD_TYPES: Debug - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CONAN_VISUAL_VERSIONS: 15 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CONAN_VISUAL_VERSIONS: 16 CONAN_BUILD_TYPES: Release - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - CONAN_VISUAL_VERSIONS: 15 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 + CONAN_VISUAL_VERSIONS: 16 CONAN_BUILD_TYPES: Debug diff --git a/conanfile.py b/conanfile.py index 17aab81..b86f289 100644 --- a/conanfile.py +++ b/conanfile.py @@ -1,9 +1,9 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from conans import ConanFile, tools, CMake -import os - +from conans import ConanFile, CMake +from conans.model.version import Version +from conans.errors import ConanException class NameofConan(ConanFile): name = 'nameof' @@ -32,15 +32,39 @@ class NameofConan(ConanFile): 'build_examples': False, } + @property + def supports_string_view(self): + compiler = str(self.settings.compiler) + version = Version(str(self.settings.compiler.version)) + if compiler == 'Visual Studio' and version >= Version('15'): + return True + if compiler == 'gcc' and version >= Version('7'): + return True + if compiler == 'icc' and version >= Version('19'): + return True + if compiler == 'clang' and version >= Version('5'): + return True + if compiler == 'apple-clang' and version >= Version('9'): + return True + return False + def requirements(self): if self.options.build_tests: self.requires('Catch2/2.9.1@catchorg/stable') + def configure(self): + if not self.supports_string_view: + raise ConanException('The specified compiler must support C++17') + def config_options(self): needs_build = self.options.build_tests or self.options.build_examples + + # remove all build settings since it is a header-only library if not needs_build: - # remove all build settings since it is a header-only library - self.options.remove(['os', 'compiler', 'build_type', 'arch']) + del self.options.os + del self.options.compiler + del self.options.build_type + del self.options.arch def configure_cmake(self): cmake = CMake(self)