diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index 8d0f09372e..c9d267f663 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -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() \ No newline at end of file diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f0c666fcc7..20d3112f8a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) diff --git a/src/suyu_cmd/CMakeLists.txt b/src/suyu_cmd/CMakeLists.txt index 3aba7800ae..82fe66110d 100644 --- a/src/suyu_cmd/CMakeLists.txt +++ b/src/suyu_cmd/CMakeLists.txt @@ -42,8 +42,12 @@ target_include_directories(suyu-cmd PRIVATE ${RESOURCES_DIR}) target_link_libraries(suyu-cmd PRIVATE SDL2::SDL2 Vulkan::Headers) -if(UNIX AND NOT APPLE) - install(TARGETS suyu-cmd) +if(UNIX) + if (APPLE) + target_link_libraries(suyu-cmd PRIVATE metal-cpp) + else() + install(TARGETS suyu-cmd) + endif() endif() if(WIN32) diff --git a/src/suyu_cmd/emu_window/emu_window_sdl2_mtl.cpp b/src/suyu_cmd/emu_window/emu_window_sdl2_mtl.cpp index d84b939586..24bb220a69 100644 --- a/src/suyu_cmd/emu_window/emu_window_sdl2_mtl.cpp +++ b/src/suyu_cmd/emu_window/emu_window_sdl2_mtl.cpp @@ -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; - } + window_info.type = Core::Frontend::WindowSystemType::Cocoa; + window_info.render_surface = SDL_Metal_CreateView(render_window); OnResize(); OnMinimalClientAreaChangeRequest(GetActiveConfig().min_client_area_size); diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index 394b37c8d7..1c3ab968f7 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt @@ -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")