diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 2909089b..5483a6b1 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,7 +2,6 @@ set( YAZE_APP_CORE_SRC app/core/common.cc app/core/controller.cc - app/core/pipeline.cc ) @@ -58,6 +57,20 @@ if(WIN32 OR MINGW) add_definitions(-DSDL_MAIN_HANDLED) endif() +if(APPLE) + list(APPEND YAZE_APP_CORE_SRC + app/core/platform/file_dialog.mm + app/core/platform/app_delegate.mm + app/core/platform/font_loader.mm + ) + + find_library(COCOA_LIBRARY Cocoa) + if(NOT COCOA_LIBRARY) + message(FATAL_ERROR "Cocoa not found") + endif() + set(CMAKE_EXE_LINKER_FLAGS "-framework ServiceManagement -framework Foundation -framework Cocoa") +endif() + include(app/CMakeLists.txt) include(cli/CMakeLists.txt) diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index f0634c97..d902c823 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -15,8 +15,6 @@ add_executable( ${YAZE_APP_GFX_SRC} ${YAZE_APP_ZELDA3_SRC} ${YAZE_GUI_SRC} - # ${ASAR_STATIC_SRC} - # ${SNES_SPC_SOURCES} ${IMGUI_SRC} ) @@ -28,8 +26,6 @@ target_include_directories( ${PNG_INCLUDE_DIRS} ${SDL2_INCLUDE_DIR} lib/SDL_mixer/include/ - # lib/asar/src/asar/ - # lib/snes_spc/snes_spc/ ) target_link_libraries( @@ -40,6 +36,8 @@ target_link_libraries( ${CMAKE_DL_LIBS} SDL2_mixer ImGui - # asar-static - # snes_spc -) \ No newline at end of file +) + +if (APPLE) + target_link_libraries(yaze PUBLIC ${COCOA_LIBRARY}) +endif() \ No newline at end of file diff --git a/src/app/yaze.cc b/src/app/yaze.cc index 8fc85f3d..a3b08719 100644 --- a/src/app/yaze.cc +++ b/src/app/yaze.cc @@ -1,5 +1,7 @@ #if defined(_WIN32) #define main SDL_main +#elif __APPLE__ +#include "app/core/platform/app_delegate.h" #endif #include "absl/debugging/failure_signal_handler.h" @@ -17,6 +19,11 @@ int main(int argc, char** argv) { yaze::app::core::Controller controller; EXIT_IF_ERROR(controller.OnEntry()) + +#ifdef __APPLE__ + InitializeCocoa(); +#endif + while (controller.IsActive()) { controller.OnInput(); controller.OnLoad();