Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build (ubuntu, macos)

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
fail-fast: false

matrix:
os: [ubuntu-latest, macos-latest]
# build_type: [Release]
c_compiler: [gcc, clang]
include:
- os: macos-latest
c_compiler: clang
cpp_compiler: clang++
- os: ubuntu-latest
c_compiler: gcc
cpp_compiler: g++
- os: ubuntu-latest
c_compiler: clang
cpp_compiler: clang++
exclude:
- os: macos-latest
c_compiler: gcc

steps:
- uses: actions/checkout@v7

- name: Set reusable strings
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
id: strings
shell: bash
run: |
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"

- name: Install dependencies
run: |
([[ $OSTYPE == 'darwin'* ]] && brew update && brew install sdl2 boost) ||
([[ $OSTYPE == 'linux'* ]] && sudo apt-get update && sudo apt-get install -y libsdl2-dev libboost-all-dev)

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
# -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-S ${{ github.workspace }}

- name: Build
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
run: cmake --build ${{ steps.strings.outputs.build-output-dir }}

# - name: Test
# working-directory: ${{ steps.strings.outputs.build-output-dir }}
# # Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
# # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
# run: ctest --build-config ${{ matrix.build_type }}
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# gbc_cpp
GameBoy (eventually Color) Emulator in C(++)

[![Build Status](https://travis-ci.com/finagle29/gbc_cpp.svg?branch=master)](https://travis-ci.com/finagle29/gbc_cpp)
[![Build (ubuntu, macos)](https://github.com/finagle29/gbc_cpp/actions/workflows/build.yml/badge.svg)](https://github.com/finagle29/gbc_cpp/actions/workflows/build.yml)

Use cmake to build.

Expand Down
4 changes: 4 additions & 0 deletions gpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@

gpu_type gpu;

SDL_Window *window, *vram_w, *bg_w;
SDL_Renderer *renderer, *vram_r, *bg_r;
SDL_Texture *framebuffer, *framebuffer_tileset, *framebuffer_bgmap;

#define RGBA(r, g, b) (((((r << 8) | g) << 8) | b) << 8) | 0xFF

bool show_tileset, show_bgmap;
Expand Down
6 changes: 2 additions & 4 deletions gpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ typedef struct
} gpu_type;

extern gpu_type gpu;

SDL_Window *window, *vram_w, *bg_w;
SDL_Renderer *renderer, *vram_r, *bg_r;
SDL_Texture *framebuffer, *framebuffer_tileset, *framebuffer_bgmap;
extern SDL_Window *window, *vram_w, *bg_w;
extern bool show_tileset, show_bgmap;

void setup(bool, bool);
void cleanup(void);
Expand Down
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
#include "keys.h"
#include "mmu.h"

extern bool show_tileset, show_bgmap;
extern SDL_Window *window, *vram_w, *bg_w;
// extern bool show_tileset, show_bgmap;
// extern SDL_Window *window, *vram_w, *bg_w;

bool frame(void);

Expand Down
Loading