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

Switch from makefiles & generated vcproj to CMake #5

Merged
merged 24 commits into from
Feb 6, 2024
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
96 changes: 40 additions & 56 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,94 +7,78 @@ on:
branches: [ "master", "dev" ]

jobs:
linux_ubuntu_20_04:
name: (Ubuntu 20.04) GCC ${{ matrix.gcc-version }}.x
runs-on: ubuntu-20.04
linux_ubuntu_22_04:
name: (Ubuntu 22.04) GCC ${{ matrix.gcc-version }}.x
runs-on: ubuntu-22.04
strategy:
matrix:
gcc-version: [9, 10, 11, 13] # 12 doesn't work for some reason
gcc-version: [11, 12, 13]
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 }}
sudo apt-get install -y gcc-${{ matrix.gcc-version }} g++-${{ matrix.gcc-version }}

- name: Select Clang ${{ matrix.clang-version }}
- name: Select GCC ${{ matrix.gcc-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
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-${{ matrix.gcc-version }} 100
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-${{ matrix.gcc-version }} 100

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

- name: Build quaesar
- name: Build quaesar
env:
CC: clang-${{ matrix.clang-version }}
CXX: clang++-${{ matrix.clang-version }}
run: make -j$(nproc)
CC: gcc-${{ matrix.gcc-version }}
CXX: g++-${{ matrix.gcc-version }}
run: mkdir temp && cd temp && cmake .. -G Ninja && ninja

linux_clang_ubuntu_22_04:
runs-on: ubuntu-22.04
name: (Ubuntu 22.04) Clang ${{ matrix.clang-version }}.x
linux_clang:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }} Clang ${{ matrix.clang-version }}.x
strategy:
fail-fast: false
matrix:
clang-version: [12, 13, 14, 15]
include:
- os: ubuntu-20.04
clang-version: 8
- os: ubuntu-20.04
clang-version: 9
- os: ubuntu-20.04
clang-version: 10
- os: ubuntu-20.04
clang-version: 11
- os: ubuntu-22.04
clang-version: 12
- os: ubuntu-22.04
clang-version: 13
- os: ubuntu-22.04
clang-version: 14
- os: ubuntu-22.04
clang-version: 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 }}
sudo apt-get install -y clang-${{ matrix.clang-version }} 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
run: sudo apt-get update && sudo apt-get install -y libsdl2-dev cmake ninja-build

- name: Build quaesar
- name: Build quaesar
env:
CC: clang-${{ matrix.clang-version }}
CXX: clang++-${{ matrix.clang-version }}
run: make -j$(nproc)
run: mkdir temp && cd temp && cmake .. -G Ninja && ninja

macos:
runs-on: ${{ matrix.os }}
Expand All @@ -107,10 +91,10 @@ jobs:
uses: actions/checkout@v4

- name: Install dependencies
run: brew install sdl2
run: brew install sdl2 cmake ninja

- name: Build quaesar
run: make -j$(nproc)
run: mkdir temp && cd temp && cmake .. -G Ninja && ninja

windows:
runs-on: ${{ matrix.os }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ gencomp
gencpu
genlinetoscr
quaesar
temp
221 changes: 221 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
# Minimum CMake version requirement
cmake_minimum_required(VERSION 3.10)

# Project name and languages used
project(quaesar LANGUAGES CXX)

# Set the C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

set(SHARED_DEFINES FSUAE)

# Zlib and disable examples

set(ZLIB_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory(external/zlib)

find_package(SDL2 REQUIRED)

# Put this global as all code shareds them
include_directories(include od-cross .)

# Code generators
# add_executable(genblitter src/genblitter.cpp src/missing.cpp od-cross/unicode.cpp)
add_executable(build68k src/build68k.cpp)
add_executable(gencpu src/cpudefs.cpp src/gencpu.cpp src/missing.cpp src/readcpu.cpp od-cross/unicode.cpp)
add_executable(gencomp src/cpudefs.cpp jit/gencomp.cpp src/missing.cpp src/readcpu.cpp od-cross/unicode.cpp)
add_executable(genblitter src/blitops.cpp src/genblitter.cpp)

target_compile_definitions(build68k PRIVATE ${SHARED_DEFINES})
target_compile_definitions(gencomp PRIVATE ${SHARED_DEFINES})
target_compile_definitions(gencpu PRIVATE ${SHARED_DEFINES})

# Set the output path for the generated code
set(BUILD68K_OUTPUT ../src/cpudefs.cpp)
set(GENCPU_OUTPUT ../src/cputbl.h)
set(GENCOMP_OUTPUT ../jit/comptbl.h)

add_custom_command(
OUTPUT ${BUILD68K_OUTPUT}
COMMAND build68k < table68k > ${BUILD68K_OUTPUT}
WORKING_DIRECTORY ../src
DEPENDS build68k
COMMENT "Generating 68k cpu definitions"
)

add_custom_command(
OUTPUT ${GENCOMP_OUTPUT}
COMMAND gencomp
WORKING_DIRECTORY ../
DEPENDS build68k
COMMENT "Generating jit/comptbl.h"
)

add_custom_command(
OUTPUT ${GENCPU_OUTPUT}
COMMAND gencpu
WORKING_DIRECTORY ../src
DEPENDS gencpu
COMMENT "Generating CPU code"
)

function(gen_blitter output letter)
add_custom_command(
OUTPUT ${output}
COMMAND genblitter ${letter} > ${output}
DEPENDS genblitter
COMMENT "Generating blitter code for ${letter}"
)
endfunction()

gen_blitter(../src/blit.h i)
gen_blitter(../src/blitfunc.cpp f)
gen_blitter(../src/blitfunc.h h)
gen_blitter(../src/blittable.cpp t)

add_executable(quaesar
src/aros.rom.cpp
src/akiko.cpp
src/amax.cpp
src/ar.cpp
src/audio.cpp
src/autoconf.cpp
src/blitfunc.cpp
src/blittable.cpp
src/blitter.cpp
src/calc.cpp
src/cd32_fmv_genlock.cpp
src/cdrom.cpp
src/cdtvcr.cpp
src/cfgfile.cpp
src/cia.cpp
src/consolehook.cpp
src/cpudefs.cpp
src/cpuemu_0.cpp
src/cpuemu_11.cpp
src/cpuemu_13.cpp
src/cpuemu_20.cpp
src/cpuemu_21.cpp
src/cpuemu_22.cpp
src/cpuemu_23.cpp
src/cpuemu_24.cpp
src/cpuemu_31.cpp
src/cpuemu_32.cpp
src/cpuemu_33.cpp
src/cpuemu_34.cpp
src/cpuemu_35.cpp
src/cpuemu_40.cpp
src/cpuemu_50.cpp
src/cpummu.cpp
src/cpummu30.cpp
src/cpustbl.cpp
src/crc32.cpp
src/custom.cpp
src/debug.cpp
src/debugmem.cpp
src/def_icons.cpp
src/devices.cpp
src/disasm.cpp
src/disk.cpp
src/diskutil.cpp
src/dlopen.cpp
src/dongle.cpp
src/drawing.cpp
src/driveclick.cpp
src/enforcer.cpp
src/ethernet.cpp
src/events.cpp
src/expansion.cpp
src/fdi2raw.cpp
src/filesys.cpp
src/flashrom.cpp
src/fpp.cpp
src/fpp_native.cpp
src/fpp_softfloat.cpp
src/fsdb.cpp
src/gayle.cpp
src/hardfile.cpp
src/hrtmon.rom.cpp
src/ide.cpp
src/idecontrollers.cpp
src/identify.cpp
src/ini.cpp
src/inputdevice.cpp
src/inputrecord.cpp
src/isofs.cpp
src/keybuf.cpp
src/logging.cpp
src/main.cpp
src/memory.cpp
src/missing.cpp
src/native2amiga.cpp
src/newcpu.cpp
src/newcpu_common.cpp
src/readcpu.cpp
src/rommgr.cpp
src/rtc.cpp
src/sana2.cpp
src/savestate.cpp
src/scp.cpp
src/scsi.cpp
src/scsiemul.cpp
src/scsitape.cpp
src/sndboard.cpp
src/statusline.cpp
src/tabletlibrary.cpp
src/test_card.cpp
src/tinyxml2.cpp
src/traps.cpp
src/uaeexe.cpp
src/uaelib.cpp
src/uaenative.cpp
src/uaeresource.cpp
src/uaeserial.cpp
src/quaesar.cpp
src/blkdev.cpp
od-cross/gfx.cpp
od-cross/gui.cpp
od-cross/mman.cpp
od-cross/machdep/m68k.cpp
od-cross/thread.cpp
od-cross/unicode.cpp
od-cross/file_system.cpp
od-cross/hardfile_host.cpp
od-cross/filepaths.cpp
od-cross/sounddep/sound.cpp
od-cross/time.cpp
od-cross/dummy.cpp
od-cross/input.cpp
src/zfile.cpp
src/zfile_archive.cpp
src/vm.cpp
softfloat/softfloat.cpp
softfloat/softfloat_fpsp.cpp
softfloat/softfloat_decimal.cpp
src/cputbl.h
jit/comptbl.h
src/blit.h
)

target_compile_definitions(quaesar PRIVATE ${SHARED_DEFINES})

target_compile_options(quaesar PRIVATE -DUAE=1 -D_cdecl= -DFILEFLAG_WRITE=1 -DOS_NAME=\"linux\")
target_compile_options(quaesar PRIVATE -DUSHORT=uint16_t -DHWND=uint32_t -DHRESULT=uint32_t -DWPARAM=uint16_t -DLPARAM=uint32_t)

if (APPLE)
target_compile_options(quaesar PRIVATE -DFILEFLAG_DIR=1 -DFILEFLAG_DIR=1 -D_ftelli64=ftell -D_fseeki64=fseek -D_fseeko64=fseeko -Dfseeko64=fseeko -Dftello64=ftell)
else()
target_compile_options(quaesar PRIVATE -DFILEFLAG_DIR=1 -D_ftelli64=ftello64 -D_fseeki64=fseeko64)
endif()

if (LINUX)
target_link_libraries(quaesar PRIVATE dl)
endif()

target_include_directories(quaesar PRIVATE ${SDL2_INCLUDE_DIRS} "src/external/zlib")
target_link_libraries(quaesar PRIVATE ${SDL2_LIBRARIES} zlibstatic)




Loading
Loading