diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml index 3e6d7b5..4ca3717 100644 --- a/.github/workflows/cpp.yml +++ b/.github/workflows/cpp.yml @@ -17,9 +17,11 @@ jobs: - name: install_dependencies run: | - sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" - sudo apt-get update -y -qq - sudo apt-get install libsdl2-dev + if [ "$RUNNER_OS" == "Linux" ]; then + sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu `lsb_release -sc` main universe restricted multiverse" + sudo apt-get update -y -qq + sudo apt-get install libsdl2-dev + fi - name: build run: | diff --git a/README.md b/README.md index d964ef2..6370537 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,15 @@ +# Dependencies +## SDL +### MacOS +`brew install sdl2` +### Linux +`sudo apt install libsdl2-dev` + +### Windows +Download the development pack `SDL2-devel-2.0.5-VC.zip` from [here](https://github.com/libsdl-org/SDL/releases/tag/release-2.26.2) + +Or use winget or choco + # Build ## Release ``` diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7784932..66701f6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -5,7 +5,6 @@ set(SOURCES gameBoy.cpp mmap.cpp graphics.cpp - # ------- # Header Files cpu.h @@ -17,8 +16,15 @@ set(SOURCES target_sources(${PROJECT_NAME} PRIVATE ${SOURCES}) +find_package(SDL2 REQUIRED) +include_directories(${SDL2_INCLUDE_DIRS}) + if (MSVC) set_target_properties( ${PROJECT_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/") endif () + +target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES}) + +set(SDL2_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/include") \ No newline at end of file diff --git a/src/gameBoy.cpp b/src/gameBoy.cpp index 6240580..be3242f 100644 --- a/src/gameBoy.cpp +++ b/src/gameBoy.cpp @@ -31,7 +31,7 @@ GBE::GBE() printf("boot rom file not opened"); // Open the Game ROM - if ((gameROM = fopen("../tests/instr_timing.gb", "rb")) == NULL) + if ((gameROM = fopen("../tests/Tetris.gb", "rb")) == NULL) printf("game rom file not opened"); // Set the Boot ROM