mirror of
https://github.com/InvisibleUp/uvmac.git
synced 2025-02-21 02:29:00 +00:00
[#9] Port build system to CMake
This commit is contained in:
parent
c399d9ba58
commit
097558c4aa
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -4,3 +4,6 @@
|
||||
[submodule "src/tomlc99"]
|
||||
path = lib/tomlc99
|
||||
url = https://github.com/cktan/tomlc99
|
||||
[submodule "vcpkg"]
|
||||
path = vcpkg
|
||||
url = https://github.com/Microsoft/vcpkg.git
|
||||
|
207
CMakeLists.txt
Normal file
207
CMakeLists.txt
Normal file
@ -0,0 +1,207 @@
|
||||
cmake_minimum_required(VERSION 3.23)
|
||||
cmake_policy(VERSION 3.23)
|
||||
|
||||
project(
|
||||
microvmac
|
||||
VERSION 0.37.0
|
||||
DESCRIPTION "68k Macintosh emulator"
|
||||
LANGUAGES C
|
||||
)
|
||||
|
||||
find_package(sdl2 CONFIG REQUIRED)
|
||||
|
||||
# Main executable
|
||||
add_executable(
|
||||
microvmac WIN32
|
||||
src/PROGMAIN.c
|
||||
src/GLOBGLUE.c
|
||||
src/PATCHES/ROMEMDEV.c
|
||||
src/UTIL/DATE2SEC.c
|
||||
src/CFGMAN.c
|
||||
src/LANG/INTLCHAR.c
|
||||
)
|
||||
set_target_properties(microvmac PROPERTIES C_STANDARD 17 C_STANDARD_REQUIRED True)
|
||||
target_compile_definitions(microvmac PUBLIC CurEmMd=kEmMd_Plus)
|
||||
configure_file(cfg/CNFGRAPI.in cfg/CNFGRAPI.h)
|
||||
include_directories(src/ cfg/ lib/ ${CMAKE_CURRENT_BINARY_DIR}/cfg/)
|
||||
|
||||
# Git submodule libraries
|
||||
add_library(tomlc99 OBJECT lib/tomlc99/toml.c)
|
||||
target_include_directories(tomlc99 PRIVATE lib/tomlc99)
|
||||
target_link_libraries(microvmac PRIVATE tomlc99)
|
||||
|
||||
# Hardware libraries
|
||||
# Some are temporarily disabled while I get CMake up and running
|
||||
|
||||
add_library(
|
||||
hw_adb OBJECT
|
||||
src/HW/ADB/ADBEMDEV.c
|
||||
)
|
||||
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/HW/DISK/)
|
||||
|
||||
add_library(
|
||||
hw_kbrd OBJECT
|
||||
src/HW/KBRD/KBRDEMDV.c
|
||||
)
|
||||
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/M68KITAB.c
|
||||
src/HW/M68K/MINEM68K.c
|
||||
)
|
||||
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/HW/MOUSE/)
|
||||
|
||||
add_library(
|
||||
hw_powerman OBJECT
|
||||
src/HW/POWERMAN/PMUEMDEV.c
|
||||
)
|
||||
target_include_directories(hw_powerman PRIVATE src/HW/POWERMAN/)
|
||||
target_compile_definitions(hw_powerman PUBLIC EmPMU=1)
|
||||
|
||||
target_include_directories(microvmac PRIVATE src/HW/RAM/RAMADDR.h) # no associated .c file
|
||||
|
||||
add_library(
|
||||
hw_rom OBJECT
|
||||
src/HW/ROM/ROMEMDEV.c
|
||||
)
|
||||
target_include_directories(hw_powerman PRIVATE src/HW/ROM/)
|
||||
|
||||
add_library(
|
||||
hw_rtc OBJECT
|
||||
src/HW/RTC/RTCEMDEV.c
|
||||
)
|
||||
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/HW/SCC/)
|
||||
|
||||
add_library(
|
||||
hw_screen OBJECT
|
||||
src/HW/SCREEN/SCRNEMDV.c
|
||||
src/PATCHES/SCRNHACK.c
|
||||
)
|
||||
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/HW/SCSI/)
|
||||
|
||||
add_library(
|
||||
hw_sound OBJECT
|
||||
src/HW/SOUND/SNDEMDEV.c
|
||||
)
|
||||
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/HW/VIA/)
|
||||
|
||||
add_library(
|
||||
hw_via2 OBJECT
|
||||
src/HW/VIA/VIA2EMDV.c
|
||||
)
|
||||
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/HW/VIA/)
|
||||
target_compile_definitions(hw_vidcard PUBLIC EmVidCard=1)
|
||||
target_compile_definitions(hw_vidcard PUBLIC IncludeVidMem=1)
|
||||
|
||||
# User interface definitions
|
||||
|
||||
add_library(
|
||||
ui_sdl2 OBJECT
|
||||
src/UI/COMOSGLU.c
|
||||
src/UI/CONTROLM.c
|
||||
src/UI/SDL2/OSGLUSD2.c
|
||||
#'src/UI/SDL2/CLIPBRD.c
|
||||
src/UI/SDL2/DBGLOG.c
|
||||
src/UI/SDL2/DRIVES.c
|
||||
src/UI/SDL2/INTL.c
|
||||
src/UI/SDL2/KEYBOARD.c
|
||||
src/UI/SDL2/MOUSE.c
|
||||
src/UI/SDL2/ROM.c
|
||||
src/UI/SDL2/SOUND.c
|
||||
src/UI/SDL2/TIMEDATE.c
|
||||
src/UI/SDL2/VIDEO.c
|
||||
)
|
||||
target_include_directories(ui_sdl2 PRIVATE src/ cfg/ ${CMAKE_CURRENT_BINARY_DIR}/cfg/ )
|
||||
target_include_directories(ui_sdl2 PRIVATE src/UI/ src/UI/SDL2/)
|
||||
target_link_libraries(ui_sdl2 SDL2::SDL2 SDL2::SDL2main)
|
||||
|
||||
# Win32 resource file
|
||||
|
||||
if (WIN32)
|
||||
target_sources(
|
||||
microvmac PRIVATE
|
||||
rsrc/WIN32/main.rc
|
||||
)
|
||||
target_include_directories(microvmac PRIVATE rsrc/WIN32)
|
||||
target_link_libraries(microvmac PRIVATE winmm ole32 uuid)
|
||||
if (MSVC)
|
||||
# if not specified, Visual Studio will attempt to add its own manifest,
|
||||
# resulting in a compilation error
|
||||
target_link_options(microvmac PRIVATE "/manifest:NO")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Macintosh definitions
|
||||
set(
|
||||
tgt_macbase
|
||||
hw_disk
|
||||
hw_m68k
|
||||
hw_rom
|
||||
hw_rtc
|
||||
hw_sound
|
||||
hw_scc
|
||||
hw_via1
|
||||
ui_sdl2
|
||||
)
|
||||
|
||||
set(
|
||||
tgt_macplus
|
||||
${tgt_macbase}
|
||||
hw_screen
|
||||
hw_mouse
|
||||
hw_kbrd
|
||||
hw_scsi
|
||||
)
|
||||
|
||||
set(
|
||||
tgt_macii
|
||||
${tgt_macbase}
|
||||
hw_vidcard
|
||||
hw_adb
|
||||
)
|
||||
|
||||
# TODO: allow selecting emulated machine and options
|
||||
target_link_libraries(microvmac PRIVATE ${tgt_macplus}) # temporary
|
||||
target_compile_definitions(microvmac INTERFACE CurEmMd=kEmMd_Plus)
|
12
CMakePresets.json
Normal file
12
CMakePresets.json
Normal file
@ -0,0 +1,12 @@
|
||||
{
|
||||
"version": 3,
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "debug",
|
||||
"toolchainFile": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
30
cfg/CNFGRAPI.in
Normal file
30
cfg/CNFGRAPI.in
Normal file
@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
// TODO: allow some of these options to be configured via CMake
|
||||
#define EnableDragDrop 1
|
||||
#define ItnlKyBdFix 1
|
||||
#define MayFullScreen 1
|
||||
#define MayNotFullScreen 1
|
||||
#define NeedDoAboutMsg 1
|
||||
#define NeedDoMoreCommandsMsg 1
|
||||
#define NeedIntlChars 0
|
||||
#define NeedRequestInsertDisk 1
|
||||
#define NeedRequestIthDisk 0
|
||||
#define RomStartCheckSum 1
|
||||
#define SaveDialogEnable 1
|
||||
#define UseControlKeys 0
|
||||
#define WantEnblCrtlKtg 1
|
||||
#define WantEnblCtrlInt 1
|
||||
#define WantEnblCtrlRst 1
|
||||
#define WantInitFullScreen 0
|
||||
#define WantInitMagnify 0
|
||||
#define WantInitRunInBackground 1
|
||||
#define WantInitSpeedValue 0
|
||||
#define WindowScale 2
|
||||
|
||||
#define kAppVariationStr "@PROJECT_VERSION@"
|
||||
#define kBldOpts "obsolete"
|
||||
#define kMaintainerName "InvisibleUp"
|
||||
#define kStrAppName "micro vMac"
|
||||
#define kStrCopyrightYear "1996-2023"
|
||||
#define kStrHomePage "https://github.com/invisibleup/uvmac/"
|
1
vcpkg
Submodule
1
vcpkg
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit cd5e746ec203c8c3c61647e0886a8df8c1e78e41
|
14
vcpkg-configuration.json
Normal file
14
vcpkg-configuration.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"default-registry": {
|
||||
"kind": "git",
|
||||
"baseline": "cd5e746ec203c8c3c61647e0886a8df8c1e78e41",
|
||||
"repository": "https://github.com/microsoft/vcpkg"
|
||||
},
|
||||
"registries": [
|
||||
{
|
||||
"kind": "artifact",
|
||||
"location": "https://github.com/microsoft/vcpkg-ce-catalog/archive/refs/heads/main.zip",
|
||||
"name": "microsoft"
|
||||
}
|
||||
]
|
||||
}
|
5
vcpkg.json
Normal file
5
vcpkg.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"dependencies": [
|
||||
"sdl2"
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user