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)
target_include_directories(sse2neon INTERFACE sse2neon)
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()
if (APPLE)
# TODO: use target_link_libraries
include_directories(${CMAKE_SOURCE_DIR}/externals/metal-cpp)
endif()
add_subdirectory(common)
add_subdirectory(core)
add_subdirectory(audio_core)

View File

@ -42,9 +42,13 @@ target_include_directories(suyu-cmd PRIVATE ${RESOURCES_DIR})
target_link_libraries(suyu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers)
if(UNIX AND NOT APPLE)
if(UNIX)
if (APPLE)
target_link_libraries(suyu-cmd PRIVATE metal-cpp)
else()
install(TARGETS suyu-cmd)
endif()
endif()
if(WIN32)
# compile as a win32 gui application instead of a console application

View File

@ -17,7 +17,7 @@
EmuWindow_SDL2_MTL::EmuWindow_SDL2_MTL(InputCommon::InputSubsystem* input_subsystem_,
Core::System& system_, bool fullscreen)
: 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);
render_window =
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);
}
switch (wm.subsystem) {
#ifdef SDL_VIDEO_DRIVER_COCOA
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();
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_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 (NOT DEFINED ENV{NSIGHT_AFTERMATH_SDK})
message(FATAL_ERROR "Environment variable NSIGHT_AFTERMATH_SDK has to be provided")