add_library(core
  AchievementApprovedHash.h
  AchievementManager.cpp
  AchievementManager.h
  ActionReplay.cpp
  ActionReplay.h
  ARDecrypt.cpp
  ARDecrypt.h
  Boot/AncastTypes.h
  Boot/Boot_BS2Emu.cpp
  Boot/Boot_WiiWAD.cpp
  Boot/Boot.cpp
  Boot/Boot.h
  Boot/DolReader.cpp
  Boot/DolReader.h
  Boot/ElfReader.cpp
  Boot/ElfReader.h
  Boot/ElfTypes.h
  BootManager.cpp
  BootManager.h
  CheatCodes.h
  CheatGeneration.cpp
  CheatGeneration.h
  CheatSearch.cpp
  CheatSearch.h
  CommonTitles.h
  Config/AchievementSettings.cpp
  Config/AchievementSettings.h
  Config/DefaultLocale.cpp
  Config/DefaultLocale.h
  Config/FreeLookSettings.cpp
  Config/FreeLookSettings.h
  Config/GraphicsSettings.cpp
  Config/GraphicsSettings.h
  Config/MainSettings.cpp
  Config/MainSettings.h
  Config/NetplaySettings.cpp
  Config/NetplaySettings.h
  Config/SessionSettings.cpp
  Config/SessionSettings.h
  Config/SYSCONFSettings.cpp
  Config/SYSCONFSettings.h
  Config/UISettings.cpp
  Config/UISettings.h
  Config/WiimoteSettings.cpp
  Config/WiimoteSettings.h
  ConfigLoaders/BaseConfigLoader.cpp
  ConfigLoaders/BaseConfigLoader.h
  ConfigLoaders/GameConfigLoader.cpp
  ConfigLoaders/GameConfigLoader.h
  ConfigLoaders/IsSettingSaveable.cpp
  ConfigLoaders/IsSettingSaveable.h
  ConfigLoaders/MovieConfigLoader.cpp
  ConfigLoaders/MovieConfigLoader.h
  ConfigLoaders/NetPlayConfigLoader.cpp
  ConfigLoaders/NetPlayConfigLoader.h
  ConfigManager.cpp
  ConfigManager.h
  Core.cpp
  Core.h
  CoreTiming.cpp
  CoreTiming.h
  CPUThreadConfigCallback.cpp
  CPUThreadConfigCallback.h
  Debugger/BranchWatch.cpp
  Debugger/BranchWatch.h
  Debugger/CodeTrace.cpp
  Debugger/CodeTrace.h
  Debugger/DebugInterface.h
  Debugger/Debugger_SymbolMap.cpp
  Debugger/Debugger_SymbolMap.h
  Debugger/Dump.cpp
  Debugger/Dump.h
  Debugger/GCELF.h
  Debugger/OSThread.cpp
  Debugger/OSThread.h
  Debugger/PPCDebugInterface.cpp
  Debugger/PPCDebugInterface.h
  Debugger/RSO.cpp
  Debugger/RSO.h
  DolphinAnalytics.cpp
  DolphinAnalytics.h
  DSP/DSPAccelerator.cpp
  DSP/DSPAccelerator.h
  DSP/DSPAnalyzer.cpp
  DSP/DSPAnalyzer.h
  DSP/DSPAssembler.cpp
  DSP/DSPAssembler.h
  DSP/DSPCaptureLogger.cpp
  DSP/DSPCaptureLogger.h
  DSP/DSPCodeUtil.cpp
  DSP/DSPCodeUtil.h
  DSP/DSPCommon.h
  DSP/DSPCore.cpp
  DSP/DSPCore.h
  DSP/DSPDisassembler.cpp
  DSP/DSPDisassembler.h
  DSP/DSPHWInterface.cpp
  DSP/DSPMemoryMap.cpp
  DSP/DSPStacks.cpp
  DSP/DSPTables.cpp
  DSP/DSPTables.h
  DSP/Interpreter/DSPIntArithmetic.cpp
  DSP/Interpreter/DSPIntBranch.cpp
  DSP/Interpreter/DSPIntCCUtil.h
  DSP/Interpreter/DSPInterpreter.cpp
  DSP/Interpreter/DSPInterpreter.h
  DSP/Interpreter/DSPIntExtOps.cpp
  DSP/Interpreter/DSPIntLoadStore.cpp
  DSP/Interpreter/DSPIntMisc.cpp
  DSP/Interpreter/DSPIntMultiplier.cpp
  DSP/Interpreter/DSPIntTables.cpp
  DSP/Interpreter/DSPIntTables.h
  DSP/Interpreter/DSPIntUtil.h
  DSP/Jit/DSPEmitterBase.cpp
  DSP/Jit/DSPEmitterBase.h
  DSP/LabelMap.cpp
  DSP/LabelMap.h
  DSPEmulator.cpp
  DSPEmulator.h
  FifoPlayer/FifoDataFile.cpp
  FifoPlayer/FifoDataFile.h
  FifoPlayer/FifoPlayer.cpp
  FifoPlayer/FifoPlayer.h
  FifoPlayer/FifoRecorder.cpp
  FifoPlayer/FifoRecorder.h
  FreeLookManager.cpp
  FreeLookManager.h
  GeckoCode.cpp
  GeckoCode.h
  GeckoCodeConfig.cpp
  GeckoCodeConfig.h
  HLE/HLE_Misc.cpp
  HLE/HLE_Misc.h
  HLE/HLE_OS.cpp
  HLE/HLE_OS.h
  HLE/HLE_VarArgs.cpp
  HLE/HLE_VarArgs.h
  HLE/HLE.cpp
  HLE/HLE.h
  Host.h
  HotkeyManager.cpp
  HotkeyManager.h
  HW/AddressSpace.cpp
  HW/AddressSpace.h
  HW/AudioInterface.cpp
  HW/AudioInterface.h
  HW/CPU.cpp
  HW/CPU.h
  HW/DSP.cpp
  HW/DSP.h
  HW/DSPHLE/DSPHLE.cpp
  HW/DSPHLE/DSPHLE.h
  HW/DSPHLE/MailHandler.cpp
  HW/DSPHLE/MailHandler.h
  HW/DSPHLE/UCodes/ASnd.cpp
  HW/DSPHLE/UCodes/ASnd.h
  HW/DSPHLE/UCodes/AESnd.cpp
  HW/DSPHLE/UCodes/AESnd.h
  HW/DSPHLE/UCodes/AX.cpp
  HW/DSPHLE/UCodes/AX.h
  HW/DSPHLE/UCodes/AXStructs.h
  HW/DSPHLE/UCodes/AXVoice.h
  HW/DSPHLE/UCodes/AXWii.cpp
  HW/DSPHLE/UCodes/AXWii.h
  HW/DSPHLE/UCodes/CARD.cpp
  HW/DSPHLE/UCodes/CARD.h
  HW/DSPHLE/UCodes/GBA.cpp
  HW/DSPHLE/UCodes/GBA.h
  HW/DSPHLE/UCodes/INIT.cpp
  HW/DSPHLE/UCodes/INIT.h
  HW/DSPHLE/UCodes/ROM.cpp
  HW/DSPHLE/UCodes/ROM.h
  HW/DSPHLE/UCodes/UCodes.cpp
  HW/DSPHLE/UCodes/UCodes.h
  HW/DSPHLE/UCodes/Zelda.cpp
  HW/DSPHLE/UCodes/Zelda.h
  HW/DSPLLE/DSPHost.cpp
  HW/DSPLLE/DSPLLE.cpp
  HW/DSPLLE/DSPLLE.h
  HW/DSPLLE/DSPSymbols.cpp
  HW/DSPLLE/DSPSymbols.h
  HW/DVD/DVDInterface.cpp
  HW/DVD/DVDInterface.h
  HW/DVD/AMMediaboard.cpp
  HW/DVD/AMMediaboard.h
  HW/DVD/DVDMath.cpp
  HW/DVD/DVDMath.h
  HW/DVD/DVDThread.cpp
  HW/DVD/DVDThread.h
  HW/DVD/FileMonitor.cpp
  HW/DVD/FileMonitor.h
  HW/EXI/BBA/TAPServerConnection.cpp
  HW/EXI/BBA/TAPServerBBA.cpp
  HW/EXI/BBA/XLINK_KAI_BBA.cpp
  HW/EXI/BBA/BuiltIn.cpp
  HW/EXI/BBA/BuiltIn.h
  HW/EXI/Modem/TAPServerModem.cpp
  HW/EXI/EXI_Channel.cpp
  HW/EXI/EXI_Channel.h
  HW/EXI/EXI_Device.cpp
  HW/EXI/EXI_Device.h
  HW/EXI/EXI_DeviceAD16.cpp
  HW/EXI/EXI_DeviceAD16.h
  HW/EXI/EXI_DeviceAGP.cpp
  HW/EXI/EXI_DeviceAGP.h
  HW/EXI/EXI_DeviceBaseboard.cpp
  HW/EXI/EXI_DeviceBaseboard.h
  HW/EXI/EXI_DeviceDummy.cpp
  HW/EXI/EXI_DeviceDummy.h
  HW/EXI/EXI_DeviceEthernet.cpp
  HW/EXI/EXI_DeviceEthernet.h
  HW/EXI/EXI_DeviceGecko.cpp
  HW/EXI/EXI_DeviceGecko.h
  HW/EXI/EXI_DeviceIPL.cpp
  HW/EXI/EXI_DeviceIPL.h
  HW/EXI/EXI_DeviceMemoryCard.cpp
  HW/EXI/EXI_DeviceMemoryCard.h
  HW/EXI/EXI_DeviceModem.cpp
  HW/EXI/EXI_DeviceModem.h
  HW/EXI/EXI.cpp
  HW/EXI/EXI.h
  HW/GBAPad.cpp
  HW/GBAPad.h
  HW/GBAPadEmu.cpp
  HW/GBAPadEmu.h
  HW/GCKeyboard.cpp
  HW/GCKeyboard.h
  HW/GCKeyboardEmu.cpp
  HW/GCKeyboardEmu.h
  HW/GCMemcard/GCIFile.cpp
  HW/GCMemcard/GCIFile.h
  HW/GCMemcard/GCMemcard.cpp
  HW/GCMemcard/GCMemcard.h
  HW/GCMemcard/GCMemcardBase.h
  HW/GCMemcard/GCMemcardDirectory.cpp
  HW/GCMemcard/GCMemcardDirectory.h
  HW/GCMemcard/GCMemcardRaw.cpp
  HW/GCMemcard/GCMemcardRaw.h
  HW/GCMemcard/GCMemcardUtils.cpp
  HW/GCMemcard/GCMemcardUtils.h
  HW/GCPad.cpp
  HW/GCPad.h
  HW/GCPadEmu.cpp
  HW/GCPadEmu.h
  HW/GPFifo.cpp
  HW/GPFifo.h
  HW/HSP/HSP.cpp
  HW/HSP/HSP.h
  HW/HSP/HSP_Device.cpp
  HW/HSP/HSP_Device.h
  HW/HSP/HSP_DeviceARAMExpansion.cpp
  HW/HSP/HSP_DeviceARAMExpansion.h
  HW/HSP/HSP_DeviceGBPlayer.cpp
  HW/HSP/HSP_DeviceGBPlayer.h
  HW/HSP/HSP_DeviceNull.cpp
  HW/HSP/HSP_DeviceNull.h
  HW/HW.cpp
  HW/HW.h
  HW/MagCard/C1231BR.cpp
  HW/MagCard/C1231BR.h
  HW/MagCard/C1231LR.cpp
  HW/MagCard/C1231LR.h
  HW/MagCard/MagneticCardReader.cpp
  HW/MagCard/MagneticCardReader.h
  HW/Memmap.cpp
  HW/Memmap.h
  HW/MemoryInterface.cpp
  HW/MemoryInterface.h
  HW/MMIO.cpp
  HW/MMIO.h
  HW/ProcessorInterface.cpp
  HW/ProcessorInterface.h
  HW/SI/SI_Device.cpp
  HW/SI/SI_Device.h
  HW/SI/SI_DeviceDanceMat.cpp
  HW/SI/SI_DeviceDanceMat.h
  HW/SI/SI_DeviceGBA.cpp
  HW/SI/SI_DeviceGBA.h
  HW/SI/SI_DeviceGCAdapter.cpp
  HW/SI/SI_DeviceGCAdapter.h
  HW/SI/SI_DeviceGCController.cpp
  HW/SI/SI_DeviceGCController.h
  HW/SI/SI_DeviceGCSteeringWheel.cpp
  HW/SI/SI_DeviceGCSteeringWheel.h
  HW/SI/SI_DeviceKeyboard.cpp
  HW/SI/SI_DeviceKeyboard.h
  HW/SI/SI_DeviceAMBaseboard.cpp
  HW/SI/SI_DeviceAMBaseboard.h
  HW/SI/SI_DeviceNull.cpp
  HW/SI/SI_DeviceNull.h
  HW/SI/SI.cpp
  HW/SI/SI.h
  HW/Sram.cpp
  HW/Sram.h
  HW/StreamADPCM.cpp
  HW/StreamADPCM.h
  HW/SystemTimers.cpp
  HW/SystemTimers.h
  HW/Triforce/DeckReader.cpp
  HW/Triforce/DeckReader.h
  HW/Triforce/FZeroAX.cpp
  HW/Triforce/FZeroAX.h
  HW/Triforce/ICCardReader.cpp
  HW/Triforce/ICCardReader.h
  HW/Triforce/IOPorts.cpp
  HW/Triforce/IOPorts.h
  HW/Triforce/JVSIO.cpp
  HW/Triforce/JVSIO.h
  HW/Triforce/MarioKartGP.cpp
  HW/Triforce/MarioKartGP.h
  HW/Triforce/SerialDevice.cpp
  HW/Triforce/SerialDevice.h
  HW/Triforce/Touchscreen.cpp
  HW/Triforce/Touchscreen.h
  HW/VideoInterface.cpp
  HW/VideoInterface.h
  HW/WII_IPC.cpp
  HW/WII_IPC.h
  HW/Wiimote.cpp
  HW/Wiimote.h
  HW/WiimoteCommon/DataReport.cpp
  HW/WiimoteCommon/DataReport.h
  HW/WiimoteCommon/WiimoteConstants.h
  HW/WiimoteCommon/WiimoteHid.h
  HW/WiimoteCommon/WiimoteReport.h
  HW/WiimoteEmu/Camera.cpp
  HW/WiimoteEmu/Camera.h
  HW/WiimoteEmu/DesiredWiimoteState.cpp
  HW/WiimoteEmu/DesiredWiimoteState.h
  HW/WiimoteEmu/Dynamics.cpp
  HW/WiimoteEmu/Dynamics.h
  HW/WiimoteEmu/EmuSubroutines.cpp
  HW/WiimoteEmu/Encryption.cpp
  HW/WiimoteEmu/Encryption.h
  HW/WiimoteEmu/Extension/Classic.cpp
  HW/WiimoteEmu/Extension/Classic.h
  HW/WiimoteEmu/Extension/DesiredExtensionState.h
  HW/WiimoteEmu/Extension/DrawsomeTablet.cpp
  HW/WiimoteEmu/Extension/DrawsomeTablet.h
  HW/WiimoteEmu/Extension/Drums.cpp
  HW/WiimoteEmu/Extension/Drums.h
  HW/WiimoteEmu/Extension/Extension.cpp
  HW/WiimoteEmu/Extension/Extension.h
  HW/WiimoteEmu/Extension/Guitar.cpp
  HW/WiimoteEmu/Extension/Guitar.h
  HW/WiimoteEmu/Extension/Nunchuk.cpp
  HW/WiimoteEmu/Extension/Nunchuk.h
  HW/WiimoteEmu/Extension/Shinkansen.cpp
  HW/WiimoteEmu/Extension/Shinkansen.h
  HW/WiimoteEmu/Extension/TaTaCon.cpp
  HW/WiimoteEmu/Extension/TaTaCon.h
  HW/WiimoteEmu/Extension/Turntable.cpp
  HW/WiimoteEmu/Extension/Turntable.h
  HW/WiimoteEmu/Extension/UDrawTablet.cpp
  HW/WiimoteEmu/Extension/UDrawTablet.h
  HW/WiimoteEmu/ExtensionPort.cpp
  HW/WiimoteEmu/ExtensionPort.h
  HW/WiimoteEmu/I2CBus.cpp
  HW/WiimoteEmu/I2CBus.h
  HW/WiimoteEmu/MotionPlus.cpp
  HW/WiimoteEmu/MotionPlus.h
  HW/WiimoteEmu/Speaker.cpp
  HW/WiimoteEmu/Speaker.h
  HW/WiimoteEmu/WiimoteEmu.cpp
  HW/WiimoteEmu/WiimoteEmu.h
  HW/WiimoteReal/WiimoteReal.cpp
  HW/WiimoteReal/WiimoteReal.h
  HW/WiiSave.cpp
  HW/WiiSave.h
  HW/WiiSaveStructs.h
  IOS/Device.cpp
  IOS/Device.h
  IOS/DeviceStub.cpp
  IOS/DeviceStub.h
  IOS/Crypto/AesDevice.cpp
  IOS/Crypto/AesDevice.h
  IOS/Crypto/Sha.cpp
  IOS/Crypto/Sha.h
  IOS/DI/DI.cpp
  IOS/DI/DI.h
  IOS/DolphinDevice.cpp
  IOS/DolphinDevice.h
  IOS/ES/ES.cpp
  IOS/ES/ES.h
  IOS/ES/Formats.cpp
  IOS/ES/Formats.h
  IOS/ES/Identity.cpp
  IOS/ES/NandUtils.cpp
  IOS/ES/TitleContents.cpp
  IOS/ES/TitleInformation.cpp
  IOS/ES/TitleManagement.cpp
  IOS/ES/Views.cpp
  IOS/FS/FileSystem.h
  IOS/FS/FileSystemCommon.cpp
  IOS/FS/FileSystemProxy.cpp
  IOS/FS/FileSystemProxy.h
  IOS/FS/HostBackend/File.cpp
  IOS/FS/HostBackend/FS.cpp
  IOS/FS/HostBackend/FS.h
  IOS/IOS.cpp
  IOS/IOS.h
  IOS/IOSC.cpp
  IOS/IOSC.h
  IOS/MIOS.cpp
  IOS/MIOS.h
  IOS/Network/ICMP.h
  IOS/Network/ICMPLin.cpp
  IOS/Network/IP/Top.cpp
  IOS/Network/IP/Top.h
  IOS/Network/KD/NetKDRequest.cpp
  IOS/Network/KD/NetKDRequest.h
  IOS/Network/KD/NetKDTime.cpp
  IOS/Network/KD/NetKDTime.h
  IOS/Network/KD/NWC24Config.cpp
  IOS/Network/KD/NWC24Config.h
  IOS/Network/KD/NWC24DL.cpp
  IOS/Network/KD/NWC24DL.h
  IOS/Network/KD/VFF/VFFUtil.cpp
  IOS/Network/KD/VFF/VFFUtil.h
  IOS/Network/KD/WC24File.h
  IOS/Network/KD/Mail/MailCommon.h
  IOS/Network/KD/Mail/WC24FriendList.cpp
  IOS/Network/KD/Mail/WC24FriendList.h
  IOS/Network/KD/Mail/WC24Send.cpp
  IOS/Network/KD/Mail/WC24Send.h
  IOS/Network/MACUtils.cpp
  IOS/Network/MACUtils.h
  IOS/Network/NCD/Manage.cpp
  IOS/Network/NCD/Manage.h
  IOS/Network/NCD/WiiNetConfig.cpp
  IOS/Network/NCD/WiiNetConfig.h
  IOS/Network/Socket.cpp
  IOS/Network/Socket.h
  IOS/Network/SSL.cpp
  IOS/Network/SSL.h
  IOS/Network/WD/Command.cpp
  IOS/Network/WD/Command.h
  IOS/SDIO/SDIOSlot0.cpp
  IOS/SDIO/SDIOSlot0.h
  IOS/STM/STM.cpp
  IOS/STM/STM.h
  IOS/USB/Bluetooth/BTBase.cpp
  IOS/USB/Bluetooth/BTBase.h
  IOS/USB/Bluetooth/BTEmu.cpp
  IOS/USB/Bluetooth/BTEmu.h
  IOS/USB/Bluetooth/BTStub.cpp
  IOS/USB/Bluetooth/BTStub.h
  IOS/USB/Bluetooth/hci.h
  IOS/USB/Bluetooth/l2cap.h
  IOS/USB/Bluetooth/WiimoteDevice.cpp
  IOS/USB/Bluetooth/WiimoteDevice.h
  IOS/USB/Bluetooth/WiimoteHIDAttr.cpp
  IOS/USB/Bluetooth/WiimoteHIDAttr.h
  IOS/USB/Common.cpp
  IOS/USB/Common.h
  IOS/USB/Emulated/Infinity.cpp
  IOS/USB/Emulated/Infinity.h
  IOS/USB/Emulated/Microphone.cpp
  IOS/USB/Emulated/Microphone.h
  IOS/USB/Emulated/Skylanders/Skylander.cpp
  IOS/USB/Emulated/Skylanders/Skylander.h
  IOS/USB/Emulated/Skylanders/SkylanderCrypto.cpp
  IOS/USB/Emulated/Skylanders/SkylanderCrypto.h
  IOS/USB/Emulated/Skylanders/SkylanderFigure.cpp
  IOS/USB/Emulated/Skylanders/SkylanderFigure.h
  IOS/USB/Emulated/WiiSpeak.cpp
  IOS/USB/Emulated/WiiSpeak.h
  IOS/USB/Emulated/LogitechMic.cpp
  IOS/USB/Emulated/LogitechMic.h
  IOS/USB/Host.cpp
  IOS/USB/Host.h
  IOS/USB/OH0/OH0.cpp
  IOS/USB/OH0/OH0.h
  IOS/USB/OH0/OH0Device.cpp
  IOS/USB/OH0/OH0Device.h
  IOS/USB/USB_HID/HIDv4.cpp
  IOS/USB/USB_HID/HIDv4.h
  IOS/USB/USB_HID/HIDv5.cpp
  IOS/USB/USB_HID/HIDv5.h
  IOS/USB/USB_KBD.cpp
  IOS/USB/USB_KBD.h
  IOS/USB/USB_VEN/VEN.cpp
  IOS/USB/USB_VEN/VEN.h
  IOS/USB/USBScanner.cpp
  IOS/USB/USBScanner.h
  IOS/USB/USBV0.cpp
  IOS/USB/USBV0.h
  IOS/USB/USBV4.cpp
  IOS/USB/USBV4.h
  IOS/USB/USBV5.cpp
  IOS/USB/USBV5.h
  IOS/VersionInfo.cpp
  IOS/VersionInfo.h
  IOS/WFS/WFSI.cpp
  IOS/WFS/WFSI.h
  IOS/WFS/WFSSRV.cpp
  IOS/WFS/WFSSRV.h
  LibusbUtils.cpp
  LibusbUtils.h
  MemTools.cpp
  MemTools.h
  Movie.cpp
  Movie.h
  NetPlayClient.cpp
  NetPlayClient.h
  NetPlayCommon.cpp
  NetPlayCommon.h
  NetPlayServer.cpp
  NetPlayServer.h
  NetworkCaptureLogger.cpp
  NetworkCaptureLogger.h
  PatchEngine.cpp
  PatchEngine.h
  PowerPC/BreakPoints.cpp
  PowerPC/BreakPoints.h
  PowerPC/CachedInterpreter/CachedInterpreter_Disassembler.cpp
  PowerPC/CachedInterpreter/CachedInterpreter.cpp
  PowerPC/CachedInterpreter/CachedInterpreter.h
  PowerPC/CachedInterpreter/CachedInterpreterBlockCache.cpp
  PowerPC/CachedInterpreter/CachedInterpreterBlockCache.h
  PowerPC/CachedInterpreter/CachedInterpreterEmitter.cpp
  PowerPC/CachedInterpreter/CachedInterpreterEmitter.h
  PowerPC/ConditionRegister.cpp
  PowerPC/ConditionRegister.h
  PowerPC/Expression.cpp
  PowerPC/Expression.h
  PowerPC/Interpreter/ExceptionUtils.h
  PowerPC/Interpreter/Interpreter_Branch.cpp
  PowerPC/Interpreter/Interpreter_FloatingPoint.cpp
  PowerPC/Interpreter/Interpreter_FPUtils.h
  PowerPC/Interpreter/Interpreter_Integer.cpp
  PowerPC/Interpreter/Interpreter_LoadStore.cpp
  PowerPC/Interpreter/Interpreter_LoadStorePaired.cpp
  PowerPC/Interpreter/Interpreter_Paired.cpp
  PowerPC/Interpreter/Interpreter_SystemRegisters.cpp
  PowerPC/Interpreter/Interpreter_Tables.cpp
  PowerPC/Interpreter/Interpreter.cpp
  PowerPC/Interpreter/Interpreter.h
  PowerPC/JitCommon/ConstantPropagation.cpp
  PowerPC/JitCommon/ConstantPropagation.h
  PowerPC/JitCommon/DivUtils.cpp
  PowerPC/JitCommon/DivUtils.h
  PowerPC/JitCommon/JitAsmCommon.cpp
  PowerPC/JitCommon/JitAsmCommon.h
  PowerPC/JitCommon/JitBase.cpp
  PowerPC/JitCommon/JitBase.h
  PowerPC/JitCommon/JitCache.cpp
  PowerPC/JitCommon/JitCache.h
  PowerPC/JitInterface.cpp
  PowerPC/JitInterface.h
  PowerPC/GDBStub.cpp
  PowerPC/GDBStub.h
  PowerPC/MMU.cpp
  PowerPC/MMU.h
  PowerPC/PowerPC.cpp
  PowerPC/PowerPC.h
  PowerPC/PPCAnalyst.cpp
  PowerPC/PPCAnalyst.h
  PowerPC/PPCCache.cpp
  PowerPC/PPCCache.h
  PowerPC/PPCSymbolDB.cpp
  PowerPC/PPCSymbolDB.h
  PowerPC/PPCTables.cpp
  PowerPC/PPCTables.h
  PowerPC/SignatureDB/CSVSignatureDB.cpp
  PowerPC/SignatureDB/CSVSignatureDB.h
  PowerPC/SignatureDB/DSYSignatureDB.cpp
  PowerPC/SignatureDB/DSYSignatureDB.h
  PowerPC/SignatureDB/MEGASignatureDB.cpp
  PowerPC/SignatureDB/MEGASignatureDB.h
  PowerPC/SignatureDB/SignatureDB.cpp
  PowerPC/SignatureDB/SignatureDB.h
  State.cpp
  State.h
  SyncIdentifier.h
  SysConf.cpp
  SysConf.h
  System.cpp
  System.h
  TimePlayed.cpp
  TimePlayed.h
  TitleDatabase.cpp
  TitleDatabase.h
  USBUtils.cpp
  USBUtils.h
  WC24PatchEngine.cpp
  WC24PatchEngine.h
  WiiRoot.cpp
  WiiRoot.h
  WiiUtils.cpp
  WiiUtils.h
)

if(_M_X86_64)
  target_sources(core PRIVATE
    DSP/Jit/x64/DSPEmitter.cpp
    DSP/Jit/x64/DSPEmitter.h
    DSP/Jit/x64/DSPJitArithmetic.cpp
    DSP/Jit/x64/DSPJitBranch.cpp
    DSP/Jit/x64/DSPJitCCUtil.cpp
    DSP/Jit/x64/DSPJitExtOps.cpp
    DSP/Jit/x64/DSPJitLoadStore.cpp
    DSP/Jit/x64/DSPJitMisc.cpp
    DSP/Jit/x64/DSPJitMultiplier.cpp
    DSP/Jit/x64/DSPJitRegCache.cpp
    DSP/Jit/x64/DSPJitRegCache.h
    DSP/Jit/x64/DSPJitTables.cpp
    DSP/Jit/x64/DSPJitTables.h
    DSP/Jit/x64/DSPJitUtil.cpp
    PowerPC/Jit64/Jit.cpp
    PowerPC/Jit64/Jit.h
    PowerPC/Jit64/Jit64_Tables.cpp
    PowerPC/Jit64/Jit_Branch.cpp
    PowerPC/Jit64/Jit_FloatingPoint.cpp
    PowerPC/Jit64/Jit_Integer.cpp
    PowerPC/Jit64/Jit_LoadStore.cpp
    PowerPC/Jit64/Jit_LoadStoreFloating.cpp
    PowerPC/Jit64/Jit_LoadStorePaired.cpp
    PowerPC/Jit64/Jit_Paired.cpp
    PowerPC/Jit64/Jit_SystemRegisters.cpp
    PowerPC/Jit64/JitAsm.cpp
    PowerPC/Jit64/JitAsm.h
    PowerPC/Jit64/RegCache/CachedReg.h
    PowerPC/Jit64/RegCache/FPURegCache.cpp
    PowerPC/Jit64/RegCache/FPURegCache.h
    PowerPC/Jit64/RegCache/GPRRegCache.cpp
    PowerPC/Jit64/RegCache/GPRRegCache.h
    PowerPC/Jit64/RegCache/JitRegCache.cpp
    PowerPC/Jit64/RegCache/JitRegCache.h
    PowerPC/Jit64/RegCache/RCMode.h
    PowerPC/Jit64Common/BlockCache.cpp
    PowerPC/Jit64Common/BlockCache.h
    PowerPC/Jit64Common/ConstantPool.cpp
    PowerPC/Jit64Common/ConstantPool.h
    PowerPC/Jit64Common/EmuCodeBlock.cpp
    PowerPC/Jit64Common/EmuCodeBlock.h
    PowerPC/Jit64Common/FarCodeCache.cpp
    PowerPC/Jit64Common/FarCodeCache.h
    PowerPC/Jit64Common/Jit64AsmCommon.cpp
    PowerPC/Jit64Common/Jit64AsmCommon.h
    PowerPC/Jit64Common/Jit64Constants.h
    PowerPC/Jit64Common/Jit64PowerPCState.h
    PowerPC/Jit64Common/TrampolineCache.cpp
    PowerPC/Jit64Common/TrampolineCache.h
    PowerPC/Jit64Common/TrampolineInfo.h
  )
elseif(_M_ARM_64)
  target_sources(core PRIVATE
    PowerPC/JitArm64/Jit.cpp
    PowerPC/JitArm64/Jit.h
    PowerPC/JitArm64/JitAsm.cpp
    PowerPC/JitArm64/JitArm64Cache.cpp
    PowerPC/JitArm64/JitArm64_BackPatch.cpp
    PowerPC/JitArm64/JitArm64_Branch.cpp
    PowerPC/JitArm64/JitArm64_FloatingPoint.cpp
    PowerPC/JitArm64/JitArm64_Integer.cpp
    PowerPC/JitArm64/JitArm64_LoadStore.cpp
    PowerPC/JitArm64/JitArm64_LoadStoreFloating.cpp
    PowerPC/JitArm64/JitArm64_LoadStorePaired.cpp
    PowerPC/JitArm64/JitArm64_Paired.cpp
    PowerPC/JitArm64/JitArm64_RegCache.cpp
    PowerPC/JitArm64/JitArm64_RegCache.h
    PowerPC/JitArm64/JitArm64_SystemRegisters.cpp
    PowerPC/JitArm64/Jit_Util.cpp
    PowerPC/JitArm64/Jit_Util.h
    PowerPC/JitArm64/JitArm64_Tables.cpp
    PowerPC/JitArmCommon/BackPatch.h
  )
endif()

target_link_libraries(core
PUBLIC
  audiocommon
  common
  discio
  enet::enet
  expr
  inputcommon
  MbedTLS::mbedtls
  pugixml
  sfml-network
  videonull
  videoogl
  videosoftware
  # Day-14 (wasm-dolphin): WebGPU scaffold backend. Linked for all
  # targets; the runtime registration is gated on HAS_WEBGPU (only set
  # for the Emscripten dolphin_web_core target below).
  videowebgpu

PRIVATE
  FatFs
  fmt::fmt
  LZO::LZO
  LZ4::LZ4
  ZLIB::ZLIB
)

if(LIBUDEV_FOUND)
  target_include_directories(core PRIVATE ${LIBUDEV_INCLUDE_DIR})
  target_link_libraries(core PRIVATE ${LIBUDEV_LIBRARY})
endif()

if (APPLE)
  target_link_libraries(core
  PRIVATE
    ${CORESERV_LIBRARY}
    ${IOB_LIBRARY}
    ${IOK_LIBRARY}
    resolv
  )
elseif (ANDROID)
  target_link_libraries(core
  PRIVATE
    androidcommon
  )
endif()

if(ENABLE_CUBEB)
  target_link_libraries(core PUBLIC cubeb)
  target_sources(core PRIVATE
    HW/EXI/EXI_DeviceMic.cpp
    HW/EXI/EXI_DeviceMic.h
  )
endif()

if(TARGET LibUSB::LibUSB)
  target_link_libraries(core PUBLIC LibUSB::LibUSB)
  target_sources(core PRIVATE
    IOS/USB/LibusbDevice.cpp
    IOS/USB/LibusbDevice.h
    IOS/USB/Bluetooth/BTReal.cpp
    IOS/USB/Bluetooth/BTReal.h
    IOS/USB/Bluetooth/LibUSBBluetoothAdapter.cpp
    IOS/USB/Bluetooth/LibUSBBluetoothAdapter.h
    IOS/USB/Bluetooth/RealtekFirmwareLoader.cpp
    IOS/USB/Bluetooth/RealtekFirmwareLoader.h
  )
endif()

if(ENABLE_VULKAN)
  target_link_libraries(core PUBLIC videovulkan)
endif()

if(APPLE)
  target_link_libraries(core PUBLIC videometal)
endif()

if(USE_MGBA)
  target_sources(core PRIVATE
    HW/GBACore.cpp
    HW/GBACore.h
    HW/SI/SI_DeviceGBAEmu.cpp
    HW/SI/SI_DeviceGBAEmu.h
  )
  target_link_libraries(core PUBLIC mGBA::mgba)
  target_compile_definitions(core PUBLIC -DHAS_LIBMGBA)
endif()

if(WIN32)
  target_sources(core PRIVATE
    HW/EXI/BBA/TAP_Win32.cpp
    HW/EXI/BBA/TAP_Win32.h
    HW/WiimoteReal/IOWin.cpp
    HW/WiimoteReal/IOWin.h
  )
  target_link_libraries(core PUBLIC
    videod3d
    videod3d12
    setupapi.lib
    iphlpapi.lib
  )
  target_compile_definitions(core PRIVATE "-D_WINSOCK_DEPRECATED_NO_WARNINGS")
elseif(APPLE)
  target_sources(core PRIVATE
    HW/EXI/BBA/TAP_Apple.cpp
  )
  target_link_libraries(core PUBLIC ${IOB_LIBRARY})
elseif(UNIX AND NOT EMSCRIPTEN)
  target_sources(core PRIVATE
    HW/EXI/BBA/TAP_Unix.cpp
  )
  if(ANDROID)
    target_sources(core PRIVATE
      HW/WiimoteReal/IOAndroid.cpp
      HW/WiimoteReal/IOAndroid.h
    )
  endif()
endif()

# Bluez doesn't support all the communication modes on FreeBSD, so only using it on Linux
if(LINUX)
  option(ENABLE_BLUEZ "Enables bluetooth support" ON)
  if(ENABLE_BLUEZ)
    find_package(BlueZ)
    if(BlueZ_FOUND)
      message(STATUS "BlueZ found, enabling bluetooth support")
      target_sources(core PRIVATE
        HW/WiimoteReal/IOLinux.cpp
        HW/WiimoteReal/IOLinux.h
      )
      target_link_libraries(core PUBLIC BlueZ::BlueZ)
      target_compile_definitions(core PRIVATE -DHAVE_BLUEZ=1)
    else()
      message(STATUS "BlueZ NOT found, disabling bluetooth support")
    endif()
  else()
    message(STATUS "BlueZ explicitly disabled, disabling bluetooth support")
  endif()
endif()

if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
  # OpenBSD doesn't allow memory to be both writable and executable by default.
  # The JIT currently needs this.
  target_link_options(core PUBLIC -Wl,-zwxneeded)
endif()

if(TARGET Hidapi::Hidapi)
  target_sources(core PRIVATE
    HW/WiimoteReal/IOhidapi.cpp
    HW/WiimoteReal/IOhidapi.h
  )
  target_link_libraries(core PUBLIC Hidapi::Hidapi)
  target_compile_definitions(core PRIVATE -DHAVE_HIDAPI=1)
endif()

if(UNIX AND NOT EMSCRIPTEN)
  target_sources(core PRIVATE
    MemoryWatcher.cpp
    MemoryWatcher.h
  )
endif()

if(TARGET cpp-ipc::ipc)
  target_sources(core PRIVATE HW/EXI/BBA/IPC.cpp)
  target_link_libraries(core PRIVATE cpp-ipc::ipc)
endif()

if(MSVC)
  # Add precompiled header
  target_link_libraries(core PRIVATE use_pch)
endif()

if(USE_RETRO_ACHIEVEMENTS)
  target_link_libraries(core PUBLIC rcheevos)
  target_compile_definitions(core PUBLIC -DUSE_RETRO_ACHIEVEMENTS)
  target_compile_definitions(core PUBLIC -DRC_CLIENT_SUPPORTS_HASH)
  if(RC_CLIENT_SUPPORTS_RAINTEGRATION)
    target_compile_definitions(core PUBLIC -DRC_CLIENT_SUPPORTS_RAINTEGRATION)
  endif()
endif()

if(EMSCRIPTEN AND DOLPHIN_WASM_CORE_SOURCE)
  add_executable(dolphin_web_core ${DOLPHIN_WASM_CORE_SOURCE})
  target_link_libraries(dolphin_web_core PRIVATE core)

  # Day-23 (wasm-dolphin): link the Naga SPIR-V→WGSL transpiler
  # staticlib (Rust, built for wasm32-unknown-emscripten — see
  # tools/naga-spirv-wgsl). This is the back half of the WebGPU
  # hardware renderer's shader pipeline: Dolphin GLSL → glslang →
  # SPIR-V (in C++) → naga_spirv_to_wgsl (this lib) → WGSL →
  # wgpuDeviceCreateShaderModule. Linked here as a full-archive blob
  # so the `naga_spirv_to_wgsl` / `naga_free_wgsl` C symbols survive
  # to WebGPUShaderTranslator.cpp.
  if(NOT DOLPHIN_WASM_NAGA_WGSL_LIB OR NOT EXISTS "${DOLPHIN_WASM_NAGA_WGSL_LIB}")
    message(FATAL_ERROR
      "DOLPHIN_WASM_NAGA_WGSL_LIB must name the pinned Naga static library. "
      "Run the wasm-dolphin configure script; it builds the crate with --locked first.")
  endif()
  target_link_libraries(dolphin_web_core PRIVATE "${DOLPHIN_WASM_NAGA_WGSL_LIB}")

  if(NOT DOLPHIN_WASM_JIT_CACHE_PRE_JS OR NOT EXISTS "${DOLPHIN_WASM_JIT_CACHE_PRE_JS}")
    message(FATAL_ERROR "DOLPHIN_WASM_JIT_CACHE_PRE_JS must name the tracked pre-js file")
  endif()

  if(NOT DOLPHIN_WASM_MEMORY_PAGES MATCHES "^[0-9]+$")
    message(FATAL_ERROR "DOLPHIN_WASM_MEMORY_PAGES must be a positive integer")
  endif()
  math(EXPR DOLPHIN_WASM_INITIAL_MEMORY_BYTES "${DOLPHIN_WASM_MEMORY_PAGES} * 65536")
  target_compile_definitions(core PRIVATE DOLPHIN_WASM_MEMORY_PAGES=${DOLPHIN_WASM_MEMORY_PAGES})
  target_compile_definitions(dolphin_web_core PRIVATE DOLPHIN_WASM_MEMORY_PAGES=${DOLPHIN_WASM_MEMORY_PAGES})

  # Day-14 (wasm-dolphin): enable the WebGPU scaffold backend on the
  # wasm target. HAS_WEBGPU gates both the include of WebGPU/VideoBackend.h
  # and the registry push_back in VideoBackendBase.cpp. Day-15+ will
  # also add `-sUSE_WEBGPU=1` (or the emdawnwebgpu port) when the
  # scaffold actually calls webgpu.h functions.
  target_compile_definitions(core PUBLIC HAS_WEBGPU)

  if(DOLPHIN_WASM_OUTPUT_DIR)
    set_target_properties(dolphin_web_core PROPERTIES
      RUNTIME_OUTPUT_DIRECTORY "${DOLPHIN_WASM_OUTPUT_DIR}"
      OUTPUT_NAME "dolphin-core-upstream"
    )
  endif()

  target_link_options(dolphin_web_core PRIVATE
    "-sWASM=1"
    "-sMODULARIZE=1"
    "-sEXPORT_NAME=createDolphinCore"
    "-sEXPORT_ES6=1"
    "-sENVIRONMENT=web,worker,node"
    # OGL+JIT-off interpreter mode OOMs at 1 GiB around the title transition,
    # but Firefox imposes a stricter per-worker memory cap that flat-out
    # refuses a 2 GiB allocation. 1.5 GiB sits between the two ceilings and
    # works in both browsers. (Memory-growth + pthread was tried and
    # produced a slow non-wasm warning plus broke ROM mount.)
    "-sALLOW_MEMORY_GROWTH=0"
    "-sINITIAL_MEMORY=${DOLPHIN_WASM_INITIAL_MEMORY_BYTES}"
    "-sFILESYSTEM=1"
    "-lworkerfs.js"
    "-lnodefs.js"
    "-sMIN_WEBGL_VERSION=2"
    "-sMAX_WEBGL_VERSION=2"
    "-sFULL_ES3=1"
    "-sGL_ENABLE_GET_PROC_ADDRESS=1"
    "-sOFFSCREENCANVAS_SUPPORT=1"
    "-sOFFSCREEN_FRAMEBUFFER=1"
    # Day-15 (wasm-dolphin): enable the Emscripten WebGPU C bindings
    # (webgpu/webgpu.h). Linked alongside WebGL2; the WebGPU backend
    # (#ifdef HAS_WEBGPU) uses these; OGL/Software paths still use
    # WebGL2 unchanged. The older `-sUSE_WEBGPU=1` flag was removed
    # from emsdk in favour of the `emdawnwebgpu` port, which implements
    # a newer (and incompatible) webgpu.h spec. We use the port form
    # because `-sUSE_WEBGPU=1` errors at link time on current emsdk.
    "--use-port=emdawnwebgpu"
    "-sALLOW_TABLE_GROWTH=1"
    "-msimd128"
    "-flto"
    "-pthread"
    "-sUSE_PTHREADS=1"
    "-sASSERTIONS=0"
    "-sSTACK_OVERFLOW_CHECK=0"
    "-sSTACK_SIZE=5242880"
    "-sDEFAULT_PTHREAD_STACK_SIZE=5242880"
    "-sPTHREAD_POOL_SIZE=16"
    "-sEXPORTED_FUNCTIONS=['_CoreInit','_SetVideoBackend','_SetCpuThread','_SetCpuCore','_SetCpuOverclock','_SetEmulationSpeed','_SetPresentationScale','_SetFastSoftwareRaster','_SetSoftwareTevHotCaseMode','_SetPpcWasmJitEnabled','_SetPpcProfileEnabled','_SetCachedInterpreterDisableMask','_GetCachedInterpreterDisableMask','_SetRendererFeatureMask','_GetRendererFeatureMask','_GetFrameRingEntryPtr','_GetFrameRingCapacity','_GetFrameRingEntrySize','_GetFrameRingHead','_GetPpcProfileStats','_BootDisc','_StopCore','_SetCorePaused','_ResetCore','_SaveCoreState','_LoadCoreState','_LoadStateFile','_SaveStateFile','_PumpHostJobs','_GetCoreState','_GetCoreStateName','_GetCoreStatus','_GetCoreTitle','_GetCoreTicksLow','_GetCoreTicksHigh','_GetCoreTicksPerSecond','_GetPPCPC','_GetLastLoadedCoreTicksLow','_GetLastLoadedCoreTicksHigh','_GetLastLoadedPPCPC','_GetLastLoadedCheckpointGeneration','_GetCPUCoreName','_AudioSampleRate','_AudioChannels','_AudioBufferFrames','_AudioBuffer','_MixAudio','_SetAudioMuted','_GetAudioStats','_GetPpcWasmBlockCompileCount','_GetPpcWasmBlockRunCount','_GetPpcWasmHelperStats','_SetWebGpuStateCacheEnabled','_SetWebGpuUboCacheEnabled','_SetWebGpuUboPackEnabled','_SetWebGpuGeometryPackEnabled','_SetWebGpuGeometryRangeEnabled','_SetWebGpuUploadArenaMiB','_SetWebGpuOwnershipTraceEnabled','_AcknowledgeWebGpuOwnershipTraceCapture','_GetWebGpuOwnershipTracePtr','_GetWebGpuOwnershipTraceCapacity','_SetWebGpuProducerProfileEnabled','_SetWebGpuDrawProfileEnabled','_SetWgpuDeepDiagnosticsEnabled','_SetWgpuIdleFifoTailElisionEnabled','_RunWebGpuDenseUboPacketSmoke','_RunWebGpuDenseUboRollbackSmoke','_GetWebGpuDenseUboSmokeError','_GetWebGpuStateCacheStats','_DolphinWeb_RecordModuleUs','_DolphinWeb_RecordInstanceUs','_DolphinWeb_RecordCacheHit','_DolphinWeb_RecordCacheMiss','_TestPpcWasmDirectCandidate','_TestDcbxLoopPattern','_TestPpcWasmDirectCandidateCompiles','_RunPpcWasmMultipleWordMemorySmoke','_RunPpcWasmSinglePrecisionArithmeticSmoke','_RunPpcWasmDoublePrecisionArithmeticSmoke','_RunPpcWasmPairedQuantizedMemorySmoke','_RunPpcWasmFloatCompareSmoke','_GetVideoStats','_RunWasmJitSmoke','_RunPpcWasmAddiSmoke','_RunPpcWasmStateAddiSmoke','_RunPpcWasmDolphinStateAddiSmoke','_RunPpcWasmIntegerBlockSmoke','_MountDisc','_Reset','_SetInputMask','_SetInputState','_RunFrame','_FrameWidth','_FrameHeight','_FrameBuffer','_SaveState','_LoadState','_GetFrame','_GetFrameSignalPtr','_GetGameId','_GetGameTitle','_GetMakerId','_GetPlatform','_GetRegion','_GetDiscNumber','_GetApploaderDate','_GetApploaderSize','_GetBootDolOffset','_GetBootDolSize','_GetFstOffset','_GetFstSize','_GetRawSize','_GetDataSize','_GetRootEntryCount','_GetRootEntryName','_GetRootEntryPath','_GetRootEntryIsDirectory','_GetRootEntryOffset','_GetRootEntrySize','_ReadDisc','_ReadDiscFile','_malloc','_free']"
    # WORKERFS and NODEFS are named here so they survive dead-code
    # elimination. -lworkerfs.js / -lnodefs.js above only make the JS
    # libraries available to the link; current Emscripten still drops a JS
    # library whose symbols nothing references, and nothing in this build
    # references either filesystem from C++ -- the discio worker mounts
    # WORKERFS from JS at runtime. Dropping it produces a core that boots and
    # runs frames but throws "Upstream Dolphin bundle was not built with
    # WORKERFS" in upstream-discio-worker.js before load completes, so no disc
    # ever mounts. MEMFS survives only because it is the default.
    "-sEXPORTED_RUNTIME_METHODS=['FS','ccall','cwrap','UTF8ToString','HEAPU8','PThread','WORKERFS','NODEFS']"
    # Wii NAND seed data. Core::InitializeWiiFileSystemContents() copies
    # Data/Sys/Wii into every fresh NAND because some games -- Mario Kart Wii
    # is the one called out in that function -- assume the WiiConnect24 files
    # the System Menu would normally have created are already present, and
    # fail with "Could not write to/read from Wii system memory" when they are
    # not. The copy reads File::GetSysDirectory(), which this build fixes at
    # /dolphin-sys (see Source/Core/Common/FileUtil.cpp). Embedding is ~183KB.
    "SHELL:--embed-file ${CMAKE_SOURCE_DIR}/Data/Sys/Wii@/dolphin-sys/Wii"
    # Day-7 persistent JIT cache: this pre-js installs a pthread-side
    # message receiver for "dolphin-jit-cache" payloads. Each pthread
    # stashes the cache map (Map<hashHex, WebAssembly.Module>) on its
    # local Module object so the EM_JS compile body can hit it. See
    # patches/dolphin-wasm/SESSION-2026-05-12-DAY-7-NOTES.md.
    "--pre-js"
    "${DOLPHIN_WASM_JIT_CACHE_PRE_JS}"
  )
endif()
