mirror of
https://github.com/dpogue/CMake-MetalShaderSupport.git
synced 2025-04-04 13:05:06 +00:00
Hopefully mostly complete Metal support?
This commit is contained in:
parent
2c3b28f97b
commit
212790029f
3 changed files with 19 additions and 5 deletions
|
@ -16,8 +16,11 @@ set(CMAKE_Metal_COMPILER_ENV_VAR "METALC")
|
|||
|
||||
set(CMAKE_Metal_COMPILER_ID_RUN "@CMAKE_Metal_COMPILER_ID_RUN@")
|
||||
set(CMAKE_Metal_SOURCE_FILE_EXTENSIONS metal)
|
||||
set(CMAKE_Metal_OUTPUT_EXTENSION ".air")
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX_Metal "")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX_Metal ".metal-ar")
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX_Metal "")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX_Metal ".metallib")
|
||||
set(CMAKE_Metal_OUTPUT_EXTENSION ".air")
|
||||
set(CMAKE_SHARED_MODULE_PREFIX_Metal "")
|
||||
set(CMAKE_SHARED_MODULE_SUFFIX_Metal ".metallib")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX_Metal ".metallib")
|
||||
|
|
|
@ -41,4 +41,17 @@ if(NOT CMAKE_Metal_CREATE_STATIC_LIBRARY)
|
|||
set(CMAKE_Metal_CREATE_STATIC_LIBRARY "${CMAKE_Metal_COMPILER_AR} crs <TARGET> <OBJECTS>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_CREATE_SHARED_LIBRARY)
|
||||
set(CMAKE_Metal_CREATE_SHARED_LIBRARY "${CMAKE_Metal_COMPILER_LINKER} <CMAKE_SHARED_LIBRARY_Metal_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_CREATE_SHARED_MODULE)
|
||||
set(CMAKE_Metal_CREATE_SHARED_MODULE "${CMAKE_Metal_CREATE_SHARED_LIBRARY}")
|
||||
endif()
|
||||
|
||||
if(NOT CMAKE_Metal_LINK_EXECUTABLE)
|
||||
# Metal shaders don't really have "executables", but we need this for the try_compile to work properly, so we'll just have it output a metallib file (identical to the "shared library" configuration)
|
||||
set(CMAKE_Metal_LINK_EXECUTABLE "${CMAKE_Metal_CREATE_SHARED_LIBRARY}")
|
||||
endif()
|
||||
|
||||
set(CMAKE_Metal_INFORMATION_LOADED 1)
|
||||
|
|
|
@ -17,8 +17,7 @@ include (CMakeTestCompilerCommon)
|
|||
# any makefiles or projects.
|
||||
if(NOT CMAKE_Metal_COMPILER_WORKS)
|
||||
PrintTestCompilerStatus("Metal")
|
||||
#__TestCompiler_setTryCompileTargetType()
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
__TestCompiler_setTryCompileTargetType()
|
||||
|
||||
string(CONCAT __TestCompiler_testMetalCompilerSource
|
||||
"#ifndef __METAL_VERSION__\n"
|
||||
|
@ -39,8 +38,7 @@ if(NOT CMAKE_Metal_COMPILER_WORKS)
|
|||
# Move result from cache to normal variable.
|
||||
set(CMAKE_Metal_COMPILER_WORKS ${CMAKE_Metal_COMPILER_WORKS})
|
||||
unset(CMAKE_Metal_COMPILER_WORKS CACHE)
|
||||
#__TestCompiler_restoreTryCompileTargetType()
|
||||
unset(CMAKE_TRY_COMPILE_TARGET_TYPE)
|
||||
__TestCompiler_restoreTryCompileTargetType()
|
||||
set(METAL_TEST_WAS_RUN 1)
|
||||
endif()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue