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

Feature: Add support for Apple Silicon (ARM64) build on macOS #8340

Merged
merged 2 commits into from
Jan 8, 2021
Merged
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
19 changes: 15 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,10 @@ jobs:
include:
- arch: x64
full_arch: x86_64
- arch: arm64
full_arch: arm64

runs-on: macos-11.0
runs-on: macos-10.15
env:
MACOSX_DEPLOYMENT_TARGET: 10.9

Expand All @@ -381,11 +383,20 @@ jobs:
run: |
tar -xf source.tar.gz --strip-components=1

# The following step can be removed and the default vcpkg installation
# (/usr/local/share/vcpkg) restored when the build VM is updated with a revision of
# vcpkg dating from roughly 01/01/2021 or later.
- name: Update vcpkg
run: |
cd /tmp
git clone https://github.com/Microsoft/vcpkg

- name: Prepare vcpkg (with cache)
uses: lukka/run-vcpkg@v6
with:
vcpkgDirectory: '/usr/local/share/vcpkg'
doNotUpdateVcpkg: true
vcpkgDirectory: '/tmp/vcpkg'
doNotUpdateVcpkg: false
vcpkgGitCommitId: 2a42024b53ebb512fb5dd63c523338bf26c8489c
vcpkgArguments: 'freetype liblzma lzo'
vcpkgTriplet: '${{ matrix.arch }}-osx'

Expand Down Expand Up @@ -418,7 +429,7 @@ jobs:
cmake ${GITHUB_WORKSPACE} \
-DCMAKE_OSX_ARCHITECTURES=${{ matrix.full_arch }} \
-DVCPKG_TARGET_TRIPLET=${{ matrix.arch }}-osx \
-DCMAKE_TOOLCHAIN_FILE=/usr/local/share/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_TOOLCHAIN_FILE=/tmp/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DHOST_BINARY_DIR=${GITHUB_WORKSPACE}/build-host \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
# EOF
Expand Down
18 changes: 10 additions & 8 deletions cmake/CompileFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,16 @@ macro(compile_flags)
endif()

if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND)

if(NO_SSE4_FOUND)
add_compile_options(
# Don't use SSE4 for general sources to increase compatibility.
-mno-sse4
)
if (NOT CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-mno-sse4" NO_SSE4_FOUND)

if(NO_SSE4_FOUND)
add_compile_options(
# Don't use SSE4 for general sources to increase compatibility.
-mno-sse4
)
endif()
endif()
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
Expand Down