Slightly working metal-ar

This commit is contained in:
Darryl Pogue 2024-05-30 04:44:45 -07:00
parent 9caf8e9b6e
commit ffc08b587a
No known key found for this signature in database
GPG key ID: CB824715C3E6FD41
3 changed files with 10 additions and 34 deletions

View file

@ -6,14 +6,6 @@ if(NOT CMAKE_Metal_COMPILER_NAMES)
set(CMAKE_Metal_COMPILER_NAMES metal)
endif()
if(NOT CMAKE_Metal_LINKER_NAMES)
set(CMAKE_Metal_LINKER_NAMES metallib)
endif()
if(NOT CMAKE_Metal_AR_NAMES)
set(CMAKE_Metal_AR_NAMES metal-ar)
endif()
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
set(CMAKE_Metal_COMPILER_XCODE_TYPE sourcecode.metal)
@ -30,18 +22,18 @@ if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result)
if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
set(CMAKE_Metal_LINKER "${_xcrun_out}")
set(CMAKE_Metal_COMPILER_LINKER "${_xcrun_out}")
else()
#_cmake_find_compiler_path(Metal)
set(CMAKE_Metal_COMPILER_LINKER "${CMAKE_Metal_COMPILER}lib")
endif()
execute_process(COMMAND xcrun --find metal-ar
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result)
if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
set(CMAKE_Metal_AR "${_xcrun_out}")
set(CMAKE_Metal_COMPILER_AR "${_xcrun_out}")
else()
#_cmake_find_compiler_path(Metal)
set(CMAKE_Metal_COMPILER_AR "${CMAKE_Metal_COMPILER}-ar")
endif()
else()
if(CMAKE_Metal_COMPILER)
@ -66,25 +58,10 @@ else()
_cmake_find_compiler(Metal)
endif()
execute_process(COMMAND xcrun --find metallib
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result)
if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
set(CMAKE_Metal_LINKER "${_xcrun_out}")
else()
#_cmake_find_compiler_path(Metal)
endif()
set(CMAKE_Metal_COMPILER_LINKER "${CMAKE_Metal_COMPILER}lib")
set(CMAKE_Metal_COMPILER_AR "${CMAKE_Metal_COMPILER}-ar")
execute_process(COMMAND xcrun --find metal-ar
OUTPUT_VARIABLE _xcrun_out OUTPUT_STRIP_TRAILING_WHITESPACE
ERROR_VARIABLE _xcrun_err RESULT_VARIABLE _xcrun_result)
if(_xcrun_result EQUAL 0 AND EXISTS "${_xcrun_out}")
set(CMAKE_Metal_AR "${_xcrun_out}")
else()
#_cmake_find_compiler_path(Metal)
endif()
mark_as_advanced(CMAKE_Metal_COMPILER CMAKE_Metal_LINKER CMAKE_Metal_AR)
mark_as_advanced(CMAKE_Metal_COMPILER CMAKE_Metal_COMPILER_LINKER CMAKE_Metal_COMPILER_AR)
endif()
# For Metal we need to explicitly query the version.

View file

@ -6,9 +6,8 @@
set(CMAKE_Metal_COMPILER "@CMAKE_Metal_COMPILER@")
set(CMAKE_Metal_COMPILER_ID "@CMAKE_Metal_COMPILER_ID@")
set(CMAKE_Metal_COMPILER_VERSION "@CMAKE_Metal_COMPILER_VERSION@")
set(CMAKE_Metal_LINKER "@CMAKE_Metal_LINKER@")
set(CMAKE_Metal_AR "@CMAKE_Metal_AR@")
set(CMAKE_Metal_COMPILER_LINKER "@CMAKE_Metal_COMPILER_LINKER@")
set(CMAKE_Metal_COMPILER_AR "@CMAKE_Metal_COMPILER_AR@")
set(CMAKE_Metal_COMPILER_LOADED 1)
set(CMAKE_Metal_COMPILER_WORKS "@CMAKE_Metal_COMPILER_WORKS@")

View file

@ -38,7 +38,7 @@ if(NOT CMAKE_Metal_COMPILE_OBJECT)
endif()
if(NOT CMAKE_Metal_CREATE_STATIC_LIBRARY)
set(CMAKE_Metal_CREATE_STATIC_LIBRARY "<CMAKE_Metal_AR> -o <TARGET> <OBJECTS> <LINK_FLAGS>")
set(CMAKE_Metal_CREATE_STATIC_LIBRARY "${CMAKE_Metal_COMPILER_AR} crs <TARGET> <OBJECTS>")
endif()
set(CMAKE_Metal_INFORMATION_LOADED 1)