Skip to content

Commit

Permalink
Make ISA selection more robust in CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
solidpixel committed Mar 24, 2024
1 parent 71a55e7 commit 7249f75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 6 additions & 2 deletions Source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------
# Copyright 2020-2023 Arm Limited
# Copyright 2020-2024 Arm Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -46,8 +46,12 @@ foreach(INDEX RANGE ${ASTCENC_ARTIFACTS_LEN})
set(CMAKE_OSX_ARCHITECTURES x86_64)
elseif(${ASTCENC_ISA_SIMD} MATCHES "avx2")
set(CMAKE_OSX_ARCHITECTURES x86_64h)
elseif(${ASTCENC_ISA_SIMD} MATCHES "none")
# Using "none" uses implicit architecture
elseif(${ASTCENC_ISA_SIMD} MATCHES "native")
# Using "native" uses implicit architecture
else()
# Using "none" or "native" uses implicit architecture
message(FATAL_ERROR "'${ASTCENC_ISA_SIMD}' is unknown ISA")
endif()

include(cmake_core.cmake)
Expand Down
14 changes: 11 additions & 3 deletions Source/UnitTest/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# ----------------------------------------------------------------------------
# Copyright 2020-2023 Arm Limited
# Copyright 2020-2024 Arm Limited
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may not
# use this file except in compliance with the License. You may obtain a copy
Expand Down Expand Up @@ -28,10 +28,18 @@ foreach(INDEX RANGE ${ASTCENC_ARTIFACTS_LEN})

if(${ASTCENC_ISA_SIMD} MATCHES "neon")
set(CMAKE_OSX_ARCHITECTURES arm64)
elseif(${ASTCENC_ISA_SIMD} MATCHES "sse2")
set(CMAKE_OSX_ARCHITECTURES x86_64)
elseif(${ASTCENC_ISA_SIMD} MATCHES "sse4.1")
set(CMAKE_OSX_ARCHITECTURES x86_64)
elseif(${ASTCENC_ISA_SIMD} MATCHES "avx2")
set(CMAKE_OSX_ARCHITECTURES x86_64h)
elseif(NOT ${ASTCENC_ISA_SIMD} MATCHES "none")
set(CMAKE_OSX_ARCHITECTURES x86_64)
elseif(${ASTCENC_ISA_SIMD} MATCHES "none")
# Using "none" uses implicit architecture
elseif(${ASTCENC_ISA_SIMD} MATCHES "native")
# Using "native" uses implicit architecture
else()
message(FATAL_ERROR "'${ASTCENC_ISA_SIMD}' is unknown ISA")
endif()

include(cmake_core.cmake)
Expand Down

0 comments on commit 7249f75

Please sign in to comment.