Skip to content

Commit

Permalink
[meta] fix iOS 10/iOS 9 metallib support (PaddlePaddle#7367)
Browse files Browse the repository at this point in the history
* [meta] fix iOS 10 support

* update
  • Loading branch information
zhangjun committed Oct 25, 2021
1 parent 8f4c854 commit cac2576
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lite/backends/metal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ FILE(GLOB LITE_METAL_KERNELS_SRC ${CMAKE_SOURCE_DIR}/lite/backends/metal/metal_k
IF (DEFINED SDK_VERSION)
#Defined by iOS toolchain
SET(SDK_NAME "iphoneos")
SET(METAL_STD_OPTION "-std=ios-metal1.1")
SET(TARGET_OPTION "-mios-version-min=${DEPLOYMENT_TARGET}")
ELSE ()
SET(SDK_NAME "macosx")
Expand All @@ -22,7 +23,7 @@ add_custom_target(LiteMetalLIB
COMMENT "Generating lite.metallib")

add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/lite.metallib
COMMAND xcrun -sdk ${SDK_NAME} metal ${TARGET_OPTION} ${LITE_METAL_KERNELS_SRC} -o ${CMAKE_BINARY_DIR}/lite.metallib
COMMAND xcrun -sdk ${SDK_NAME} metal ${METAL_STD_OPTION} ${TARGET_OPTION} ${LITE_METAL_KERNELS_SRC} -o ${CMAKE_BINARY_DIR}/lite.metallib
DEPENDS ${LITE_METAL_KERNELS_SRC}
COMMENT "Built target lite.metallib")

Expand Down

0 comments on commit cac2576

Please sign in to comment.