Add CMake build files

This commit is contained in:
David Hrdlička
2021-01-12 18:22:40 +01:00
parent 4a87af237a
commit 11b6604196
29 changed files with 679 additions and 46 deletions

52
CMakeLists.txt Normal file
View File

@@ -0,0 +1,52 @@
cmake_minimum_required(VERSION 3.16)
project(86Box
VERSION 2.10
DESCRIPTION "Emulator of x86-based systems"
HOMEPAGE_URL "https://86box.github.io/"
LANGUAGES C CXX)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(TargetArch)
target_architecture(CMAKE_TARGET_ARCHITECTURES)
include(CMakeDependentOption)
add_compile_definitions(CMAKE)
option(RELEASE "Release build" OFF)
option(USB "USB support" OFF)
option(DYNAREC "Dynamic recompiler" ON)
option(FLUIDSYNTH "FluidSynth" ON)
option(MUNT "MUNT" ON)
option(VRAMDUMP "Video RAM dumping" OFF)
option(DINPUT "DirectInput" OFF)
option(DISCORD "Discord integration" ON)
option(NEW_DYNAREC "Use the PCem v15 (\"new\") dynamic recompiler" OFF)
option(DEV_BRANCH "Development branch" OFF)
CMAKE_DEPENDENT_OPTION(AMD_K5 "AMD K5" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(CL5422 "Cirrus Logic CL-GD 5402/5420/5422" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(CYRIX_6X86 "Cyrix 6x86" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(GUSMAX "Gravis UltraSound MAX" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(HEDAKA "Hedaka HED-919" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(LASERXT "VTech Laser XT" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(MGA "Matrox Mystique graphics adapters" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(NO_SIO "Machines without emulated Super I/O chips" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(OPEN_AT "OpenAT" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PAS16 "Pro Audio Spectrum 16" OFF "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PS1M2133 "IBM PS/1 model 2133" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(PS2M70T4 "IBM PS/2 model 70 (type 4)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(S3TRIO3D2X "S3 Trio3D/2X" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(SIO_DETECT "Super I/O Detection Helper" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(STPC "STPC machines" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(M1489 "ALi M1489" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(M6117 "ALi M6117" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VGAWONDER "ATI VGA Wonder (ATI-18800)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VNC "VNC renderer" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(VECT486VL "HP Vectra 486VL" ON "DEV_BRANCH" OFF)
CMAKE_DEPENDENT_OPTION(DELLS4 "Dell Dimension XPS P60; Dell OptiPlex 560/L" ON "DEV_BRANCH" OFF)
add_subdirectory(src)

141
cmake/TargetArch.cmake Normal file
View File

@@ -0,0 +1,141 @@
# Based on the Qt 5 processor detection code, so should be very accurate
# https://qt.gitorious.org/qt/qtbase/blobs/master/src/corelib/global/qprocessordetection.h
# Currently handles arm (v5, v6, v7, v8), x86 (32/64), ia64, and ppc (32/64)
# Regarding POWER/PowerPC, just as is noted in the Qt source,
# "There are many more known variants/revisions that we do not handle/detect."
set(archdetect_c_code "
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64)
#if defined(__ARM64_ARCH_8__) \\
|| defined(__aarch64__) \\
|| defined(__ARMv8__) \\
|| defined(__ARMv8_A__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 8) \\
|| (defined(_M_ARM64) && _M_ARM64 >= 1)
#error cmake_ARCH armv8
#elif defined(__ARM_ARCH_7__) \\
|| defined(__ARM_ARCH_7A__) \\
|| defined(__ARM_ARCH_7R__) \\
|| defined(__ARM_ARCH_7M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 7) \\
|| (defined(_M_ARM) && _M_ARM >= 7)
#error cmake_ARCH armv7
#elif defined(__ARM_ARCH_6__) \\
|| defined(__ARM_ARCH_6J__) \\
|| defined(__ARM_ARCH_6T2__) \\
|| defined(__ARM_ARCH_6Z__) \\
|| defined(__ARM_ARCH_6K__) \\
|| defined(__ARM_ARCH_6ZK__) \\
|| defined(__ARM_ARCH_6M__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 6)
#error cmake_ARCH armv6
#elif defined(__ARM_ARCH_5TEJ__) \\
|| (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM-0 >= 5)
#error cmake_ARCH armv5
#else
#error cmake_ARCH arm
#endif
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
#error cmake_ARCH i386
#elif defined(__x86_64) || defined(__x86_64__) || defined(__amd64) || defined(_M_X64)
#error cmake_ARCH x86_64
#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64)
#error cmake_ARCH ia64
#elif defined(__ppc__) || defined(__ppc) || defined(__powerpc__) \\
|| defined(_ARCH_COM) || defined(_ARCH_PWR) || defined(_ARCH_PPC) \\
|| defined(_M_MPPC) || defined(_M_PPC)
#if defined(__ppc64__) || defined(__powerpc64__) || defined(__64BIT__)
#error cmake_ARCH ppc64
#else
#error cmake_ARCH ppc
#endif
#endif
#error cmake_ARCH unknown
")
# Set ppc_support to TRUE before including this file or ppc and ppc64
# will be treated as invalid architectures since they are no longer supported by Apple
function(target_architecture output_var)
if(APPLE AND CMAKE_OSX_ARCHITECTURES)
# On OS X we use CMAKE_OSX_ARCHITECTURES *if* it was set
# First let's normalize the order of the values
# Note that it's not possible to compile PowerPC applications if you are using
# the OS X SDK version 10.6 or later - you'll need 10.4/10.5 for that, so we
# disable it by default
# See this page for more information:
# http://stackoverflow.com/questions/5333490/how-can-we-restore-ppc-ppc64-as-well-as-full-10-4-10-5-sdk-support-to-xcode-4
# Architecture defaults to i386 or ppc on OS X 10.5 and earlier, depending on the CPU type detected at runtime.
# On OS X 10.6+ the default is x86_64 if the CPU supports it, i386 otherwise.
foreach(osx_arch ${CMAKE_OSX_ARCHITECTURES})
if("${osx_arch}" STREQUAL "ppc" AND ppc_support)
set(osx_arch_ppc TRUE)
elseif("${osx_arch}" STREQUAL "i386")
set(osx_arch_i386 TRUE)
elseif("${osx_arch}" STREQUAL "x86_64")
set(osx_arch_x86_64 TRUE)
elseif("${osx_arch}" STREQUAL "ppc64" AND ppc_support)
set(osx_arch_ppc64 TRUE)
else()
message(FATAL_ERROR "Invalid OS X arch name: ${osx_arch}")
endif()
endforeach()
# Now add all the architectures in our normalized order
if(osx_arch_ppc)
list(APPEND ARCH ppc)
endif()
if(osx_arch_i386)
list(APPEND ARCH i386)
endif()
if(osx_arch_x86_64)
list(APPEND ARCH x86_64)
endif()
if(osx_arch_ppc64)
list(APPEND ARCH ppc64)
endif()
else()
file(WRITE "${CMAKE_BINARY_DIR}/arch.c" "${archdetect_c_code}")
enable_language(C)
# Detect the architecture in a rather creative way...
# This compiles a small C program which is a series of ifdefs that selects a
# particular #error preprocessor directive whose message string contains the
# target architecture. The program will always fail to compile (both because
# file is not a valid C program, and obviously because of the presence of the
# #error preprocessor directives... but by exploiting the preprocessor in this
# way, we can detect the correct target architecture even when cross-compiling,
# since the program itself never needs to be run (only the compiler/preprocessor)
try_run(
run_result_unused
compile_result_unused
"${CMAKE_BINARY_DIR}"
"${CMAKE_BINARY_DIR}/arch.c"
COMPILE_OUTPUT_VARIABLE ARCH
CMAKE_FLAGS CMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
)
# Parse the architecture name from the compiler output
string(REGEX MATCH "cmake_ARCH ([a-zA-Z0-9_]+)" ARCH "${ARCH}")
# Get rid of the value marker leaving just the architecture name
string(REPLACE "cmake_ARCH " "" ARCH "${ARCH}")
# If we are compiling with an unknown architecture this variable should
# already be set to "unknown" but in the case that it's empty (i.e. due
# to a typo in the code), then set it to unknown
if (NOT ARCH)
set(ARCH unknown)
endif()
endif()
set(${output_var} "${ARCH}" PARENT_SCOPE)
endfunction()

94
src/CMakeLists.txt Normal file
View File

@@ -0,0 +1,94 @@
# WIN32 marks us as a GUI app on Windows
add_executable(86Box WIN32 pc.c config.c random.c timer.c io.c acpi.c apm.c
dma.c ddma.c nmi.c pic.c pit.c port_92.c ppi.c pci.c mca.c usb.c
device.c nvr.c nvr_at.c nvr_ps2.c)
if(NEW_DYNAREC)
add_compile_definitions(USE_NEW_DYNAREC)
endif()
if(RELEASE)
add_compile_definitions(RELEASE_BUILD)
endif()
if(DYNAREC)
add_compile_definitions(USE_DYNAREC)
endif()
if(VRAMDUMP)
add_compile_definitions(ENABLE_VRAM_DUMP)
endif()
if(DEV_BRANCH)
add_compile_definitions(DEV_BRANCH)
endif()
if(VNC)
add_compile_definitions(USE_VNC)
add_library(vnc OBJECT vnc.c vnc_keymap.c)
target_link_libraries(86Box vnc vncserver ws2_32)
endif()
if(STPC)
add_compile_definitions(USE_STPC)
endif()
target_link_libraries(86Box cpu chipset mch dev mem fdd game cdrom zip mo hdd
net print scsi sio snd vid plat ui)
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
find_package(OpenAL CONFIG REQUIRED)
include_directories(${OPENAL_INCLUDE_DIRS})
target_link_libraries(86Box OpenAL::OpenAL)
find_package(SDL2 CONFIG REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
target_link_libraries(86Box SDL2::SDL2)
find_package(PNG REQUIRED)
include_directories(${PNG_INCLUDE_DIRS})
target_link_libraries(86Box PNG::PNG)
if(CMAKE_TARGET_ARCHITECTURES STREQUAL "i386")
if(MSVC)
set_target_properties(86Box PROPERTIES LINK_FLAGS "/LARGEADDRESSAWARE")
elseif(MINGW)
set_target_properties(86Box PROPERTIES LINK_FLAGS "-Wl,--large-address-aware")
endif()
endif()
configure_file(include/86box/version.h.in include/86box/version.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR}/include)
include_directories(include)
if(NEW_DYNAREC)
include_directories(cpu codegen_new)
else()
include_directories(cpu codegen)
endif()
add_subdirectory(cdrom)
add_subdirectory(chipset)
add_subdirectory(cpu)
if(NEW_DYNAREC)
add_subdirectory(codegen_new)
else()
add_subdirectory(codegen)
endif()
add_subdirectory(device)
add_subdirectory(disk)
add_subdirectory(floppy)
add_subdirectory(game)
add_subdirectory(machine)
add_subdirectory(mem)
add_subdirectory(network)
add_subdirectory(printer)
add_subdirectory(sio)
add_subdirectory(scsi)
add_subdirectory(sound)
add_subdirectory(video)
add_subdirectory(win)

1
src/cdrom/CMakeLists.txt Normal file
View File

@@ -0,0 +1 @@
add_library(cdrom OBJECT cdrom.c cdrom_image_backend.c cdrom_image.c)

View File

@@ -0,0 +1,18 @@
add_library(chipset OBJECT acc2168.c cs8230.c ali1429.c headland.c intel_82335.c
cs4031.c intel_420ex.c intel_4x0.c intel_sio.c intel_piix.c ../ioapic.c
neat.c opti495.c opti895.c opti5x7.c scamp.c scat.c via_vt82c49x.c
via_vt82c505.c sis_85c310.c sis_85c4xx.c sis_85c496.c sis_85c50x.c
opti283.c opti291.c umc491.c via_apollo.c via_pipc.c wd76c10.c
vl82c480.c)
if(STPC)
target_sources(chipset PRIVATE stpc.c)
endif()
if(M1489)
target_sources(chipset PRIVATE ali1489.c)
endif()
if(M6117)
target_sources(chipset PRIVATE ali6117.c)
endif()

View File

@@ -0,0 +1,17 @@
if(DYNAREC)
add_library(dynarec OBJECT codegen.c codegen_ops.c)
if(CMAKE_TARGET_ARCHITECTURES STREQUAL "i386")
target_sources(dynarec PRIVATE codegen_x86.c
codegen_accumulate_x86.c)
elseif(CMAKE_TARGET_ARCHITECTURES STREQUAL "x86_64")
target_sources(dynarec PRIVATE codegen_x86-64.c
codegen_accumulate_x86-64.c)
else()
message(SEND_ERROR
"Dynarec is incompatible with target platform "
${CMAKE_TARGET_ARCHITECTURES})
endif()
target_link_libraries(86Box dynarec cgt)
endif()

View File

@@ -0,0 +1,37 @@
if(DYNAREC)
add_library(dynarec OBJECT codegen.c codegen_accumulate.c
codegen_allocator.c codegen_block.c codegen_ir.c codegen_ops.c
codegen_ops_3dnow.c codegen_ops_branch.c codegen_ops_arith.c
codegen_ops_fpu_arith.c codegen_ops_fpu_constant.c
codegen_ops_fpu_loadstore.c codegen_ops_fpu_misc.c
codegen_ops_helpers.c codegen_ops_jump.c codegen_ops_logic.c
codegen_ops_misc.c codegen_ops_mmx_arith.c codegen_ops_mmx_cmp.c
codegen_ops_mmx_loadstore.c codegen_ops_mmx_logic.c
codegen_ops_mmx_pack.c codegen_ops_mmx_shift.c codegen_ops_mov.c
codegen_ops_shift.c codegen_ops_stack.c codegen_reg.c)
if(CMAKE_TARGET_ARCHITECTURES STREQUAL "i386")
target_sources(dynarec PRIVATE codegen_backend_x86.c
codegen_backend_x86_ops.c codegen_backend_x86_ops_fpu.c
codegen_backend_x86_ops_sse.c
codegen_backend_x86_uops.c)
elseif(CMAKE_TARGET_ARCHITECTURES STREQUAL "x86_64")
target_sources(dynarec PRIVATE codegen_backend_x86-64.c
codegen_backend_x86-64_ops.c
codegen_backend_x86-64_ops_sse.c
codegen_backend_x86-64_uops.c)
elseif(CMAKE_TARGET_ARCHITECTURES STREQUAL "armv8")
target_sources(dynarec PRIVATE codegen_backend_arm64.c
codegen_backend_arm64_ops.c codegen_backend_arm64_uops.c
codegen_backend_arm64_imm.c)
elseif(CMAKE_TARGET_ARCHITECTURES MATCHES "arm")
target_sources(dynarec PRIVATE codegen_backend_arm.c
codegen_backend_arm_ops.c codegen_backend_arm_uops.c)
else()
message(SEND_ERROR
"Dynarec is incompatible with target platform "
${CMAKE_TARGET_ARCHITECTURES})
endif()
target_link_libraries(86Box dynarec cgt)
endif()

17
src/cpu/CMakeLists.txt Normal file
View File

@@ -0,0 +1,17 @@
add_library(cpu OBJECT cpu.c cpu_table.c 808x.c 386.c 386_common.c 386_dynarec.c
386_dynarec_ops.c x86seg.c x87.c x87_timings.c)
if(AMD_K5)
target_compile_definitions(cpu PRIVATE USE_AMD_K5)
endif()
if(CYRIX_6X86)
target_compile_definitions(cpu PRIVATE USE_CYRIX_6X86)
endif()
if(DYNAREC)
add_library(cgt OBJECT codegen_timing_486.c codegen_timing_686.c
codegen_timing_common.c codegen_timing_k6.c
codegen_timing_pentium.c codegen_timing_p6.c
codegen_timing_winchip.c codegen_timing_winchip2.c)
endif()

View File

@@ -0,0 +1,9 @@
add_library(dev OBJECT bugger.c hwm.c hwm_lm75.c hwm_lm78.c hwm_gl518sm.c
hwm_vt82c686.c ibm_5161.c isamem.c isartc.c ../lpt.c pci_bridge.c
postcard.c serial.c vpc2007.c clock_ics9xxx.c i2c.c i2c_gpio.c
smbus_piix4.c keyboard.c keyboard_xt.c keyboard_at.c mouse.c mouse_bus.c
mouse_serial.c mouse_ps2.c phoenix_486_jumper.c)
if(LASERXT)
target_compile_definitions(dev PRIVATE USE_LASERXT)
endif()

10
src/disk/CMakeLists.txt Normal file
View File

@@ -0,0 +1,10 @@
add_library(hdd OBJECT hdd.c hdd_image.c hdd_table.c hdc.c hdc_st506_xt.c
hdc_st506_at.c hdc_xta.c hdc_esdi_at.c hdc_esdi_mca.c hdc_xtide.c
hdc_ide.c hdc_ide_opti611.c hdc_ide_cmd640.c hdc_ide_sff8038i.c)
add_library(zip OBJECT zip.c)
add_library(mo OBJECT mo.c)
add_subdirectory(minivhd)
target_link_libraries(86Box minivhd)

View File

@@ -0,0 +1,3 @@
add_library(minivhd STATIC cwalk.c libxml2_encoding.c minivhd_convert.c
minivhd_create.c minivhd_io.c minivhd_manage.c minivhd_struct_rw.c
minivhd_util.c)

View File

@@ -0,0 +1,2 @@
add_library(fdd OBJECT fdd.c fdc.c fdc_pii15xb.c fdi2raw.c fdd_common.c
fdd_86f.c fdd_fdi.c fdd_imd.c fdd_img.c fdd_json.c fdd_mfm.c fdd_td0.c)

2
src/game/CMakeLists.txt Normal file
View File

@@ -0,0 +1,2 @@
add_library(game OBJECT gameport.c joystick_standard.c
joystick_ch_flightstick_pro.c joystick_sw_pad.c joystick_tm_fcs.c)

View File

@@ -0,0 +1,31 @@
/*
* 86Box A hypervisor and IBM PC system emulator that specializes in
* running old operating systems and software designed for IBM
* PC systems and compatibles from 1981 through fairly recent
* system designs based on the PCI bus.
*
* This file is part of the 86Box distribution.
*
* Definitions for project version, branding, and external links.
*
* Authors: Miran Grca, <mgrca8@gmail.com>
*
* Copyright 2020 Miran Grca.
*/
/* Version info. */
#define EMU_NAME "@CMAKE_PROJECT_NAME@"
#define EMU_NAME_W L"@CMAKE_PROJECT_NAME@"
#define EMU_VERSION "@CMAKE_PROJECT_VERSION@"
#define EMU_VERSION_W L"@CMAKE_PROJECT_VERSION@"
#define EMU_VERSION_EX "@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@0"
#define EMU_VERSION_MAJ @CMAKE_PROJECT_VERSION_MAJOR@
#define EMU_VERSION_MIN @CMAKE_PROJECT_VERSION_MINOR@
#define COPYRIGHT_YEAR "2020"
/* Web URL info. */
#define EMU_SITE L"@CMAKE_PROJECT_HOMEPAGE_URL@"
#define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest"
#define EMU_DOCS_URL L"https://86box.readthedocs.io"

View File

@@ -28,4 +28,4 @@
/* Web URL info. */
#define EMU_SITE L"86box.net"
#define EMU_ROMS_URL L"https://github.com/86Box/roms/releases/latest"
#define EMU_DOCS_URL L"https://86box.readthedocs.io"
#define EMU_DOCS_URL L"https://86box.readthedocs.io"

View File

@@ -0,0 +1,48 @@
add_library(mch OBJECT machine.c machine_table.c m_xt.c m_xt_compaq.c
m_xt_t1000.c m_xt_t1000_vid.c m_xt_xi8088.c m_xt_zenith.c m_pcjr.c
m_amstrad.c m_europc.c m_xt_olivetti.c m_tandy.c m_at.c m_at_commodore.c
m_at_t3100e.c m_at_t3100e_vid.c m_ps1.c m_ps1_hdc.c m_ps2_isa.c
m_ps2_mca.c m_at_compaq.c m_at_286_386sx.c m_at_386dx_486.c
m_at_socket4_5.c m_at_socket7.c m_at_sockets7.c m_at_socket8.c
m_at_slot1.c m_at_slot2.c m_at_socket370.c m_at_misc.c)
if(HEDAKA)
target_compile_definitions(mch PRIVATE USE_HEDAKA)
endif()
if(LASERXT)
target_sources(mch PRIVATE m_xt_laserxt.c)
target_compile_definitions(mch PRIVATE USE_LASERXT)
endif()
if(NO_SIO)
target_compile_definitions(mch PRIVATE NO_SIO)
endif()
if(OPEN_AT)
target_compile_definitions(mch PRIVATE USE_OPEN_AT)
endif()
if(PS1M2133)
target_compile_definitions(mch PRIVATE USE_PS1M2133)
endif()
if(PS2M70T4)
target_compile_definitions(mch PRIVATE USE_PS2M70T4)
endif()
if(M1489)
target_compile_definitions(mch PRIVATE USE_M1489)
endif()
if(M6117)
target_compile_definitions(mch PRIVATE USE_M6117)
endif()
if(VECT486VL)
target_compile_definitions(mch PRIVATE USE_VECT486VL)
endif()
if(DELLS4)
target_compile_definitions(mch PRIVATE USE_DELLS4)
endif()

2
src/mem/CMakeLists.txt Normal file
View File

@@ -0,0 +1,2 @@
add_library(mem OBJECT catalyst_flash.c i2c_eeprom.c intel_flash.c mem.c rom.c
smram.c spd.c sst_flash.c)

View File

@@ -0,0 +1,5 @@
add_library(net OBJECT network.c net_pcap.c net_slirp.c net_dp8390.c net_3c503.c
net_ne2000.c net_pcnet.c net_wd8003.c net_plip.c)
add_subdirectory(slirp)
target_link_libraries(86Box slirp)

View File

@@ -0,0 +1,5 @@
add_library(slirp STATIC arp_table.c bootp.c cksum.c dnssearch.c if.c ip_icmp.c
ip_input.c ip_output.c mbuf.c misc.c sbuf.c slirp.c socket.c tcp_input.c
tcp_output.c tcp_subr.c tcp_timer.c udp.c util.c version.c)
target_link_libraries(slirp wsock32 iphlpapi)

View File

@@ -0,0 +1 @@
add_library(print OBJECT png.c prt_cpmap.c prt_escp.c prt_text.c prt_ps.c)

3
src/scsi/CMakeLists.txt Normal file
View File

@@ -0,0 +1,3 @@
add_library(scsi OBJECT scsi.c scsi_device.c scsi_cdrom.c scsi_disk.c
scsi_x54x.c scsi_aha154x.c scsi_buslogic.c scsi_ncr5380.c
scsi_ncr53c8xx.c scsi_pcscsi.c scsi_spock.c)

9
src/sio/CMakeLists.txt Normal file
View File

@@ -0,0 +1,9 @@
add_library(sio OBJECT sio_acc3221.c sio_f82c710.c sio_82091aa.c sio_fdc37c661.c
sio_fdc37c66x.c sio_fdc37c669.c sio_fdc37c93x.c sio_fdc37m60x.c
sio_pc87306.c sio_pc87307.c sio_pc87309.c sio_pc87311.c sio_pc87332.c
sio_prime3c.c sio_w83787f.c sio_w83877f.c sio_w83977f.c sio_um8669f.c
sio_vt82c686.c)
if(SIO_DETECT)
target_sources(sio PRIVATE sio_detect.c)
endif()

30
src/sound/CMakeLists.txt Normal file
View File

@@ -0,0 +1,30 @@
add_library(snd OBJECT sound.c openal.c snd_opl.c snd_opl_nuked.c snd_resid.cc
midi.c midi_system.c snd_speaker.c snd_pssj.c snd_lpt_dac.c
snd_lpt_dss.c snd_adlib.c snd_adlibgold.c snd_ad1848.c snd_audiopci.c
snd_azt2316a.c snd_cms.c snd_gus.c snd_sb.c snd_sb_dsp.c snd_emu8k.c
snd_mpu401.c snd_sn76489.c snd_ssi2001.c snd_wss.c snd_ym7128.c)
if(FLUIDSYNTH)
target_compile_definitions(snd PRIVATE USE_FLUIDSYNTH)
target_sources(snd PRIVATE midi_fluidsynth.c)
endif()
if(MUNT)
target_compile_definitions(snd PRIVATE USE_MUNT)
target_sources(snd PRIVATE midi_mt32.c)
add_subdirectory(munt)
target_link_libraries(86Box mt32emu)
endif()
if(PAS16)
target_compile_definitions(snd PRIVATE USE_PAS16)
target_sources(snd PRIVATE snd_pas16.c)
endif()
if(GUSMAX)
target_compile_definitions(snd PRIVATE USE_GUSMAX)
endif()
add_subdirectory(resid-fp)
target_link_libraries(86Box resid-fp)

View File

@@ -0,0 +1,11 @@
add_library(mt32emu STATIC Analog.cpp BReverbModel.cpp File.cpp FileStream.cpp
LA32Ramp.cpp LA32FloatWaveGenerator.cpp LA32WaveGenerator.cpp
MidiStreamParser.cpp Part.cpp Partial.cpp PartialManager.cpp
Poly.cpp ROMInfo.cpp SampleRateConverter.cpp
srchelper/srctools/src/FIRResampler.cpp
srchelper/srctools/src/IIR2xResampler.cpp
srchelper/srctools/src/LinearResampler.cpp
srchelper/srctools/src/ResamplerModel.cpp
srchelper/srctools/src/SincResampler.cpp
srchelper/InternalResampler.cpp Synth.cpp Tables.cpp TVA.cpp TVF.cpp
TVP.cpp sha1/sha1.cpp c_interface/c_interface.cpp)

View File

@@ -0,0 +1,4 @@
add_library(resid-fp STATIC convolve-sse.cc convolve.cc envelope.cc extfilt.cc
filter.cc pot.cc sid.cc voice.cc wave.cc wave6581_PST.cc
wave6581_PS_.cc wave6581_P_T.cc wave6581__ST.cc wave8580_PST.cc
wave8580_PS_.cc wave8580_P_T.cc wave8580__ST.cc)

40
src/video/CMakeLists.txt Normal file
View File

@@ -0,0 +1,40 @@
add_library(vid OBJECT video.c vid_table.c vid_cga.c vid_cga_comp.c
vid_compaq_cga.c vid_mda.c vid_hercules.c vid_herculesplus.c
vid_incolor.c vid_colorplus.c vid_genius.c vid_pgc.c vid_im1024.c
vid_sigma.c vid_wy700.c vid_ega.c vid_ega_render.c vid_svga.c
vid_svga_render.c vid_ddc.c vid_vga.c vid_ati_eeprom.c vid_ati18800.c
vid_ati28800.c vid_ati_mach64.c vid_ati68860_ramdac.c vid_bt48x_ramdac.c
vid_av9194.c vid_icd2061.c vid_ics2494.c vid_ics2595.c vid_cl54xx.c
vid_et4000.c vid_sc1148x_ramdac.c vid_sc1502x_ramdac.c vid_et4000w32.c
vid_stg_ramdac.c vid_ht216.c vid_oak_oti.c vid_paradise.c
vid_ti_cf62011.c vid_tvga.c vid_tgui9440.c vid_tkd8001_ramdac.c
vid_att20c49x_ramdac.c vid_s3.c vid_s3_virge.c vid_ibm_rgb528_ramdac.c
vid_sdac_ramdac.c vid_voodoo.c vid_voodoo_banshee.c
vid_voodoo_banshee_blitter.c vid_voodoo_blitter.c vid_voodoo_display.c
vid_voodoo_fb.c vid_voodoo_fifo.c vid_voodoo_reg.c vid_voodoo_render.c
vid_voodoo_setup.c vid_voodoo_texture.c vid_ogc.c vid_nga.c)
if(NOT MSVC)
target_compile_options(vid PRIVATE "-msse2")
endif()
if(CL5422)
target_compile_definitions(vid PRIVATE USE_CL5422)
endif()
if(MGA)
target_compile_definitions(vid PRIVATE USE_MGA)
target_sources(vid PRIVATE vid_mga.c)
endif()
if(S3TRIO3D2X)
target_compile_definitions(vid PRIVATE USE_S3TRIO3D2X)
endif()
if(VGAWONDER)
target_compile_definitions(vid PRIVATE USE_VGAWONDER)
endif()
if(XL24)
target_compile_definitions(vid PRIVATE USE_XL24)
endif()

View File

@@ -696,68 +696,76 @@ BEGIN
END
#ifndef NO_INCLUDE_MANIFEST
/////////////////////////////////////////////////////////////////////////////
//
// 24
//
1 24 MOVEABLE PURE "86Box.manifest"
#endif
/////////////////////////////////////////////////////////////////////////////
//
// Icon
//
#ifdef CMAKE
#define ICON_PATH
#else
#define ICON_PATH "win/"
#endif
// Icon with lowest ID value placed first to ensure application icon
// remains consistent on all systems.
#ifdef RELEASE_BUILD
/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC_256x256.png */
10 ICON DISCARDABLE "win/icons/86Box-RB.ico"
10 ICON DISCARDABLE ICON_PATH "icons/86Box-RB.ico"
#else
/* Icon by Devcore - https://commons.wikimedia.org/wiki/File:Icon_PC2_256x256.png */
10 ICON DISCARDABLE "win/icons/86Box.ico"
10 ICON DISCARDABLE ICON_PATH "icons/86Box.ico"
#endif
16 ICON DISCARDABLE "win/icons/floppy_525.ico"
17 ICON DISCARDABLE "win/icons/floppy_525_active.ico"
24 ICON DISCARDABLE "win/icons/floppy_35.ico"
25 ICON DISCARDABLE "win/icons/floppy_35_active.ico"
32 ICON DISCARDABLE "win/icons/cdrom.ico"
33 ICON DISCARDABLE "win/icons/cdrom_active.ico"
48 ICON DISCARDABLE "win/icons/zip.ico"
49 ICON DISCARDABLE "win/icons/zip_active.ico"
56 ICON DISCARDABLE "win/icons/mo.ico"
57 ICON DISCARDABLE "win/icons/mo_active.ico"
64 ICON DISCARDABLE "win/icons/cassette.ico"
65 ICON DISCARDABLE "win/icons/cassette_active.ico"
80 ICON DISCARDABLE "win/icons/hard_disk.ico"
81 ICON DISCARDABLE "win/icons/hard_disk_active.ico"
96 ICON DISCARDABLE "win/icons/network.ico"
97 ICON DISCARDABLE "win/icons/network_active.ico"
144 ICON DISCARDABLE "win/icons/floppy_525_empty.ico"
145 ICON DISCARDABLE "win/icons/floppy_525_empty_active.ico"
152 ICON DISCARDABLE "win/icons/floppy_35_empty.ico"
153 ICON DISCARDABLE "win/icons/floppy_35_empty_active.ico"
160 ICON DISCARDABLE "win/icons/cdrom_empty.ico"
161 ICON DISCARDABLE "win/icons/cdrom_empty_active.ico"
176 ICON DISCARDABLE "win/icons/zip_empty.ico"
177 ICON DISCARDABLE "win/icons/zip_empty_active.ico"
184 ICON DISCARDABLE "win/icons/mo_empty.ico"
185 ICON DISCARDABLE "win/icons/mo_empty_active.ico"
192 ICON DISCARDABLE "win/icons/cassette_empty.ico"
193 ICON DISCARDABLE "win/icons/cassette_empty_active.ico"
240 ICON DISCARDABLE "win/icons/machine.ico"
241 ICON DISCARDABLE "win/icons/display.ico"
242 ICON DISCARDABLE "win/icons/input_devices.ico"
243 ICON DISCARDABLE "win/icons/sound.ico"
244 ICON DISCARDABLE "win/icons/ports.ico"
245 ICON DISCARDABLE "win/icons/other_peripherals.ico"
246 ICON DISCARDABLE "win/icons/floppy_and_cdrom_drives.ico"
247 ICON DISCARDABLE "win/icons/other_removable_devices.ico"
248 ICON DISCARDABLE "win/icons/floppy_disabled.ico"
249 ICON DISCARDABLE "win/icons/cdrom_disabled.ico"
250 ICON DISCARDABLE "win/icons/zip_disabled.ico"
251 ICON DISCARDABLE "win/icons/mo_disabled.ico"
252 ICON DISCARDABLE "win/icons/storage_controllers.ico"
16 ICON DISCARDABLE ICON_PATH "icons/floppy_525.ico"
17 ICON DISCARDABLE ICON_PATH "icons/floppy_525_active.ico"
24 ICON DISCARDABLE ICON_PATH "icons/floppy_35.ico"
25 ICON DISCARDABLE ICON_PATH "icons/floppy_35_active.ico"
32 ICON DISCARDABLE ICON_PATH "icons/cdrom.ico"
33 ICON DISCARDABLE ICON_PATH "icons/cdrom_active.ico"
48 ICON DISCARDABLE ICON_PATH "icons/zip.ico"
49 ICON DISCARDABLE ICON_PATH "icons/zip_active.ico"
56 ICON DISCARDABLE ICON_PATH "icons/mo.ico"
57 ICON DISCARDABLE ICON_PATH "icons/mo_active.ico"
64 ICON DISCARDABLE ICON_PATH "icons/cassette.ico"
65 ICON DISCARDABLE ICON_PATH "icons/cassette_active.ico"
80 ICON DISCARDABLE ICON_PATH "icons/hard_disk.ico"
81 ICON DISCARDABLE ICON_PATH "icons/hard_disk_active.ico"
96 ICON DISCARDABLE ICON_PATH "icons/network.ico"
97 ICON DISCARDABLE ICON_PATH "icons/network_active.ico"
144 ICON DISCARDABLE ICON_PATH "icons/floppy_525_empty.ico"
145 ICON DISCARDABLE ICON_PATH "icons/floppy_525_empty_active.ico"
152 ICON DISCARDABLE ICON_PATH "icons/floppy_35_empty.ico"
153 ICON DISCARDABLE ICON_PATH "icons/floppy_35_empty_active.ico"
160 ICON DISCARDABLE ICON_PATH "icons/cdrom_empty.ico"
161 ICON DISCARDABLE ICON_PATH "icons/cdrom_empty_active.ico"
176 ICON DISCARDABLE ICON_PATH "icons/zip_empty.ico"
177 ICON DISCARDABLE ICON_PATH "icons/zip_empty_active.ico"
184 ICON DISCARDABLE ICON_PATH "icons/mo_empty.ico"
185 ICON DISCARDABLE ICON_PATH "icons/mo_empty_active.ico"
192 ICON DISCARDABLE ICON_PATH "icons/cassette_empty.ico"
193 ICON DISCARDABLE ICON_PATH "icons/cassette_empty_active.ico"
240 ICON DISCARDABLE ICON_PATH "icons/machine.ico"
241 ICON DISCARDABLE ICON_PATH "icons/display.ico"
242 ICON DISCARDABLE ICON_PATH "icons/input_devices.ico"
243 ICON DISCARDABLE ICON_PATH "icons/sound.ico"
244 ICON DISCARDABLE ICON_PATH "icons/ports.ico"
245 ICON DISCARDABLE ICON_PATH "icons/other_peripherals.ico"
246 ICON DISCARDABLE ICON_PATH "icons/floppy_and_cdrom_drives.ico"
247 ICON DISCARDABLE ICON_PATH "icons/other_removable_devices.ico"
248 ICON DISCARDABLE ICON_PATH "icons/floppy_disabled.ico"
249 ICON DISCARDABLE ICON_PATH "icons/cdrom_disabled.ico"
250 ICON DISCARDABLE ICON_PATH "icons/zip_disabled.ico"
251 ICON DISCARDABLE ICON_PATH "icons/mo_disabled.ico"
252 ICON DISCARDABLE ICON_PATH "icons/storage_controllers.ico"
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////

33
src/win/CMakeLists.txt Normal file
View File

@@ -0,0 +1,33 @@
enable_language(RC)
add_library(plat OBJECT win.c win_dynld.c win_thread.c win_cdrom.c
win_keyboard.c win_crashdump.c win_midi.c win_mouse.c)
add_library(ui OBJECT win_ui.c win_stbar.c win_sdl.c win_dialog.c win_about.c
win_settings.c win_devconf.c win_snd_gain.c win_new_floppy.c
win_jsconf.c win_media_menu.c 86Box.rc)
if(MSVC)
# MSVC complains when we include the manifest from 86Box.rc...
# On the bright side, CMake supports passing the manifest as a source
# file when using MSVC, so we might just as well do that!
target_compile_definitions(ui PRIVATE NO_INCLUDE_MANIFEST)
target_sources(86Box PRIVATE 86Box.manifest)
endif()
if(DINPUT)
target_sources(plat PRIVATE win_joystick.cpp)
target_link_libraries(86Box dinput8)
else()
target_sources(plat PRIVATE win_joystick_rawinput.c)
endif()
if(DISCORD)
# PUBLIC due to config.c and pc.c
target_compile_definitions(ui PUBLIC USE_DISCORD)
target_sources(ui PRIVATE win_discord.c)
endif()
target_link_libraries(86Box advapi32 comctl32 comdlg32 gdi32 shell32 iphlpapi
dxguid imm32 hid setupapi uxtheme version winmm psapi)

View File

@@ -318,7 +318,7 @@ DEPFILE := win/.depends
# Set up the correct toolchain flags.
OPTS := $(EXTRAS) $(STUFF)
OPTS += -Iinclude \
OPTS += -Iinclude -Iinclude_make \
-iquote $(CODEGEN) -iquote cpu
ifdef EXFLAGS
OPTS += $(EXFLAGS)
@@ -369,7 +369,7 @@ ifeq ($(ARM64), y)
AOPTIM :=
AFLAGS := -mfloat-abi=hard
endif
RFLAGS := --input-format=rc -O coff -Iinclude
RFLAGS := --input-format=rc -O coff -Iinclude -Iinclude_make
ifeq ($(RELEASE), y)
OPTS += -DRELEASE_BUILD
RFLAGS += -DRELEASE_BUILD