Make Xcode builds work properly

This commit is contained in:
Darryl Pogue 2024-05-31 02:17:08 -07:00
parent 13ccf6d8bc
commit 7cdbd54913
No known key found for this signature in database
GPG key ID: CB824715C3E6FD41
3 changed files with 27 additions and 1 deletions

View file

@ -13,6 +13,12 @@ endif()
include (CMakeTestCompilerCommon)
if("${CMAKE_GENERATOR}" STREQUAL "Xcode")
if(XCODE_VERSION VERSION_GREATER 7.0)
set(CMAKE_Metal_COMPILER_WORKS 1)
endif()
endif()
# This file is used by EnableLanguage in cmGlobalGenerator to
# determine that that selected Metal compiler can actually compile
# and link the most basic of programs. If not, a fatal error

View file

@ -9,7 +9,17 @@ set(ShaderBase_SOURCES
AAPLShaders.metal
)
add_library(ShaderBase STATIC
add_library(ShaderBase MODULE
${ShaderBase_SOURCES}
${ShaderBase_HEADERS}
)
set_target_properties(ShaderBase PROPERTIES
XCODE_PRODUCT_TYPE com.apple.product-type.metal-library
XCODE_ATTRIBUTE_MTL_LANGUAGE_REVISION Metal21
SUFFIX ".metallib"
PREFIX ""
XCODE_ATTRIBUTE_MTL_FAST_MATH "YES"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=Debug] "INCLUDE_SOURCE"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=RelWithDebInfo] "INCLUDE_SOURCE"
)

View file

@ -9,3 +9,13 @@ target_link_libraries(ShaderFull
PUBLIC
ShaderBase
)
set_target_properties(ShaderFull PROPERTIES
XCODE_PRODUCT_TYPE com.apple.product-type.metal-library
XCODE_ATTRIBUTE_MTL_LANGUAGE_REVISION Metal21
SUFFIX ".metallib"
PREFIX ""
XCODE_ATTRIBUTE_MTL_FAST_MATH "YES"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=Debug] "INCLUDE_SOURCE"
XCODE_ATTRIBUTE_MTL_ENABLE_DEBUG_INFO[variant=RelWithDebInfo] "INCLUDE_SOURCE"
)