diff --git a/build/autotools/m4/lol-conf.m4 b/build/autotools/m4/lol-conf.m4 index d4a8beaa..093b2043 100644 --- a/build/autotools/m4/lol-conf.m4 +++ b/build/autotools/m4/lol-conf.m4 @@ -1,7 +1,7 @@ dnl dnl Lol Engine dnl -dnl Copyright © 2010—2017 Sam Hocevar +dnl Copyright © 2010—2019 Sam Hocevar dnl dnl Lol Engine is free software. It comes without any warranty, to dnl the extent permitted by applicable law. You can redistribute it @@ -64,7 +64,6 @@ dnl dnl Activate some header-only libraries dnl -LOL_CFLAGS="$LOL_CFLAGS -I\$(lol_srcdir)/src/3rdparty/mingw-std-threads" LOL_CFLAGS="$LOL_CFLAGS -I\$(lol_srcdir)/src/3rdparty/pegtl/include" LOL_CFLAGS="$LOL_CFLAGS -I\$(lol_srcdir)/src/3rdparty/imgui" @@ -168,6 +167,8 @@ AM_CONDITIONAL(LOL_USE_GDIPLUS, test "${ac_cv_my_have_gdiplus}" = "yes") dnl Are we building using MinGW? LOL_TRY_CXXFLAGS(-mwindows -mwin32, [AM_CXXFLAGS="${AM_CXXFLAGS} -mwindows -mwin32" + LOL_CFLAGS="${LOL_CFLAGS} -I\$(lol_srcdir)/src/3rdparty/mingw-std-threads" + LOL_CFLAGS="${LOL_CFLAGS} -D__STDC_FORMAT_MACROS" LOL_LIBS="${LOL_LIBS} -uWinMain -u_WinMain@16"]) diff --git a/build/autotools/m4/lol-ffmpeg.m4 b/build/autotools/m4/lol-ffmpeg.m4 index 2a8a9b11..79771811 100644 --- a/build/autotools/m4/lol-ffmpeg.m4 +++ b/build/autotools/m4/lol-ffmpeg.m4 @@ -31,6 +31,7 @@ PKG_CHECK_MODULES([LIBAVCODEC], [libavcodec], [:], [ac_cv_my_have_ffmpeg=no]) PKG_CHECK_MODULES([LIBAVUTIL], [libavutil], [:], [ac_cv_my_have_ffmpeg=no]) PKG_CHECK_MODULES([LIBAVFORMAT], [libavformat], [:], [ac_cv_my_have_ffmpeg=no]) PKG_CHECK_MODULES([LIBSWSCALE], [libswscale], [:], [ac_cv_my_have_ffmpeg=no]) +LOL_FFMPEG_EXTRA_LIBS="" if test "${ac_cv_my_have_ffmpeg}" != "yes"; then ac_cv_my_have_ffmpeg="yes" AC_CHECK_HEADERS(libavcodec/avcodec.h, [:], [ac_cv_my_have_ffmpeg=no]) @@ -41,13 +42,21 @@ if test "${ac_cv_my_have_ffmpeg}" != "yes"; then LIBAVUTIL_LIBS="-lavutil" LIBAVFORMAT_LIBS="-lavformat" LIBSWSCALE_LIBS="-lswscale" - AC_CHECK_LIB(ws2_32, main, LOL_LIBS="${LOL_LIBS} -lws2_32") + LIBSWRESAMPLE_LIBS="-lswresample" + dnl Required by avformat/network.c + AC_CHECK_LIB(ws2_32, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lws2_32") + dnl Required by avformat/tls_schannel.c + AC_CHECK_LIB(secur32, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lsecur32") + dnl Required by avutil/random_seed.c + AC_CHECK_LIB(bcrypt, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lbcrypt") + dnl Required by avcodec/dxva2.c + AC_CHECK_LIB(ole32, main, LOL_FFMPEG_EXTRA_LIBS="${LOL_FFMPEG_EXTRA_LIBS} -lole32") fi fi if test "${ac_cv_my_have_ffmpeg}" = "yes"; then AC_DEFINE(LOL_USE_FFMPEG, 1, Define to 1 to use FFmpeg) LOL_CFLAGS="${LOL_CFLAGS} ${LIBAVFORMAT_CFLAGS} ${LIBAVUTIL_CFLAGS} ${LIBAVCODEC_CFLAGS} ${LIBSWSCALE_CFLAGS}" - LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVUTIL_LIBS} ${LIBAVCODEC_LIBS} ${LIBSWSCALE_LIBS}" + LOL_LIBS="${LOL_LIBS} ${LIBAVFORMAT_LIBS} ${LIBAVCODEC_LIBS} ${LIBAVUTIL_LIBS} ${LIBSWSCALE_LIBS} ${LIBSWRESAMPLE_LIBS} ${LOL_FFMPEG_EXTRA_LIBS}" fi ]) # LOL_AC_CHECK_FFMPEG_INNER diff --git a/build/lol-build b/build/lol-build index 84bff820..8258ac14 100755 --- a/build/lol-build +++ b/build/lol-build @@ -245,7 +245,7 @@ configure() CPPFLAGS="$CPPFLAGS -I$PWD/external/sdl-image-2.0.4/include" CPPFLAGS="$CPPFLAGS -I$PWD/external/sdl-mixer-2.0.4/include" CPPFLAGS="$CPPFLAGS -I$PWD/external/ffmpeg-20190130/include" - CPPFLAGS="$CPPFLAGS -I$PWD/external/glew-2.1.0/include/GL -DGLEW_STATIC" + CPPFLAGS="$CPPFLAGS -I$PWD/external/glew-2.1.0/include -DGLEW_STATIC" CPPFLAGS="$CPPFLAGS -I$PWD/external/gtk-2.22.1/lib/glib-2.0/include" CPPFLAGS="$CPPFLAGS -I$PWD/external/gtk-2.22.1/lib/gtk-2.0/include" CPPFLAGS="$CPPFLAGS -I$PWD/external/gtk-2.22.1/include/glib-2.0" diff --git a/doc/samples/sandbox/sample.cpp b/doc/samples/sandbox/sample.cpp index 13b31a4c..8fb497ce 100644 --- a/doc/samples/sandbox/sample.cpp +++ b/doc/samples/sandbox/sample.cpp @@ -18,7 +18,7 @@ using namespace lol; -int main() +int main(int, char **) { timer t; @@ -38,5 +38,7 @@ int main() printf("%d %d\n", (int)x, (int)y); printf("Time: %f s\n", t.get()); + + return EXIT_SUCCESS; } diff --git a/src/lol/base/features.h b/src/lol/base/features.h index b3561f05..d6aa9006 100644 --- a/src/lol/base/features.h +++ b/src/lol/base/features.h @@ -177,6 +177,17 @@ namespace lol } +// +// Ensure CreateFile2() is available on Mingw +// + +#if defined _WIN32 && !defined _MSC_VER && \ + (!defined _WIN32_WINNT || _WIN32_WINNT < 0x0602) +# undef _WIN32_WINNT +# define _WIN32_WINNT 0x0602 +#endif + + /* XXX: workaround for X11 headers that try to #define these */ #undef Always #define Always Always