diff --git a/.gitignore b/.gitignore index c69bc38ba7..377fd52d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .vs/ .vscode/ .idea/ +build*/ cmake-*/ obj/ out/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..0767bfb84b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,96 @@ +cmake_minimum_required(VERSION 3.14...3.27) + +project( + ares + VERSION 0.134 + DESCRIPTION "ares is a cross-platform, open source, multi-system emulator, focusing on accuracy and preservation." + LANGUAGES C CXX) + +if(WIN32 AND NOT MINGW) + add_compile_definitions(EXCLUDE_MANIFEST_FROM_RC) #global +endif() + +function(add_sourcery_command target subdir) + add_custom_command(OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/resource.cpp ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/resource.hpp + COMMAND sourcery resource.bml resource.cpp resource.hpp + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${subdir} + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/resource.bml + VERBATIM + ) + add_custom_target(${target}-resource DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/resource.cpp ${CMAKE_CURRENT_SOURCE_DIR}/${subdir}/resource.hpp) + add_dependencies(${target} ${target}-resource) +endfunction() + +add_subdirectory(thirdparty) + +set(build optimized) +set(threaded TRUE) +set(openmp FALSE) +set(vulkan TRUE) +set(local TRUE) +set(lto TRUE) +set(console FALSE) + +set(default_build_type "Release") +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message(STATUS "Setting build type to '${default_build_type}' as none was specified.") + set(CMAKE_BUILD_TYPE "${default_build_type}" CACHE + STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS + "Debug" "Release" "MinSizeRel" "RelWithDebInfo") +endif() + +#for now, derive build type from cmake standard build type +set(build $<$:debug>$<$:optimized>$<$:release>$<$:minified>) +#file(GENERATE OUTPUT build_$.txt CONTENT "build = ${build}") + +include_directories(.) #global + +add_subdirectory(nall) + +if(arch STREQUAL x86 OR arch STREQUAL amd64) + if(NOT MSVC) + if(local) + add_compile_options(-march=native) #global + else() + # For official builds, default to x86-64-v2 (Intel Nehalem, AMD Bulldozer) which supports up to SSE 4.2. + add_compile_options(-march=x86-64-v2) #global + endif() + endif() +endif() + +add_subdirectory(libco) +add_subdirectory(ruby) + +#hiro.resource := resource/ares.rc +add_subdirectory(hiro) + +set(profile performance) +set(cores n64 ng spec) +#set(cores a26 fc sfc n64 sg ms md ps1 pce ng msx cv myvision gb gba ws ngp spec) #saturn + +add_subdirectory(ares) +add_subdirectory(mia) +add_subdirectory(desktop-ui) +add_subdirectory(tests/i8080) +if(NOT WIN32) + add_subdirectory(tools/genius) +endif() +add_subdirectory(tools/mame2bml) +add_subdirectory(tools/sourcery) + + +set_target_properties( + ares + hiro + libco + mia + nall + ruby + desktop-ui + libchdr + sljit + tzxfile + ymfm + PROPERTIES VS_GLOBAL_VcpkgEnabled false) diff --git a/ares/CMakeLists.txt b/ares/CMakeLists.txt new file mode 100644 index 0000000000..e04c6b813b --- /dev/null +++ b/ares/CMakeLists.txt @@ -0,0 +1,126 @@ +add_library(ares STATIC + ares/ares.cpp + ares/memory/fixed-allocator.cpp +) + +target_include_directories(ares PUBLIC .) + +target_link_libraries(ares + PUBLIC libco sljit nall + PRIVATE thirdparty ymfm +) + +if(platform STREQUAL windows) +# target_link_libraries(ares PRIVATE uuid kernel32 user32 gdi32 comctl32 comdlg32 shell32) +elseif(platform STREQUAL macos) +elseif(platform STREQUAL linux OR platform STREQUAL bsd) +# target_link_options(ares PRIVATE LINKER:-export-dynamic) +# target_link_libraries(ares PRIVATE X11 Xext) +else() + message(FATAL_ERROR "ares is a library and cannot be built directly.") +endif() + +if(platform STREQUAL macos) +# set(ares.dylibs "") +endif() + +if(vulkan) + target_compile_definitions(ares PUBLIC VULKAN) +endif() + +if(profile STREQUAL accuracy) + target_compile_definitions(ares PUBLIC PROFILE_ACCURACY) +endif() + +if(profile STREQUAL performance) + target_compile_definitions(ares PUBLIC PROFILE_PERFORMANCE) +endif() + +macro(ares_components) + list(APPEND ares.components ${ARGV}) + set(ares.components ${ares.components} PARENT_SCOPE) +endmacro() + +if(a26 IN_LIST cores) + add_subdirectory(a26) +endif() + +if(fc IN_LIST cores) + add_subdirectory(fc) +endif() + +if(sfc IN_LIST cores) + add_subdirectory(sfc) +endif() + +if(n64 IN_LIST cores) + add_subdirectory(n64) +endif() + +if(sg IN_LIST cores) + add_subdirectory(sg) +endif() + +if(ms IN_LIST cores) + add_subdirectory(ms) +endif() + +if(md IN_LIST cores) + add_subdirectory(md) +endif() + +if(saturn IN_LIST cores) + add_subdirectory(saturn) +endif() + +if(ps1 IN_LIST cores) + add_subdirectory(ps1) +endif() + +if(pce IN_LIST cores) + add_subdirectory(pce) +endif() + +if(msx IN_LIST cores) + add_subdirectory(msx) +endif() + +if(cv IN_LIST cores) + add_subdirectory(cv) +endif() + +if(myvision IN_LIST cores) + add_subdirectory(myvision) +endif() + +if(gb IN_LIST cores) + add_subdirectory(gb) +endif() + +if(gba IN_LIST cores) + add_subdirectory(gba) +endif() + +if(ws IN_LIST cores) + add_subdirectory(ws) +endif() + +if(ng IN_LIST cores) + add_subdirectory(ng) +endif() + +if(ngp IN_LIST cores) + add_subdirectory(ngp) +endif() + +if(spec IN_LIST cores) + add_subdirectory(spec) +endif() + +add_subdirectory(component) + +foreach(c IN LISTS cores) + target_compile_definitions(ares PUBLIC CORE_$) +endforeach() + +add_sourcery_command(ares ares/resource) diff --git a/ares/a26/CMakeLists.txt b/ares/a26/CMakeLists.txt new file mode 100644 index 0000000000..20116383a1 --- /dev/null +++ b/ares/a26/CMakeLists.txt @@ -0,0 +1,12 @@ +ares_components( + mos6502 +) + +target_sources(ares PRIVATE + system/system.cpp + controller/controller.cpp + cartridge/cartridge.cpp + cpu/cpu.cpp + tia/tia.cpp + riot/riot.cpp +) diff --git a/ares/component/CMakeLists.txt b/ares/component/CMakeLists.txt new file mode 100644 index 0000000000..f038623a75 --- /dev/null +++ b/ares/component/CMakeLists.txt @@ -0,0 +1,44 @@ +list(REMOVE_DUPLICATES ares.components) + +function(component_sources component) + if(component IN_LIST ares.components) + target_sources(ares PRIVATE ${ARGN}) + endif() +endfunction() + +component_sources(ay38910 audio/ay38910/ay38910.cpp) +component_sources(msm5205 audio/msm5205/msm5205.cpp) +component_sources(sn76489 audio/sn76489/sn76489.cpp) +component_sources(t6w28 audio/t6w28/t6w28.cpp) +component_sources(ym2149 audio/ym2149/ym2149.cpp) +component_sources(ym2413 audio/ym2413/ym2413.cpp) +component_sources(ym2612 audio/ym2612/ym2612.cpp) + +component_sources(m24c eeprom/m24c/m24c.cpp) +component_sources(m93lcx6 eeprom/m93lcx6/m93lcx6.cpp) + +component_sources(i8255 io/i8255/i8255.cpp) + +component_sources(arm7tdmi processor/arm7tdmi/arm7tdmi.cpp) +component_sources(gsu processor/gsu/gsu.cpp) +component_sources(hg51b processor/hg51b/hg51b.cpp) +component_sources(huc6280 processor/huc6280/huc6280.cpp) +component_sources(i8080 processor/i8080/i8080.cpp) +component_sources(m68hc05 processor/m68hc05/m68hc05.cpp) +component_sources(m68000 processor/m68000/m68000.cpp) +component_sources(mos6502 processor/mos6502/mos6502.cpp) +component_sources(sh2 processor/sh2/sh2.cpp) +component_sources(sm5k processor/sm5k/sm5k.cpp) +component_sources(sm83 processor/sm83/sm83.cpp) +component_sources(spc700 processor/spc700/spc700.cpp) +component_sources(ssp1601 processor/ssp1601/ssp1601.cpp) +component_sources(tlcs900h processor/tlcs900h/tlcs900h.cpp) +component_sources(upd96050 processor/upd96050/upd96050.cpp) +component_sources(v30mz processor/v30mz/v30mz.cpp) +component_sources(wdc65816 processor/wdc65816/wdc65816.cpp) +component_sources(z80 processor/z80/z80.cpp) + +component_sources(sst39sf0x0 flash/sst39sf0x0/sst39sf0x0.cpp) + +component_sources(tms9918 video/tms9918/tms9918.cpp) +component_sources(v9938 video/v9938/v9938.cpp) diff --git a/ares/cv/CMakeLists.txt b/ares/cv/CMakeLists.txt new file mode 100644 index 0000000000..a32deb3a21 --- /dev/null +++ b/ares/cv/CMakeLists.txt @@ -0,0 +1,14 @@ +ares_components( + z80 + tms9918 + sn76489 +) + +target_sources(ares PRIVATE + cpu/cpu.cpp + vdp/vdp.cpp + psg/psg.cpp + system/system.cpp + cartridge/cartridge.cpp + controller/controller.cpp +) diff --git a/ares/fc/CMakeLists.txt b/ares/fc/CMakeLists.txt new file mode 100644 index 0000000000..9c16232a30 --- /dev/null +++ b/ares/fc/CMakeLists.txt @@ -0,0 +1,18 @@ +ares_components( + mos6502 + ym2149 + ym2413 + m24c + sst39sf0x0 +) + +target_sources(ares PRIVATE + system/system.cpp + controller/controller.cpp + expansion/expansion.cpp + cartridge/cartridge.cpp + cpu/cpu.cpp + apu/apu.cpp + ppu/ppu.cpp + fds/fds.cpp +) diff --git a/ares/gb/CMakeLists.txt b/ares/gb/CMakeLists.txt new file mode 100644 index 0000000000..4ee4e2ce77 --- /dev/null +++ b/ares/gb/CMakeLists.txt @@ -0,0 +1,13 @@ +ares_components( + sm83 + m93lcx6 +) + +target_sources(ares PRIVATE + system/system.cpp + cartridge/cartridge.cpp + bus/bus.cpp + cpu/cpu.cpp + ppu/ppu.cpp + apu/apu.cpp +) diff --git a/ares/gba/CMakeLists.txt b/ares/gba/CMakeLists.txt new file mode 100644 index 0000000000..0214d11e54 --- /dev/null +++ b/ares/gba/CMakeLists.txt @@ -0,0 +1,13 @@ +ares_components( + arm7tdmi +) + +target_sources(ares PRIVATE + memory/memory.cpp + system/system.cpp + cartridge/cartridge.cpp + player/player.cpp + cpu/cpu.cpp + ppu/ppu.cpp + apu/apu.cpp +) diff --git a/ares/md/CMakeLists.txt b/ares/md/CMakeLists.txt new file mode 100644 index 0000000000..c9cd7e28df --- /dev/null +++ b/ares/md/CMakeLists.txt @@ -0,0 +1,22 @@ +ares_components( + m68000 + z80 + sh2 + ssp1601 + sn76489 + ym2612 + m24c +) + +target_sources(ares PRIVATE + bus/bus.cpp + cpu/cpu.cpp + apu/apu.cpp + vdp/vdp.cpp + opn2/opn2.cpp + m32x/m32x.cpp + mcd/mcd.cpp + system/system.cpp + cartridge/cartridge.cpp + controller/controller.cpp +) diff --git a/ares/ms/CMakeLists.txt b/ares/ms/CMakeLists.txt new file mode 100644 index 0000000000..1667d33c3d --- /dev/null +++ b/ares/ms/CMakeLists.txt @@ -0,0 +1,16 @@ +ares_components( + z80 + sn76489 + ym2413 +) + +target_sources(ares PRIVATE + cpu/cpu.cpp + vdp/vdp.cpp + psg/psg.cpp + opll/opll.cpp + system/system.cpp + cartridge/cartridge.cpp + controller/controller.cpp + expansion/expansion.cpp +) diff --git a/ares/msx/CMakeLists.txt b/ares/msx/CMakeLists.txt new file mode 100644 index 0000000000..e78809e339 --- /dev/null +++ b/ares/msx/CMakeLists.txt @@ -0,0 +1,19 @@ +ares_components( + z80 + tms9918 + v9938 + ay38910 + ym2413 +) + +target_sources(ares PRIVATE + system/system.cpp + keyboard/keyboard.cpp + cartridge/cartridge.cpp + controller/controller.cpp + cpu/cpu.cpp + vdp/vdp.cpp + psg/psg.cpp + tape/tape.cpp + rtc/rtc.cpp +) diff --git a/ares/myvision/CMakeLists.txt b/ares/myvision/CMakeLists.txt new file mode 100644 index 0000000000..6c0225e474 --- /dev/null +++ b/ares/myvision/CMakeLists.txt @@ -0,0 +1,13 @@ +ares_components( + z80 + tms9918 + ay38910 +) + +target_sources(ares PRIVATE + cpu/cpu.cpp + vdp/vdp.cpp + psg/psg.cpp + system/system.cpp + cartridge/cartridge.cpp +) diff --git a/ares/n64/CMakeLists.txt b/ares/n64/CMakeLists.txt new file mode 100644 index 0000000000..d154cebd5f --- /dev/null +++ b/ares/n64/CMakeLists.txt @@ -0,0 +1,99 @@ +ares_components( + sm5k +) + +target_sources(ares PRIVATE + memory/memory.cpp + system/system.cpp + cartridge/cartridge.cpp + cic/cic.cpp + controller/controller.cpp + dd/dd.cpp + mi/mi.cpp + vi/vi.cpp + ai/ai.cpp + pi/pi.cpp + pif/pif.cpp + ri/ri.cpp + si/si.cpp + rdram/rdram.cpp + cpu/cpu.cpp + rsp/rsp.cpp + rdp/rdp.cpp +) + +if(vulkan) + if(platform STREQUAL macos) +# molten = $(ares.path)/../thirdparty/MoltenVK/libMoltenVK.dylib +# ifeq ($(wildcard $(molten)),) +# molten = $(shell brew --prefix molten-vk)/lib/libMoltenVK.dylib +# ifeq ($(wildcard $(molten)),) +# $(error Compiling Ares N64 Vulkan backend requires MoltenVK. Install it via Homebrew, compile it using thirdparty/MoltenVK/build-moltenvk.sh, or disable with vulkan=false") +# endif +# endif +# ares.dylibs += $(molten) + endif() + + target_sources(ares PRIVATE + vulkan/vulkan.cpp + ) + + target_sources(ares PRIVATE +# $(wildcard vulkan/parallel-rdp/parallel-rdp/*.cpp) + vulkan/parallel-rdp/parallel-rdp/command_ring.cpp + vulkan/parallel-rdp/parallel-rdp/rdp_device.cpp + vulkan/parallel-rdp/parallel-rdp/rdp_dump_write.cpp + vulkan/parallel-rdp/parallel-rdp/rdp_renderer.cpp + vulkan/parallel-rdp/parallel-rdp/video_interface.cpp + vulkan/parallel-rdp/vulkan/buffer.cpp + vulkan/parallel-rdp/vulkan/buffer_pool.cpp + vulkan/parallel-rdp/vulkan/command_buffer.cpp + vulkan/parallel-rdp/vulkan/command_pool.cpp + vulkan/parallel-rdp/vulkan/context.cpp + vulkan/parallel-rdp/vulkan/cookie.cpp + vulkan/parallel-rdp/vulkan/descriptor_set.cpp + vulkan/parallel-rdp/vulkan/device.cpp + vulkan/parallel-rdp/vulkan/event_manager.cpp + vulkan/parallel-rdp/vulkan/fence.cpp + vulkan/parallel-rdp/vulkan/fence_manager.cpp + vulkan/parallel-rdp/vulkan/image.cpp + vulkan/parallel-rdp/vulkan/indirect_layout.cpp + vulkan/parallel-rdp/vulkan/memory_allocator.cpp + vulkan/parallel-rdp/vulkan/pipeline_event.cpp + vulkan/parallel-rdp/vulkan/query_pool.cpp + vulkan/parallel-rdp/vulkan/render_pass.cpp + vulkan/parallel-rdp/vulkan/sampler.cpp + vulkan/parallel-rdp/vulkan/semaphore.cpp + vulkan/parallel-rdp/vulkan/semaphore_manager.cpp + vulkan/parallel-rdp/vulkan/shader.cpp + vulkan/parallel-rdp/vulkan/texture/texture_format.cpp + vulkan/parallel-rdp/util/arena_allocator.cpp + vulkan/parallel-rdp/util/logging.cpp + vulkan/parallel-rdp/util/thread_id.cpp + vulkan/parallel-rdp/util/aligned_alloc.cpp + vulkan/parallel-rdp/util/timer.cpp + vulkan/parallel-rdp/util/timeline_trace_file.cpp + vulkan/parallel-rdp/util/thread_name.cpp + + vulkan/parallel-rdp/volk/volk.c + ) + + target_include_directories(ares PRIVATE + vulkan/parallel-rdp/parallel-rdp + vulkan/parallel-rdp/volk + vulkan/parallel-rdp/vulkan + vulkan/parallel-rdp/vulkan-headers/include + vulkan/parallel-rdp/util + ) + +# PARALLEL_RDP_LDFLAGS := -pthread + if(platform STREQUAL windows) + target_compile_definitions(ares PRIVATE VK_USE_PLATFORM_WIN32_KHR) +# PARALLEL_RDP_LDFLAGS += -lwinmm + else() +# PARALLEL_RDP_LDFLAGS += -ldl + endif() + +else() + message(WARNING "Ares n64 core requires Vulkan for RDP emulation, only titles using Software Rendering will function") +endif() diff --git a/ares/ng/CMakeLists.txt b/ares/ng/CMakeLists.txt new file mode 100644 index 0000000000..547a801ee7 --- /dev/null +++ b/ares/ng/CMakeLists.txt @@ -0,0 +1,15 @@ +ares_components( + m68000 + z80 +) + +target_sources(ares PRIVATE + system/system.cpp + cpu/cpu.cpp + apu/apu.cpp + lspc/lspc.cpp + opnb/opnb.cpp + cartridge/cartridge.cpp + controller/controller.cpp + card/card.cpp +) diff --git a/ares/ngp/CMakeLists.txt b/ares/ngp/CMakeLists.txt new file mode 100644 index 0000000000..20891a28d7 --- /dev/null +++ b/ares/ngp/CMakeLists.txt @@ -0,0 +1,14 @@ +ares_components( + tlcs900h + z80 + t6w28 +) + +target_sources(ares PRIVATE + system/system.cpp + cartridge/cartridge.cpp + cpu/cpu.cpp + apu/apu.cpp + kge/kge.cpp + psg/psg.cpp +) diff --git a/ares/pce/CMakeLists.txt b/ares/pce/CMakeLists.txt new file mode 100644 index 0000000000..92144c768e --- /dev/null +++ b/ares/pce/CMakeLists.txt @@ -0,0 +1,15 @@ +ares_components( + huc6280 + msm5205 +) + +target_sources(ares PRIVATE + cpu/cpu.cpp + vdp/vdp.cpp + vdp-performance/vdp.cpp + psg/psg.cpp + pcd/pcd.cpp + system/system.cpp + cartridge/cartridge.cpp + controller/controller.cpp +) diff --git a/ares/ps1/CMakeLists.txt b/ares/ps1/CMakeLists.txt new file mode 100644 index 0000000000..741c6b1f73 --- /dev/null +++ b/ares/ps1/CMakeLists.txt @@ -0,0 +1,17 @@ +ares_components( + m68hc05 +) + +target_sources(ares PRIVATE + memory/memory.cpp + system/system.cpp + disc/disc.cpp + cpu/cpu.cpp + gpu/gpu.cpp + spu/spu.cpp + mdec/mdec.cpp + interrupt/interrupt.cpp + peripheral/peripheral.cpp + dma/dma.cpp + timer/timer.cpp +) diff --git a/ares/saturn/CMakeLists.txt b/ares/saturn/CMakeLists.txt new file mode 100644 index 0000000000..1e6f67a16b --- /dev/null +++ b/ares/saturn/CMakeLists.txt @@ -0,0 +1,8 @@ +ares_components( + sh2 + m68k +) + +target_sources(ares PRIVATE + system/system.cpp +) diff --git a/ares/saturn/saturn.hpp b/ares/saturn/saturn.hpp index bb858b7b43..ff7b3c2168 100644 --- a/ares/saturn/saturn.hpp +++ b/ares/saturn/saturn.hpp @@ -4,7 +4,7 @@ #include #include -#include +#include namespace ares::Saturn { auto enumerate() -> vector; diff --git a/ares/sfc/CMakeLists.txt b/ares/sfc/CMakeLists.txt new file mode 100644 index 0000000000..35b2319ce0 --- /dev/null +++ b/ares/sfc/CMakeLists.txt @@ -0,0 +1,25 @@ +ares_components( + wdc65816 + spc700 + arm7tdmi + gsu + hg51b + upd96050 +) + +target_sources(ares PRIVATE + system/system.cpp + controller/controller.cpp + cartridge/cartridge.cpp + memory/memory.cpp + + cpu/cpu.cpp + smp/smp.cpp + dsp/dsp.cpp + ppu/ppu.cpp + ppu-performance/ppu.cpp + + coprocessor/coprocessor.cpp + expansion/expansion.cpp + slot/slot.cpp +) diff --git a/ares/sg/CMakeLists.txt b/ares/sg/CMakeLists.txt new file mode 100644 index 0000000000..956cc92d59 --- /dev/null +++ b/ares/sg/CMakeLists.txt @@ -0,0 +1,16 @@ +ares_components( + z80 + tms9918 + sn76489 + i8255 +) + +target_sources(ares PRIVATE + cpu/cpu.cpp + vdp/vdp.cpp + psg/psg.cpp + ppi/ppi.cpp + system/system.cpp + cartridge/cartridge.cpp + controller/controller.cpp +) diff --git a/ares/spec/CMakeLists.txt b/ares/spec/CMakeLists.txt new file mode 100644 index 0000000000..e683ebccb4 --- /dev/null +++ b/ares/spec/CMakeLists.txt @@ -0,0 +1,14 @@ +ares_components( + z80 + ay38910 +) + +target_sources(ares PRIVATE + keyboard/keyboard.cpp + expansion/expansion.cpp + system/system.cpp + cpu/cpu.cpp + ula/ula.cpp + psg/psg.cpp + tape/tape.cpp +) diff --git a/ares/ws/CMakeLists.txt b/ares/ws/CMakeLists.txt new file mode 100644 index 0000000000..7240d2e476 --- /dev/null +++ b/ares/ws/CMakeLists.txt @@ -0,0 +1,15 @@ +ares_components( + v30mz + m93lcx6 +) + +target_sources(ares PRIVATE + system/system.cpp + memory/memory.cpp + eeprom/eeprom.cpp + cartridge/cartridge.cpp + cpu/cpu.cpp + ppu/ppu.cpp + apu/apu.cpp + serial/serial.cpp +) diff --git a/desktop-ui/CMakeLists.txt b/desktop-ui/CMakeLists.txt new file mode 100644 index 0000000000..0ea05d4a2c --- /dev/null +++ b/desktop-ui/CMakeLists.txt @@ -0,0 +1,30 @@ +add_executable(desktop-ui + desktop-ui.cpp + resource/resource.cpp + input/input.cpp + emulator/emulator.cpp + game-browser/game-browser.cpp + program/program.cpp + presentation/presentation.cpp + settings/settings.cpp + tools/tools.cpp +) + +target_link_libraries(desktop-ui PRIVATE nall ruby hiro ares mia) + +set_target_properties( + desktop-ui + PROPERTIES + OUTPUT_NAME ares +) + +add_sourcery_command(desktop-ui resource) + +if(WIN32) + target_sources(desktop-ui PRIVATE + resource/ares.rc + resource/ares.Manifest + ) +endif() + +nall_set_properties(desktop-ui) diff --git a/desktop-ui/resource/ares.rc b/desktop-ui/resource/ares.rc index 1cd3c8ccd6..2fe06eaa49 100644 --- a/desktop-ui/resource/ares.rc +++ b/desktop-ui/resource/ares.rc @@ -1,2 +1,4 @@ +#ifndef EXCLUDE_MANIFEST_FROM_RC 1 24 "ares.Manifest" +#endif 2 ICON DISCARDABLE "ares.ico" diff --git a/hiro/CMakeLists.txt b/hiro/CMakeLists.txt new file mode 100644 index 0000000000..99bbd74aa3 --- /dev/null +++ b/hiro/CMakeLists.txt @@ -0,0 +1,102 @@ +add_library(hiro STATIC hiro.cpp) + +target_link_libraries(hiro PUBLIC nall) + +#PKG_CONFIG ?= pkg-config + + +if(platform STREQUAL windows) + if(NOT hiro) + set(hiro windows) + endif() + + if(hiro STREQUAL windows) + target_compile_definitions(hiro PRIVATE HIRO_WINDOWS) + target_link_libraries(hiro PRIVATE kernel32 user32 gdi32 advapi32 ole32 comctl32 comdlg32 uxtheme msimg32 dwmapi) + endif() + + if(hiro STREQUAL gtk2) +# hiro.flags = $(flags.cpp) -DHIRO_GTK=2 $(shell pkg-config --cflags gtk+-2.0) -Wno-deprecated-declarations +# hiro.options = $(shell pkg-config --libs gtk+-2.0) + endif() + + if(hiro STREQUAL gtk3) +# hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell pkg-config --cflags gtk+-3.0) -Wno-deprecated-declarations +# hiro.options = $(shell pkg-config --libs gtk+-3.0) + endif() +endif() + +if(platform STREQUAL macos) + if(NOT hiro) + set(hiro cocoa) + endif() + + if(hiro STREQUAL cocoa) +# hiro.flags = $(flags.objcpp) -w -DHIRO_COCOA +# hiro.options = -framework Cocoa -framework Carbon -framework IOKit -framework Security + endif() +endif() + +if(platform STREQUAL linux OR platform STREQUAL bsd) + if(NOT hiro) + set(hiro gtk3) + endif() + + if(hiro STREQUAL gtk2) +# hiro.flags = $(flags.cpp) -DHIRO_GTK=2 $(shell $(PKG_CONFIG) --cflags gtk+-2.0) -Wno-deprecated-declarations +# hiro.options = -L/usr/local/lib -lX11 $(shell $(PKG_CONFIG) --libs gtk+-2.0) + endif() + + if(hiro STREQUAL gtk2-se) +# flags += -DHiro_SourceEdit +# hiro.flags = $(flags.cpp) -DHIRO_GTK=2 $(shell $(PKG_CONFIG) --cflags gtk+-2.0 gtksourceview-2.0) -Wno-deprecated-declarations +# hiro.options = -L/usr/local/lib -lX11 $(shell $(PKG_CONFIG) --libs gtk+-2.0 gtksourceview-2.0) + endif() + + if(hiro STREQUAL gtk3) +# hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell $(PKG_CONFIG) --cflags gtk+-3.0) -Wno-deprecated-declarations +# hiro.options = -L/usr/local/lib -lX11 $(shell $(PKG_CONFIG) --libs gtk+-3.0) + endif() + + if(hiro STREQUAL gtk3-se) +# flags += -DHiro_SourceEdit +# hiro.flags = $(flags.cpp) -DHIRO_GTK=3 $(shell $(PKG_CONFIG) --cflags gtk+-3.0 gtksourceview-3.0) -Wno-deprecated-declarations +# hiro.options = -L/usr/local/lib -lX11 $(shell $(PKG_CONFIG) --libs gtk+-3.0 gtksourceview-3.0) + endif() + + if(hiro STREQUAL qt4) +# moc = /usr/local/lib/qt4/bin/moc +# hiro.flags = $(flags.cpp) -DHIRO_QT=4 $(shell $(PKG_CONFIG) --cflags QtCore QtGui) +# hiro.options = -L/usr/local/lib -lX11 $(shell $(PKG_CONFIG) --libs QtCore QtGui) + endif() + + if(hiro STREQUAL qt5) +# moc = $(shell $(PKG_CONFIG) --variable=host_bins Qt5Core)/moc +# hiro.flags = $(flags.cpp) -DHIRO_QT=5 -fPIC $(shell $(PKG_CONFIG) --cflags Qt5Core Qt5Gui Qt5Widgets) +# hiro.options = -L/usr/local/lib -lX11 $(shell $(PKG_CONFIG) --libs Qt5Core Qt5Gui Qt5Widgets) + endif() +endif() + +if(NOT hiro.resource) + set(hiro.resource windows/hiro.rc) +endif() + +#hiro.objects := \ +# $(object.path)/hiro-$(hiro).o \ +# $(if $(filter windows,$(hiro)),$(object.path)/hiro-resource$(hiro.resource.extension)) + +#$(object.path)/hiro-$(hiro).o: $(hiro.path)/hiro.cpp +# $(if $(filter qt%,$(hiro)),$(info Compiling $(hiro.path)/qt/qt.moc ...)) +# $(if $(filter qt%,$(hiro)),@$(moc) -i -o $(hiro.path)/qt/qt.moc $(hiro.path)/qt/qt.hpp) +# $(info Compiling $(subst ../,,$<) ...) +# @$(compiler) $(hiro.flags) $(flags) $(flags.deps) -c $< $(call obj,$@) + +#$(object.path)/hiro-resource$(hiro.resource.extension): $(hiro.resource) +# $(info Compiling $(subst ../,,$<) ...) +# @$(windres) $(call hiro.resource.command,$<,$@) + +#hiro.verbose: +# $(info hiro Target:) +# $(info $([space]) $(hiro)) + +add_sourcery_command(hiro resource) diff --git a/libco/CMakeLists.txt b/libco/CMakeLists.txt new file mode 100644 index 0000000000..1c9d6b183a --- /dev/null +++ b/libco/CMakeLists.txt @@ -0,0 +1 @@ +add_library(libco STATIC libco.c) diff --git a/mia/CMakeLists.txt b/mia/CMakeLists.txt new file mode 100644 index 0000000000..6be72640cd --- /dev/null +++ b/mia/CMakeLists.txt @@ -0,0 +1,23 @@ +add_library(mia STATIC mia.cpp resource/resource.cpp) + +target_compile_definitions(mia PUBLIC MIA_LIBRARY) + +target_link_libraries(mia PUBLIC nall ares PRIVATE tzxfile) + +add_sourcery_command(mia resource) + + +add_executable(mia-standalone mia.cpp resource/resource.cpp) + +target_link_libraries(mia-standalone PUBLIC nall hiro ares PRIVATE tzxfile) + +add_sourcery_command(mia-standalone resource) + +if(WIN32) + target_sources(mia-standalone PRIVATE + resource/mia.rc + resource/mia.Manifest + ) +endif() + +nall_set_properties(mia-standalone) diff --git a/mia/resource/mia.rc b/mia/resource/mia.rc index de5eb226ab..6601ec0dc8 100644 --- a/mia/resource/mia.rc +++ b/mia/resource/mia.rc @@ -1,2 +1,4 @@ +#ifndef EXCLUDE_MANIFEST_FROM_RC 1 24 "mia.Manifest" +#endif 2 ICON DISCARDABLE "mia.ico" diff --git a/nall/CMakeLists.txt b/nall/CMakeLists.txt new file mode 100644 index 0000000000..4405deb088 --- /dev/null +++ b/nall/CMakeLists.txt @@ -0,0 +1,263 @@ +add_library(nall OBJECT + nall.cpp + main.cpp + ../thirdparty/sljitAllocator.cpp +) + +target_link_libraries(nall PUBLIC sljit libchdr) + + +# platform detection +if(NOT platform) + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(platform windows) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(platform macos) + elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(platform linux) + elseif(CMAKE_SYSTEM_NAME MATCHES "BSD") + set(platform bsd) + else() + message(FATAL_ERROR "unknown platform, please specify manually.") + endif() +endif() + +# compiler detection +if(NOT compiler) + if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set(compiler cl) + elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + set(compiler g++) + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(compiler clang++) + else() + message(FATAL_ERROR "unknown compiler, please specify manually.") + endif() +endif() + +if (CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86|i[3-6]86)$") + set(machine x86) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(x86_64|amd64|AMD64)$") + set(machine amd64) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$") + set(machine arm64) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(armv7l?|arm|ARM)$") + set(machine arm32) +elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(ppc64|ppc64le)") + set(machine ppc64) +elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") + set(machine rv64) +elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv32") + set(machine rv32) +endif() + +# global compiler flags +target_compile_features(nall PUBLIC c_std_11) +set_target_properties(nall PROPERTIES C_EXTENSIONS OFF) + +target_compile_features(nall PUBLIC cxx_std_17) +set_target_properties(nall PROPERTIES CXX_EXTENSIONS OFF) + +if(MSVC) + target_compile_options(nall PUBLIC /W2) +endif() + +# explicit architecture flags to allow for cross-compilation on macos +if(platform STREQUAL macos) + if(arch STREQUAL amd64) + add_compile_options(-arch x86_64) #global + add_link_options(-arch x86_64) #global + elseif(arch STREQUAL arm64) + add_compile_options(-arch arm64) #global + add_link_options(-arch arm64) #global + endif() + if(NOT machine STREQUAL arch) + set(local FALSE) + endif() +endif() + +# architecture detection +if(NOT arch) + if(machine) + set(arch ${machine}) + else() + message(FATAL_ERROR "unknown arch, please specify manually.") + endif() +endif() + +# build optimization levels +#ifeq ($(build),debug) +# symbols = true +# ifeq ($(cl),true) +# flags += -Od +# else +# flags += -Og +# endif +# flags += -DBUILD_DEBUG +#else ifeq ($(build),stable) +# flags += -O1 -DBUILD_STABLE +#else ifeq ($(build),minified) +# flags += -Os -DBUILD_MINIFIED +#else ifeq ($(build),release) +# flags += -O2 -DBUILD_RELEASE +#else ifeq ($(build),optimized) +# ifeq ($(cl),true) +# flags += -O2 +# else +# flags += -O3 -fomit-frame-pointer +# endif +# flags += -DBUILD_OPTIMIZED +#else +# $(error unrecognized build type.) +#endif + +target_compile_definitions(nall PUBLIC BUILD_$) + +if(local) + target_compile_definitions(nall PUBLIC BUILD_LOCAL) +endif() + +# debugging information +#ifeq ($(symbols),true) +# ifeq ($(cl),true) +# flags += -Zi -FS +# options += -debug +# ifneq ($(build),debug) +# options += -opt:ref,icf +# endif +# else +# flags += -g +# ifeq ($(platform),windows) +# ifeq ($(findstring clang++,$(compiler)),clang++) +# ifeq ($(symformat),gdb) +# flags += -ggdb +# else +# flags += -gcodeview +# endif +# ifeq ($(msvc),true) +# options += -Wl,-debug +# else +# options += -Wl,-pdb= +# endif +# endif +# endif +# endif +#endif + +# link-time optimization +#ifeq ($(lto),true) +# ifeq ($(cl),true) +# ifneq ($(findstring clang,$(compiler)),clang) +# flags += -GL +# options += -ltcg:incremental -ltcgout:$(object.path)/$(name).iobj +# else +# flags += -flto=thin +# options += -lldltocache:$(object.path)/lto +# endif +# else +# ifneq ($(findstring clang++,$(compiler)),clang++) +# flags += -flto=auto -fno-fat-lto-objects +# else +# flags += -flto=thin +# options += -flto=thin +# ifeq ($(platform),macos) +# options += -Wl,-cache_path_lto,$(object.path)/lto +# else ifeq ($(msvc),true) +# options += -Wl,-lldltocache:$(object.path)/lto +# else +# options += -Wl,--thinlto-cache-dir=$(object.path)/lto +# endif +# endif +# endif +#endif + +# openmp support +#ifeq ($(openmp),true) +# # macOS Xcode does not ship with OpenMP support +# ifneq ($(platform),macos) +# flags += -fopenmp +# options += -fopenmp +# endif +#endif + +# clang settings +if(compiler STREQUAL clang++) + target_compile_options(nall PUBLIC -fno-strict-aliasing -fwrapv) + if(NOT platform STREQUAL macos) + target_link_options(nall PUBLIC -fuse-ld=lld) + endif() +# gcc settings +elseif(compiler STREQUAL g++) + target_compile_options(nall PUBLIC -fno-strict-aliasing -fwrapv -Wno-trigraphs) +endif() + +# windows settings +if(platform STREQUAL windows) + # target Windows 7 + add_compile_definitions(_WIN32_WINNT=0x0601) #global + if(NOT MINGW) + add_compile_definitions(_CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) #global + endif() + target_link_libraries(nall PUBLIC ws2_32 ole32 shell32 shlwapi) + if(MINGW) + target_link_options(nall PUBLIC -mthreads -static) + endif() + if(console) + target_compile_definitions(nall PUBLIC SUBSYTEM_CONSOLE) + else() + target_compile_definitions(nall PUBLIC SUBSYTEM_WINDOWS) + endif() +endif() + +function(nall_set_properties target) + set_target_properties(${target} PROPERTIES WIN32_EXECUTABLE $>) +endfunction() + +# macos settings +#ifeq ($(platform),macos) +# flags += -stdlib=libc++ -mmacosx-version-min=10.9 -Wno-auto-var-id -fobjc-arc +# options += -lc++ -lobjc -mmacosx-version-min=10.9 +# # allow mprotect() on dynamic recompiler code blocks +# options += -Wl,-segprot,__DATA,rwx,rw +#endif + +# linux settings +#ifeq ($(platform),linux) +# options += -ldl +#endif + +# bsd settings +#ifeq ($(platform),bsd) +# flags += -I/usr/local/include +# options += -Wl,-rpath=/usr/local/lib +# options += -Wl,-rpath=/usr/local/lib/gcc8 +# options += -lstdc++ -lm +#endif + +# threading support +#ifeq ($(threaded),true) +# ifneq ($(filter $(platform),linux bsd),) +# flags += -pthread +# options += -pthread -lrt +# endif +#endif + +#nall.verbose: +# $(info Compiler:) +# $(info $([space]) $(compiler)) +# $(info Compiler Flags:) +# $(foreach n,$(sort $(call unique,$(flags))),$(if $(filter-out -I%,$n),$(info $([space]) $n))) +# $(info Linker Options:) +# $(foreach n,$(sort $(call unique,$(options))),$(if $(filter-out -l%,$n),$(info $([space]) $n))) + +set(platform ${platform} PARENT_SCOPE) +set(compiler ${compiler} PARENT_SCOPE) +set(machine ${machine} PARENT_SCOPE) +set(local ${local} PARENT_SCOPE) +set(arch ${arch} PARENT_SCOPE) + +message("platform ${platform}") +message("compiler ${compiler}") +message("machine ${machine}") +message("local ${local}") +message("arch ${arch}") diff --git a/ruby/CMakeLists.txt b/ruby/CMakeLists.txt new file mode 100644 index 0000000000..7b37c4e8a9 --- /dev/null +++ b/ruby/CMakeLists.txt @@ -0,0 +1,149 @@ +add_library(ruby STATIC ruby.cpp) + +target_link_libraries(ruby PUBLIC nall PRIVATE thirdparty) + + +if(NOT ruby) + if(platform STREQUAL windows) + list(APPEND ruby video.direct3d9 video.gdi) + if (arch STREQUAL x86 OR arch STREQUAL amd64) + list(APPEND ruby video.wgl) + endif() + list(APPEND ruby audio.wasapi audio.xaudio2 audio.directsound audio.waveout) #audio.asio + list(APPEND ruby input.windows) + +# ifeq ($(call which,pkg-config),) +# # TODO: Check presence of libSDL +# else() +# # If we're in a posix shell, use pkg-config/pkg-check +# pkg_check = $(if $(shell pkg-config $1 && echo 1),$2) +# ruby += $(call pkg_check,sdl2,input.sdl) +# ruby += $(call pkg_check,sdl2,audio.sdl) +# endif() + elseif(platform STREQUAL macos) + list(APPEND ruby video.cgl) + list(APPEND ruby audio.openal) + list(APPEND ruby input.quartz) #input.carbon + elseif(platform STREQUAL linux) +# pkg_check = $(if $(shell pkg-config $1 && echo 1),$2) + list(APPEND ruby video.glx video.glx2 video.xshm) +# ruby += $(call pkg_check,xv,video.xvideo) + list(APPEND ruby audio.oss audio.alsa) +# ruby += $(call pkg_check,openal,audio.openal) +# ruby += $(call pkg_check,libpulse,audio.pulseaudio) +# ruby += $(call pkg_check,libpulse-simple,audio.pulseaudiosimple) +# ruby += $(call pkg_check,ao,audio.ao) + list(APPEND ruby input.xlib) +# ruby += $(call pkg_check,libudev,input.udev) +# ruby += $(call pkg_check,sdl2,input.sdl) +# ruby += $(call pkg_check,sdl2,audio.sdl) + elseif(platform STREQUAL bsd) +# pkg_check = $(if $(shell pkg-config $1 && echo 1),$2) + list(APPEND ruby video.glx video.glx2 video.xshm) +# ruby += $(call pkg_check,xv,video.xvideo) + list(APPEND ruby audio.oss) +# ruby += $(call pkg_check,openal,audio.openal) +# ruby += $(call pkg_check,libpulse,audio.pulseaudio) +# ruby += $(call pkg_check,libpulse-simple,audio.pulseaudiosimple) +# ruby += $(call pkg_check,ao,audio.ao) + list(APPEND ruby input.uhid input.xlib) +# ruby += $(call pkg_check,sdl2,input.sdl) +# ruby += $(call pkg_check,sdl2,audio.sdl) + endif() +endif() + +if(platform STREQUAL macos) +# ruby.flags := $(flags.objcpp) +else() +# ruby.flags := $(flags.cpp) +endif() + +foreach(c IN LISTS ruby) + target_compile_definitions(ruby PRIVATE $>) +endforeach() + +#ifeq ($(call which,pkg-config),) +# # TODO: add SDL2 cflags +#else() +# ruby.flags += $(if $(findstring input.sdl,$(ruby)),$(shell pkg-config sdl2 --cflags)) +# ruby.flags += $(if $(findstring audio.sdl,$(ruby)),$(shell pkg-config sdl2 --cflags)) +#endif() + +set(ruby.options "") + +#ruby.options += $(if $(findstring video.cgl,$(ruby)),-framework OpenGL) +if(video.direct3d9 IN_LIST ruby) + target_link_libraries(ruby PRIVATE d3d9) +endif() +#ruby.options += $(if $(findstring video.glx,$(ruby)),-lGL) +if(video.wgl IN_LIST ruby) + target_link_libraries(ruby PRIVATE opengl32) +endif() +#ruby.options += $(if $(findstring video.xvideo,$(ruby)),-lXv) + +#ruby.options += $(if $(findstring audio.alsa,$(ruby)),-lasound) +#ruby.options += $(if $(findstring audio.ao,$(ruby)),-lao) +if(audio.directsound IN_LIST ruby) + target_link_libraries(ruby PRIVATE dsound uuid) +endif() +#ruby.options += $(if $(findstring audio.pulseaudio,$(ruby)),-lpulse) +#ruby.options += $(if $(findstring audio.pulseaudiosimple,$(ruby)),-lpulse-simple) +if(audio.wasapi IN_LIST ruby) + target_link_libraries(ruby PRIVATE avrt uuid) +endif() +if(audio.waveout IN_LIST ruby) + target_link_libraries(ruby PRIVATE winmm) +endif() +if(audio.xaudio2 IN_LIST ruby) + target_link_libraries(ruby PRIVATE ole32) +endif() + +if(platform STREQUAL windows) +# ifeq ($(call which,pkg-config),) +# # TODO: add SDL2 ldflags +# else() +# ruby.options += $(if $(findstring input.sdl,$(ruby)),$(shell pkg-config sdl2 --libs --static)) +# ruby.options += $(if $(findstring audio.sdl,$(ruby)),$(shell pkg-config sdl2 --libs --static)) +# endif() +else() +# ruby.options += $(if $(findstring input.sdl,$(ruby)),$(shell pkg-config sdl2 --libs)) +# ruby.options += $(if $(findstring audio.sdl,$(ruby)),$(shell pkg-config sdl2 --libs)) +endif() + +#ruby.options += $(if $(findstring input.udev,$(ruby)),-ludev) +#ruby.options += $(if $(findstring input.uhid,$(ruby)),-lusbhid) +if(input.windows IN_LIST ruby) + target_link_libraries(ruby PRIVATE dinput8 dxguid) +endif() + +if(platform STREQUAL windows) + if(audio.openal IN_LIST ruby) + target_link_libraries(ruby PRIVATE openal32) + endif() +endif() + +if(platform STREQUAL macos) +# ruby.options += -framework IOKit +# ruby.options += $(if $(findstring audio.openal,$(ruby)),-framework OpenAL) +endif() + +if(platform STREQUAL linux) +# ruby.options += -lX11 -lXext -lXrandr +# ruby.options += $(if $(findstring audio.openal,$(ruby)),-lopenal) +endif() + +if(platform STREQUAL bsd) +# ruby.options += -lX11 -lXext -lXrandr +# ruby.options += $(if $(findstring audio.openal,$(ruby)),-lopenal -fuse-ld=bfd) +# # -fuse-ld=bfd: see FreeBSD bug 219089 +endif() + +#ruby.objects := $(object.path)/ruby.o + +#$(object.path)/ruby.o: $(ruby.path)/ruby.cpp $(call rwildcard,$(ruby.path)) +# $(info Compiling $(subst ../,,$<) ...) +# @$(compiler) $(ruby.flags) $(flags) $(flags.deps) -c $< $(call obj,$@) + +#ruby.verbose: +# $(info ruby Drivers:) +# $(foreach n,$(ruby),$(info $([space]) $n)) diff --git a/tests/i8080/CMakeLists.txt b/tests/i8080/CMakeLists.txt new file mode 100644 index 0000000000..d84f1daca5 --- /dev/null +++ b/tests/i8080/CMakeLists.txt @@ -0,0 +1,8 @@ +add_executable(i8080 + i8080.cpp + ../../ares/component/processor/i8080/i8080.cpp +) + +target_link_libraries(i8080 PRIVATE nall ares) + +nall_set_properties(i8080) diff --git a/thirdparty/CMakeLists.txt b/thirdparty/CMakeLists.txt new file mode 100644 index 0000000000..d6f9e8c17a --- /dev/null +++ b/thirdparty/CMakeLists.txt @@ -0,0 +1,98 @@ +add_library(thirdparty INTERFACE) + +target_include_directories(thirdparty INTERFACE + ../thirdparty +) + +add_library(sljit STATIC + sljit/sljit_src/sljitLir.c +) + +target_include_directories(sljit PUBLIC ../thirdparty) +target_compile_definitions(sljit PUBLIC SLJIT_HAVE_CONFIG_PRE=1 SLJIT_HAVE_CONFIG_POST=1) + +add_library(libchdr STATIC + libchdr/src/libchdr_bitstream.c + libchdr/src/libchdr_cdrom.c + libchdr/src/libchdr_chd.c + libchdr/src/libchdr_flac.c + libchdr/src/libchdr_huffman.c + + libchdr/deps/lzma-19.00/src/Alloc.c + libchdr/deps/lzma-19.00/src/Bra86.c + libchdr/deps/lzma-19.00/src/BraIA64.c + libchdr/deps/lzma-19.00/src/CpuArch.c + libchdr/deps/lzma-19.00/src/Delta.c + libchdr/deps/lzma-19.00/src/LzFind.c + libchdr/deps/lzma-19.00/src/Lzma86Dec.c + libchdr/deps/lzma-19.00/src/LzmaDec.c + libchdr/deps/lzma-19.00/src/LzmaEnc.c + libchdr/deps/lzma-19.00/src/Sort.c + + libchdr/deps/zlib-1.2.13/adler32.c + libchdr/deps/zlib-1.2.13/compress.c + libchdr/deps/zlib-1.2.13/crc32.c + libchdr/deps/zlib-1.2.13/deflate.c + libchdr/deps/zlib-1.2.13/infback.c + libchdr/deps/zlib-1.2.13/inffast.c + libchdr/deps/zlib-1.2.13/inflate.c + libchdr/deps/zlib-1.2.13/inftrees.c + libchdr/deps/zlib-1.2.13/trees.c + libchdr/deps/zlib-1.2.13/uncompr.c + libchdr/deps/zlib-1.2.13/zutil.c +) + +target_include_directories(libchdr + PUBLIC ../thirdparty/libchdr/include + PRIVATE + ../thirdparty/libchdr/deps/lzma-19.00/include + ../thirdparty/libchdr/deps/zlib-1.2.13 +) + +target_compile_definitions(libchdr PRIVATE + _7ZIP_ST + # instruct glibc to declare fseeko/ftello + _LARGEFILE_SOURCE +) + +add_library(tzxfile STATIC + TZXFile/TZXAudioGenerator.cpp + TZXFile/TZXBlock.cpp + TZXFile/TZXBlockArchiveInfo.cpp + TZXFile/TZXBlockCustomInfo.cpp + TZXFile/TZXBlockGroupEnd.cpp + TZXFile/TZXBlockGroupStart.cpp + TZXFile/TZXBlockHardwareType.cpp + TZXFile/TZXBlockLoopEnd.cpp + TZXFile/TZXBlockLoopStart.cpp + TZXFile/TZXBlockMessage.cpp + TZXFile/TZXBlockPause.cpp + TZXFile/TZXBlockPulseSequence.cpp + TZXFile/TZXBlockPureData.cpp + TZXFile/TZXBlockPureTone.cpp + TZXFile/TZXBlockStandardSpeedData.cpp + TZXFile/TZXBlockStopTheTape48K.cpp + TZXFile/TZXBlockTextDescription.cpp + TZXFile/TZXBlockTurboSpeedData.cpp + TZXFile/TZXFile.cpp +) + +target_include_directories(tzxfile PUBLIC + ../thirdparty/TZXFile + ) + +add_library(ymfm STATIC + ymfm/src/ymfm_adpcm.cpp + ymfm/src/ymfm_misc.cpp + ymfm/src/ymfm_opl.cpp + ymfm/src/ymfm_opm.cpp + ymfm/src/ymfm_opn.cpp + ymfm/src/ymfm_opq.cpp + ymfm/src/ymfm_opz.cpp + ymfm/src/ymfm_pcm.cpp + ymfm/src/ymfm_ssg.cpp +) + +target_include_directories(ymfm PUBLIC + ../thirdparty/ymfm/src +) diff --git a/tools/genius/CMakeLists.txt b/tools/genius/CMakeLists.txt new file mode 100644 index 0000000000..6b43ea832e --- /dev/null +++ b/tools/genius/CMakeLists.txt @@ -0,0 +1,3 @@ +add_executable(genius genius.cpp) + +target_link_libraries(genius PRIVATE nall hiro) diff --git a/tools/mame2bml/CMakeLists.txt b/tools/mame2bml/CMakeLists.txt new file mode 100644 index 0000000000..9f9cbf1501 --- /dev/null +++ b/tools/mame2bml/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(mame2bml mame2bml.cpp) + +target_link_libraries(mame2bml PRIVATE nall) + +nall_set_properties(mame2bml) diff --git a/tools/sourcery/CMakeLists.txt b/tools/sourcery/CMakeLists.txt new file mode 100644 index 0000000000..4a2b580388 --- /dev/null +++ b/tools/sourcery/CMakeLists.txt @@ -0,0 +1,5 @@ +add_executable(sourcery sourcery.cpp) + +target_link_libraries(sourcery PRIVATE nall) + +nall_set_properties(sourcery)