Add Apple Silicon support
This commit is contained in:
parent
4d50c3db49
commit
5d27a6cb4b
@ -30,6 +30,8 @@ import os.path
|
|||||||
import sys
|
import sys
|
||||||
import io
|
import io
|
||||||
import tempfile
|
import tempfile
|
||||||
|
import platform
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import hashlib
|
import hashlib
|
||||||
HASHLIB = True
|
HASHLIB = True
|
||||||
@ -170,7 +172,13 @@ def getScytherBackend():
|
|||||||
elif "darwin" in sys.platform:
|
elif "darwin" in sys.platform:
|
||||||
|
|
||||||
""" OS X """
|
""" OS X """
|
||||||
scythername = "scyther-mac"
|
# Check if there is an ARM version available at scyther-mac-arm
|
||||||
|
# Otherwise, just fallback to the default scyther-mac which is the
|
||||||
|
# Intel version for backwards-compatibility reasons.
|
||||||
|
if platform.processor().startswith("arm"):
|
||||||
|
scythername = "scyther-mac-arm"
|
||||||
|
else:
|
||||||
|
scythername = "scyther-mac"
|
||||||
|
|
||||||
elif sys.platform.startswith('win'):
|
elif sys.platform.startswith('win'):
|
||||||
|
|
||||||
|
10
src/BuildMacArm.cmake
Normal file
10
src/BuildMacArm.cmake
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
################################################################
|
||||||
|
# Name: BuildMacArm.cmake
|
||||||
|
# Purpose: Build MacArm binary
|
||||||
|
# Author: Sam Jakob M.
|
||||||
|
################################################################
|
||||||
|
|
||||||
|
message (STATUS "Building Apple Mac ARM (Apple Silicon) version")
|
||||||
|
set (scythername "scyther-mac")
|
||||||
|
add_executable (${scythername} ${Scyther_sources})
|
||||||
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.15")
|
@ -7,5 +7,5 @@
|
|||||||
message (STATUS "Building Apple Mac Intel version")
|
message (STATUS "Building Apple Mac Intel version")
|
||||||
set (scythername "scyther-mac")
|
set (scythername "scyther-mac")
|
||||||
add_executable (${scythername} ${Scyther_sources})
|
add_executable (${scythername} ${Scyther_sources})
|
||||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6")
|
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mmacosx-version-min=10.6 -arch x86_64")
|
||||||
|
set (CMAKE_OSX_ARCHITECTURES "x86_64")
|
||||||
|
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
# Scyther project
|
# Scyther project
|
||||||
project (Scyther)
|
project (Scyther)
|
||||||
# I need 2.4 for flex/etc although it does not run yet
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.18)
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.4)
|
|
||||||
|
|
||||||
# Try clang
|
# Try clang
|
||||||
#set (CMAKE_C_COMPILER "clang")
|
#set (CMAKE_C_COMPILER "clang")
|
||||||
|
@ -18,9 +18,13 @@ if (WIN32)
|
|||||||
else (WIN32)
|
else (WIN32)
|
||||||
# Not windows, is it a mac?
|
# Not windows, is it a mac?
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
# TODO: A mac, but what architecture?
|
if(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64" AND NOT DEFINED ENV{ARCH})
|
||||||
# For now we assume intel
|
# If Apple and Arm64, set Source_OS to MacArm
|
||||||
set (Source_OS "MacIntel")
|
set(Source_OS "MacArm")
|
||||||
|
else(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64" AND NOT DEFINED ENV{ARCH})
|
||||||
|
# If not arm64, assume Intel for legacy reasons.
|
||||||
|
set(Source_OS "MacIntel")
|
||||||
|
endif(${CMAKE_HOST_SYSTEM_PROCESSOR} STREQUAL "arm64" AND NOT DEFINED ENV{ARCH})
|
||||||
else (APPLE)
|
else (APPLE)
|
||||||
# Not a mac, not windows
|
# Not a mac, not windows
|
||||||
if (UNIX)
|
if (UNIX)
|
||||||
|
18
src/build.sh
18
src/build.sh
@ -5,13 +5,19 @@
|
|||||||
|
|
||||||
# Different choice if on Darwin
|
# Different choice if on Darwin
|
||||||
PLATFORM=`uname`
|
PLATFORM=`uname`
|
||||||
echo $PLATFORM
|
echo "Platform: $PLATFORM"
|
||||||
if [ "$PLATFORM" = "Darwin" ]
|
|
||||||
then
|
if [ "$PLATFORM" = "Darwin" ]; then
|
||||||
./subbuild-mac-intel.sh
|
ARCH=`arch`
|
||||||
|
echo "Architecture: $ARCH"
|
||||||
|
|
||||||
|
if [ "$ARCH" = "arm64" ]; then
|
||||||
|
./subbuild-mac-arm.sh
|
||||||
|
else
|
||||||
|
./subbuild-mac-intel.sh
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
if [ "$PLATFORM" = "Linux" ]
|
if [ "$PLATFORM" = "Linux" ]; then
|
||||||
then
|
|
||||||
# Build linux version
|
# Build linux version
|
||||||
./subbuild-unix-unix.sh
|
./subbuild-unix-unix.sh
|
||||||
else
|
else
|
||||||
|
20
src/subbuild-mac-arm.sh
Normal file
20
src/subbuild-mac-arm.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# Default flags
|
||||||
|
CMFLAGS="-D CMAKE_BUILD_TYPE:STRING=Release"
|
||||||
|
|
||||||
|
# Make for intel
|
||||||
|
cmake $CMFLAGS -D TARGETOS=MacArm . && make scyther-mac
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo
|
||||||
|
echo "---------------------------------------------------------"
|
||||||
|
echo "Built the Mac ARM binary"
|
||||||
|
|
||||||
|
# Copy to the correct locations
|
||||||
|
cp scyther-mac ../gui/Scyther/scyther-mac-arm
|
||||||
|
|
||||||
|
echo Copied the files to their respective locations
|
||||||
|
echo "---------------------------------------------------------"
|
Loading…
Reference in New Issue
Block a user