build fixes: ffmpeg, xbrz, travis, C++ version

Fix the cmake ffmpeg detection and make it not print the detection
messages twice.

Add `-D__STDC_FORMAT_MACROS` to compiler flags, some versions of ffmpeg
require this.

Redefine `static_assert(x)` to the `static_assert(x, msg)` form in
`xbrz.cpp`. This is a C++17 feature and some versions of gcc wrongly set
`__cpp_static_assert` even though they do not support it.

Also we want to stick to C++11 for the time being, until there is
consensus to support a newer a version.

For that reason, change the MSVC flag `/std:c++latest` to `/std:c++11`
as well.

Remove `-DENABLE_OPENAL=ON` and `-DENABLE_LINK=ON` from travis config,
as these are now automatic.

In `installdeps` remove the hacks for supporting the `https://` apt url
for mxe and use an `http://` url instead. This works perfectly on Ubuntu
14 (trusty).

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2019-08-31 22:58:59 +00:00
parent 23224fbaac
commit d9e4a0874d
No known key found for this signature in database
GPG Key ID: 08AB596679D86240
4 changed files with 21 additions and 45 deletions

View File

@ -16,7 +16,7 @@ matrix:
script:
- mkdir build
- cd build
- cmake .. -DENABLE_SDL=ON -DENABLE_OPENAL=ON
- cmake .. -DENABLE_SDL=ON
- make -j2
- xvfb-run ./visualboyadvance-m --help
cache:
@ -31,7 +31,7 @@ matrix:
script:
- mkdir build
- cd build
- /usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-cmake .. -DENABLE_SDL=ON -DENABLE_OPENAL=ON
- /usr/lib/mxe/usr/bin/x86_64-w64-mingw32.static-cmake .. -DENABLE_SDL=ON
- make -j2
cache:
directories:
@ -45,7 +45,7 @@ matrix:
script:
- mkdir build
- cd build
- /usr/lib/mxe/usr/bin/i686-w64-mingw32.static-cmake .. -DENABLE_SDL=ON -DENABLE_OPENAL=ON
- /usr/lib/mxe/usr/bin/i686-w64-mingw32.static-cmake .. -DENABLE_SDL=ON
- make -j2
cache:
directories:
@ -72,7 +72,7 @@ matrix:
script:
- mkdir build
- cd build
- cmake .. -DENABLE_SDL=ON -DENABLE_OPENAL=ON -DENABLE_LINK=ON
- cmake .. -DENABLE_SDL=ON
- make -j2
# - ./visualboyadvance-m.app/Contents/MacOS/visualboyadvance-m --help
cache:

View File

@ -121,17 +121,16 @@ set(FFMPEG_DEFAULT OFF)
find_package(PkgConfig)
if(PKGCONFIG_FOUND)
set(FFMPEG_DEFAULT ON)
set(FFMPEG_DEFAULT ON)
foreach(ffmpeg_lib libavcodec libavformat libswscale libavutil libswresample)
unset(FFMPEG_LIB)
pkg_check_modules(FFMPEG_LIB ${ffmpeg_lib})
foreach(ffmpeg_lib libavcodec libavformat libswscale libavutil libswresample)
pkg_check_modules(FFMPEG_LIB_${ffmpeg_lib} ${ffmpeg_lib} QUIET)
if(NOT FFMPEG_LIB_FOUND)
set(FFMPEG_DEFAULT OFF)
break()
endif()
endforeach()
if(NOT FFMPEG_LIB_${ffmpeg_lib}_FOUND)
set(FFMPEG_DEFAULT OFF)
break()
endif()
endforeach()
endif()
option(ENABLE_FFMPEG "Enable ffmpeg A/V recording" ${FFMPEG_DEFAULT})
@ -326,6 +325,8 @@ include(GNUInstallDirs)
add_definitions(-DHAVE_NETINET_IN_H -DHAVE_ARPA_INET_H -DHAVE_ZLIB_H -DFINAL_VERSION -DSDL -DUSE_OPENGL -DSYSCONF_INSTALL_DIR="${CMAKE_INSTALL_FULL_SYSCONFDIR}" -DWITH_LIRC=${WITHLIRC})
add_definitions(-DPKGDATADIR="${CMAKE_INSTALL_FULL_DATADIR}/vbam" -DPACKAGE=)
add_definitions(-D__STDC_FORMAT_MACROS)
if(ENABLE_LINK)
# IPC linking code needs sem_timedwait which can be either in librt or pthreads
if(NOT WIN32)
@ -557,6 +558,8 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
add_compile_options(${C_COMPILE_FLAG})
endforeach()
include(CheckCXXCompilerFlag)
set(MY_CXX_FLAGS -std=gnu++11 -fexceptions)
foreach(ARG ${MY_CXX_FLAGS})
@ -611,7 +614,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_C_LINK_EXECUTABLE "${CMAKE_C_LINK_EXECUTABLE} ${MY_C_LINKER_FLAGS_STR}")
set(CMAKE_CXX_LINK_EXECUTABLE "${CMAKE_CXX_LINK_EXECUTABLE} ${MY_C_LINKER_FLAGS_STR}")
elseif(MSVC)
add_compile_options(/std:c++latest)
add_compile_options(/std:c++11)
if(CMAKE_BUILD_TYPE STREQUAL Debug)
add_compile_options(/W4)

View File

@ -318,43 +318,14 @@ debian_installdeps() {
;;
esac
# if on the travis ubuntu trusty, add xenial sources for newer gnutls
# otherwise the mxe pkg server does not work
if [ -n "$TRAVIS" ]; then
if grep -q trusty /etc/apt/sources.list 2>/dev/null; then
sudo sh -c "sed 's/trusty/xenial/g' /etc/apt/sources.list > /etc/apt/sources.list.d/xenial.list"
fi
fi
sudo apt-get -qq -y update
curl_gnutls_lib=$(apt-cache search libcurl | grep -E '^libcurl[0-9]+-gnutls - ' | sed 's/ - .*//' | sort | tail -1)
sudo apt-get -qy install apt apt-transport-https ca-certificates $curl_gnutls_lib curl
# this is necessary to upgrade libcurl from trusty to xenial on travis
sudo apt-get -qy -f install
debian_rel=trusty
apt_ssl_exceptions=/etc/apt/apt.conf.d/80ssl-exceptions
if ! grep -Eq '(pkg|mirror)\.mxe\.cc' $apt_ssl_exceptions 2>/dev/null; then
sudo sh -c "cat >> $apt_ssl_exceptions" <<EOF
Acquire::https::pkg.mxe.cc::Verify-Peer "false";
Acquire::https::pkg.mxe.cc::Verify-Host "false";
Acquire::https::mirror.mxe.cc::Verify-Peer "false";
Acquire::https::mirror.mxe.cc::Verify-Host "false";
EOF
fi
mxe_apt_sources=/etc/apt/sources.list.d/mxeapt.list
sudo apt-get -qq -y update
if [ -z "$(apt-cache search '^mxe-source$')" ]; then
if [ ! -f "$mxe_apt_sources" ]; then
echo "deb https://pkg.mxe.cc/repos/apt $debian_rel main" | sudo -- sh -c "cat > $mxe_apt_sources"
echo "deb http://pkg.mxe.cc/repos/apt $debian_rel main" | sudo -- sh -c "cat > $mxe_apt_sources"
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C6BF758A33A3A276 || :
else
error "$mxe_apt_sources exists but mxe packages are not found in apt, either delete it or fix it"

View File

@ -21,8 +21,10 @@
#include <cmath> //std::sqrt
#include "xbrz_tools.h"
using namespace xbrz;
// some gcc versions lie about having this C++17 feature
#define static_assert(x) static_assert(x, "assertion failed")
using namespace xbrz;
namespace
{