mirror of
https://github.com/open-goal/jak-project.git
synced 2024-11-23 06:09:57 +00:00
Create separate x86_64 and ARM64 macOS targets. (#3760)
Some checks failed
Update Controller Database / update-controller-db (push) Has been cancelled
Some checks failed
Update Controller Database / update-controller-db (push) Has been cancelled
Create explicit x86_64 and ARM64 macOS build targets, so it's clear that the CI is building x86_64 binaries (on both Intel and ARM64 build machines). Also, use the `CMAKE_APPLE_SILICON_PROCESSOR` CMake variable (which sets `CMAKE_SYSTEM_PROCESSOR`) so `BUILD_X86_ON_MACOS` is not necessary. And update the README.
This commit is contained in:
parent
24ad5515f8
commit
8f445bda3e
4
.github/workflows/build-matrix.yaml
vendored
4
.github/workflows/build-matrix.yaml
vendored
@ -49,12 +49,12 @@ jobs:
|
|||||||
name: "🍎 MacOS"
|
name: "🍎 MacOS"
|
||||||
uses: ./.github/workflows/macos-build.yaml
|
uses: ./.github/workflows/macos-build.yaml
|
||||||
with:
|
with:
|
||||||
cmakePreset: "Release-macos-clang"
|
cmakePreset: "Release-macos-x86_64-clang"
|
||||||
cachePrefix: ""
|
cachePrefix: ""
|
||||||
|
|
||||||
build_macos_arm:
|
build_macos_arm:
|
||||||
name: "🍎 MacOS"
|
name: "🍎 MacOS"
|
||||||
uses: ./.github/workflows/macos-build-arm.yaml
|
uses: ./.github/workflows/macos-build-arm.yaml
|
||||||
with:
|
with:
|
||||||
cmakePreset: "Release-macos-rosetta-clang"
|
cmakePreset: "Release-macos-x86_64-clang"
|
||||||
cachePrefix: ""
|
cachePrefix: ""
|
||||||
|
4
.github/workflows/release-pipeline.yaml
vendored
4
.github/workflows/release-pipeline.yaml
vendored
@ -74,7 +74,7 @@ jobs:
|
|||||||
name: "🍎 MacOS"
|
name: "🍎 MacOS"
|
||||||
uses: ./.github/workflows/macos-build.yaml
|
uses: ./.github/workflows/macos-build.yaml
|
||||||
with:
|
with:
|
||||||
cmakePreset: "Release-macos-clang-static"
|
cmakePreset: "Release-macos-x86_64-clang-static"
|
||||||
cachePrefix: "static"
|
cachePrefix: "static"
|
||||||
uploadArtifacts: true
|
uploadArtifacts: true
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
@ -85,7 +85,7 @@ jobs:
|
|||||||
name: "🍎 MacOS"
|
name: "🍎 MacOS"
|
||||||
uses: ./.github/workflows/macos-build.yaml
|
uses: ./.github/workflows/macos-build.yaml
|
||||||
with:
|
with:
|
||||||
cmakePreset: "Release-macos-rosetta-clang-static"
|
cmakePreset: "Release-macos-x86_64-clang-static"
|
||||||
cachePrefix: "static"
|
cachePrefix: "static"
|
||||||
uploadArtifacts: true
|
uploadArtifacts: true
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
@ -6,9 +6,6 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
project(jak)
|
project(jak)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
|
|
||||||
# Options
|
|
||||||
option(BUILD_X86_ON_MACOS "Builds the project for macOS for Rosetta 2" OFF)
|
|
||||||
|
|
||||||
# Include third-party modules
|
# Include third-party modules
|
||||||
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/third-party/cmake/modules/)
|
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/third-party/cmake/modules/)
|
||||||
|
|
||||||
@ -127,11 +124,7 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
|
|||||||
|
|
||||||
# pin to AVX for macOS, hopefully all macOS runners have atleast this architecture
|
# pin to AVX for macOS, hopefully all macOS runners have atleast this architecture
|
||||||
# technically speaking, SSE4 is the cutoff for Apple Silicon so...only a matter of time!
|
# technically speaking, SSE4 is the cutoff for Apple Silicon so...only a matter of time!
|
||||||
if (BUILD_X86_ON_MACOS)
|
if(NOT CMAKE_CXX_COMPILER_TARGET STREQUAL "arm64-apple-darwin")
|
||||||
message("Targetting x86 on macOS via Rosetta 2 (requires Sequoia)")
|
|
||||||
set(CMAKE_OSX_ARCHITECTURES "x86_64")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
|
|
||||||
elseif(NOT CMAKE_CXX_COMPILER_TARGET STREQUAL "arm64-apple-darwin")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -78,6 +78,22 @@
|
|||||||
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}"
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/build/install/${presetName}"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "base-macos-arm64",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_APPLE_SILICON_PROCESSOR": "arm64",
|
||||||
|
"CMAKE_OSX_ARCHITECTURES": "arm64"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "base-macos-x86_64",
|
||||||
|
"hidden": true,
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_APPLE_SILICON_PROCESSOR": "x86_64",
|
||||||
|
"CMAKE_OSX_ARCHITECTURES": "x86_64"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "base-clang",
|
"name": "base-clang",
|
||||||
"hidden": true,
|
"hidden": true,
|
||||||
@ -159,37 +175,33 @@
|
|||||||
"inherits": ["base-linux-release", "base-clang"]
|
"inherits": ["base-linux-release", "base-clang"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Release-macos-clang",
|
"name": "Release-macos-arm64-clang",
|
||||||
"displayName": "MacOS Release (clang)",
|
"displayName": "MacOS ARM64 Release (clang)",
|
||||||
"description": "Build with Clang as Release without Debug Symbols",
|
"description": "Build for ARM64 with Clang as Release without Debug Symbols",
|
||||||
"inherits": ["base-macos-release", "base-clang"]
|
"inherits": ["base-macos-release", "base-macos-arm64", "base-clang"]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Release-macos-rosetta-clang",
|
"name": "Release-macos-x86_64-clang",
|
||||||
"displayName": "MacOS Release Rosetta (clang)",
|
"displayName": "MacOS x86_64 Release (clang)",
|
||||||
"description": "Build with Clang as Release without Debug Symbols",
|
"description": "Build for x86_64 with Clang as Release without Debug Symbols",
|
||||||
"inherits": ["base-macos-release", "base-clang"],
|
"inherits": ["base-macos-release", "base-macos-x86_64", "base-clang"]
|
||||||
"cacheVariables": {
|
|
||||||
"BUILD_X86_ON_MACOS": "ON"
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Release-macos-clang-static",
|
"name": "Release-macos-arm64-clang-static",
|
||||||
"displayName": "MacOS Static Release (clang)",
|
"displayName": "MacOS ARM64 Static Release (clang)",
|
||||||
"description": "Build with Clang as Release without Debug Symbols but statically linked",
|
"description": "Build for ARM64 with Clang as Release without Debug Symbols but statically linked",
|
||||||
"inherits": ["base-macos-release", "base-clang"],
|
"inherits": ["base-macos-release", "base-macos-arm64", "base-clang"],
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"STATICALLY_LINK": "true",
|
"STATICALLY_LINK": "true",
|
||||||
"ZYDIS_BUILD_SHARED_LIB": "OFF"
|
"ZYDIS_BUILD_SHARED_LIB": "OFF"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Release-macos-rosetta-clang-static",
|
"name": "Release-macos-x86_64-clang-static",
|
||||||
"displayName": "MacOS Rosetta Static Release (clang)",
|
"displayName": "MacOS x86_64 Static Release (clang)",
|
||||||
"description": "Build with Clang as Release without Debug Symbols but statically linked, requires MacOS Sequoia",
|
"description": "Build for x86_64 with Clang as Release without Debug Symbols but statically linked, requires MacOS Sequoia",
|
||||||
"inherits": ["base-macos-release", "base-clang"],
|
"inherits": ["base-macos-release", "base-macos-x86_64", "base-clang"],
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"BUILD_X86_ON_MACOS": "ON",
|
|
||||||
"STATICALLY_LINK": "true",
|
"STATICALLY_LINK": "true",
|
||||||
"ZYDIS_BUILD_SHARED_LIB": "OFF"
|
"ZYDIS_BUILD_SHARED_LIB": "OFF"
|
||||||
}
|
}
|
||||||
|
20
README.md
20
README.md
@ -72,7 +72,7 @@ Our objectives are:
|
|||||||
|
|
||||||
We support both Linux and Windows on x86-64.
|
We support both Linux and Windows on x86-64.
|
||||||
|
|
||||||
> We do not support, or plan to support the ARM architecture. This means that this will not run on devices such as an M1 Mac or a mobile device.
|
> We do not support, or plan to support the ARM architecture. This means that this will not run on devices such as a mobile device.
|
||||||
|
|
||||||
### Current Status
|
### Current Status
|
||||||
|
|
||||||
@ -235,7 +235,7 @@ Then build the entire project as `Windows Release (clang)`. You can also press C
|
|||||||
|
|
||||||
### MacOS
|
### MacOS
|
||||||
|
|
||||||
> NOTE: At this time you can only run the game on macOS if you have an Intel processor.
|
> NOTE: Running the game requires an Apple Silicon Mac running macOS Sequoia, or an Intel Mac.
|
||||||
|
|
||||||
Ensure that you have Xcode command line tools installed (this installs things like Apple Clang). If you don't, you can run the following command:
|
Ensure that you have Xcode command line tools installed (this installs things like Apple Clang). If you don't, you can run the following command:
|
||||||
|
|
||||||
@ -243,21 +243,25 @@ Ensure that you have Xcode command line tools installed (this installs things li
|
|||||||
xcode-select --install
|
xcode-select --install
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Intel Based
|
On Apple Silicon, Rosetta 2 also must be installed:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
softwareupdate --install-rosetta
|
||||||
|
```
|
||||||
|
|
||||||
|
#### Building for x86_64
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install cmake nasm ninja go-task clang-format
|
brew install cmake nasm ninja go-task clang-format
|
||||||
cmake -B build --preset=Release-macos-clang
|
cmake -B build --preset=Release-macos-x86_64-clang
|
||||||
cmake --build build --parallel $((`sysctl -n hw.logicalcpu`))
|
cmake --build build --parallel $((`sysctl -n hw.logicalcpu`))
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Apple Silicon
|
#### Building for ARM64 (experimental, unsupported)
|
||||||
|
|
||||||
**Not Supported at This Time**
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
brew install cmake ninja go-task clang-format
|
brew install cmake ninja go-task clang-format
|
||||||
cmake -B build --preset=Release-macos-clang
|
cmake -B build --preset=Release-macos-arm64-clang
|
||||||
cmake --build build --parallel $((`sysctl -n hw.logicalcpu`))
|
cmake --build build --parallel $((`sysctl -n hw.logicalcpu`))
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -1,10 +1,7 @@
|
|||||||
# Set a more convenient ARM flag
|
# Set a more convenient ARM flag
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64" AND (NOT BUILD_X86_ON_MACOS))
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
|
||||||
set(ARM64_ARCH TRUE)
|
set(ARM64_ARCH TRUE)
|
||||||
message(STATUS "ARM64 architecture detected")
|
message(STATUS "ARM64 architecture detected")
|
||||||
elseif()
|
|
||||||
set(ARM64_ARCH FALSE)
|
|
||||||
message(STATUS "Forcefully targetting x86 via Rosetta 2")
|
|
||||||
else()
|
else()
|
||||||
set(ARM64_ARCH FALSE)
|
set(ARM64_ARCH FALSE)
|
||||||
message(STATUS "Non-ARM64 architecture detected")
|
message(STATUS "Non-ARM64 architecture detected")
|
||||||
|
Loading…
Reference in New Issue
Block a user