CMake: Windows Qt build support

This commit is contained in:
TellowKrinkle 2022-08-22 06:08:28 -05:00 committed by tellowkrinkle
parent 8975f2d92c
commit 4e4ffa6526
2 changed files with 95 additions and 57 deletions

View File

@ -92,22 +92,16 @@ if(TARGET SDL2::SDL2 OR TARGET SDL2::SDL2-static)
endif()
if(WIN32)
# Resources
target_sources(PCSX2 PRIVATE
PCSX2.rc
GS/GS.rc
PAD/Windows/PAD.rc
SPU2/Windows/SPU2.rc
USB/usb-pad/dx/versionproxy.rc
USB/usb-pad/raw/raw-config.rc
windows/wxResources.rc
windows/PCSX2.manifest
)
if(PCSX2_CORE)
set(MIN_WIN32 0x0A00)
else()
set(MIN_WIN32 0x0603)
endif()
target_compile_definitions(PCSX2_FLAGS INTERFACE
_M_SSE=0x401 # TODO: Multiple ISA
DIRECTINPUT_VERSION=0x0800
WINVER=0x0603
_WIN32_WINNT=0x0603
WINVER=${MIN_WIN32}
_WIN32_WINNT=${MIN_WIN32}
WIN32_LEAN_AND_MEAN
LZMA_API_STATIC
WIL_SUPPRESS_EXCEPTIONS
@ -115,7 +109,6 @@ if(WIN32)
target_include_directories(PCSX2_FLAGS INTERFACE
../3rdparty # GL headers
)
set_target_properties(PCSX2 PROPERTIES WIN32_EXECUTABLE TRUE)
endif(WIN32)
# Main pcsx2 source
@ -808,15 +801,6 @@ set(pcsx2GSMetalShaders
GS/Renderers/Metal/fxaa.metal
)
if(NOT PCSX2_CORE)
list(APPEND pcsx2GSSources
GS/Window/GSwxDialog.cpp
)
list(APPEND pcsx2GSHeaders
GS/Window/GSwxDialog.h
)
endif()
if(PCSX2_CORE)
list(APPEND pcsx2SPU2Headers
SPU2/Host/Config.cpp
@ -833,22 +817,50 @@ if(PCSX2_CORE)
SPU2/WavFile.cpp
)
endif()
elseif(WIN32)
list(APPEND pcsx2SPU2Sources
SPU2/Windows/CfgHelpers.cpp
SPU2/Windows/Config.cpp
SPU2/Windows/ConfigDebug.cpp
SPU2/Windows/ConfigSoundTouch.cpp
SPU2/Windows/dsp.cpp
SPU2/Windows/RealtimeDebugger.cpp
SPU2/Windows/SndOut_XAudio2.cpp
SPU2/Windows/UIHelpers.cpp
else()
list(APPEND pcsx2GSSources
GS/Window/GSwxDialog.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Windows/Dialogs.h
SPU2/Windows/dsp.h
SPU2/Windows/resource.h
SPU2/Windows/WinConfig.h
list(APPEND pcsx2GSHeaders
GS/Window/GSwxDialog.h
)
if(WIN32)
list(APPEND pcsx2SPU2Sources
SPU2/Windows/CfgHelpers.cpp
SPU2/Windows/Config.cpp
SPU2/Windows/ConfigDebug.cpp
SPU2/Windows/ConfigSoundTouch.cpp
SPU2/Windows/dsp.cpp
SPU2/Windows/RealtimeDebugger.cpp
SPU2/Windows/UIHelpers.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Windows/Dialogs.h
SPU2/Windows/dsp.h
SPU2/Windows/resource.h
SPU2/Windows/WinConfig.h
)
else()
list(APPEND pcsx2SPU2Sources
SPU2/Linux/CfgHelpers.cpp
SPU2/Linux/Config.cpp
SPU2/Linux/ConfigDebug.cpp
SPU2/Linux/ConfigSoundTouch.cpp
SPU2/Linux/Dialogs.cpp
SPU2/WavFile.cpp
SPU2/wx/wxConfig.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Linux/Config.h
SPU2/Linux/Dialogs.h
SPU2/wx/wxConfig.h
)
endif()
endif()
if(WIN32)
list(APPEND pcsx2SPU2Sources
SPU2/Windows/SndOut_XAudio2.cpp
)
list(APPEND pcsx2DEV9Sources
@ -911,21 +923,6 @@ elseif(WIN32)
GS/Renderers/DX12/GSTexture12.h
)
else()
list(APPEND pcsx2SPU2Sources
SPU2/Linux/CfgHelpers.cpp
SPU2/Linux/Config.cpp
SPU2/Linux/ConfigDebug.cpp
SPU2/Linux/ConfigSoundTouch.cpp
SPU2/Linux/Dialogs.cpp
SPU2/WavFile.cpp
SPU2/wx/wxConfig.cpp
)
list(APPEND pcsx2SPU2Headers
SPU2/Linux/Config.h
SPU2/Linux/Dialogs.h
SPU2/wx/wxConfig.h
)
list(APPEND pcsx2USBSources
USB/icon_buzz_24.cpp
USB/linux/config-gtk.cpp
@ -1117,6 +1114,16 @@ if(PCSX2_CORE)
discord-rpc
)
endif()
if(WIN32)
list(APPEND pcsx2FrontendSources
Frontend/DInputSource.cpp
Frontend/XInputSource.cpp
)
list(APPEND pcsx2FrontendHeaders
Frontend/DInputSource.h
Frontend/XInputSource.h
)
endif()
endif()
# gui sources
@ -1437,10 +1444,15 @@ set(pcsx2WindowsSources
CDVD/Windows/IOCtlSrc.cpp
windows/FlatFileReaderWindows.cpp
windows/Optimus.cpp
windows/WinConsolePipe.cpp
windows/WinKeyCodes.cpp
windows/WinPowerProfile.cpp
)
if(NOT PCSX2_CORE)
list(APPEND pcsx2WindowsSources
windows/WinConsolePipe.cpp
windows/WinKeyCodes.cpp
windows/WinPowerProfile.cpp
)
endif()
# Windows headers
set(pcsx2WindowsHeaders
@ -1829,6 +1841,24 @@ function(setup_main_executable target)
get_property(PCSX2_SOURCE_DIR GLOBAL PROPERTY PCSX2_SOURCE_DIR)
get_property(PCSX2_METAL_SHADERS GLOBAL PROPERTY PCSX2_METAL_SHADERS)
if(WIN32)
if(NOT PCSX2_CORE)
target_sources(${target} PRIVATE
${PCSX2_SOURCE_DIR}/GS/GS.rc
${PCSX2_SOURCE_DIR}/PAD/Windows/PAD.rc
${PCSX2_SOURCE_DIR}/SPU2/Windows/SPU2.rc
${PCSX2_SOURCE_DIR}/USB/usb-pad/dx/versionproxy.rc
${PCSX2_SOURCE_DIR}/USB/usb-pad/raw/raw-config.rc
)
endif()
target_sources(${target} PRIVATE
${PCSX2_SOURCE_DIR}/PCSX2.rc
${PCSX2_SOURCE_DIR}/windows/wxResources.rc
${PCSX2_SOURCE_DIR}/windows/PCSX2.manifest
)
set_target_properties(${target} PROPERTIES WIN32_EXECUTABLE TRUE)
endif()
if(APPLE)
if(CMAKE_GENERATOR MATCHES "Xcode")
# If we're generating an xcode project, you can just add the shaders to the main pcsx2 target and xcode will deal with them properly

View File

@ -1,15 +1,23 @@
add_executable(updater
SZErrors.h
Updater.cpp
Updater.h
UpdaterExtractor.h
)
target_link_libraries(updater PRIVATE common fmt::fmt)
target_include_directories(updater PRIVATE .)
if(WIN32)
target_link_libraries(updater PRIVATE
LZMA::LZMA
Comctl32.lib
)
target_sources(updater PRIVATE
Win32Update.cpp
Windows/WindowsUpdater.cpp
Windows/resource.h
Windows/updater.rc
Windows/updater.manifest
)
set_target_properties(updater PROPERTIES WIN32_EXECUTABLE TRUE)
endif()