Mercurial > hg > sonic-visualiser
changeset 1976:810a0b8f5472 c++14
Requiring c++14 is not going to work for Travis (because we want to support a Qt version too old to know about the c++14 config flag) or for our AppImage build (because we want to run on distros to old to support the relevant gcc ABI). So instead we try to confine the C++ standard selection to one place (config/noconfig) and revert to c++11 if the compiler is too old to know about c++14. All of the actual SV code remains c++11, and we assume we build against an older version of capnproto when we want to perform a c++11 build.
author | Chris Cannam |
---|---|
date | Fri, 31 Aug 2018 13:41:27 +0100 |
parents | 18fb91db5311 |
children | 34cb861994a2 |
files | .travis.yml acinclude.m4 base.pri config.pri.in configure configure.ac convert.pro deploy/linux/docker/Dockerfile_appimage.in noconfig.pri platform-dataquay.pri server.pro |
diffstat | 11 files changed, 113 insertions(+), 15 deletions(-) [+] |
line wrap: on
line diff
--- a/.travis.yml Fri Aug 31 12:16:59 2018 +0100 +++ b/.travis.yml Fri Aug 31 13:41:27 2018 +0100 @@ -13,15 +13,15 @@ sources: - ubuntu-toolchain-r-test packages: - - libbz2-dev libfftw3-dev libfishsound1-dev libid3tag0-dev liblo-dev liblrdf0-dev libmad0-dev liboggz2-dev libpulse-dev libsamplerate-dev libsndfile-dev libsord-dev libxml2-utils portaudio19-dev qt5-default libqt5svg5-dev raptor-utils librubberband-dev autoconf libtool git mlton g++-4.9 + - libbz2-dev libfftw3-dev libfishsound1-dev libid3tag0-dev liblo-dev liblrdf0-dev libmad0-dev liboggz2-dev libpulse-dev libsamplerate-dev libsndfile-dev libsord-dev libxml2-utils portaudio19-dev qt5-default libqt5svg5-dev raptor-utils librubberband-dev autoconf libtool git mlton before_install: - if [[ "$TRAVIS_OS_NAME" = "osx" ]] ; then brew update ; fi - if [[ "$TRAVIS_OS_NAME" = "osx" ]] ; then brew install polyml ; fi - if [[ "$TRAVIS_OS_NAME" = "osx" ]] ; then brew install qt5 ; fi - if [[ "$TRAVIS_OS_NAME" = "osx" ]] ; then export PATH=$PATH:/usr/local/opt/qt5/bin ; fi - - if [[ "$TRAVIS_OS_NAME" = "linux" ]]; then for x in g++ gcc gcc-ar gcc-nm gcc-ranlib ; do sudo ln -sf /usr/bin/$x-4.9 /usr/bin/$x ; sudo ln -sf /usr/bin/x86_64-linux-gnu-gcc-$x-4.9 /usr/bin/x86_64-linux-gnu-gcc-$x ; done; fi - ( cd ../ ; git clone https://github.com/sandstorm-io/capnproto ) + - ( cd ../capnproto/ ; git checkout v0.6.0 ) - ( cd ../capnproto/c++ ; autoreconf -i ) - ( cd ../capnproto/c++ ; ./configure && make && sudo make install )
--- a/acinclude.m4 Fri Aug 31 12:16:59 2018 +0100 +++ b/acinclude.m4 Fri Aug 31 13:41:27 2018 +0100 @@ -261,3 +261,54 @@ fi ]) +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_compile_flag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILE_FLAG(FLAG, [ACTION-SUCCESS], [ACTION-FAILURE], [EXTRA-FLAGS], [INPUT]) +# +# DESCRIPTION +# +# Check whether the given FLAG works with the current language's compiler +# or gives an error. (Warnings, however, are ignored) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# If EXTRA-FLAGS is defined, it is added to the current language's default +# flags (e.g. CFLAGS) when the check is done. The check is thus made with +# the flags: "CFLAGS EXTRA-FLAGS FLAG". This can for example be used to +# force the compiler to issue an error when a bad flag is given. +# +# INPUT gives an alternative input source to AC_COMPILE_IFELSE. +# +# NOTE: Implementation based on AX_CFLAGS_GCC_OPTION. Please keep this +# macro in sync with AX_CHECK_{PREPROC,LINK}_FLAG. +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de> +# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com> +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +AC_DEFUN([AX_CHECK_COMPILE_FLAG], +[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF +AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl +AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [ + ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1" + AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])], + [AS_VAR_SET(CACHEVAR,[yes])], + [AS_VAR_SET(CACHEVAR,[no])]) + _AC_LANG_PREFIX[]FLAGS=$ax_check_save_flags]) +AS_VAR_IF(CACHEVAR,yes, + [m4_default([$2], :)], + [m4_default([$3], :)]) +AS_VAR_POPDEF([CACHEVAR])dnl +])dnl AX_CHECK_COMPILE_FLAGS
--- a/base.pri Fri Aug 31 12:16:59 2018 +0100 +++ b/base.pri Fri Aug 31 13:41:27 2018 +0100 @@ -31,5 +31,5 @@ # Defines for Dataquay DEFINES += USE_SORD -CONFIG += qt thread warn_on stl rtti exceptions c++14 +CONFIG += qt thread warn_on stl rtti exceptions
--- a/config.pri.in Fri Aug 31 12:16:59 2018 +0100 +++ b/config.pri.in Fri Aug 31 13:41:27 2018 +0100 @@ -13,6 +13,8 @@ QMAKE_CXXFLAGS += @CXXFLAGS@ QMAKE_LFLAGS += @LDFLAGS@ +CONFIG += @CXXSTANDARD@ + linux*:LIBS += -L$$PWD -lbase -lasound -ldl macx*:DEFINES += HAVE_COREAUDIO
--- a/configure Fri Aug 31 12:16:59 2018 +0100 +++ b/configure Fri Aug 31 13:41:27 2018 +0100 @@ -624,6 +624,7 @@ LIBOBJS QMAKE_CONFIG HAVES +CXXSTANDARD CXXFLAGS_MINIMAL CUT SHA1SUM @@ -4422,13 +4423,53 @@ CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS" CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS" CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" +CXXSTANDARD=c++14 if test "x$GCC" = "xyes"; then CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -O2 -Werror" CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math" CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" - LIBS_DEBUG="$LIBS -lubsan" + LIBS_DEBUG="$LIBS" + as_CACHEVAR=`$as_echo "ax_cv_check_cxxflags__--std=$CXXSTANDARD" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C++ compiler accepts --std=$CXXSTANDARD" >&5 +$as_echo_n "checking whether C++ compiler accepts --std=$CXXSTANDARD... " >&6; } +if eval \${$as_CACHEVAR+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_check_save_flags=$CXXFLAGS + CXXFLAGS="$CXXFLAGS --std=$CXXSTANDARD" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + eval "$as_CACHEVAR=yes" +else + eval "$as_CACHEVAR=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CXXFLAGS=$ax_check_save_flags +fi +eval ac_res=\$$as_CACHEVAR + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +if eval test \"x\$"$as_CACHEVAR"\" = x"yes"; then : + : +else + { $as_echo "$as_me:${as_lineno-$LINENO}: Compiler does not appear to support $CXXSTANDARD, falling back to c++11" >&5 +$as_echo "$as_me: Compiler does not appear to support $CXXSTANDARD, falling back to c++11" >&6;} + CXXSTANDARD=c++11 +fi + fi CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" @@ -7353,6 +7394,7 @@ + ac_config_files="$ac_config_files config.pri"
--- a/configure.ac Fri Aug 31 12:16:59 2018 +0100 +++ b/configure.ac Fri Aug 31 13:41:27 2018 +0100 @@ -51,13 +51,16 @@ CXXFLAGS_DEBUG="$AUTOCONF_CXXFLAGS" CXXFLAGS_RELEASE="$AUTOCONF_CXXFLAGS" CXXFLAGS_MINIMAL="$AUTOCONF_CXXFLAGS" +CXXSTANDARD=c++14 if test "x$GCC" = "xyes"; then CXXFLAGS_ANY="-fpic -Wall -Wextra -Woverloaded-virtual -Wformat-nonliteral -Wformat-security -Winit-self -Wswitch-enum -Wconversion -pipe" CXXFLAGS_DEBUG="$CXXFLAGS_ANY -g -O2 -Werror" CXXFLAGS_RELEASE="$CXXFLAGS_ANY -g0 -O3 -ffast-math" CXXFLAGS_MINIMAL="$CXXFLAGS_ANY -g0 -O0" - LIBS_DEBUG="$LIBS -lubsan" + LIBS_DEBUG="$LIBS" + AX_CHECK_COMPILE_FLAG(--std=$CXXSTANDARD, [], [AC_MSG_NOTICE([Compiler does not appear to support $CXXSTANDARD, falling back to c++11]) + CXXSTANDARD=c++11]) fi CXXFLAGS_BUILD="$CXXFLAGS_RELEASE" @@ -128,6 +131,7 @@ AC_SUBST(CFLAGS) AC_SUBST(CXXFLAGS) AC_SUBST(CXXFLAGS_MINIMAL) +AC_SUBST(CXXSTANDARD) AC_SUBST(LDFLAGS) AC_SUBST(HAVES) AC_SUBST(LIBS)
--- a/convert.pro Fri Aug 31 12:16:59 2018 +0100 +++ b/convert.pro Fri Aug 31 13:41:27 2018 +0100 @@ -1,7 +1,7 @@ TEMPLATE = app -CONFIG += stl exceptions console warn_on c++14 +CONFIG += stl exceptions console warn_on CONFIG -= qt
--- a/deploy/linux/docker/Dockerfile_appimage.in Fri Aug 31 12:16:59 2018 +0100 +++ b/deploy/linux/docker/Dockerfile_appimage.in Fri Aug 31 13:41:27 2018 +0100 @@ -40,16 +40,12 @@ # actually linking against it. We also have Pulse as the default I/O. RUN apt-add-repository -y ppa:beineri/opt-qt-5.10.1-trusty -RUN apt-add-repository -y ppa:ubuntu-toolchain-r/test RUN apt-get update && \ apt-get install -y \ - g++-4.9 \ qt510base \ qt510svg RUN apt-get clean && rm -rf /var/lib/apt/lists/* -RUN for x in g++ gcc gcc-ar gcc-nm gcc-ranlib ; do ln -sf /usr/bin/$x-4.9 /usr/bin/$x ; ln -sf /usr/bin/x86_64-linux-gnu-gcc-$x-4.9 /usr/bin/x86_64-linux-gnu-gcc-$x ; done - RUN locale-gen en_US.UTF-8 ENV LANG en_US.UTF-8 ENV LANGUAGE en_US:en @@ -59,7 +55,7 @@ RUN git clone https://github.com/sandstorm-io/capnproto WORKDIR capnproto -RUN git checkout v0.7.0 +RUN git checkout v0.6.0 WORKDIR c++ RUN autoreconf -i && ./configure && make -j3 && make install
--- a/noconfig.pri Fri Aug 31 12:16:59 2018 +0100 +++ b/noconfig.pri Fri Aug 31 13:41:27 2018 +0100 @@ -1,5 +1,5 @@ -CONFIG += release +CONFIG += release c++14 #CONFIG -= release #CONFIG += debug
--- a/platform-dataquay.pri Fri Aug 31 12:16:59 2018 +0100 +++ b/platform-dataquay.pri Fri Aug 31 13:41:27 2018 +0100 @@ -3,7 +3,11 @@ include(./config.pri) } -CONFIG += staticlib c++14 +!exists(config.pri) { + include(./noconfig.pri) +} + +CONFIG += staticlib DEFINES -= USE_REDLAND QMAKE_CXXFLAGS -= -I/usr/include/rasqal -I/usr/include/raptor2