Move build system to Meson

This is so, so mucher nicer than CMake. Unfortunately, SDL2 doesn't
compile, so I have to go fix that now.
This commit is contained in:
InvisibleUp 2020-06-30 19:42:28 -04:00
parent 514add67d8
commit b5d3c3ef05
9 changed files with 234 additions and 339 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ bld
*.pdb
build/
.vs/*
make/

View File

@ -1,222 +0,0 @@
cmake_minimum_required(VERSION 3.1)
if(${CMAKE_VERSION} VERSION_LESS 3.15)
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
else()
cmake_policy(VERSION 3.15)
endif()
project(
microvmac
VERSION 0.37.0
DESCRIPTION "68k Macintosh emulator"
LANGUAGES C
)
# For now, only target WIN32; just to make sure everything still works
#set(TARGET_PLATFORM AUTO CACHE STRING "Set platform to compile for")
#set_property(CACHE TARGET_PLATFORM PROPERTY STRINGS WINDOWS SDL2)
# Git submodule libraries
add_library(incbin INTERFACE)
target_include_directories(incbin INTERFACE src/incbin/)
# Hardware libraries
# Some are temporarily disabled while I get CMake up and running
#add_library(
# hw_adb OBJECT
# src/HW/ADB/ADBEMDEV.c
#)
#target_include_directories(hw_adb PRIVATE src/ cfg/)
#target_include_directories(hw_adb PRIVATE src/HW/ADB/)
#target_compile_definitions(hw_adb PUBLIC EmADB=1)
add_library(
hw_disk OBJECT
src/HW/DISK/IWMEMDEV.c
src/HW/DISK/SONYEMDV.c
src/PATCHES/SONYDRV.c
)
target_include_directories(hw_disk PRIVATE src/ cfg/ rsrc/)
target_include_directories(hw_disk PRIVATE src/HW/DISK/)
configure_file(rsrc/SONYDRV.bin SONYDRV.bin COPYONLY)
configure_file(rsrc/SONYICO.bin SONYICO.bin COPYONLY)
add_library(
hw_kbrd OBJECT
src/HW/KBRD/KBRDEMDV.c
)
target_include_directories(hw_kbrd PRIVATE src/ cfg/)
target_include_directories(hw_kbrd PRIVATE src/HW/KBRD/)
target_compile_definitions(hw_kbrd PUBLIC EmClassicKbrd=1)
add_library(
hw_m68k OBJECT
# src/HW/M68K/DISAM68K.c
src/HW/M68K/M68KITAB.c
src/HW/M68K/MINEM68K.c
)
target_include_directories(hw_m68k PRIVATE src/ cfg/)
target_include_directories(hw_m68k PUBLIC src/HW/M68K/)
add_library(
hw_mouse OBJECT
src/HW/MOUSE/MOUSEMDV.c
)
target_include_directories(hw_mouse PRIVATE src/ cfg/)
target_include_directories(hw_mouse PRIVATE src/HW/MOUSE/)
#add_library(
# hw_powerman OBJECT
# src/HW/POWERMAN/PMUEMDEV.c
#)
#target_include_directories(hw_powerman PRIVATE src/ cfg/)
#target_include_directories(hw_powerman PRIVATE src/HW/POWERMAN/)
#target_compile_definitions(hw_powerman PUBLIC EmPMU=1)
add_library(
hw_rtc OBJECT
src/HW/RTC/RTCEMDEV.c
)
target_include_directories(hw_rtc PRIVATE src/ cfg/)
target_include_directories(hw_rtc PRIVATE src/HW/RTC/)
target_compile_definitions(hw_rtc PUBLIC EmRtc=1)
add_library(
hw_scc OBJECT
src/HW/SCC/SCCEMDEV.c
)
target_include_directories(hw_scc PRIVATE src/ cfg/)
target_include_directories(hw_scc PRIVATE src/HW/SCC/)
add_library(
hw_screen OBJECT
src/HW/SCREEN/SCRNEMDV.c
src/PATCHES/SCRNHACK.c
)
target_include_directories(hw_screen PRIVATE src/ cfg/)
target_include_directories(hw_screen PRIVATE src/HW/SCREEN/)
add_library(
hw_scsi OBJECT
src/HW/SCSI/SCSIEMDV.c
)
target_include_directories(hw_scsi PRIVATE src/ cfg/)
target_include_directories(hw_scsi PRIVATE src/HW/SCSI/)
add_library(
hw_sound OBJECT
# src/HW/SOUND/ASCEMDEV.c
src/HW/SOUND/SNDEMDEV.c
)
target_include_directories(hw_sound PRIVATE src/ cfg/)
target_include_directories(hw_sound PRIVATE src/HW/SOUND/)
add_library(
hw_via1 OBJECT
src/HW/VIA/VIAEMDEV.c
)
target_include_directories(hw_via1 PRIVATE src/ cfg/)
target_include_directories(hw_via1 PRIVATE src/HW/VIA/)
#add_library(
# hw_via2 OBJECT
# src/HW/VIA/VIA2EMDV.c
#)
#target_include_directories(hw_via2 PRIVATE src/ cfg/)
#target_include_directories(hw_via2 PRIVATE src/HW/VIA/)
#target_compile_definitions(hw_via2 PUBLIC EmVIA2=1)
#add_library(
# hw_vidcard OBJECT
# src/HW/VIDCARD/VIDEMDEV.c
#)
#target_include_directories(hw_vidcard PRIVATE src/ cfg/)
#target_include_directories(hw_vidcard PRIVATE src/HW/VIA/)
#target_compile_definitions(hw_vidcard PUBLIC EmVidCard=1)
#target_compile_definitions(hw_vidcard PUBLIC IncludeVidMem=1)
# Macintosh definitions
add_library(tgt_macbase INTERFACE) # things every Mac has
target_link_libraries(
tgt_macbase INTERFACE
hw_disk
hw_m68k
hw_rtc
hw_sound
hw_via1
)
add_library(tgt_macplus INTERFACE) # Macintosh Plus
target_link_libraries(
tgt_macplus INTERFACE
tgt_macbase
hw_screen
hw_mouse
hw_kbrd
)
target_compile_definitions(tgt_macplus INTERFACE CurEmMd=kEmMd_Plus)
#add_library(tgt_macii INTERFACE) # Macintosh II
#target_link_libraries(tgt_macii INTERFACE tgt_macbase hw_vidcard hw_adb)
#target_compile_definitions(tgt_macii INTERFACE CurEmMd=kEmMd_Plus)
# User interface definitions
add_library(
ui_win32 OBJECT
src/UI/COMOSGLU.c
src/UI/CONTROLM.c
src/UI/WIN32/DBGLOG.c
src/UI/WIN32/INTLKBRD.c
src/UI/WIN32/KEYBOARD.c
src/UI/WIN32/OSGLUWIN.c
src/UI/WIN32/SOUND.c
src/UI/WIN32/TIMEDATE.c
rsrc/WIN32/main.rc
)
target_include_directories(ui_win32 PRIVATE cfg/ src/ rsrc/)
target_include_directories(ui_win32 PRIVATE src/UI/ src/UI/WIN32/)
configure_file(rsrc/WIN32/ICONAPPW.ico ICONAPPW.ico COPYONLY)
configure_file(rsrc/WIN32/ICONDSKW.ico ICONDSKW.ico COPYONLY)
configure_file(rsrc/WIN32/ICONROMW.ico ICONROMW.ico COPYONLY)
target_link_libraries(ui_win32 PUBLIC winmm ole32 uuid)
#add_library(
# ui_sdl2 OBJECT
# src/UI/COMOSGLU.c
# src/UI/CONTROLM.c
# src/UI/SDL2/OSGLUSD2.c
#)
#target_include_directories(ui_sdl2 PUBLIC src/UI/ src/UI/SDL2/)
## Final compiled program definition
add_executable(
microvmac WIN32
src/PROGMAIN.c
src/GLOBGLUE.c
src/PATCHES/ROMEMDEV.c
src/UTIL/DATE2SEC.c
)
target_include_directories(microvmac PRIVATE cfg/ src/)
set_target_properties(microvmac PROPERTIES C_STANDARD 99 C_STANDARD_REQUIRED True)
#target_link_libraries(microvmac INTERFACE tgt_macplus) # temporary
target_link_libraries(microvmac PRIVATE incbin ui_win32)
# temporary, because "INTERFACE" isn't working how I expect it to
target_link_libraries(
microvmac PRIVATE
hw_disk
hw_m68k
hw_rtc
hw_sound
hw_via1
hw_screen
hw_mouse
hw_kbrd
hw_scc
hw_scsi
)
target_compile_definitions(microvmac PUBLIC CurEmMd=kEmMd_Plus)

View File

@ -29,8 +29,6 @@
#define IncludeSonyNew 1
#define IncludeSonyNameNew 1
#define kROM_Size 0x00020000
#define IncludePbufs 1
#define NumPbufs 4

View File

@ -1,81 +0,0 @@
/*
Configuration options used by platform specific code.
Hopefully, one day, we can remove this file entirely.
*/
#ifndef CNFGRAPI_H
#define CNFGRAPI_H
// TODO: replace below with struct of variable options
#define RomFileName "vMac.ROM"
#define kCheckSumRom_Size 0x00020000
#define kRomCheckSum1 0x4D1EEEE1
#define kRomCheckSum2 0x4D1EEAE1
#define kRomCheckSum3 0x4D1F8172
// Keybindings
// TODO: Make these variable
#define MKC_formac_Control MKC_CM
#define MKC_formac_Command MKC_Command
#define MKC_formac_Option MKC_Option
#define MKC_formac_Shift MKC_Shift
#define MKC_formac_CapsLock MKC_CapsLock
#define MKC_formac_Escape MKC_Escape
#define MKC_formac_BackSlash MKC_BackSlash
#define MKC_formac_Slash MKC_Slash
#define MKC_formac_Grave MKC_Grave
#define MKC_formac_Enter MKC_Enter
#define MKC_formac_PageUp MKC_PageUp
#define MKC_formac_PageDown MKC_PageDown
#define MKC_formac_Home MKC_Home
#define MKC_formac_End MKC_End
#define MKC_formac_Help MKC_Help
#define MKC_formac_ForwardDel MKC_ForwardDel
#define MKC_formac_F1 MKC_Option
#define MKC_formac_F2 MKC_Command
#define MKC_formac_F3 MKC_F3
#define MKC_formac_F4 MKC_F4
#define MKC_formac_F5 MKC_F5
#define MKC_formac_RControl MKC_CM
#define MKC_formac_RCommand MKC_Command
#define MKC_formac_ROption MKC_Option
#define MKC_formac_RShift MKC_Shift
#define MKC_UnMappedKey MKC_Control
// Options (please remove / make variable as many as possible!)
#define RomStartCheckSum 1 // Let emu verify ROM chksum on startup
#define EnableDragDrop 1 // Enable drag+drop of disk images
#define SaveDialogEnable 1 // Allow user to choose loc. for new disks
#define WantInitFullScreen 0 // Start with full-screen mode on
#define MayFullScreen 1 // Full screen is an option
#define MayNotFullScreen 1 // Windowed is an option
#define WantInitMagnify 0 // Start magnified (boolean)
#define WindowScale 2 // Magnification power (TODO: make a var!!!)
#define WantInitRunInBackground 1 // Start running in background (boolean)
#define WantInitSpeedValue 0 // Initial clock multiplier (0 = 1x)
#define WantEnblCtrlInt 1 // Enable interrupt key (from prog. switch)
#define WantEnblCtrlRst 1 // Enable reset key (from prog. switch)
#define WantEnblCtrlKtg 1 // Emulated control key toggle via Ctrl+K
#define NeedRequestIthDisk 0 // Use Ctrl+num to insert "./disk#.dsk"
#define NeedRequestInsertDisk 1 // Disk open dialog on Ctrl+O
#define NeedDoMoreCommandsMsg 1 // Special > More Commands tutorial message
#define NeedDoAboutMsg 1 // About mini vMac message
#define UseControlKeys 1 // Enable Control Mode (options mode)
#define NeedIntlChars 0 // Include int'l chars for Control Mode
#define ItnlKyBdFix 1 // force keyboard to match Mac layout
/* version and other info to display to user */
#define kStrAppName "micro vMac"
#define kAppVariationStr "uvmac-0.37.0-wx64"
#define kStrCopyrightYear "2020"
#define kMaintainerName "InvisibleUp"
#define kStrHomePage "https://github.com/invisibleup/minivmac"
#define kBldOpts "obsolete"
#endif

View File

@ -10,6 +10,35 @@
#ifndef EMCONFIG_H
#define EMCONFIG_H
// Keybindings
// TODO: Make these variable
#define MKC_formac_Control MKC_CM
#define MKC_formac_Command MKC_Command
#define MKC_formac_Option MKC_Option
#define MKC_formac_Shift MKC_Shift
#define MKC_formac_CapsLock MKC_CapsLock
#define MKC_formac_Escape MKC_Escape
#define MKC_formac_BackSlash MKC_BackSlash
#define MKC_formac_Slash MKC_Slash
#define MKC_formac_Grave MKC_Grave
#define MKC_formac_Enter MKC_Enter
#define MKC_formac_PageUp MKC_PageUp
#define MKC_formac_PageDown MKC_PageDown
#define MKC_formac_Home MKC_Home
#define MKC_formac_End MKC_End
#define MKC_formac_Help MKC_Help
#define MKC_formac_ForwardDel MKC_ForwardDel
#define MKC_formac_F1 MKC_Option
#define MKC_formac_F2 MKC_Command
#define MKC_formac_F3 MKC_F3
#define MKC_formac_F4 MKC_F4
#define MKC_formac_F5 MKC_F5
#define MKC_formac_RControl MKC_CM
#define MKC_formac_RCommand MKC_Command
#define MKC_formac_ROption MKC_Option
#define MKC_formac_RShift MKC_Shift
#define MKC_UnMappedKey MKC_Control
#define CurEmMd kEmMd_Plus
#define MaxATTListN 32

View File

@ -19,6 +19,13 @@
#define IncludeVidMem 0
#define EmVidCard 0
#define RomFileName "vMac.ROM"
#define kCheckSumRom_Size 0x00020000
#define kRomCheckSum1 0x4D1EEEE1
#define kRomCheckSum2 0x4D1EEAE1
#define kRomCheckSum3 0x4D1F8172
#define kROM_Size 0x00020000
/* the Wire variables are 1/0, not true/false */
enum {

191
meson.build Normal file
View File

@ -0,0 +1,191 @@
# Project definition
project('microvmac', 'c')
# Configuration data
conf = configuration_data({
# verify ROM checksum on startup?
'RomStartCheckSum': 1,
# Enable drag/drop of disk images?
'EnableDragDrop': 1,
# Allow user to choose location for new disks?
'SaveDialogEnable': 1,
# Start in full-screen mode?
'WantInitFullScreen': 0,
# Full screen is an option?
'MayFullScreen': 1,
# Windowed is an option?
'MayNotFullScreen': 1,
# Start magnified?
'WantInitMagnify': 0,
# Magnificaton power
'WindowScale': 2,
# Allow background running by default?
'WantInitRunInBackground': 1,
# Initial clock multiplied (0 = 1x)
'WantInitSpeedValue': 0,
# Enable interrupt key? (on prog. switch)
'WantEnblCtrlInt': 1,
# Enable reset key? (on prog. switch)
'WantEnblCtrlRst': 1,
# Emulated control key toggle via Ctrl+K?
'WantEnblCrtlKtg': 1,
# Use Ctrl+num to insert "./disk#.dsk"
'NeedRequestIthDisk': 0,
# Disk open dialog on Ctrl+O
'NeedRequestInsertDisk': 1,
# Special > More Commands tutorial message
'NeedDoMoreCommandsMsg': 1,
# Enable about dialog
'NeedDoAboutMsg': 1,
# Enable Control Mode (options menu)
'UseControlKeys': 1,
# Include international characters for Control Mode
'NeedIntlChars': 0,
# Force keyboard to match Mac layout on Windows
'ItnlKyBdFix': 1,
# Version information
'kStrAppName': '"micro vMac"',
'kAppVariationStr': '"0.37.0"',
'kStrCopyrightYear': '"2020"',
'kMaintainerName': '"InvisibleUp"',
'kStrHomePage': '"https://github.com/invisibleup/minivmac/"',
'kBldOpts': '"obsolete"'
})
configure_file(
output: 'CNFGRAPI.h',
configuration: conf
)
# Dependencies
lSDL2 = dependency('SDL2')
# Hardware libraries
# Some are temporarily disabled while I get CMake up and running
HW_SRC = {
'ADB': [
'src/HW/ADB/ADBEMDEV.c'
],
'DISK': [
'src/HW/DISK/IWMEMDEV.c',
'src/HW/DISK/SONYEMDV.c',
'src/PATCHES/SONYDRV.c'
],
'KBRD': [
'src/HW/KBRD/KBRDEMDV.c',
],
'M68K': [
# 'src/HW/M68K/DISAM68K.c',
'src/HW/M68K/M68KITAB.c',
'src/HW/M68K/MINEM68K.c',
],
'MOUSE': [
'src/HW/MOUSE/MOUSEMDV.c',
],
'POWERMAN': [
'src/HW/POWERMAN/PMUEMDEV.c',
],
'RTC': [
'src/HW/RTC/RTCEMDEV.c',
],
'SCC': [
'src/HW/SCC/SCCEMDEV.c',
],
'SCREEN': [
'src/HW/SCREEN/SCRNEMDV.c',
'src/PATCHES/SCRNHACK.c',
],
'SCSI': [
'src/HW/SCSI/SCSIEMDV.c',
],
'SOUND': [
# 'src/HW/SOUND/ASCEMDEV.c',
'src/HW/SOUND/SNDEMDEV.c',
],
'VIA1': [
'src/HW/VIA/VIAEMDEV.c',
],
'VIA2': [
'src/HW/VIA/VIA2EMDV.c',
],
'VIDCARD': [
'src/HW/VIDCARD/VIDEMDEV.c',
],
}
MAC_SRC_COMMON = HW_SRC['DISK'] + HW_SRC['M68K'] + HW_SRC['RTC'] + HW_SRC['SOUND'] + HW_SRC['VIA1']
# Macintosh definitions
MAC_SRC = {
'Plus':
MAC_SRC_COMMON +
HW_SRC['SCREEN'] +
HW_SRC['MOUSE'] +
HW_SRC['KBRD'],
'II':
MAC_SRC_COMMON +
HW_SRC['VIDCARD'] +
HW_SRC['ADB'],
}
# User interface definitions
UI_SRC = {
'WIN32': [
'src/UI/COMOSGLU.c',
'src/UI/CONTROLM.c',
'src/UI/WIN32/DBGLOG.c',
'src/UI/WIN32/INTLKBRD.c',
'src/UI/WIN32/KEYBOARD.c',
'src/UI/WIN32/OSGLUWIN.c',
'src/UI/WIN32/SOUND.c',
'src/UI/WIN32/TIMEDATE.c',
'rsrc/WIN32/main.rc',
],
'SDL2': [
'src/UI/COMOSGLU.c',
'src/UI/CONTROLM.c',
'src/UI/SDL2/OSGLUSD2.c'
]
}
EMU_SRC = [
'src/PROGMAIN.c',
'src/GLOBGLUE.c',
'src/PATCHES/ROMEMDEV.c',
'src/UTIL/DATE2SEC.c',
'src/incbin/incbin.c',
]
EMU_INC = include_directories([
'cfg/',
'src/',
'src/HW/ADB',
'src/HW/DISK',
'src/HW/KBRD',
'src/HW/M68K',
'src/HW/MOUSE',
'src/HW/POWERMAN',
'src/HW/RTC',
'src/HW/SCC',
'src/HW/SCREEN',
'src/HW/SCSI',
'src/HW/SOUND',
'src/HW/VIA',
'src/HW/VIDCARD',
'src/LANG',
'src/UI',
'src/UI/SDL2',
# 'src/UI/WIN32',
'src/UTIL',
'src/incbin',
])
## Final compiled program definition
# Just gonna do an SDL2 Mac Plus for now
executable(
'microvmac',
sources: MAC_SRC['Plus'] + UI_SRC['SDL2'] + EMU_SRC,
dependencies: [lSDL2],
include_directories: EMU_INC,
)

View File

@ -4,9 +4,7 @@
Included in the resource file for WIN32 builds
*/
#include <stdint.h>
#ifdef _WINDOWS
#include <windows.h>
#endif
#include <string.h>
#include "incbin/incbin.h"
#include "EMCONFIG.h"
@ -17,44 +15,20 @@
#include "PATCHES/SCRNHACK.h"
// Include binaries
#ifndef _WINDOWS
INCBIN(SonyDriver, "SONYDRV.bin");
INCBIN(SonyIcon, "SONYICO.bin");
#endif
INCBIN(SonyDriver, "rsrc/SONYDRV.bin");
INCBIN(SonyIcon, "rsrc/SONYICO.bin");
void Sony_LoadDriver(uint8_t *pto, int *size)
{
#if defined(gSonyDriverData)
memcpy(pto, gSonyDriverData, gSonyDriverSize);
*size = gSonyDriverSize;
#elif defined(_WINDOWS)
HRSRC hDrvInfo = FindResource(NULL, "SONY_DRV", RT_RCDATA);
HGLOBAL hDrv = LoadResource(NULL, hDrvInfo);
DWORD sDrv = SizeofResource(NULL, hDrvInfo);
void *pDrv = LockResource(hDrv);
memcpy(pto, pDrv, sDrv);
*size = sDrv;
#else
#error("Unsupported platform/compiler")
#endif
}
void Sony_LoadIcon(uint8_t *pto, int *icoSize)
{
disk_icon_addr = (pto - ROM) + kROM_Base;
#if defined(gSonyIconData)
memcpy(pto, gSonyIcon, gSonyIconSize;
memcpy(pto, gSonyIconData, gSonyIconSize);
*icoSize = gSonyIconSize;
#elif defined(_WINDOWS)
HRSRC hIcoInfo = FindResource(NULL, "SONY_ICO", RT_RCDATA);
HGLOBAL hIco = LoadResource(NULL, hIcoInfo);
DWORD sIco = SizeofResource(NULL, hIcoInfo);
void *pIco = LockResource(hIco);
memcpy(pto, pIco, sIco);
*icoSize = sIco;
#else
#error("Unsupported platform/compiler")
#endif
}
void Sony_TwiggyPatch(uint8_t *pto)

View File

@ -169,9 +169,7 @@ LOCALPROC dbglog_close0(void)
#define WantColorTransValid 0
#include "UI/COMOSGLU.h"
#include "UTILS/PBUFSTDC.h"
#include "UTIL/PBUFSTDC.h"
#include "UI/CONTROLM.h"
/* --- text translation --- */