Преглед изворни кода

build: fix the mingw cross compilation.

legacy
Sam Hocevar пре 5 година
родитељ
комит
9c13aabe98
5 измењених фајлова са 29 додато и 6 уклоњено
  1. +3
    -2
      build/autotools/m4/lol-conf.m4
  2. +11
    -2
      build/autotools/m4/lol-ffmpeg.m4
  3. +1
    -1
      build/lol-build
  4. +3
    -1
      doc/samples/sandbox/sample.cpp
  5. +11
    -0
      src/lol/base/features.h

+ 3
- 2
build/autotools/m4/lol-conf.m4 Прегледај датотеку

@@ -1,7 +1,7 @@
dnl
dnl Lol Engine
dnl
dnl Copyright © 2010—2017 Sam Hocevar <sam@hocevar.net>
dnl Copyright © 2010—2019 Sam Hocevar <sam@hocevar.net>
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"])




+ 11
- 2
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


+ 1
- 1
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"


+ 3
- 1
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;
}


+ 11
- 0
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


Loading…
Откажи
Сачувај