Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for macosx-arm64 #23

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions common/cputypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -438,14 +438,11 @@
#define HAVE_POSIX_THREADS
#endif
#elif defined(__APPLE__)
#if defined(__arm64__)
#define CLIENT_OS_NAME "iOS"
#define CLIENT_OS OS_IOS
#define CLIENT_CPU CPU_ARM64
#elif defined(__arm__) || defined(ARM)
#define CLIENT_OS_NAME "iOS"
#define CLIENT_OS OS_IOS
#define CLIENT_CPU CPU_ARM
#if not defined(IS_ACTUALLY_OSX)
#if defined(__arm64__)
#define CLIENT_OS_NAME "iOS"
#define CLIENT_OS OS_IOS
#endif
#else
#define CLIENT_OS_NAME "Mac OS X"
#define CLIENT_OS OS_MACOSX
Expand All @@ -463,6 +460,10 @@
#define CLIENT_CPU CPU_X86
#elif defined(ASM_AMD64) || defined(__x86_64__) || defined(__amd64__)
#define CLIENT_CPU CPU_AMD64
#elif defined(__arm__) || defined(ARM)
#define CLIENT_CPU CPU_ARM
#elif defined(__arm64__)
#define CLIENT_CPU CPU_ARM64
#endif
#elif defined(__BEOS__) || defined(__be_os)
#ifndef __unix__ /* 4.4bsd compatible or not? */
Expand Down
1 change: 1 addition & 0 deletions common/lurk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ return "@(#)$Id: lurk.cpp,v 1.68 2008/12/30 20:58:41 andreasb Exp $"; }

//#define TRACE

#include <ctype.h> // required for mac os x
#include <stdio.h>
#include <string.h>
#include "cputypes.h"
Expand Down
17 changes: 16 additions & 1 deletion configure
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,11 @@ add_sources() # $1=os, $2=arch, $3=custom
elif [ "$2" = "arm64" ]; then
if [ "$HAVE_RC5_72" = "1" ]; then
DEFAULT_RC5_72="1"
TARGET_ADDASMS="$TARGET_ADDASMS rc5-72/arm64/r72-ks-scalarfusion.S"
if [ "$1" = "macosx" -o "$1" = "ios" ]; then
TARGET_ADDASMS="$TARGET_ADDASMS rc5-72/arm64/r72-ks-scalarfusion-clang.S"
else
TARGET_ADDASMS="$TARGET_ADDASMS rc5-72/arm64/r72-ks-scalarfusion.S"
fi
TARGET_ADDSRCS="$TARGET_ADDSRCS $OGR_GENERAL_SRCS rc5-72/arm64/r72-ks-scalarfusion.cpp"
fi # HAVE_RC5_72

Expand Down Expand Up @@ -1374,6 +1378,7 @@ OPTS_CLANGCC="-W -Wall -Wpointer-arith -Wcast-align \
-fno-exceptions -fno-rtti"
OPTS_CLANGCC_32="$OPTS_CLANGCC -DASM_X86"
OPTS_CLANGCC_64="$OPTS_CLANGCC -DASM_AMD64"
OPTS_CLANGCC_ARM64="$OPTS_CLANGCC"

# -------------------------------------------------------------------------

Expand Down Expand Up @@ -2929,6 +2934,16 @@ case "$1" in
add_sources "macosx" "x86"
;;

*macosx-arm64) # [ncommander] Mac OS X ARM64-bit
TARGET_plat="-arch arm64"
TARGET_CCFLAGS="$OPTS_CLANGCC_ARM64 -DIS_ACTUALLY_OSX -DHAVE_POSIX_THREADS $TARGET_plat"
TARGET_LIBS="-framework IOKit -framework CoreFoundation"
TARGET_LDFLAGS="$TARGET_plat"
TARGET_DOCFILES="docs/readme._ix" #platform specific docfile
TARGET_TARBALL="macosx-arm64"
add_sources "macosx" "arm64"
;;

*qnx4-x86)
TARGET_AS="cc -c"
TARGET_CC="cc"
Expand Down
4 changes: 2 additions & 2 deletions plat/macosx/temperature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static UInt32 _SMCread(UInt32 key, io_connect_t connection)
smc_input.key = key;
smc_input.cmd = SMC_READ_KEYINFO;

#if defined(__x86_64__)
#if defined(__x86_64__) or (__arm64__)
if (kIOReturnSuccess == IOConnectCallStructMethod(connection, 2,
&smc_input, input_size, &smc_output, &output_size)) {
#else
Expand All @@ -260,7 +260,7 @@ static UInt32 _SMCread(UInt32 key, io_connect_t connection)
if (smc_input.size == 0)
return 0; // Unknown key.

#if defined(__x86_64__)
#if defined(__x86_64__) or (__arm64__)
if (kIOReturnSuccess == IOConnectCallStructMethod(connection, 2,
&smc_input, input_size, &smc_output, &output_size)) {
#else
Expand Down
Loading