From 60d249a9090b4942c371c9c1557684f21b096336 Mon Sep 17 00:00:00 2001 From: sorgts Date: Wed, 12 Aug 2020 20:15:32 +0200 Subject: [PATCH 1/4] Fix Windows/CMake build with Visual Studio --- CMakeLists.txt | 25 +++++++++++++++---------- Windows/InputDevice.cpp | 1 + Windows/WASAPIStream.cpp | 1 + 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0137d06d5a..76e754e72d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -915,6 +915,7 @@ if(WIN32) set(THIN3D_PLATFORMS ${THIN3D_PLATFORMS} ext/native/thin3d/thin3d_d3d9.cpp ext/native/thin3d/thin3d_d3d11.cpp + ext/native/thin3d/d3d9_d3dcompiler_loader.cpp ext/native/thin3d/d3dx9_loader.cpp ext/native/thin3d/d3dx9_loader.h ext/native/thin3d/d3d11_loader.cpp @@ -1848,8 +1849,6 @@ if(USE_MINIUPNPC) if (NOT WIN32) add_definitions (-DMINIUPNPC_SET_SOCKET_TIMEOUT) add_definitions (-D_BSD_SOURCE -D_DEFAULT_SOURCE -D_POSIX_C_SOURCE=200112L) - else() - add_definitions (-D_WIN32_WINNT=0x0501) # XP or higher for getnameinfo and friends endif() if (MACOSX) add_definitions (-D_DARWIN_C_SOURCE) @@ -1897,25 +1896,31 @@ if(USE_MINIUPNPC) # find_library (RESOLV_LIBRARY NAMES resolv) # set (LDLIBS ${SOCKET_LIBRARY} ${NSL_LIBRARY} ${RESOLV_LIBRARY} ${LDLIBS}) endif() - if (MSVC) - # Suppress noise warnings - target_compile_definitions(miniupnpc _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS) - endif() if (UPNPC_BUILD_STATIC) add_library(miniupnpc STATIC ${MINIUPNPC_SOURCES}) target_link_libraries(${CoreLibName} miniupnpc ${LDLIBS}) set(UPNPC_LIBRARY miniupnpc) + if (MSVC) + # Suppress noise warnings + target_compile_definitions(miniupnpc PRIVATE _CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS) + endif() endif() endif() setup_target_project(${CoreLibName} Core) -# Generate git-version.cpp at build time. -add_custom_target(GitVersion ALL - DEPENDS something_that_never_exists) +# Generate git-version at build time. +add_custom_target(GitVersion DEPENDS something_that_never_exists) + +set(WIN_VERSION_CMD "") +if (WIN32) + set(WIN_VERSION_CMD COMMAND ${CMAKE_SOURCE_DIR}/Windows/git-version-gen.cmd PPSSPPWindows) +endif() + add_custom_command(OUTPUT something_that_never_exists COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} - -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake) + -P ${CMAKE_CURRENT_SOURCE_DIR}/git-version.cmake + ${WIN_VERSION_CMD}) set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/git-version.cpp PROPERTIES GENERATED TRUE diff --git a/Windows/InputDevice.cpp b/Windows/InputDevice.cpp index 3c59c8323e..d800c87713 100644 --- a/Windows/InputDevice.cpp +++ b/Windows/InputDevice.cpp @@ -15,6 +15,7 @@ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. +#include "stdafx.h" #include #include diff --git a/Windows/WASAPIStream.cpp b/Windows/WASAPIStream.cpp index d399781c46..9662bf2891 100644 --- a/Windows/WASAPIStream.cpp +++ b/Windows/WASAPIStream.cpp @@ -1,3 +1,4 @@ +#include "stdafx.h" #include "WindowsAudio.h" #include "WASAPIStream.h" #include "Common/Log.h" From 0ae12da3a7c58de41324ad19532e3bc3217d0c85 Mon Sep 17 00:00:00 2001 From: sorgts Date: Thu, 13 Aug 2020 16:48:19 +0200 Subject: [PATCH 2/4] Fix SSE detection with clang-cl clang-cl advertises its SSE support through the macros and expects the program to adhere to them, so check if any macro definition is available before falling back to the latest level as a default --- Common/Common.h | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Common/Common.h b/Common/Common.h index 9fffa42922..9894771c53 100644 --- a/Common/Common.h +++ b/Common/Common.h @@ -70,18 +70,16 @@ #define __forceinline inline __attribute__((always_inline)) #endif -#if !defined(__GNUC__) && (defined(_M_X64) || defined(_M_IX86)) +#if defined __SSE4_2__ +# define _M_SSE 0x402 +#elif defined __SSE4_1__ +# define _M_SSE 0x401 +#elif defined __SSSE3__ +# define _M_SSE 0x301 +#elif defined __SSE3__ +# define _M_SSE 0x300 +#elif defined __SSE2__ +# define _M_SSE 0x200 +#elif !defined(__GNUC__) && (defined(_M_X64) || defined(_M_IX86)) # define _M_SSE 0x402 -#else -# if defined __SSE4_2__ -# define _M_SSE 0x402 -# elif defined __SSE4_1__ -# define _M_SSE 0x401 -# elif defined __SSSE3__ -# define _M_SSE 0x301 -# elif defined __SSE3__ -# define _M_SSE 0x300 -# elif defined __SSE2__ -# define _M_SSE 0x200 -# endif #endif From a8a1c67df0451a7cc8ec98610e3ea30abd1eb23f Mon Sep 17 00:00:00 2001 From: sorgts Date: Thu, 13 Aug 2020 16:48:48 +0200 Subject: [PATCH 3/4] Fix build with clang-cl --- CMakeLists.txt | 4 +++- Core/HLE/sceKernel.h | 2 +- Core/HLE/sceKernelModule.cpp | 2 +- Windows/InputDevice.cpp | 2 +- Windows/aboutbox.rc | Bin 2418 -> 1179 bytes Windows/version.rc | Bin 2486 -> 1214 bytes 6 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76e754e72d..6e51ca995e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -311,7 +311,9 @@ if(NOT MSVC) else() # Disable warnings about MS-specific _s variants of libc functions add_definitions(-D_CRT_SECURE_NO_WARNINGS) - add_definitions(-MP) + if (NOT CLANG) + add_compile_options(-MP) + endif() set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -D_NDEBUG") endif() diff --git a/Core/HLE/sceKernel.h b/Core/HLE/sceKernel.h index 9e2a8ff3ac..c9d4e20d4c 100644 --- a/Core/HLE/sceKernel.h +++ b/Core/HLE/sceKernel.h @@ -25,7 +25,7 @@ class PointerWrap; -enum { +enum : u32 { SCE_KERNEL_ERROR_OK = 0, SCE_KERNEL_ERROR_ALREADY = 0x80000020, SCE_KERNEL_ERROR_BUSY = 0x80000021, diff --git a/Core/HLE/sceKernelModule.cpp b/Core/HLE/sceKernelModule.cpp index c049729246..3d096e8a43 100644 --- a/Core/HLE/sceKernelModule.cpp +++ b/Core/HLE/sceKernelModule.cpp @@ -72,7 +72,7 @@ enum { PSP_THREAD_ATTR_USER = 0x80000000, }; -enum { +enum : u32 { // Function exports. NID_MODULE_START = 0xD632ACDB, NID_MODULE_STOP = 0xCEE8593C, diff --git a/Windows/InputDevice.cpp b/Windows/InputDevice.cpp index d800c87713..70d4a6ff48 100644 --- a/Windows/InputDevice.cpp +++ b/Windows/InputDevice.cpp @@ -27,7 +27,7 @@ static std::atomic_flag threadRunningFlag; static std::thread inputThread; -static std::atomic_bool focused = true; +static std::atomic_bool focused = ATOMIC_VAR_INIT(true); inline static void ExecuteInputPoll() { if (host && (focused.load(std::memory_order_relaxed) || !g_Config.bGamepadOnlyFocused)) { diff --git a/Windows/aboutbox.rc b/Windows/aboutbox.rc index 1e669a134b7b8236aa39c98cced9566a0eafad2e..43e3b7200515c8b1dc71e5bd7e9879a29d2fd615 100644 GIT binary patch literal 1179 zcmaJ=-A#EZF(B$wS>J2zgXU?H*?Pg%)kItu9xg-5uet29ZMY5({ortxIfbzRZbG)S{JS@Z?H zq4Q|5w5>mHonWn++Oe&j%$R^Pr$9F-C4{nYcD_1y-(B09MCb9swg3Ra=qz2*Pm^Vq zB?|y>k_(5#VRAwI(U5o}mmImo8}-fcbl3BI#bLZkQ%cj6#Nl*BvmlG7#B<3h@jc?Z zJ!+Ok*V!`$!092K%yji7x}Fj!;xW^#-A*25rt%a)viHe!K7?E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q&fh+~aLdc&y-hFdstyYX^=$Juc+*(bv1C;^WiRn~MeI VO+od6ko}O1y3ijGav|Gl{{cp3NAv&y literal 2486 zcmcJR+iu!G5Qe|&N_~eFy=kT5KozCRB?ptD5YqZslckuyG zMU{$+#on3!pZ#|Z{{8DMZ@A(LMW06&L?~t~SmLA1vroW;HB)@1@-{#*pihG$Wp4P0 z;#vGBJRbZ4)@)Hk?AWkjO~}?@Jg`SGXTcT+MN=$e{)O-@+2t5DMnoj5L&!u}HG<|W z3QMdRTxVa3!izRN|TV>{1XI7B(b zW5f`b9v)3Pv>DN)O@j_9w`1Sy^C=oMY2oH<6kWP_c(RW8CSJ!JH9FjLPsN~h>CvIi zfExW*!n6@KXi?z~Pxw5(qA2k~na{L@U+XuMyPu&LQOBjqfVjcuZIpYL>W&A!D-_B{qv&sbG)xs$ty`IP*swCGS1MGAOq2_=)} zG)zS{37D}qITL%SGib?f8nwhVC2nPXpp-*Od``t@ckMc)LW_ZDP@u+|6)UNrEfEFj z3WZDt>U`9>sPI{_V<~l}`$Aj=7CFD3V%jh!U{9N|uv)$^5`k9k2}O@RQ|A06WO@;c z)x3^R#6%D`Y)#j&Z0Y*CuFi%Hdr@u9Bin;w$2*Gm)cAnn6D3OAP?UdVZc%1ZywzTG1H&@S6ez?F3FTE>i??(mp1iG xmpy)y?Yl#{S*zy1blhyk#d#JGnQj+ Date: Sat, 15 Aug 2020 21:36:42 +0200 Subject: [PATCH 4/4] Update .editorconfig to match the encoding of the resource files. --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 965fbcf1ee..332927531a 100644 --- a/.editorconfig +++ b/.editorconfig @@ -27,7 +27,7 @@ charset = utf-8-bom charset = utf-8-bom [Windows/{aboutbox.rc,version.rc}] -charset = utf-16le +charset = utf-8 [libretro/**.{cpp,h}] indent_style = space