Allow unix-like build under mingw

This commit is contained in:
Higor Eurípedes 2014-08-29 16:35:56 -03:00
parent dab2dbe8bf
commit 2703fa7f66
4 changed files with 83 additions and 9 deletions

View File

@ -139,6 +139,9 @@ endif
ifeq ($(HAVE_NETPLAY), 1)
OBJ += netplay.o
ifneq ($(findstring Win32,$(OS)),)
LIBS += -lws2_32
endif
endif
ifeq ($(HAVE_COMMAND), 1)
@ -240,6 +243,34 @@ ifeq ($(HAVE_SDL2), 1)
LIBS += $(SDL2_LIBS)
endif
ifeq ($(HAVE_D3D9), 1)
OBJ += gfx/d3d9/d3d.o gfx/d3d9/render_chain.o gfx/fonts/d3d_font.o gfx/fonts/d3d_w32_font.o gfx/context/d3d_ctx.o
DEFINES += -DHAVE_WIN32_D3D9
LIBS += -ld3d9 -ld3dx9 -ldxguid
endif
ifeq ($(HAVE_WINXINPUT), 1)
OBJ += input/winxinput_joypad.o
JOYCONFIG_OBJ += input/winxinput_joypad.o
endif
ifeq ($(HAVE_DINPUT), 1)
LIBS += -ldinput8 -ldxguid -lole32
OBJ += input/dinput.o
JOYCONFIG_LIBS += -ldinput8 -ldxguid -lole32
JOYCONFIG_OBJ += input/dinput.o
endif
ifeq ($(HAVE_XAUDIO), 1)
OBJ += audio/xaudio.o audio/xaudio-c/xaudio-c.o
LIBS += -lole32
endif
ifeq ($(HAVE_DSOUND), 1)
OBJ += audio/dsound.o
LIBS += -ldxguid -ldsound
endif
ifeq ($(HAVE_OMAP), 1)
OBJ += gfx/omap_gfx.o
endif
@ -310,6 +341,9 @@ ifeq ($(HAVE_OPENGL), 1)
OBJ += gfx/glsym/glsym_gl.o
ifeq ($(OSX), 1)
LIBS += -framework OpenGL
else ifneq ($(findstring Win32,$(OS)),)
LIBS += -lopengl32 -lgdi32 -lcomdlg32
OBJ += gfx/context/wgl_ctx.o gfx/context/win32_common.o
else
LIBS += -lGL
endif
@ -349,6 +383,9 @@ ifeq ($(HAVE_CG), 1)
LIBS += -framework Cg
else
LIBS += -lCg -lCgGL
ifeq ($(HAVE_D3D9),1)
LIBS += -lcgD3D9
endif
endif
endif
@ -437,11 +474,19 @@ ifeq ($(GL_DEBUG), 1)
endif
CFLAGS += -Wall $(OPTIMIZE_FLAG) $(INCLUDE_DIRS) $(DEBUG_FLAG) -I.
CXXFLAGS = -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
ifeq ($(CXX_BUILD), 1)
LINK = $(CXX)
CFLAGS += -std=c++0x -xc++ -D__STDC_CONSTANT_MACROS
CFLAGS += $(CXXFLAGS)
else
LINK = $(CC)
ifeq ($(findstring Win32,$(OS)),)
LINK = $(CC)
else
# directx-related code is c++
LINK = $(CXX)
endif
ifneq ($(GNU90_BUILD), 1)
ifneq ($(findstring icc,$(CC)),)
CFLAGS += -std=c99 -D_GNU_SOURCE
@ -460,7 +505,7 @@ endif
GIT_VERSION := $(shell git rev-parse --short HEAD 2>/dev/null)
ifneq ($(GIT_VERSION),)
DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION=\"$(GIT_VERSION)\"
DEFINES += -DHAVE_GIT_VERSION -DGIT_VERSION="\"$(GIT_VERSION)\""
OBJ += git_version.o
endif
@ -497,6 +542,11 @@ $(OBJDIR)/%.o: %.c config.h config.mk
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CFLAGS) $(DEFINES) -MMD -c -o $@ $<
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
.FORCE:
$(OBJDIR)/git_version.o: git_version.c .FORCE

View File

@ -20,7 +20,7 @@
#include <stddef.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "../config.h"
#endif
#ifndef HAVE_STRL

View File

@ -24,7 +24,7 @@ extern "C" {
#include "../boolean.h"
#ifdef HAVE_CONFIG_H
#include "config.h"
#include "../config.h"
#endif
enum state_tracker_type

View File

@ -22,6 +22,9 @@ elif [ "$OS" = 'Haiku' ]; then
CLIB=-lroot
PTHREADLIB=-lroot
SOCKETLIB=-lnetwork
elif [ "$OS" = 'Win32' ]; then
SOCKETLIB=-lws2_32
DYLIB=
fi
add_define_make DYLIB_LIB "$DYLIB"
@ -113,8 +116,13 @@ else
add_define_make MAN_DIR "${PREFIX}/share/man/man1"
fi
check_lib THREADS "$PTHREADLIB" pthread_create
check_lib DYLIB "$DYLIB" dlopen
if [ "$OS" = 'Win32' ]; then
HAVE_THREADS=yes
HAVE_DYLIB=yes
else
check_lib THREADS "$PTHREADLIB" pthread_create
check_lib DYLIB "$DYLIB" dlopen
fi
check_lib NETPLAY "$SOCKETLIB" socket
if [ "$HAVE_NETPLAY" = 'yes' ]; then
@ -177,6 +185,18 @@ if [ "$HAVE_SDL2" = 'yes' ]; then
fi
fi
if [ "$OS" = 'Win32' ]; then
check_lib DINPUT -ldinput8
check_lib D3D9 -ld3d9
check_lib DSOUND -ldsound
if [ "$HAVE_DINPUT" != 'no' ]; then
HAVE_WINXINPUT=yes
fi
HAVE_XAUDIO=yes
fi
if [ "$HAVE_OPENGL" != 'no' ] && [ "$HAVE_GLES" != 'yes' ]; then
if [ "$OS" = 'Darwin' ]; then
check_lib CG "-framework Cg" cgCreateContext
@ -205,7 +225,9 @@ else
HAVE_FFMPEG='no'
fi
check_lib DYNAMIC "$DYLIB" dlopen
if [ "$OS" != 'Win32' ]; then
check_lib DYNAMIC "$DYLIB" dlopen
fi
if [ "$HAVE_KMS" != "no" ]; then
check_pkgconf GBM gbm 9.0
@ -249,6 +271,8 @@ check_pkgconf V4L2 libv4l2
if [ "$OS" = 'Darwin' ]; then
check_lib FBO "-framework OpenGL" glFramebufferTexture2D
elif [ "$OS" = 'Win32' ]; then
HAVE_FBO=yes
else
if [ "$HAVE_GLES" = "yes" ]; then
[ $HAVE_FBO != "no" ] && HAVE_FBO=yes
@ -295,6 +319,6 @@ add_define_make OS "$OS"
# Creates config.mk and config.h.
add_define_make GLOBAL_CONFIG_DIR "$GLOBAL_CONFIG_DIR"
VARS="RGUI LAKKA ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL SDL2 OPENGL LIMA OMAP GLES GLES3 VG EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG LIBXML2 ZLIB DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE FREETYPE XKBCOMMON XVIDEO X11 XEXT XF86VM XINERAMA WAYLAND MALI_FBDEV VIVANTE_FBDEV NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO STRL STRCASESTR MMAP PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 BSV_MOVIE VIDEOCORE NEON FLOATHARD FLOATSOFTFP UDEV V4L2 AV_CHANNEL_LAYOUT"
VARS="RGUI LAKKA ALSA OSS OSS_BSD OSS_LIB AL RSOUND ROAR JACK COREAUDIO PULSE SDL SDL2 D3D9 DINPUT WINXINPUT DSOUND XAUDIO OPENGL LIMA OMAP GLES GLES3 VG EGL KMS GBM DRM DYLIB GETOPT_LONG THREADS CG LIBXML2 ZLIB DYNAMIC FFMPEG AVCODEC AVFORMAT AVUTIL SWSCALE FREETYPE XKBCOMMON XVIDEO X11 XEXT XF86VM XINERAMA WAYLAND MALI_FBDEV VIVANTE_FBDEV NETPLAY NETWORK_CMD STDIN_CMD COMMAND SOCKET_LEGACY FBO STRL STRCASESTR MMAP PYTHON FFMPEG_ALLOC_CONTEXT3 FFMPEG_AVCODEC_OPEN2 FFMPEG_AVIO_OPEN FFMPEG_AVFORMAT_WRITE_HEADER FFMPEG_AVFORMAT_NEW_STREAM FFMPEG_AVCODEC_ENCODE_AUDIO2 FFMPEG_AVCODEC_ENCODE_VIDEO2 BSV_MOVIE VIDEOCORE NEON FLOATHARD FLOATSOFTFP UDEV V4L2 AV_CHANNEL_LAYOUT"
create_config_make config.mk $VARS
create_config_header config.h $VARS