add yaze_c lib top level bindings

This commit is contained in:
scawful
2024-08-06 21:26:41 -04:00
parent 51eb640192
commit 4013f30663
3 changed files with 77 additions and 1 deletions

View File

@@ -111,4 +111,38 @@ set_target_properties(yaze
)
endif()
add_subdirectory(test)
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
)

15
src/yaze.cc Normal file
View File

@@ -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;
}

27
src/yaze.h Normal file
View File

@@ -0,0 +1,27 @@
#ifndef YAZE_H
#define YAZE_H
#include <cstdint>
#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