From 74cbb46cd89718cf0d5f04ad734a23327177a8e3 Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Tue, 10 Dec 2024 23:34:58 -0800 Subject: [PATCH] Build for a Windows 8.1 minimum (#201) --- CMakeLists.txt | 6 ++-- UVAtlas/UVAtlas_2019_Win10.vcxproj | 12 ++++---- UVAtlas/UVAtlas_2022_Win10.vcxproj | 12 ++++---- UVAtlasTool/Mesh.cpp | 42 +++++++++++----------------- UVAtlasTool/UVAtlasTool_2019.vcxproj | 12 ++++---- UVAtlasTool/UVAtlasTool_2022.vcxproj | 12 ++++---- 6 files changed, 42 insertions(+), 54 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c25683e5..95f34e6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,7 +24,7 @@ project (UVAtlas # # cmake install the individual packages and add the per-configuration variables for directxmesh_DIR and directxtex_DIR # -# Note to support Windows 7, turn off BUILD_DX12 build options for both libraries. +# Note to support Windows 8.1, turn off BUILD_DX12 build options for both libraries. option(BUILD_TOOLS "Build UVAtlasTool" OFF) # Enable the use of OpenMP @@ -327,10 +327,8 @@ endif() if(WIN32) if(WINDOWS_STORE OR (${DIRECTX_ARCH} MATCHES "^arm64") OR (DEFINED XBOX_CONSOLE_TARGET)) set(WINVER 0x0A00) - elseif(${DIRECTX_ARCH} MATCHES "^arm") - set(WINVER 0x0602) else() - set(WINVER 0x0601) + set(WINVER 0x0603) endif() foreach(t IN LISTS TOOL_EXES ITEMS ${PROJECT_NAME}) diff --git a/UVAtlas/UVAtlas_2019_Win10.vcxproj b/UVAtlas/UVAtlas_2019_Win10.vcxproj index 345e7d09..2bae8479 100644 --- a/UVAtlas/UVAtlas_2019_Win10.vcxproj +++ b/UVAtlas/UVAtlas_2019_Win10.vcxproj @@ -192,7 +192,7 @@ Use EnableAllWarnings Disabled - _WIN32_WINNT=0x0601;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -216,7 +216,7 @@ Use EnableAllWarnings Disabled - _WIN32_WINNT=0x0601;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -239,7 +239,7 @@ Use EnableAllWarnings Disabled - _WIN32_WINNT=0x0601;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -262,7 +262,7 @@ EnableAllWarnings Use MaxSpeed - _WIN32_WINNT=0x0601;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -286,7 +286,7 @@ EnableAllWarnings Use MaxSpeed - _WIN32_WINNT=0x0601;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -310,7 +310,7 @@ EnableAllWarnings Use MaxSpeed - _WIN32_WINNT=0x0601;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb diff --git a/UVAtlas/UVAtlas_2022_Win10.vcxproj b/UVAtlas/UVAtlas_2022_Win10.vcxproj index bd504f7e..38d136d4 100644 --- a/UVAtlas/UVAtlas_2022_Win10.vcxproj +++ b/UVAtlas/UVAtlas_2022_Win10.vcxproj @@ -192,7 +192,7 @@ Use EnableAllWarnings Disabled - _WIN32_WINNT=0x0601;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -216,7 +216,7 @@ Use EnableAllWarnings Disabled - _WIN32_WINNT=0x0601;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -239,7 +239,7 @@ Use EnableAllWarnings Disabled - _WIN32_WINNT=0x0601;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;_DEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -262,7 +262,7 @@ EnableAllWarnings Use MaxSpeed - _WIN32_WINNT=0x0601;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -286,7 +286,7 @@ EnableAllWarnings Use MaxSpeed - _WIN32_WINNT=0x0601;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb @@ -310,7 +310,7 @@ EnableAllWarnings Use MaxSpeed - _WIN32_WINNT=0x0601;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) + _WIN32_WINNT=0x0603;WIN32;NDEBUG;_LIB;_CRT_STDIO_ARBITRARY_WIDE_SPECIFIERS;%(PreprocessorDefinitions) Fast pch.h $(IntDir)$(TargetName).pdb diff --git a/UVAtlasTool/Mesh.cpp b/UVAtlasTool/Mesh.cpp index 38f21969..73c43ee8 100644 --- a/UVAtlasTool/Mesh.cpp +++ b/UVAtlasTool/Mesh.cpp @@ -1312,13 +1312,10 @@ HRESULT Mesh::ExportToVBO(const wchar_t* szFileName) const noexcept } // Write header and data -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - ScopedHandle hFile(safe_handle(CreateFile2(szFileName, - GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr))); -#else - ScopedHandle hFile(safe_handle(CreateFileW(szFileName, - GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr))); -#endif + ScopedHandle hFile(safe_handle(CreateFile2( + szFileName, + GENERIC_WRITE, 0, CREATE_ALWAYS, + nullptr))); if (!hFile) return HRESULT_FROM_WIN32(GetLastError()); @@ -1358,11 +1355,10 @@ HRESULT Mesh::CreateFromVBO(const wchar_t* szFileName, std::unique_ptr& re result.reset(); -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - ScopedHandle hFile(safe_handle(CreateFile2(szFileName, GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, nullptr))); -#else - ScopedHandle hFile(safe_handle(CreateFileW(szFileName, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr))); -#endif + ScopedHandle hFile(safe_handle(CreateFile2( + szFileName, + GENERIC_READ, FILE_SHARE_READ, OPEN_EXISTING, + nullptr))); if (!hFile) { return HRESULT_FROM_WIN32(GetLastError()); @@ -1719,13 +1715,10 @@ HRESULT Mesh::ExportToCMO(const wchar_t* szFileName, size_t nMaterials, const Ma } // Create CMO file -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - ScopedHandle hFile(safe_handle(CreateFile2(szFileName, - GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr))); -#else - ScopedHandle hFile(safe_handle(CreateFileW(szFileName, - GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr))); -#endif + ScopedHandle hFile(safe_handle(CreateFile2( + szFileName, + GENERIC_WRITE, 0, CREATE_ALWAYS, + nullptr))); if (!hFile) return HRESULT_FROM_WIN32(GetLastError()); @@ -2516,13 +2509,10 @@ HRESULT Mesh::ExportToSDKMESH(const wchar_t* szFileName, } // Create file -#if (_WIN32_WINNT >= _WIN32_WINNT_WIN8) - ScopedHandle hFile(safe_handle(CreateFile2(szFileName, - GENERIC_WRITE, 0, CREATE_ALWAYS, nullptr))); -#else - ScopedHandle hFile(safe_handle(CreateFileW(szFileName, - GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr))); -#endif + ScopedHandle hFile(safe_handle(CreateFile2( + szFileName, + GENERIC_WRITE, 0, CREATE_ALWAYS, + nullptr))); if (!hFile) return HRESULT_FROM_WIN32(GetLastError()); diff --git a/UVAtlasTool/UVAtlasTool_2019.vcxproj b/UVAtlasTool/UVAtlasTool_2019.vcxproj index bd92bbf6..23d006a5 100644 --- a/UVAtlasTool/UVAtlasTool_2019.vcxproj +++ b/UVAtlasTool/UVAtlasTool_2019.vcxproj @@ -135,7 +135,7 @@ Fast StreamingSIMDExtensions2 ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true true /Zc:__cplusplus /Zc:twoPhase- /ZH:SHA_256 %(AdditionalOptions) @@ -162,7 +162,7 @@ MultiThreadedDebugDLL Fast ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true true /Zc:__cplusplus /Zc:twoPhase- /ZH:SHA_256 %(AdditionalOptions) @@ -188,7 +188,7 @@ Fast StreamingSIMDExtensions2 ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true @@ -216,7 +216,7 @@ MaxSpeed Fast ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true @@ -244,7 +244,7 @@ Fast StreamingSIMDExtensions2 ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true @@ -271,7 +271,7 @@ MaxSpeed Fast ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true diff --git a/UVAtlasTool/UVAtlasTool_2022.vcxproj b/UVAtlasTool/UVAtlasTool_2022.vcxproj index fa351e29..b3665308 100644 --- a/UVAtlasTool/UVAtlasTool_2022.vcxproj +++ b/UVAtlasTool/UVAtlasTool_2022.vcxproj @@ -135,7 +135,7 @@ Fast StreamingSIMDExtensions2 ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true true /Zc:__cplusplus /Zc:twoPhase- %(AdditionalOptions) @@ -162,7 +162,7 @@ MultiThreadedDebugDLL Fast ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;_DEBUG;DEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true true /Zc:__cplusplus /Zc:twoPhase- %(AdditionalOptions) @@ -188,7 +188,7 @@ Fast StreamingSIMDExtensions2 ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true @@ -216,7 +216,7 @@ MaxSpeed Fast ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true @@ -244,7 +244,7 @@ Fast StreamingSIMDExtensions2 ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true @@ -271,7 +271,7 @@ MaxSpeed Fast ..\UVAtlas\inc;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0601;%(PreprocessorDefinitions) + WIN32;NDEBUG;PROFILE;_CONSOLE;_WIN32_WINNT=0x0603;%(PreprocessorDefinitions) true Guard true