2022-12-12 23:02:47 +00:00
|
|
|
project(metal)
|
|
|
|
|
|
|
|
remove_sdk_framework(Metal)
|
|
|
|
remove_sdk_framework(MetalKit)
|
|
|
|
remove_sdk_framework(MetalPerformanceShaders)
|
|
|
|
|
2022-12-31 18:16:33 +00:00
|
|
|
if (BUILD_METAL)
|
|
|
|
add_subdirectory(deps/indium)
|
|
|
|
endif()
|
2022-12-12 23:02:47 +00:00
|
|
|
|
|
|
|
add_compile_options(
|
|
|
|
-fvisibility=hidden
|
|
|
|
)
|
|
|
|
|
|
|
|
#
|
|
|
|
# Metal
|
|
|
|
#
|
|
|
|
|
|
|
|
set(DYLIB_COMPAT_VERSION "1.0.0")
|
|
|
|
set(DYLIB_CURRENT_VERSION "1.0.0")
|
|
|
|
|
|
|
|
set(FRAMEWORK_VERSION "A")
|
|
|
|
|
|
|
|
generate_sdk_framework(Metal
|
|
|
|
VERSION ${FRAMEWORK_VERSION}
|
|
|
|
HEADER "include/Metal"
|
|
|
|
)
|
|
|
|
|
2022-12-31 18:16:33 +00:00
|
|
|
if (BUILD_METAL)
|
|
|
|
set(METAL_LINK_INDIUM indium)
|
|
|
|
else()
|
|
|
|
set(METAL_LINK_INDIUM "")
|
|
|
|
endif()
|
|
|
|
|
2022-12-12 23:02:47 +00:00
|
|
|
add_framework(Metal
|
|
|
|
# Metal is not supported in 32-bit apps, but it does still link successfully into such apps.
|
|
|
|
# thus, we have to provide a 32-bit build of the framework, but it doesn't have to provide any
|
|
|
|
# functionality. so e.g. we can use modern objc features like non-fragile classes.
|
|
|
|
FAT
|
|
|
|
CURRENT_VERSION
|
|
|
|
VERSION ${FRAMEWORK_VERSION}
|
|
|
|
|
|
|
|
SOURCES
|
|
|
|
src/Metal/Metal.mm
|
|
|
|
src/Metal/MTLBuffer.mm
|
|
|
|
src/Metal/MTLCommandBuffer.mm
|
|
|
|
src/Metal/MTLCommandQueue.mm
|
|
|
|
src/Metal/MTLComputeCommandEncoder.mm
|
|
|
|
src/Metal/MTLComputePipeline.mm
|
|
|
|
src/Metal/MTLDevice.mm
|
|
|
|
src/Metal/MTLDrawable.mm
|
|
|
|
src/Metal/MTLLibrary.mm
|
|
|
|
src/Metal/MTLPipeline.mm
|
2022-12-26 04:42:12 +00:00
|
|
|
src/Metal/MTLRenderCommandEncoder.mm
|
|
|
|
src/Metal/MTLRenderPipeline.mm
|
|
|
|
src/Metal/MTLTexture.mm
|
2022-12-12 23:02:47 +00:00
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
system
|
|
|
|
objc
|
|
|
|
Foundation
|
2022-12-31 18:16:33 +00:00
|
|
|
${METAL_LINK_INDIUM}
|
2022-12-12 23:02:47 +00:00
|
|
|
cxx
|
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(Metal
|
|
|
|
PROPERTIES
|
|
|
|
CXX_STANDARD 17
|
|
|
|
CXX_STANDARD_REQUIRED ON
|
|
|
|
CXX_EXTENSIONS OFF
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(Metal PUBLIC
|
|
|
|
include
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(Metal PRIVATE
|
|
|
|
private-include
|
|
|
|
)
|
|
|
|
|
2022-12-26 04:42:12 +00:00
|
|
|
# private API
|
|
|
|
add_library(Metal_private INTERFACE)
|
|
|
|
target_link_libraries(Metal_private INTERFACE
|
|
|
|
Metal
|
|
|
|
)
|
|
|
|
target_include_directories(Metal_private INTERFACE
|
|
|
|
private-include
|
|
|
|
)
|
|
|
|
|
2022-12-31 18:16:33 +00:00
|
|
|
if (BUILD_METAL)
|
|
|
|
target_compile_definitions(Metal PUBLIC
|
|
|
|
DARLING_METAL_ENABLED=1
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-12-12 23:02:47 +00:00
|
|
|
#
|
|
|
|
# MetalKit
|
|
|
|
#
|
|
|
|
|
|
|
|
set(DYLIB_COMPAT_VERSION "1.0.0")
|
|
|
|
set(DYLIB_CURRENT_VERSION "113.0.0")
|
|
|
|
|
|
|
|
set(FRAMEWORK_VERSION "A")
|
|
|
|
|
|
|
|
generate_sdk_framework(MetalKit
|
|
|
|
VERSION ${FRAMEWORK_VERSION}
|
|
|
|
HEADER "include/MetalKit"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_framework(MetalKit
|
|
|
|
FAT
|
|
|
|
CURRENT_VERSION
|
|
|
|
VERSION ${FRAMEWORK_VERSION}
|
|
|
|
|
|
|
|
SOURCES
|
2022-12-29 07:24:00 +00:00
|
|
|
src/MetalKit/MTKView.m
|
2022-12-12 23:02:47 +00:00
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
AppKit
|
|
|
|
system
|
|
|
|
objc
|
|
|
|
Foundation
|
|
|
|
Metal
|
2022-12-29 07:24:00 +00:00
|
|
|
QuartzCore
|
2022-12-12 23:02:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(MetalKit PUBLIC
|
|
|
|
include
|
|
|
|
)
|
|
|
|
|
2022-12-29 07:24:00 +00:00
|
|
|
target_include_directories(MetalKit PRIVATE
|
|
|
|
private-include
|
|
|
|
${CMAKE_SOURCE_DIR}/src/external/foundation/internal_include
|
|
|
|
)
|
|
|
|
|
2022-12-12 23:02:47 +00:00
|
|
|
#
|
|
|
|
# MetalPerformanceShaders
|
|
|
|
#
|
|
|
|
|
|
|
|
set(DYLIB_COMPAT_VERSION "1.0.0")
|
|
|
|
set(DYLIB_CURRENT_VERSION "122.5.6")
|
|
|
|
|
|
|
|
set(FRAMEWORK_VERSION "A")
|
|
|
|
|
|
|
|
generate_sdk_framework(MetalPerformanceShaders
|
|
|
|
VERSION ${FRAMEWORK_VERSION}
|
|
|
|
HEADER "include/MetalPerformanceShaders"
|
|
|
|
)
|
|
|
|
|
|
|
|
add_framework(MetalPerformanceShaders
|
|
|
|
FAT
|
|
|
|
CURRENT_VERSION
|
|
|
|
VERSION ${FRAMEWORK_VERSION}
|
|
|
|
|
|
|
|
SOURCES
|
|
|
|
src/dummy.c
|
|
|
|
|
|
|
|
DEPENDENCIES
|
|
|
|
system
|
|
|
|
objc
|
|
|
|
Foundation
|
|
|
|
Metal
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(MetalPerformanceShaders PUBLIC
|
|
|
|
include
|
|
|
|
)
|