forked from ShuriZma/suyu
1
0
Fork 0

metal: make metal-cpp a proper external

This commit is contained in:
Exverge 2024-04-06 21:13:26 -04:00
parent 76009b05a8
commit c3584e6c39
No known key found for this signature in database
GPG Key ID: 19AAFC0AC6A9B35A
5 changed files with 19 additions and 20 deletions

View File

@ -320,3 +320,9 @@ if (ARCHITECTURE_arm64 AND NOT TARGET sse2neon)
add_library(sse2neon INTERFACE) add_library(sse2neon INTERFACE)
target_include_directories(sse2neon INTERFACE sse2neon) target_include_directories(sse2neon INTERFACE sse2neon)
endif() endif()
# metal-cpp
if (APPLE)
add_library(metal-cpp INTERFACE)
target_include_directories(metal-cpp INTERFACE metal-cpp)
endif()

View File

@ -184,11 +184,6 @@ else()
endif() endif()
endif() endif()
if (APPLE)
# TODO: use target_link_libraries
include_directories(${CMAKE_SOURCE_DIR}/externals/metal-cpp)
endif()
add_subdirectory(common) add_subdirectory(common)
add_subdirectory(core) add_subdirectory(core)
add_subdirectory(audio_core) add_subdirectory(audio_core)

View File

@ -42,8 +42,12 @@ target_include_directories(suyu-cmd PRIVATE ${RESOURCES_DIR})
target_link_libraries(suyu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers) target_link_libraries(suyu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
if(UNIX AND NOT APPLE) if(UNIX)
install(TARGETS suyu-cmd) if (APPLE)
target_link_libraries(suyu-cmd PRIVATE metal-cpp)
else()
install(TARGETS suyu-cmd)
endif()
endif() endif()
if(WIN32) if(WIN32)

View File

@ -17,7 +17,7 @@
EmuWindow_SDL2_MTL::EmuWindow_SDL2_MTL(InputCommon::InputSubsystem* input_subsystem_, EmuWindow_SDL2_MTL::EmuWindow_SDL2_MTL(InputCommon::InputSubsystem* input_subsystem_,
Core::System& system_, bool fullscreen) Core::System& system_, bool fullscreen)
: EmuWindow_SDL2{input_subsystem_, system_} { : EmuWindow_SDL2{input_subsystem_, system_} {
const std::string window_title = fmt::format("suyu {} | {}-{} (Vulkan)", Common::g_build_name, const std::string window_title = fmt::format("suyu {} | {}-{} (Metal)", Common::g_build_name,
Common::g_scm_branch, Common::g_scm_desc); Common::g_scm_branch, Common::g_scm_desc);
render_window = render_window =
SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SDL_CreateWindow(window_title.c_str(), SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED,
@ -39,18 +39,8 @@ EmuWindow_SDL2_MTL::EmuWindow_SDL2_MTL(InputCommon::InputSubsystem* input_subsys
ShowCursor(false); ShowCursor(false);
} }
switch (wm.subsystem) { window_info.type = Core::Frontend::WindowSystemType::Cocoa;
#ifdef SDL_VIDEO_DRIVER_COCOA window_info.render_surface = SDL_Metal_CreateView(render_window);
case SDL_SYSWM_TYPE::SDL_SYSWM_COCOA:
window_info.type = Core::Frontend::WindowSystemType::Cocoa;
window_info.render_surface = SDL_Metal_CreateView(render_window);
break;
#endif
default:
LOG_CRITICAL(Frontend, "Window manager subsystem {} not implemented", wm.subsystem);
std::exit(EXIT_FAILURE);
break;
}
OnResize(); OnResize();
OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size);

View File

@ -405,6 +405,10 @@ add_dependencies(video_core host_shaders)
target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE}) target_include_directories(video_core PRIVATE ${HOST_SHADERS_INCLUDE})
target_link_libraries(video_core PRIVATE sirit Vulkan::Headers Vulkan::UtilityHeaders GPUOpen::VulkanMemoryAllocator) target_link_libraries(video_core PRIVATE sirit Vulkan::Headers Vulkan::UtilityHeaders GPUOpen::VulkanMemoryAllocator)
if (APPLE)
target_link_libraries(video_core PRIVATE metal-cpp)
endif()
if (ENABLE_NSIGHT_AFTERMATH) if (ENABLE_NSIGHT_AFTERMATH)
if (NOT DEFINED ENV{NSIGHT_AFTERMATH_SDK}) if (NOT DEFINED ENV{NSIGHT_AFTERMATH_SDK})
message(FATAL_ERROR "Environment variable NSIGHT_AFTERMATH_SDK has to be provided") message(FATAL_ERROR "Environment variable NSIGHT_AFTERMATH_SDK has to be provided")