more Mingw32 fixes

This commit is contained in:
Zhang
2007-07-27 11:19:35 -06:00
committed by Brian
parent 0fb0d9715c
commit 35f35294cd
8 changed files with 84 additions and 98 deletions

View File

@@ -91,9 +91,11 @@ Running the Build:
*******************This section is added by Heromyth***************************** ******This section is added by Heromyth <zxpmyth@yahoo.com.cn>*************
Updated on 2007-7-21, by Heromyth <zxpmyth@yahoo.com.cn>
====================
Updated on 2007-7-21
====================
Notice: Notice:
1) The generated DLLs are *not* compatible with the ones built 1) The generated DLLs are *not* compatible with the ones built
@@ -115,7 +117,7 @@ For example, run:
, and delete all the lines where all the wgl*() functions are. Because they would , and delete all the lines where all the wgl*() functions are. Because they would
be conflicted with the ones in <Mesa3D-root>\include\GL\mesa_wgl.h. be conflicted with the ones in <Mesa3D-root>\include\GL\mesa_wgl.h.
======= Conflicted Functions List ====== >>>>>>>>>> Conflicted Functions List >>>>>>>>>>
WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT); WINGDIAPI BOOL WINAPI wglCopyContext(HGLRC,HGLRC,UINT);
WINGDIAPI HGLRC WINAPI wglCreateContext(HDC); WINGDIAPI HGLRC WINAPI wglCreateContext(HDC);
WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int); WINGDIAPI HGLRC WINAPI wglCreateLayerContext(HDC,int);
@@ -134,6 +136,18 @@ WINGDIAPI BOOL WINAPI wglUseFontBitmapsA(HDC,DWORD,DWORD,DWORD);
WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD); WINGDIAPI BOOL WINAPI wglUseFontBitmapsW(HDC,DWORD,DWORD,DWORD);
WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); WINGDIAPI BOOL WINAPI wglUseFontOutlinesA(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT); WINGDIAPI BOOL WINAPI wglUseFontOutlinesW(HDC,DWORD,DWORD,DWORD,FLOAT,FLOAT,int,LPGLYPHMETRICSFLOAT);
=================== <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
====================
Updated on 2007-7-22
====================
I havn't thought that I would find a better way to solve my problems so soon.
I changed the method in which the import-libs and DLLs are made. After this update,
the DLLs of MESA are more optimized and more compatible.
It seems that there is no need to keep the building way of 'NO-STDCALL'.The
way of USING_STDCALL is so nice! The file <Mesa3D-root>\configs\config.mgw is
also not needed, and can be deleted safely!
********************************************************************************* *********************************************************************************

View File

@@ -58,11 +58,7 @@
# else /* for use with static link lib build of Win32 edition only */ # else /* for use with static link lib build of Win32 edition only */
# define GLAPI extern # define GLAPI extern
# endif /* _STATIC_MESA support */ # endif /* _STATIC_MESA support */
# if defined(__MINGW32__) && defined(GL_NO_STDCALL) /* The generated DLLs by MingW with STDCALL are not compatible with the ones done by Microsoft's compilers */ # define GLAPIENTRY __stdcall
# define GLAPIENTRY
# else
# define GLAPIENTRY __stdcall
# endif
#elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */ #elif defined(__CYGWIN__) && defined(USE_OPENGL32) /* use native windows opengl32 */
# define GLAPI extern # define GLAPI extern
# define GLAPIENTRY __stdcall # define GLAPIENTRY __stdcall

View File

@@ -112,7 +112,7 @@ extern _CRTIMP void __cdecl exit(int);
and redifinition of Windows system defs, also removes requirement of and redifinition of Windows system defs, also removes requirement of
pretty much any standard windows header from this file */ pretty much any standard windows header from this file */
#if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__) #if (_MSC_VER >= 800) || defined(__MINGW32__) || defined(_STDCALL_SUPPORTED) || defined(__CYGWIN32__)
# define GLUTAPIENTRY __stdcall # define GLUTAPIENTRY __stdcall
#else #else
# define GLUTAPIENTRY # define GLUTAPIENTRY

View File

@@ -81,8 +81,6 @@ WGLAPI int GLAPIENTRY wglChoosePixelFormat(HDC, const PIXELFORMATDESCRIPTOR *)
WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR); WGLAPI int GLAPIENTRY wglDescribePixelFormat(HDC,int, unsigned int, LPPIXELFORMATDESCRIPTOR);
WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc); WGLAPI int GLAPIENTRY wglGetPixelFormat(HDC hdc);
#if defined(GL_NO_STDCALL) || !defined(__MINGW32__)
WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int); WGLAPI int GLAPIENTRY wglCopyContext(HGLRC, HGLRC, unsigned int);
WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC); WGLAPI HGLRC GLAPIENTRY wglCreateContext(HDC);
WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int); WGLAPI HGLRC GLAPIENTRY wglCreateLayerContext(HDC,int);
@@ -101,7 +99,6 @@ WGLAPI int GLAPIENTRY wglUseFontBitmapsA(HDC, unsigned long, unsigned long, un
WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long); WGLAPI int GLAPIENTRY wglUseFontBitmapsW(HDC, unsigned long, unsigned long, unsigned long);
WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); WGLAPI int GLAPIENTRY wglUseFontOutlinesA(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT); WGLAPI int GLAPIENTRY wglUseFontOutlinesW(HDC, unsigned long, unsigned long, unsigned long, float,float, int, LPGLYPHMETRICSFLOAT);
#endif
#ifndef __MINGW32__ #ifndef __MINGW32__
WGLAPI int GLAPIENTRY SwapBuffers(HDC); WGLAPI int GLAPIENTRY SwapBuffers(HDC);

View File

@@ -53,14 +53,9 @@
TOP = ../.. TOP = ../..
include $(TOP)/configs/config.mgw
ALL_USING_STDCALL ?= 1
GL_USING_STDCALL ?= 1
GLUT_USING_STDCALL ?= 1
CC = mingw32-gcc CC = mingw32-gcc
CFLAGS = -Wall -pedantic CFLAGS = -Wall -pedantic
CFLAGS += -O2 -ffast-math CFLAGS += -O2 -ffast-math -D_DLL
CFLAGS += -I$(TOP)/include -I../util CFLAGS += -I$(TOP)/include -I../util
ifeq ($(FX),1) ifeq ($(FX),1)
CFLAGS += -DFX CFLAGS += -DFX
@@ -68,17 +63,6 @@ endif
CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK CFLAGS += -DGLUT_DISABLE_ATEXIT_HACK
ifeq ($(GL_USING_STDCALL),0)
CFLAGS += -DGL_NO_STDCALL
endif
ifeq ($(GLUT_USING_STDCALL),1)
CFLAGS += -D_STDCALL_SUPPORTED
else
CFLAGS += -DGLUT_NO_STDCALL
endif
LD = mingw32-g++ LD = mingw32-g++
LDFLAGS = -s -L$(TOP)/lib LDFLAGS = -s -L$(TOP)/lib
@@ -87,7 +71,8 @@ LDLIBS = -lglut32 -lglu32 -lopengl32
.c.o: .c.o:
$(CC) -o $@ $(CFLAGS) -c $< $(CC) -o $@ $(CFLAGS) -c $<
%.exe: ../util/readtex.o ../util/showbuffer.o %.o %.exe: ../util/readtex.o ../util/showbuffer.o %.o
$(LD) -o $@ $(LDFLAGS) $^ $(LDLIBS) $(LD) -o $@ $(LDFLAGS) $(LDLIBS) $^
all: all:
$(error Must specify <filename.exe> to build) $(error Must specify <filename.exe> to build)

View File

@@ -70,30 +70,31 @@
TOOLS_PREFIX = mingw32- TOOLS_PREFIX = mingw32-
TOP = ../../.. TOP = ../../..
LIBDIR = $(TOP)/lib LIBDIR = $(TOP)/lib
GLU_DLL = glu32.dll LIB_NAME = glu32
GLU_IMP = libglu32.a DLL_EXT = .dll
GLU_DEF = glu.def IMP_EXT = .a
LIB_PRE = lib
STRIP = -s
include $(TOP)/configs/config.mgw AR = ar
GL_USING_STDCALL ?= 1 ARFLAGS = crus
DLLTOOL = dlltool
GLU_DLL = $(LIB_NAME)$(DLL_EXT)
GLU_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
GLU_DEF = $(LIB_NAME).def
LDLIBS = -L$(LIBDIR) -lopengl32 LDLIBS = -L$(LIBDIR) -lopengl32
LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLU_IMP) -Wl,--output-def=$(LIBDIR)/$(GLU_DEF) LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CFLAGS += -DBUILD_GLU32 -D_DLL CFLAGS += -DBUILD_GLU32 -D_DLL
ifeq ($(GL_USING_STDCALL),1)
LDFLAGS += -Wl,--add-stdcall-alias
else
CFLAGS += -DGL_NO_STDCALL
endif
CC = gcc CC = $(TOOLS_PREFIX)gcc
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include -Iinclude
CXX = g++ CXX = $(TOOLS_PREFIX)g++
CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess CXXFLAGS = $(CFLAGS) -Ilibnurbs/internals -Ilibnurbs/interface -Ilibnurbs/nurbtess
AR = ar AR = ar
@@ -216,9 +217,9 @@ $(LIBDIR):
mkdir -p $(LIBDIR) mkdir -p $(LIBDIR)
$(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS) $(LIBDIR)/$(GLU_DLL) $(LIBDIR)/$(GLU_IMP): $(OBJECTS)
g++ -shared -fPIC -o $(LIBDIR)/$(GLU_DLL) $(LDFLAGS) \ $(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLU_DLL) $^ $(LDLIBS)
$^ $(LDLIBS) $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLU_DEF) $^
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLU_IMP) --def $(LIBDIR)/$(GLU_DEF)
clean: clean:

View File

@@ -74,35 +74,29 @@ TOP = ../../..
LIBDIR = $(TOP)/lib LIBDIR = $(TOP)/lib
GLUT_DLL = glut32.dll LIB_NAME = glut32
GLUT_IMP = libglut32.a
GLUT_DEF = glut.def
include $(TOP)/configs/config.mgw DLL_EXT = .dll
GLUT_USING_STDCALL ?= 1 IMP_EXT = .a
LIB_PRE = lib
STRIP = -s
AR = ar
ARFLAGS = crus
DLLTOOL = dlltool
GLUT_DLL = $(LIB_NAME)$(DLL_EXT)
GLUT_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
GLUT_DEF = $(LIB_NAME).def
LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32 LDLIBS = -L$(LIBDIR) -lwinmm -lgdi32 -luser32 -lopengl32 -lglu32
LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GLUT_IMP) -Wl,--output-def=$(LIBDIR)/$(GLUT_DEF) LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL CFLAGS += -DBUILD_GLUT32 -DGLUT_BUILDING_LIB -DMESA -D_DLL
ifeq ($(GL_USING_STDCALL),0)
CFLAGS += -DGL_NO_STDCALL
endif
ifeq ($(GLUT_USING_STDCALL),1)
CFLAGS += -D_STDCALL_SUPPORTED
LDFLAGS += -Wl,--add-stdcall-alias
else
CFLAGS += -DGLUT_NO_STDCALL
endif
CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include CFLAGS += -DNDEBUG -DLIBRARYBUILD -I$(TOP)/include
CC = gcc CC = $(TOOLS_PREFIX)gcc
CXX = g++ CXX = $(TOOLS_PREFIX)g++
CXXFLAGS = $(CFLAGS) CXXFLAGS = $(CFLAGS)
AR = ar AR = ar
@@ -189,10 +183,9 @@ $(LIBDIR):
mkdir -p $(LIBDIR) mkdir -p $(LIBDIR)
$(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS) $(LIBDIR)/$(GLUT_DLL) $(LIBDIR)/$(GLUT_IMP): $(OBJECTS)
$(CXX) -shared -fPIC -o $(LIBDIR)/$(GLUT_DLL) $(LDFLAGS) \ $(CXX) $(LDFLAGS) -o $(LIBDIR)/$(GLUT_DLL) $^ $(LDLIBS)
$^ $(LDLIBS) $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GLUT_DEF) $^
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GLUT_IMP) --def $(LIBDIR)/$(GLUT_DEF)
clean: clean:
-$(call UNLINK,*.o) -$(call UNLINK,*.o)

View File

@@ -69,39 +69,37 @@
# Set this to the prefix of your build tools, i.e. mingw32- # Set this to the prefix of your build tools, i.e. mingw32-
TOOLS_PREFIX = mingw32- TOOLS_PREFIX = mingw32-
ifeq ($(ICD),1)
LIB_NAME = mesa32
else
LIB_NAME = opengl32
endif
DLL_EXT = .dll
IMP_EXT = .a
LIB_PRE = lib
STRIP = -s
AR = ar
ARFLAGS = crus
DLLTOOL = dlltool
TOP = ../.. TOP = ../..
GLIDE ?= $(TOP)/glide3 GLIDE ?= $(TOP)/glide3
LIBDIR = $(TOP)/lib LIBDIR = $(TOP)/lib
ifeq ($(ICD),1)
GL_DLL = mesa32.dll
GL_IMP = libmesa32.a
else
GL_DLL = opengl32.dll
GL_IMP = libopengl32.a
endif
GL_DEF = gl.def GL_DLL = $(LIB_NAME)$(DLL_EXT)
GL_IMP = $(LIB_PRE)$(LIB_NAME)$(IMP_EXT)
include $(TOP)/configs/config.mgw
GL_USING_STDCALL ?= 1
MESA_LIB = libmesa.a MESA_LIB = libmesa.a
CC = $(TOOLS_PREFIX)gcc
LDLIBS = -lgdi32 -luser32 -liberty LDLIBS = -lgdi32 -luser32 -liberty
LDFLAGS = -Wl,--out-implib=$(LIBDIR)/$(GL_IMP) -Wl,--output-def=$(LIBDIR)/gl.def LDFLAGS = $(STRIP) -shared -fPIC -Wl,--kill-at
CC = $(TOOLS_PREFIX)gcc CFLAGS += -DBUILD_GL32 -D_DLL -DMESA_MINWARN
CFLAGS += -DBUILD_GL32 -D_OPENGL32_ -D_DLL -DMESA_MINWARN -DNDEBUG -D_USRDLL -DGDI_EXPORTS CFLAGS += -DNDEBUG -DUSE_EXTERNAL_DXTN_LIB=1
ifeq ($(GL_USING_STDCALL),1)
LDFLAGS += -Wl,--add-stdcall-alias
else
CFLAGS += -DGL_NO_STDCALL
endif
CFLAGS += -DUSE_EXTERNAL_DXTN_LIB=1
ifeq ($(FX),1) ifeq ($(FX),1)
CFLAGS += -I$(GLIDE)/include -DFX CFLAGS += -I$(GLIDE)/include -DFX
LDLIBS += -L$(GLIDE)/lib -lglide3x LDLIBS += -L$(GLIDE)/lib -lglide3x
@@ -112,12 +110,11 @@ else
CFLAGS += -DUSE_MGL_NAMESPACE CFLAGS += -DUSE_MGL_NAMESPACE
GL_DEF = drivers/windows/icd/mesa.def GL_DEF = drivers/windows/icd/mesa.def
else else
GL_DEF = drivers/windows/gdi/mesa.def GL_DEF = $(LIB_NAME).def
endif endif
endif endif
AR = ar
ARFLAGS = crus
UNLINK = del $(subst /,\,$(1)) UNLINK = del $(subst /,\,$(1))
ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),) ifneq ($(wildcard $(addsuffix /rm.exe,$(subst ;, ,$(PATH)))),)
@@ -173,14 +170,17 @@ RESOURCE = $(GL_RES:.rc=.res)
.rc.res: .rc.res:
windres -o $@ -Irc -Ocoff $< windres -o $@ -Irc -Ocoff $<
all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP) all: $(LIBDIR) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP)
$(LIBDIR): $(LIBDIR):
mkdir -p $(LIBDIR) mkdir -p $(LIBDIR)
$(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE) $(LIBDIR)/$(GL_DLL) $(LIBDIR)/$(GL_IMP): $(OBJECTS) $(RESOURCE)
$(CC) -shared -fPIC -o $(LIBDIR)/$(GL_DLL) $(LDFLAGS) \ $(CC) $(LDFLAGS) -o $(LIBDIR)/$(GL_DLL) $^ $(LDLIBS)
$^ $(LDLIBS) $(DLLTOOL) --as=as --dllname $(LIB_NAME) --output-def $(LIBDIR)/$(GL_DEF) $^
$(DLLTOOL) --as=as -k --dllname $(LIB_NAME) --output-lib $(LIBDIR)/$(GL_IMP) --def $(LIBDIR)/$(GL_DEF)
$(X86_OBJECTS): x86/matypes.h $(X86_OBJECTS): x86/matypes.h