Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes for metal backend #766

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions cmake/FindMETAL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,24 @@
# This Find module is also distributed alongside the occa package config file!
###############################################################################

find_library(FOUNDATION_LIBRARY Foundation)
find_library(METAL_LIBRARY Metal)
find_library(CORE_SERVICES CoreServices)
find_library(APP_KIT AppKit)
find_library(METAL_KIT_LIBRARY MetalKit)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(
METAL
REQUIRED_VARS
FOUNDATION_LIBRARY
METAL_LIBRARY
CORE_SERVICES
APP_KIT
)
METAL_KIT_LIBRARY
)

if(METAL_FOUND AND NOT TARGET OCCA::depends::METAL)
# Create our wrapper imported target
# Put it in the OCCA namespace to make it clear that we created it.
add_library(OCCA::depends::METAL INTERFACE IMPORTED)
set_target_properties(OCCA::depends::METAL PROPERTIES
INTERFACE_LINK_LIBRARIES "${METAL_LIBRARY} ${CORE_SERVICES} ${APP_KIT}"
target_link_libraries(OCCA::depends::METAL INTERFACE
${FOUNDATION_LIBRARY} ${METAL_LIBRARY} ${METAL_KIT_LIBRARY}
)
endif()
2 changes: 1 addition & 1 deletion src/occa/internal/api/metal.mm
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ int getDeviceCount() {
}

device_t getDevice(const int deviceId) {
NSArray <id<MTLDevice>> *devices = MTLCopyAllDevices();
NSArray<id<MTLDevice>> *devices = MTLCopyAllDevices();

id<MTLDevice> device = devices[deviceId];
void *deviceObj = (__bridge void*) device;
Expand Down