Merge pull request #169 from fmazur/Qt-macOS2-M1

Fix quirks preventing building on arm
This commit is contained in:
Garux
2024-02-10 16:25:46 +06:00
committed by GitHub
4 changed files with 16 additions and 59 deletions
+11 -5
View File
@@ -9,7 +9,7 @@ BUILD ?= release
OS ?= $(shell uname)
# or: Linux, Win32, Darwin
LDFLAGS ?=
CFLAGS ?=
CFLAGS ?= -fno-builtin-strrchr
CXXFLAGS ?=
CPPFLAGS ?=
LIBS ?=
@@ -76,6 +76,12 @@ LIBS_QTGUI ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt
CPPFLAGS_QTWIDGETS ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt5Widgets --cflags $(STDERR_TO_DEVNULL))
LIBS_QTWIDGETS ?= $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt5Widgets --libs-only-L $(STDERR_TO_DEVNULL)) \
$(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt5Widgets --libs-only-l $(STDERR_TO_DEVNULL))
ifeq ($(OS),Darwin)
LIBS_QTCORE = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt5Core --libs $(STDERR_TO_DEVNULL))
LIBS_QTGUI = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt5Gui --libs $(STDERR_TO_DEVNULL))
LIBS_QTWIDGETS = $(shell PKG_CONFIG_PATH=$(PKG_CONFIG_PATH) $(PKGCONFIG) Qt5Widgets --libs $(STDERR_TO_DEVNULL))
endif
CPPFLAGS_GL ?=
LIBS_GL ?= -lGL # -lopengl32 on Win32
CPPFLAGS_DL ?=
@@ -516,9 +522,9 @@ $(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA := -Wl,--stack,4194304
endif
endif
ifneq ($(OS),Win32)
$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA += -Wl,-rpath '-Wl,$$ORIGIN'
$(INSTALLDIR)/q3map2.$(EXE): LDFLAGS_EXTRA += -Wl,-rpath,@loader_path/.. -Wl,-rpath,@executable_path/..
endif
$(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_ZLIB) -lassimp_ -L$(INSTALLDIR)
$(INSTALLDIR)/q3map2.$(EXE): LIBS_EXTRA := $(LIBS_XML) $(LIBS_GLIB) $(LIBS_PNG) $(LIBS_JPEG) $(LIBS_ZLIB) -lassimp -L$(INSTALLDIR)
$(INSTALLDIR)/q3map2.$(EXE): CPPFLAGS_EXTRA := $(CPPFLAGS_XML) $(CPPFLAGS_GLIB) $(CPPFLAGS_PNG) $(CPPFLAGS_JPEG) -Itools/quake3/common -Ilibs -Iinclude -Ilibs/assimp/include
$(INSTALLDIR)/q3map2.$(EXE): \
tools/quake3/common/cmdlib.o \
@@ -1055,9 +1061,9 @@ $(INSTALLDIR)/modules/mapxml.$(DLL): \
plugins/mapxml/xmlwrite.o \
ifneq ($(OS),Win32)
$(INSTALLDIR)/modules/assmodel.$(DLL): LDFLAGS_EXTRA := -Wl,-rpath '-Wl,$$ORIGIN/..'
$(INSTALLDIR)/modules/assmodel.$(DLL): LDFLAGS_EXTRA := -Wl,-rpath,@loader_path/.. -Wl,-rpath,@executable_path/..
endif
$(INSTALLDIR)/modules/assmodel.$(DLL): LIBS_EXTRA := -lassimp_ -L$(INSTALLDIR)
$(INSTALLDIR)/modules/assmodel.$(DLL): LIBS_EXTRA := -lassimp -L$(INSTALLDIR)
$(INSTALLDIR)/modules/assmodel.$(DLL): CPPFLAGS_EXTRA := -Ilibs -Iinclude -Ilibs/assimp/include $(CPPFLAGS_QTGUI)
$(INSTALLDIR)/modules/assmodel.$(DLL): \
plugins/assmodel/mdlimage.o \
+2
View File
@@ -208,7 +208,9 @@ void GLSLProgram_validate( GLuint program ){
printProgramLog( program );
}
#ifndef __APPLE__ // hack: says 'Current draw framebuffer is invalid.' but works; Showing messagebox at this init point triggers Qt crash.
ASSERT_MESSAGE( validated, "program validation failed" );
#endif
}
bool g_bumpGLSLPass_enabled = false;
+3
View File
@@ -156,6 +156,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
#define idx64 1
#define ARCH_STRING "x86_64"
#define Q3_LITTLE_ENDIAN
#elif defined __aarch64__
#define ARCH_STRING "arm64"
#define Q3_LITTLE_ENDIAN
#endif
#define DLL_EXT ".dylib"
-54
View File
@@ -2496,7 +2496,6 @@ static const uLong crc_table[256] = {
/* =========================================================================
* This function can be used by asm versions of crc32()
*/
#ifndef __APPLE__
const uLong * get_crc_table()
{
#ifdef DYNAMIC_CRC_TABLE
@@ -2504,7 +2503,6 @@ const uLong * get_crc_table()
#endif
return (const uLong *)crc_table;
}
#endif
/* ========================================================================= */
#define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8);
@@ -2513,7 +2511,6 @@ const uLong * get_crc_table()
#define DO8(buf) DO4(buf); DO4(buf);
/* ========================================================================= */
#ifndef __APPLE__
uLong crc32(uLong crc, const Byte *buf, uInt len)
{
if (buf == Z_NULL) return 0L;
@@ -2532,7 +2529,6 @@ uLong crc32(uLong crc, const Byte *buf, uInt len)
} while (--len);
return crc ^ 0xffffffffL;
}
#endif
/* infblock.h -- header to use infblock.c
* Copyright (C) 1995-1998 Mark Adler
@@ -2813,7 +2809,6 @@ extern int inflate_flush OF((
*/
#ifndef __APPLE__
void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLong *c)
{
if (c != Z_NULL)
@@ -2830,9 +2825,7 @@ void inflate_blocks_reset(inflate_blocks_statef *s, z_streamp z, uLong *c)
z->adler = s->check = (*s->checkfn)(0L, (const Byte *)Z_NULL, 0);
Tracev(("inflate: blocks reset\n"));
}
#endif
#ifndef __APPLE__
inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w)
{
inflate_blocks_statef *s;
@@ -2859,9 +2852,7 @@ inflate_blocks_statef *inflate_blocks_new(z_streamp z, check_func c, uInt w)
inflate_blocks_reset(s, z, Z_NULL);
return s;
}
#endif
#ifndef __APPLE__
int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
{
uInt t; /* temporary storage */
@@ -3104,9 +3095,7 @@ int inflate_blocks(inflate_blocks_statef *s, z_streamp z, int r)
LEAVE
}
}
#endif
#ifndef __APPLE__
int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
{
inflate_blocks_reset(s, z, Z_NULL);
@@ -3116,26 +3105,21 @@ int inflate_blocks_free(inflate_blocks_statef *s, z_streamp z)
Tracev(("inflate: blocks freed\n"));
return Z_OK;
}
#endif
#ifndef __APPLE__
void inflate_set_dictionary(inflate_blocks_statef *s, const Byte *d, uInt n)
{
zmemcpy(s->window, d, n);
s->read = s->write = s->window + n;
}
#endif
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH.
* IN assertion: s != Z_NULL
*/
#ifndef __APPLE__
int inflate_blocks_sync_point(inflate_blocks_statef *s)
{
return s->mode == LENS;
}
#endif
/* And'ing with mask[n] masks the lower n bits */
uInt inflate_mask[17] = {
@@ -3145,7 +3129,6 @@ uInt inflate_mask[17] = {
};
/* copy as much as possible from the sliding window to the output area */
#ifndef __APPLE__
int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
{
uInt n;
@@ -3208,17 +3191,14 @@ int inflate_flush(inflate_blocks_statef *s, z_streamp z, int r)
/* done */
return r;
}
#endif
/* inftrees.c -- generate Huffman trees for efficient decoding
* Copyright (C) 1995-1998 Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/
#ifndef __APPLE__
const char inflate_copyright[] =
" inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
#endif
/*
If you use the zlib library in a product, an acknowledgment is welcome
@@ -3498,7 +3478,6 @@ static int huft_build(uInt *b, uInt n, uInt s, const uInt *d, const uInt *e, inf
}
#ifndef __APPLE__
int inflate_trees_bits(uInt *c, uInt *bb, inflate_huft * *tb, inflate_huft *hp, z_streamp z)
//uInt *c; /* 19 code lengths */
//uInt *bb; /* bits tree desired/actual depth */
@@ -3524,9 +3503,7 @@ int inflate_trees_bits(uInt *c, uInt *bb, inflate_huft * *tb, inflate_huft *hp,
ZFREE(z, v);
return r;
}
#endif
#ifndef __APPLE__
int inflate_trees_dynamic(uInt nl, uInt nd, uInt *c, uInt *bl, uInt *bd, inflate_huft * *tl, inflate_huft * *td, inflate_huft *hp, z_streamp z)
//uInt nl; /* number of literal/length codes */
//uInt nd; /* number of distance codes */
@@ -3589,7 +3566,6 @@ int inflate_trees_dynamic(uInt nl, uInt nd, uInt *c, uInt *bl, uInt *bd, inflate
ZFREE(z, v);
return Z_OK;
}
#endif
/* inffixed.h -- table for decoding fixed codes
* Generated automatically by the maketree.c program
@@ -3743,7 +3719,6 @@ static inflate_huft fixed_td[] = {
{{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577}
};
#ifndef __APPLE__
int inflate_trees_fixed(uInt *bl, uInt *bd, inflate_huft * *tl, inflate_huft * *td, z_streamp z)
//uInt *bl; /* literal desired/actual bit depth */
//uInt *bd; /* distance desired/actual bit depth */
@@ -3757,7 +3732,6 @@ int inflate_trees_fixed(uInt *bl, uInt *bd, inflate_huft * *tl, inflate_huft * *
*td = fixed_td;
return Z_OK;
}
#endif
/* simplify the use of the inflate_huft type with some defines */
#define exop word.what.Exop
@@ -3772,7 +3746,6 @@ int inflate_trees_fixed(uInt *bl, uInt *bd, inflate_huft * *tl, inflate_huft * *
at least ten. The ten bytes are six bytes for the longest length/
distance pair plus four bytes for overloading the bit buffer. */
#ifndef __APPLE__
int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_blocks_statef *s, z_streamp z)
{
inflate_huft *t; /* temporary pointer */
@@ -3911,7 +3884,6 @@ int inflate_fast(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, inflate_b
UPDATE
return Z_OK;
}
#endif
/* infcodes.c -- process literals and length/distance pairs
* Copyright (C) 1995-1998 Mark Adler
@@ -3963,7 +3935,6 @@ struct inflate_codes_state {
};
#ifndef __APPLE__
inflate_codes_statef *inflate_codes_new(uInt bl, uInt bd, inflate_huft *tl, inflate_huft *td, z_streamp z)
{
inflate_codes_statef *c;
@@ -3980,9 +3951,7 @@ inflate_codes_statef *inflate_codes_new(uInt bl, uInt bd, inflate_huft *tl, infl
}
return c;
}
#endif
#ifndef __APPLE__
int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
{
uInt j; /* temporary storage */
@@ -4148,15 +4117,12 @@ int inflate_codes(inflate_blocks_statef *s, z_streamp z, int r)
return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
#endif
}
#endif
#ifndef __APPLE__
void inflate_codes_free(inflate_codes_statef *c, z_streamp z)
{
ZFREE(z, c);
Tracev(("inflate: codes free\n"));
}
#endif
/* adler32.c -- compute the Adler-32 checksum of a data stream
* Copyright (C) 1995-1998 Mark Adler
@@ -4179,7 +4145,6 @@ void inflate_codes_free(inflate_codes_statef *c, z_streamp z)
#define DO16(buf) DO8(buf,0); DO8(buf,8);
/* ========================================================================= */
#ifndef __APPLE__
uLong adler32(uLong adler, const Byte *buf, uInt len)
{
unsigned long s1 = adler & 0xffff;
@@ -4205,7 +4170,6 @@ uLong adler32(uLong adler, const Byte *buf, uInt len)
}
return (s2 << 16) | s1;
}
#endif
/* infblock.h -- header to use infblock.c
@@ -4287,7 +4251,6 @@ struct internal_state {
};
#ifndef __APPLE__
int inflateReset(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL)
@@ -4299,9 +4262,7 @@ int inflateReset(z_streamp z)
Tracev(("inflate: reset\n"));
return Z_OK;
}
#endif
#ifndef __APPLE__
int inflateEnd(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL)
@@ -4313,9 +4274,7 @@ int inflateEnd(z_streamp z)
Tracev(("inflate: end\n"));
return Z_OK;
}
#endif
#ifndef __APPLE__
int inflateInit2_(z_streamp z, int w, const char *version, int stream_size)
{
if (version == Z_NULL || version[0] != ZLIB_VERSION[0] ||
@@ -4367,19 +4326,15 @@ int inflateInit2_(z_streamp z, int w, const char *version, int stream_size)
inflateReset(z);
return Z_OK;
}
#endif
#ifndef __APPLE__
int inflateInit_(z_streamp z, const char *version, int stream_size)
{
return inflateInit2_(z, DEF_WBITS, version, stream_size);
}
#endif
#define iNEEDBYTE {if(z->avail_in==0)return r;r=f;}
#define iNEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++)
#ifndef __APPLE__
int inflate(z_streamp z, int f)
{
int r;
@@ -4504,9 +4459,7 @@ int inflate(z_streamp z, int f)
return Z_STREAM_ERROR; /* Some dumb compilers complain without this */
#endif
}
#endif
#ifndef __APPLE__
int inflateSetDictionary(z_streamp z, const Byte *dictionary, uInt dictLength)
{
uInt length = dictLength;
@@ -4526,9 +4479,7 @@ int inflateSetDictionary(z_streamp z, const Byte *dictionary, uInt dictLength)
z->state->mode = imBLOCKS;
return Z_OK;
}
#endif
#ifndef __APPLE__
int inflateSync(z_streamp z)
{
uInt n; /* number of bytes to look at */
@@ -4577,7 +4528,6 @@ int inflateSync(z_streamp z)
z->state->mode = imBLOCKS;
return Z_OK;
}
#endif
/* Returns true if inflate is currently at the end of a block generated
* by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP
@@ -4586,16 +4536,13 @@ int inflateSync(z_streamp z)
* decompressing, PPP checks that at the end of input packet, inflate is
* waiting for these length bytes.
*/
#ifndef __APPLE__
int inflateSyncPoint(z_streamp z)
{
if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL)
return Z_STREAM_ERROR;
return inflate_blocks_sync_point(z->state->blocks);
}
#endif
#ifndef __APPLE__
voidp zcalloc (voidp opaque, unsigned items, unsigned size)
{
if (opaque) items += size - size; /* make compiler happy */
@@ -4607,4 +4554,3 @@ void zcfree (voidp opaque, voidp ptr)
free(ptr);
if (opaque) return; /* make compiler happy */
}
#endif