Skip to content

Commit

Permalink
build fixes: ffmpeg, xbrz, travis, C++ version
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rkitover committed Aug 31, 2019
1 parent 23224fb commit d9e4a08
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 45 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
23 changes: 13 additions & 10 deletions CMakeLists.txt
Expand Up @@ -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})
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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})
Expand Down Expand Up @@ -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)
Expand Down
31 changes: 1 addition & 30 deletions installdeps
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion src/filters/xBRZ/xbrz.cpp
Expand Up @@ -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
{
Expand Down

0 comments on commit d9e4a08

Please sign in to comment.