Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #2

Closed
wants to merge 21 commits into from
Closed
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
114 changes: 114 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: C/C++ CI

on:
push:
branches: [ "master", "dev" ]
pull_request:
branches: [ "master", "dev" ]

jobs:
linux_ubuntu_20_04:
name: (Ubuntu 20.04) GCC ${{ matrix.gcc-version }}.x
runs-on: ubuntu-20.04
strategy:
matrix:
gcc-version: [9, 10, 11, 13] # 12 doesn't work for some reason
steps:
- uses: actions/checkout@v4

- name: Install GCC ${{ matrix.gcc-version }}
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt update
sudo apt install -y gcc-${{ matrix.gcc-version }} g++-${{ matrix.gcc-version }}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc-version }} 100 --slave /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc-version }}
sudo update-alternatives --set gcc /usr/bin/gcc-${{ matrix.gcc-version }}

- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libsdl2-dev

- name: Build quaesar
run: make -j$(nproc)

linux_clang_ubuntu_20_04:
runs-on: ubuntu-20.04
name: (Ubuntu 20.04) Clang ${{ matrix.clang-version }}.x
strategy:
matrix:
clang-version: [8, 9, 10, 11]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Clang ${{ matrix.clang-version }}
run: |
sudo apt-get update
sudo apt-get install -y clang-${{ matrix.clang-version }}
sudo apt-get install -y clang++-${{ matrix.clang-version }}

- name: Select Clang ${{ matrix.clang-version }}
run: |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ matrix.clang-version }} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ matrix.clang-version }} 100
clang --version # Display the version of clang for debugging
clang++ --version # Display the version of clang for debugging

- name: Install dependencies
run: sudo apt-get install -y libsdl2-dev

- name: Build quaesar
env:
CC: clang-${{ matrix.clang-version }}
CXX: clang++-${{ matrix.clang-version }}
run: make -j$(nproc)

linux_clang_ubuntu_22_04:
runs-on: ubuntu-22.04
name: (Ubuntu 22.04) Clang ${{ matrix.clang-version }}.x
strategy:
matrix:
clang-version: [12, 13, 14, 15]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Clang ${{ matrix.clang-version }}
run: |
sudo apt-get update
sudo apt-get install -y clang-${{ matrix.clang-version }}
sudo apt-get install -y clang++-${{ matrix.clang-version }}

- name: Select Clang ${{ matrix.clang-version }}
run: |
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-${{ matrix.clang-version }} 100
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-${{ matrix.clang-version }} 100
clang --version # Display the version of clang for debugging
clang++ --version # Display the version of clang for debugging

- name: Install dependencies
run: sudo apt-get install -y libsdl2-dev

- name: Build quaesar
env:
CC: clang-${{ matrix.clang-version }}
CXX: clang++-${{ matrix.clang-version }}
run: make -j$(nproc)

macos:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-11, macos-12, macos-13, macos-14]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install dependencies
run: brew install sdl2

- name: Build quaesar
run: make -j$(nproc)

7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,10 @@ packages.config
**/.vs
*.7z
*.zip
*.d
build68k
genblitter
gencomp
gencpu
genlinetoscr
quaesar
77 changes: 77 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
.PHONY: all clean

all: quaesar

# build68k

build68k: FORCE
$(MAKE) -f build/Makefile.build68k

src/cpudefs.cpp: build68k src/table68k
./build68k < src/table68k > $@

generated += src/cpudefs.cpp

# gencomp

gencomp: FORCE $(generated)
$(MAKE) -f build/Makefile.gencomp

src/jit/comptbl.h: gencomp
./gencomp

generated += src/jit/comptbl.h

# gencpu

gencpu: FORCE $(generated)
$(MAKE) -f build/Makefile.gencpu

src/cputbl.h: gencpu
cd src && ../gencpu && cd ..

generated += src/cputbl.h

# genblitter

genblitter: FORCE
$(MAKE) -f Makefile.genblitter

blit.h: genblitter
./genblitter i > src/$@
blitfunc.cpp: genblitter
./genblitter f > src/$@
blitfunc.h: genblitter
./genblitter h > src/$@
blittable.cpp: genblitter
./genblitter t > src/$@

generated += src/blit.h src/blitfunc.cpp src/blitfunc.h src/blittable.cpp

# genlinetoscr

genlinetoscr: FORCE
$(MAKE) -f build/Makefile.genlinetoscr

linetoscr.cpp: genlinetoscr
./genlinetoscr > src/linetoscr.cpp

generated += src/linetoscr.cpp

# quasar

quaesar: FORCE $(generated)
$(MAKE) -f build/Makefile.quaesar

# clean

clean:
make -f build/Makefile.build68k clean
make -f build/Makefile.genblitter clean
make -f build/Makefile.gencomp clean
make -f build/Makefile.gencpu clean
make -f build/Makefile.genlinetoscr clean
make -f build/Makefile.quaesar clean
rm -rf out

FORCE: ;
4 changes: 2 additions & 2 deletions archivers/chd/chdcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
#include "flac.h"
#include "chdcdrom.h"
#include <zlib.h>
#include "7z/LzmaEnc.h"
#include "7z/LzmaDec.h"
//#include "7z/LzmaEnc.h"
#//include "7z/LzmaDec.h"
#include <new>


Expand Down
2 changes: 1 addition & 1 deletion archivers/chd/chdtypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

#define ARRAY_LENGTH(x) (sizeof(x) / sizeof(x[0]))

#define CLIB_DECL __cdecl
#define CLIB_DECL //__cdecl
#define FLAC_API_EXPORTS

/* Macros for normalizing data into big or little endian formats */
Expand Down
6 changes: 3 additions & 3 deletions archivers/chd/corealloc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ memory_entry *memory_entry::allocate(size_t size, void *base, const char *file,
fprintf(stderr, "#%06d, alloc %d bytes (%s:%d)\n", (UINT32)entry->m_id, static_cast<UINT32>(entry->m_size), entry->m_file, (int)entry->m_line);

// add it to the alloc list
int hashval = reinterpret_cast<FPTR>(base) % k_hash_prime;
int hashval = reinterpret_cast<FPTR>((unsigned int)(uintptr_t)base) % k_hash_prime;
entry->m_next = s_hash[hashval];
if (entry->m_next != NULL)
entry->m_next->m_prev = entry;
Expand All @@ -317,7 +317,7 @@ memory_entry *memory_entry::find(void *ptr)
// scan the list under the lock
acquire_lock();

int hashval = reinterpret_cast<FPTR>(ptr) % k_hash_prime;
int hashval = reinterpret_cast<FPTR>((unsigned int)(uintptr_t)ptr) % k_hash_prime;
memory_entry *entry;
for (entry = s_hash[hashval]; entry != NULL; entry = entry->m_next)
if (entry->m_base == ptr)
Expand All @@ -340,7 +340,7 @@ void memory_entry::release(memory_entry *entry, const char *file, int line)
fprintf(stderr, "#%06d, release %d bytes (%s:%d)\n", (UINT32)entry->m_id, static_cast<UINT32>(entry->m_size), file, line);

// remove ourselves from the alloc list
int hashval = reinterpret_cast<FPTR>(entry->m_base) % k_hash_prime;
int hashval = reinterpret_cast<FPTR>((unsigned int)(uintptr_t)entry->m_base) % k_hash_prime;
if (entry->m_prev != NULL)
entry->m_prev->m_next = entry->m_next;
else
Expand Down
6 changes: 6 additions & 0 deletions build/Makefile.build68k
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ./build68k < table68k > cpudefs.cpp

target = build68k
srcs = src/build68k.cpp

include build/Makefile.inc
9 changes: 9 additions & 0 deletions build/Makefile.genblitter
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# ./genblitter i > blit.h
# ./genblitter f > blitfunc.c
# ./genblitter h > blitfunc.h
# ./genblitter t > blittable.c

target = genblitter
srcs = src/blitops.cpp src/genblitter.cpp

include build/Makefile.inc
7 changes: 7 additions & 0 deletions build/Makefile.gencomp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# ./gencomp

target = gencomp
srcs = src/cpudefs.cpp jit/gencomp.cpp src/missing.cpp src/readcpu.cpp od-cross/unicode.cpp

include build/Makefile.inc

6 changes: 6 additions & 0 deletions build/Makefile.gencpu
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ./gencpu

target = gencpu
srcs = src/cpudefs.cpp src/gencpu.cpp src/missing.cpp src/readcpu.cpp od-cross/unicode.cpp

include build/Makefile.inc
6 changes: 6 additions & 0 deletions build/Makefile.genlinetoscr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# ./genlinetoscr > linetoscr.cpp

target = genlinetoscr
srcs = src/genlinetoscr.cpp

include build/Makefile.inc
30 changes: 30 additions & 0 deletions build/Makefile.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
UNAME_S := $(shell uname -s)

CPPFLAGS += -g -DFSUAE -I . -I include -I od-cross -MMD -std=c++17

OUT=out/$(target)

objs = $(srcs:%.cpp=$(OUT)/%.o)
deps = $(objs:.o=.d)

# bash Create Dir rule
MD = mkdir -p $(1) > /dev/null

# Create output dirs
dirs:=$(sort $(OUT) $(patsubst %/,%,$(dir $(objs))))
$(foreach dir,$(dirs),$(shell $(call MD,$(dir))))

.PHONY: all clean

all: $(target)

clean:
rm -f $(objs) $(deps) $(target) -r $(OUT)

$(objs): $(OUT)/%.o : %.cpp
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c -o $@ $<

$(target) : $(objs)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_ARCH) $^ $(LOADLIBES) $(LDLIBS) -o $@

-include $(objs:.o=.d)
Loading