Allows C++ to be used in sources

Enable C++ compiler

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Frediano Ziglio 2015-08-29 05:35:46 +01:00 committed by Frediano Ziglio
parent bea4ad66b9
commit c4b4b967fb
5 changed files with 36 additions and 4 deletions

View File

@ -8,7 +8,7 @@ before_script:
glib2-devel pixman-devel alsa-lib-devel openssl-devel libjpeg-turbo-devel
libcacard-devel cyrus-sasl-devel lz4-devel opus-devel
gstreamer1-devel gstreamer1-plugins-base-devel
dconf
dconf gcc-c++ autoconf-archive
-y
- &protocol >
git clone ${CI_REPOSITORY_URL/spice.git/spice-protocol.git} &&
@ -31,6 +31,7 @@ makecheck:
- cd builddir
- >
CFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
CXXFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
LDFLAGS='-fsanitize=address -lasan'
../autogen.sh
- make
@ -40,6 +41,7 @@ meson-makecheck:
script:
- >
CFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
CXXFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
LDFLAGS='-fsanitize=address -lasan'
meson --buildtype=release --werror build || (cat build/meson-logs/meson-log.txt && exit 1)
- ninja -C build
@ -70,6 +72,7 @@ check-valgrind:
-y
- >
CFLAGS='-O2 -pipe -g -D_FORTIFY_SOURCE=0'
CXXFLAGS='-O2 -pipe -g -D_FORTIFY_SOURCE=0'
./autogen.sh --enable-valgrind --enable-extra-checks
- make
- make check-valgrind || (cat server/tests/test-suite-memcheck.log && exit 1)
@ -96,13 +99,14 @@ makecheck-centos:
libcacard-devel cyrus-sasl-devel lz4-devel
gstreamer1-devel gstreamer1-plugins-base-devel
git-core python3-pyparsing python3-six python3
meson
meson gcc-c++ autoconf-archive
-y
- *protocol
image: centos:latest
script:
- >
CFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
CXXFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
LDFLAGS='-fsanitize=address -lasan'
./autogen.sh
- make
@ -123,11 +127,13 @@ makecheck-debian32:
libjpeg-dev liblz4-dev libopus-dev libpixman-1-dev libsasl2-dev
libspice-protocol-dev libssl-dev pkg-config
python3-six python3-pyparsing liborc-0.4-dev meson git
g++ autoconf-archive
- *protocol
image: i386/debian:latest
script:
- >
CFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
CXXFLAGS='-O2 -pipe -g -fsanitize=address -fno-omit-frame-pointer -Wframe-larger-than=40920'
LDFLAGS='-fsanitize=address -lasan'
meson --buildtype=release --werror build || (cat build/meson-logs/meson-log.txt && exit 1)
- ninja -C build

View File

@ -48,6 +48,12 @@ AM_PROG_CC_C_O
AC_C_BIGENDIAN
PKG_PROG_PKG_CONFIG
AC_PROG_CXX
AC_LANG_PUSH([C++])
m4_ifndef([AX_CXX_COMPILE_STDCXX_11], [m4_fatal([Missing AX_CXX_COMPILE_STDCXX_11, install autoconf-archive])])
AX_CXX_COMPILE_STDCXX_11
AC_LANG_POP([C++])
AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h pthread_np.h])
AC_CHECK_DECL([TCP_KEEPIDLE], [have_tcp_keepidle="yes"],,
[#include <netinet/tcp.h>])
@ -318,6 +324,7 @@ AC_MSG_NOTICE([
prefix: ${prefix}
C compiler: ${CC}
C++ compiler: ${CXX}
LZ4 support: ${have_lz4}
Smartcard: ${have_smartcard}

View File

@ -1,7 +1,7 @@
#
# project definition
#
project('spice', 'c',
project('spice', 'c', 'cpp',
version : run_command('build-aux/git-version-gen', meson.source_root() + '/.tarball-version', check : true).stdout().strip(),
license : 'LGPLv2.1',
meson_version : '>= 0.48',
@ -44,6 +44,7 @@ spice_server_global_cflags = ['-DSPICE_SERVER_INTERNAL',
'-Wno-unused-parameter']
compiler = meson.get_compiler('c')
cxx_compiler = meson.get_compiler('cpp')
spice_server_config_data = configuration_data()
spice_server_include = [include_directories('.')]
spice_server_deps = [dependency('threads')]
@ -189,6 +190,10 @@ spice_server_global_cflags += ['-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_enc
add_project_arguments(compiler.get_supported_arguments(spice_server_global_cflags),
language : 'c')
spice_server_global_cxxflags = spice_server_global_cflags
add_project_arguments(cxx_compiler.get_supported_arguments(spice_server_global_cxxflags),
language : 'cpp')
#
# Subdirectories
#

View File

@ -21,10 +21,17 @@ AM_CPPFLAGS = \
$(GSTREAMER_1_0_CFLAGS) \
$(SSL_CFLAGS) \
$(VISIBILITY_HIDDEN_CFLAGS) \
$(WARN_CFLAGS) \
$(ORC_CFLAGS) \
$(NULL)
AM_CFLAGS = \
$(WARN_CFLAGS) \
$(NULL)
AM_CXXFLAGS = \
$(WARN_CXXFLAGS) \
$(NULL)
noinst_LTLIBRARIES = libserver.la
lib_LTLIBRARIES = libspice-server.la

View File

@ -22,9 +22,16 @@ AM_CPPFLAGS = \
$(GOBJECT2_CFLAGS) \
$(SMARTCARD_CFLAGS) \
$(SPICE_NONPKGCONFIG_CFLAGS) \
$(NULL)
AM_CFLAGS = \
$(WARN_CFLAGS) \
$(NULL)
AM_CXXFLAGS = \
$(WARN_CXXFLAGS) \
$(NULL)
noinst_LIBRARIES = libtest.a
libtest_a_SOURCES = \