Skip to content

Commit

Permalink
fix arm mac build error
Browse files Browse the repository at this point in the history
  • Loading branch information
injae committed Dec 30, 2023
1 parent d5feafc commit 1487447
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 10 additions & 1 deletion cppm/setting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,15 @@ endmacro()

# from vcpkg https://github.com/microsoft/vcpkg/blob/master/scripts/buildsystems/vcpkg.cmake
macro(_cppm_arch_flag)

# for arm-mac
if (CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND (NOT DEFINED CMAKE_OSX_ARCHITECTURES))
execute_process(COMMAND uname -m OUTPUT_VARIABLE CMAKE_OSX_ARCHITECTURES)
string(STRIP "${CMAKE_OSX_ARCHITECTURES}" CMAKE_OSX_ARCHITECTURES)
cppm_set(CMAKE_OSX_ARCHITECTURES "${CMAKE_OSX_ARCHITECTURES}")
cppm_print("Detected CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}")
endif()

if(cppm_target_arch)
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$")
set(cppm_target_arch x86)
Expand Down Expand Up @@ -139,7 +148,7 @@ else()
set(cppm_target_arch arm64)
elseif(cl_path MATCHES "bin/cl.exe$" OR cl_path MATCHES "x86/cl.exe$")
set(cppm_target_arch x86)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_SYSTEM_NAME AND NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin" AND DEFINED CMAKE_OSX_ARCHITECTURES)
list(LENGTH CMAKE_OSX_ARCHITECTURES arch_count)
if(arch_count EQUAL 0)
cppm_warning_print("Unable to determine target architecture. "
Expand Down
1 change: 0 additions & 1 deletion utility/cppm_print.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,4 @@ function(cppm_warning_print)
foreach(message ${ARGV})
message(WARNING "[cppm-warning] ${message}")
endforeach()
message(FATAL_ERROR "")
endfunction()

0 comments on commit 1487447

Please sign in to comment.