add yaze_emu target and YAZE_BUILD_EMU flag

This commit is contained in:
scawful
2024-08-13 20:07:16 -04:00
parent 93c1e1b6fa
commit e2168cc939
4 changed files with 21 additions and 7 deletions

View File

@@ -5,6 +5,7 @@ project(yaze VERSION 0.2.0)
# Build Flags
set(YAZE_BUILD_APP ON)
set(YAZE_BUILD_EMU ON)
set(YAZE_BUILD_Z3ED ON)
set(YAZE_BUILD_PYTHON ON)
set(YAZE_BUILD_CLIB ON)

View File

@@ -71,6 +71,10 @@ if (YAZE_BUILD_APP)
include(app/app.cmake)
endif()
if (YAZE_BUILD_EMU)
include(app/emu/CMakeLists.txt)
endif()
if (YAZE_BUILD_Z3ED)
include(cli/z3ed.cmake)
endif()

View File

@@ -20,4 +20,12 @@ target_include_directories(
${SDL2_INCLUDE_DIR}
)
target_link_libraries(yaze_emu PUBLIC ${ABSL_TARGETS} ${SDL_TARGETS} ${PNG_LIBRARIES} ${CMAKE_DL_LIBS} ImGui)
target_link_libraries(
yaze_emu PUBLIC
${ABSL_TARGETS}
${SDL_TARGETS}
${PNG_LIBRARIES}
${CMAKE_DL_LIBS}
ImGui
ImGuiTestEngine
)

View File

@@ -28,6 +28,7 @@
#include "imgui_memory_editor.h"
using namespace yaze::app;
using yaze::app::core::SDL_Deleter;
int main(int argc, char **argv) {
absl::InitializeSymbolizer(argv[0]);
@@ -37,8 +38,8 @@ int main(int argc, char **argv) {
options.alarm_on_failure_secs = true;
absl::InstallFailureSignalHandler(options);
std::unique_ptr<SDL_Window, sdl_deleter> window_;
std::unique_ptr<SDL_Renderer, sdl_deleter> renderer_;
std::unique_ptr<SDL_Window, SDL_Deleter> window_;
std::unique_ptr<SDL_Renderer, SDL_Deleter> renderer_;
if (SDL_Init(SDL_INIT_EVERYTHING) != 0) {
return EXIT_FAILURE;
} else {
@@ -47,23 +48,23 @@ int main(int argc, char **argv) {
int screenWidth = displayMode.w * 0.8;
int screenHeight = displayMode.h * 0.8;
window_ = std::unique_ptr<SDL_Window, sdl_deleter>(
window_ = std::unique_ptr<SDL_Window, SDL_Deleter>(
SDL_CreateWindow("Yaze Emulator", // window title
SDL_WINDOWPOS_UNDEFINED, // initial x position
SDL_WINDOWPOS_UNDEFINED, // initial y position
512, // width, in pixels
480, // height, in pixels
SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI),
sdl_deleter());
SDL_Deleter());
if (window_ == nullptr) {
return EXIT_FAILURE;
}
}
renderer_ = std::unique_ptr<SDL_Renderer, sdl_deleter>(
renderer_ = std::unique_ptr<SDL_Renderer, SDL_Deleter>(
SDL_CreateRenderer(window_.get(), -1,
SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
sdl_deleter());
SDL_Deleter());
if (renderer_ == nullptr) {
return EXIT_FAILURE;
} else {