Add Cocoa and macOS code to CMakeLists
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
)
|
||||
)
|
||||
|
||||
if (APPLE)
|
||||
target_link_libraries(yaze PUBLIC ${COCOA_LIBRARY})
|
||||
endif()
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user