Skip to content

Commit

Permalink
Merge pull request #11527 from Hibyehello/MacOSPlatform
Browse files Browse the repository at this point in the history
NoGUI: Create MacOS platform
  • Loading branch information
AdmiralCurtiss committed Jun 2, 2023
2 parents 4ee2740 + 8324a85 commit 4c9210b
Show file tree
Hide file tree
Showing 4 changed files with 451 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Source/Core/DolphinNoGUI/CMakeLists.txt
Expand Up @@ -13,6 +13,11 @@ if(WIN32)
target_sources(dolphin-nogui PRIVATE PlatformWin32.cpp)
endif()

if(APPLE)
target_sources(dolphin-nogui PRIVATE PlatformMacos.mm)
target_compile_options(dolphin-nogui PRIVATE -fobjc-arc)
endif()

if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_sources(dolphin-nogui PRIVATE PlatformFBDev.cpp)
endif()
Expand All @@ -26,6 +31,15 @@ PRIVATE
cpp-optparse
)

if(APPLE)
target_link_libraries(dolphin-nogui
PRIVATE
${APPKIT_LIBRARY}
${COREFOUNDATION_LIBRARY}
${IOK_LIBRARY}
)
endif()

if(MSVC)
# Add precompiled header
target_link_libraries(dolphin-nogui PRIVATE use_pch)
Expand Down
8 changes: 8 additions & 0 deletions Source/Core/DolphinNoGUI/MainNoGUI.cpp
Expand Up @@ -168,6 +168,10 @@ static std::unique_ptr<Platform> GetPlatform(const optparse::Values& options)
if (platform_name == "win32" || platform_name.empty())
return Platform::CreateWin32Platform();
#endif
#ifdef __APPLE__
if (platform_name == "macos" || platform_name.empty())
return Platform::CreateMacOSPlatform();
#endif

if (platform_name == "headless" || platform_name.empty())
return Platform::CreateHeadlessPlatform();
Expand Down Expand Up @@ -198,6 +202,10 @@ int main(int argc, char* argv[])
#ifdef _WIN32
,
"win32"
#endif
#ifdef __APPLE__
,
"macos"
#endif
});

Expand Down
4 changes: 4 additions & 0 deletions Source/Core/DolphinNoGUI/Platform.h
Expand Up @@ -43,6 +43,10 @@ class Platform
static std::unique_ptr<Platform> CreateWin32Platform();
#endif

#ifdef __APPLE__
static std::unique_ptr<Platform> CreateMacOSPlatform();
#endif

protected:
void UpdateRunningFlag();

Expand Down

0 comments on commit 4c9210b

Please sign in to comment.