Skip to content

Commit

Permalink
Fix build issues on Apple silicon M-series macs (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
mode80 authored Sep 29, 2024
1 parent aaee218 commit 756f76f
Show file tree
Hide file tree
Showing 9 changed files with 50 additions and 45 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,8 @@ Temporary
# cibuildwheel
wheelhouse
tests/test_cibuildwheel/tmp_dockerfiles

# build artifacts
*.cmake
Makefile
*.tmp
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif()

if(UNIX)
if(APPLE) # APPLE counts as a UNIX, so APPLE must come first
set(PYEXT_SUFFIX
".so"
CACHE STRING "Suffix for Python extension modules")
set(DYNLIB_SUFFIX
".so"
".dylib"
CACHE STRING "Suffix for dynamic libraries")
elseif(APPLE)
elseif(UNIX)
set(PYEXT_SUFFIX
".so"
CACHE STRING "Suffix for Python extension modules")
set(DYNLIB_SUFFIX
".dylib"
".so"
CACHE STRING "Suffix for dynamic libraries")
elseif(WIN32)
set(PYEXT_SUFFIX
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pip3 install -e .

**Build from source**
1. `pip install cmake wheel`
2. `brew install pkg-config lua@5.1 libzip qt5 capnp`
2. `brew install pkg-config lua@5.3 libzip qt@5 capnp`
3. `echo 'export PATH="/opt/homebrew/opt/qt@5/bin:$PATH"' >> ~/.zshrc`
4. `export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)`
5. `pip install -e .`
Expand Down
4 changes: 2 additions & 2 deletions cores/pce/mednafen/pce_fast/huc6280.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ uint8 *HuCPUFastMap[0x100];


#ifdef HUC6280_CRAZY_VERSION
#define LOAD_LOCALS_PC() register uint8 *PC_local = HuCPU.PC;
#define LOAD_LOCALS_PC() uint8 *PC_local = HuCPU.PC;
#else
#define LOAD_LOCALS_PC() register uint32 PC_local /*asm ("edi")*/ = HuCPU.PC; // asm ("edi") = HuCPU.PC;
#define LOAD_LOCALS_PC() uint32 PC_local /*asm ("edi")*/ = HuCPU.PC; // asm ("edi") = HuCPU.PC;
#endif

#define LOAD_LOCALS() \
Expand Down
4 changes: 2 additions & 2 deletions cores/snes/cpuexec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,8 @@ void S9xMainLoop (void)
if (CPU.Flags & SCAN_KEYS_FLAG)
break;

register uint8 Op;
register struct SOpcodes *Opcodes;
uint8 Op;
struct SOpcodes *Opcodes;

if (CPU.PCBase)
{
Expand Down
18 changes: 9 additions & 9 deletions cores/snes/gfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,12 @@ void S9xUpdateScreen (void)
// ignoring the true, larger size of the buffer.
GFX.RealPPL = GFX.Pitch >> 1;

for (register int32 y = (int32) GFX.StartY - 1; y >= 0; y--)
for (int32 y = (int32) GFX.StartY - 1; y >= 0; y--)
{
register uint16 *p = GFX.Screen + y * GFX.PPL + 255;
register uint16 *q = GFX.Screen + y * GFX.RealPPL + 510;
uint16 *p = GFX.Screen + y * GFX.PPL + 255;
uint16 *q = GFX.Screen + y * GFX.RealPPL + 510;

for (register int x = 255; x >= 0; x--, p--, q -= 2)
for (int x = 255; x >= 0; x--, p--, q -= 2)
*q = *(q + 1) = *p;
}

Expand All @@ -698,12 +698,12 @@ void S9xUpdateScreen (void)
#endif
{
// Have to back out of the regular speed hack
for (register uint32 y = 0; y < GFX.StartY; y++)
for (uint32 y = 0; y < GFX.StartY; y++)
{
register uint16 *p = GFX.Screen + y * GFX.PPL + 255;
register uint16 *q = GFX.Screen + y * GFX.PPL + 510;
uint16 *p = GFX.Screen + y * GFX.PPL + 255;
uint16 *q = GFX.Screen + y * GFX.PPL + 510;

for (register int x = 255; x >= 0; x--, p--, q -= 2)
for (int x = 255; x >= 0; x--, p--, q -= 2)
*q = *(q + 1) = *p;
}
}
Expand All @@ -719,7 +719,7 @@ void S9xUpdateScreen (void)
GFX.PPL = GFX.RealPPL << 1;
GFX.DoInterlace = 2;

for (register int32 y = (int32) GFX.StartY - 1; y >= 0; y--)
for (int32 y = (int32) GFX.StartY - 1; y >= 0; y--)
memmove(GFX.Screen + y * GFX.PPL, GFX.Screen + y * GFX.RealPPL, IPPU.RenderedScreenWidth * sizeof(uint16));
}
}
Expand Down
4 changes: 2 additions & 2 deletions cores/snes/sa1cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,8 @@ void S9xSA1MainLoop (void)
S9xSA1Trace();
#endif

register uint8 Op;
register struct SOpcodes *Opcodes;
uint8 Op;
struct SOpcodes *Opcodes;

if (SA1.PCBase)
{
Expand Down
50 changes: 25 additions & 25 deletions cores/snes/tile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -205,11 +205,11 @@ static uint8 hrbit_even[256];

void S9xInitTileRenderer (void)
{
register int i;
int i;

for (i = 0; i < 16; i++)
{
register uint32 b = 0;
uint32 b = 0;

#ifdef LSB_FIRST
if (i & 8)
Expand Down Expand Up @@ -237,8 +237,8 @@ void S9xInitTileRenderer (void)

for (i = 0; i < 256; i++)
{
register uint8 m = 0;
register uint8 s = 0;
uint8 m = 0;
uint8 s = 0;

if (i & 0x80)
s |= 8;
Expand Down Expand Up @@ -274,7 +274,7 @@ void S9xInitTileRenderer (void)

static uint8 ConvertTile2 (uint8 *pCache, uint32 TileAddr, uint32)
{
register uint8 *tp = &Memory.VRAM[TileAddr];
uint8 *tp = &Memory.VRAM[TileAddr];
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -283,7 +283,7 @@ static uint8 ConvertTile2 (uint8 *pCache, uint32 TileAddr, uint32)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand All @@ -297,7 +297,7 @@ static uint8 ConvertTile2 (uint8 *pCache, uint32 TileAddr, uint32)

static uint8 ConvertTile4 (uint8 *pCache, uint32 TileAddr, uint32)
{
register uint8 *tp = &Memory.VRAM[TileAddr];
uint8 *tp = &Memory.VRAM[TileAddr];
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -306,7 +306,7 @@ static uint8 ConvertTile4 (uint8 *pCache, uint32 TileAddr, uint32)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand All @@ -322,7 +322,7 @@ static uint8 ConvertTile4 (uint8 *pCache, uint32 TileAddr, uint32)

static uint8 ConvertTile8 (uint8 *pCache, uint32 TileAddr, uint32)
{
register uint8 *tp = &Memory.VRAM[TileAddr];
uint8 *tp = &Memory.VRAM[TileAddr];
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -331,7 +331,7 @@ static uint8 ConvertTile8 (uint8 *pCache, uint32 TileAddr, uint32)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand Down Expand Up @@ -359,7 +359,7 @@ static uint8 ConvertTile8 (uint8 *pCache, uint32 TileAddr, uint32)

static uint8 ConvertTile2h_odd (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
register uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -373,7 +373,7 @@ static uint8 ConvertTile2h_odd (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand All @@ -387,7 +387,7 @@ static uint8 ConvertTile2h_odd (uint8 *pCache, uint32 TileAddr, uint32 Tile)

static uint8 ConvertTile4h_odd (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
register uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -401,7 +401,7 @@ static uint8 ConvertTile4h_odd (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand All @@ -425,7 +425,7 @@ static uint8 ConvertTile4h_odd (uint8 *pCache, uint32 TileAddr, uint32 Tile)

static uint8 ConvertTile2h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
register uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -439,7 +439,7 @@ static uint8 ConvertTile2h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand All @@ -453,7 +453,7 @@ static uint8 ConvertTile2h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile)

static uint8 ConvertTile4h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
register uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint8 *tp1 = &Memory.VRAM[TileAddr], *tp2;
uint32 *p = (uint32 *) pCache;
uint32 non_zero = 0;
uint8 line;
Expand All @@ -467,7 +467,7 @@ static uint8 ConvertTile4h_even (uint8 *pCache, uint32 TileAddr, uint32 Tile)
{
uint32 p1 = 0;
uint32 p2 = 0;
register uint8 pix;
uint8 pix;

DOBIT( 0, 0);
DOBIT( 1, 1);
Expand Down Expand Up @@ -748,8 +748,8 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)

#define DRAW_TILE() \
uint8 *pCache; \
register int32 l; \
register uint8 *bp, Pix; \
int32 l; \
uint8 *bp, Pix; \
\
GET_CACHED_TILE(); \
if (IS_BLANK_TILE()) \
Expand Down Expand Up @@ -839,8 +839,8 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)

#define DRAW_TILE() \
uint8 *pCache; \
register int32 l; \
register uint8 *bp, Pix, w; \
int32 l; \
uint8 *bp, Pix, w; \
\
GET_CACHED_TILE(); \
if (IS_BLANK_TILE()) \
Expand Down Expand Up @@ -947,8 +947,8 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)

#define DRAW_TILE() \
uint8 *pCache; \
register int32 l, w; \
register uint8 Pix; \
int32 l, w; \
uint8 Pix; \
\
GET_CACHED_TILE(); \
if (IS_BLANK_TILE()) \
Expand Down Expand Up @@ -996,7 +996,7 @@ void S9xSelectTileConverter (int depth, bool8 hires, bool8 sub, bool8 mosaic)
#define Pix 0

#define DRAW_TILE() \
register uint32 l, x; \
uint32 l, x; \
\
GFX.RealScreenColors = IPPU.ScreenColors; \
GFX.ScreenColors = GFX.ClipColors ? BlackColourMap : GFX.RealScreenColors; \
Expand Down
Binary file modified retro/examples/best.bk2
Binary file not shown.

0 comments on commit 756f76f

Please sign in to comment.