From 4013f30663c95a8376aecef9a4643f453b9857c7 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 6 Aug 2024 21:26:41 -0400 Subject: [PATCH] add yaze_c lib top level bindings --- src/CMakeLists.txt | 36 +++++++++++++++++++++++++++++++++++- src/yaze.cc | 15 +++++++++++++++ src/yaze.h | 27 +++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 src/yaze.cc create mode 100644 src/yaze.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5f5ed05a..7c4d5d74 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -111,4 +111,38 @@ set_target_properties(yaze ) endif() -add_subdirectory(test) \ No newline at end of file +add_subdirectory(test) + +# Yaze C API +add_library(yaze_c SHARED + app/yaze.cc + app/rom.cc + ${YAZE_APP_EMU_SRC} + ${YAZE_APP_CORE_SRC} + ${YAZE_APP_EDITOR_SRC} + ${YAZE_APP_GFX_SRC} + ${YAZE_APP_ZELDA3_SRC} + ${YAZE_GUI_SRC} + ${IMGUI_SRC} + ${IMGUI_TEST_ENGINE_SOURCES} +) + +target_include_directories( + yaze_c PUBLIC + lib/ + app/ + ${CMAKE_SOURCE_DIR}/src/ + ${CMAKE_SOURCE_DIR}/src/lib/imgui_test_engine + ${PNG_INCLUDE_DIRS} + ${SDL2_INCLUDE_DIR} +) + +target_link_libraries( + yaze_c PUBLIC + ${ABSL_TARGETS} + ${SDL_TARGETS} + ${PNG_LIBRARIES} + ${CMAKE_DL_LIBS} + ImGuiTestEngine + ImGui +) \ No newline at end of file diff --git a/src/yaze.cc b/src/yaze.cc new file mode 100644 index 00000000..27d5abdb --- /dev/null +++ b/src/yaze.cc @@ -0,0 +1,15 @@ +#include "yaze.h" + +// TODO: Implement yaze_initialize +void yaze_initialize(void) {} + +// TODO: Implement yaze_cleanup +void yaze_cleanup(void) {} + +// TODO: Implement load_rom +Rom load_rom(const char* filename) { + Rom rom; + rom.filename = filename; + rom.data = nullptr; + return rom; +} \ No newline at end of file diff --git a/src/yaze.h b/src/yaze.h new file mode 100644 index 00000000..28134983 --- /dev/null +++ b/src/yaze.h @@ -0,0 +1,27 @@ +#ifndef YAZE_H +#define YAZE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void yaze_initialize(void); + +void yaze_cleanup(void); + +typedef struct Rom Rom; + +struct Rom { + const char* filename; + const uint8_t* data; +}; + +Rom load_rom(const char* filename); + +#ifdef __cplusplus +} +#endif + +#endif // YAZE_H