Qt: Enable SDL2 input source for Qt

This commit is contained in:
Connor McLaughlin 2022-02-01 00:12:26 +10:00 committed by refractionpcsx2
parent aeb9403b67
commit 5c33e9666a
4 changed files with 42 additions and 33 deletions

View File

@ -56,6 +56,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ryml", "3rdparty\rapidyaml\
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "glslang", "3rdparty\glslang\glslang.vcxproj", "{EF6834A9-11F3-4331-BC34-21B325ABB180}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SDL", "3rdparty\sdl2\SDL.vcxproj", "{812B4434-FD6B-4CB2-8865-5FD8EB34B046}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug AVX2|x64 = Debug AVX2|x64
@ -342,6 +344,18 @@ Global
{EF6834A9-11F3-4331-BC34-21B325ABB180}.Release AVX2|x64.Build.0 = Release|x64
{EF6834A9-11F3-4331-BC34-21B325ABB180}.Release|x64.ActiveCfg = Release|x64
{EF6834A9-11F3-4331-BC34-21B325ABB180}.Release|x64.Build.0 = Release|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug AVX2|x64.ActiveCfg = Debug|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug AVX2|x64.Build.0 = Debug|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug|x64.ActiveCfg = Debug|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Debug|x64.Build.0 = Debug|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel AVX2|x64.ActiveCfg = Devel|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel AVX2|x64.Build.0 = Devel|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel|x64.ActiveCfg = Devel|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Devel|x64.Build.0 = Devel|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release AVX2|x64.ActiveCfg = Release|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release AVX2|x64.Build.0 = Release|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release|x64.ActiveCfg = Release|x64
{812B4434-FD6B-4CB2-8865-5FD8EB34B046}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -367,6 +381,7 @@ Global
{BF74C473-DC04-44B3-92E8-4145F4E77342} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
{DE9653B6-17DD-356A-9EE0-28A731772587} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
{EF6834A9-11F3-4331-BC34-21B325ABB180} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
{812B4434-FD6B-4CB2-8865-5FD8EB34B046} = {78EBE642-7A4D-4EA7-86BE-5639C6646C38}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {0BC474EA-3628-45D3-9DBC-E22D0B7E0F77}

View File

@ -144,7 +144,9 @@ else()
check_lib(SOUNDTOUCH SoundTouch SoundTouch.h PATH_SUFFIXES soundtouch)
check_lib(SAMPLERATE samplerate samplerate.h)
check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2)
if(NOT QT_BUILD)
check_lib(SDL2 SDL2 SDL.h PATH_SUFFIXES SDL2)
endif()
if(UNIX AND NOT APPLE)
find_package(X11 REQUIRED)
@ -233,7 +235,16 @@ if(NOT USE_SYSTEM_YAML)
endif()
if(QT_BUILD)
find_package(Qt6 COMPONENTS Core Gui Widgets Network LinguistTools REQUIRED)
# Default to bundled Qt6 for Windows.
if(WIN32 AND NOT DEFINED Qt6_DIR)
set(Qt6_DIR ${CMAKE_SOURCE_DIR}/3rdparty/qt/6.2.2/msvc2019_64/lib/cmake/Qt6)
endif()
# Find the Qt components that we need.
find_package(Qt6 COMPONENTS CoreTools Core GuiTools Gui WidgetsTools Widgets Network LinguistTools REQUIRED)
# We use the bundled (latest) SDL version for Qt.
add_subdirectory(3rdparty/sdl2 EXCLUDE_FROM_ALL)
endif()
add_subdirectory(3rdparty/libchdr/libchdr EXCLUDE_FROM_ALL)

View File

@ -68,9 +68,14 @@ if(XDG_STD)
target_compile_definitions(PCSX2_FLAGS INTERFACE XDG_STD)
endif()
if(TARGET PkgConfig::SDL2)
if(TARGET PkgConfig::SDL2 OR QT_BUILD)
target_compile_definitions(PCSX2_FLAGS INTERFACE SDL_BUILD)
target_link_libraries(PCSX2_FLAGS INTERFACE PkgConfig::SDL2)
if (QT_BUILD)
# Use our in-tree SDL build.
target_link_libraries(PCSX2_FLAGS INTERFACE SDL2::SDL2-static)
else()
target_link_libraries(PCSX2_FLAGS INTERFACE PkgConfig::SDL2)
endif()
if(PCSX2_CORE)
target_sources(PCSX2 PRIVATE
Frontend/SDLInputSource.cpp

View File

@ -45,13 +45,14 @@
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\cubeb\cubeb\include;$(SolutionDir)3rdparty\cubeb\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\imgui\imgui;$(SolutionDir)3rdparty\imgui\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\simpleini\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(SolutionDir)3rdparty\sdl2\include;$(SolutionDir)3rdparty\sdl2\SDL\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<ExceptionHandling>Async</ExceptionHandling>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>PrecompiledHeader.h</PrecompiledHeaderFile>
<ForcedIncludeFiles>PrecompiledHeader.h;%(ForcedIncludeFiles)</ForcedIncludeFiles>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<AdditionalOptions>/Zc:externConstexpr %(AdditionalOptions)</AdditionalOptions>
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;LZMA_API_STATIC;BUILD_DX=1;ENABLE_VULKAN;SPU2X_CUBEB;PCSX2_CORE;DISABLE_RECORDING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32_LEAN_AND_MEAN;LZMA_API_STATIC;BUILD_DX=1;ENABLE_VULKAN;SPU2X_CUBEB;SDL_BUILD;PCSX2_CORE;DISABLE_RECORDING;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(Debug))">PCSX2_DEBUG;PCSX2_DEVBUILD;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(Devel))">PCSX2_DEVEL;PCSX2_DEVBUILD;NDEBUG;_SECURE_SCL_=1;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="$(Configuration.Contains(Release))">NDEBUG;_SECURE_SCL_=0;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@ -180,20 +181,7 @@
<ClCompile Include="Frontend\InputSource.cpp" />
<ClCompile Include="Frontend\LayeredSettingsInterface.cpp" />
<ClCompile Include="Frontend\OpenGLHostDisplay.cpp" />
<ClCompile Include="Frontend\SDLInputSource.cpp">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug AVX2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel AVX2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release AVX2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug AVX2|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel AVX2|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release AVX2|x64'">true</ExcludedFromBuild>
</ClCompile>
<ClCompile Include="Frontend\SDLInputSource.cpp" />
<ClCompile Include="Frontend\VulkanHostDisplay.cpp" />
<ClCompile Include="Frontend\XInputSource.cpp" />
<ClCompile Include="GameDatabase.cpp" />
@ -493,20 +481,7 @@
<ClInclude Include="Frontend\InputSource.h" />
<ClInclude Include="Frontend\LayeredSettingsInterface.h" />
<ClInclude Include="Frontend\OpenGLHostDisplay.h" />
<ClInclude Include="Frontend\SDLInputSource.h">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug AVX2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel AVX2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release AVX2|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug AVX2|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel AVX2|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Devel|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release AVX2|x64'">true</ExcludedFromBuild>
</ClInclude>
<ClInclude Include="Frontend\SDLInputSource.h" />
<ClInclude Include="Frontend\VulkanHostDisplay.h" />
<ClInclude Include="Frontend\XInputSource.h" />
<ClInclude Include="GameDatabase.h" />
@ -788,6 +763,9 @@
<ProjectReference Include="$(SolutionDir)3rdparty\imgui\imgui.vcxproj">
<Project>{88fb34ec-845e-4f21-a552-f1573b9ed167}</Project>
</ProjectReference>
<ProjectReference Include="..\3rdparty\sdl2\SDL.vcxproj">
<Project>{812b4434-fd6b-4cb2-8865-5fd8eb34b046}</Project>
</ProjectReference>
<ProjectReference Include="..\common\common.vcxproj">
<Project>{4639972e-424e-4e13-8b07-ca403c481346}</Project>
</ProjectReference>