Merge branch '2.6.x' into master

This commit is contained in:
Lukas Dürrenberger 2024-06-26 00:02:26 +02:00 committed by Lukas Dürrenberger
commit 1bf092fe6d
15 changed files with 70 additions and 23 deletions

View File

@ -137,8 +137,6 @@ if(SFML_USE_SYSTEM_DEPS)
endforeach()
list(REMOVE_DUPLICATES CMAKE_IGNORE_PATH)
elseif(SFML_COMPILER_GCC AND GCC_COMPILER_VERSION MATCHES "ucrt")
message(FATAL_ERROR "The pre-compiled SFML dependencies for MinGW are not compatible with the UCRT. Either switch to the MSVCRT or build the dependencies yourself.")
endif()
if(SFML_COMPILER_MSVC)
@ -387,13 +385,15 @@ if(SFML_OS_WINDOWS)
if(NOT SFML_USE_SYSTEM_DEPS)
# install the binaries of SFML dependencies
if(ARCH_32BITS)
if(ARCH_ARM64)
install(DIRECTORY extlibs/libs-msvc-universal/ARM64/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
elseif(ARCH_X86)
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()
install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
elseif(ARCH_64BITS)
elseif(ARCH_X64)
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
else()

View File

@ -6,10 +6,14 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
set(OPENGL_ES 0)
# detect the architecture
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCH_32BITS 1)
if(${CMAKE_GENERATOR_PLATFORM} MATCHES "ARM64")
set(ARCH_ARM64 1)
elseif("${CMAKE_GENERATOR_PLATFORM}" STREQUAL "" AND ${CMAKE_SYSTEM_PROCESSOR} MATCHES "ARM64")
set(ARCH_ARM64 1)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
set(ARCH_X86 1)
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH_64BITS 1)
set(ARCH_X64 1)
else()
message(FATAL_ERROR "Unsupported architecture")
return()
@ -87,11 +91,21 @@ if(MSVC)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(SFML_COMPILER_CLANG 1)
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-v" OUTPUT_VARIABLE CLANG_COMPILER_VERSION ERROR_VARIABLE CLANG_COMPILER_VERSION)
if("${CLANG_COMPILER_VERSION}" MATCHES "ucrt")
set(SFML_RUNTIME_UCRT 1)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
set(SFML_COMPILER_GCC 1)
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "--version" OUTPUT_VARIABLE GCC_COMPILER_VERSION)
execute_process(COMMAND "${CMAKE_CXX_COMPILER}" "-v" OUTPUT_VARIABLE GCC_COMPILER_VERSION ERROR_VARIABLE GCC_COMPILER_VERSION)
string(REGEX MATCHALL ".*(tdm[64]*-[1-9]).*" SFML_COMPILER_GCC_TDM "${GCC_COMPILER_VERSION}")
if("${GCC_COMPILER_VERSION}" MATCHES "ucrt")
set(SFML_RUNTIME_UCRT 1)
endif()
else()
message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}. Use at your own risk.")
endif()

View File

@ -4,10 +4,12 @@ set(MESA3D_SHA256 "FEF8A643689414A70347AE8027D24674DEFD85E8D6428C8A9D4145BB3F44A
get_filename_component(MESA3D_ARCHIVE "${MESA3D_URL}" NAME)
get_filename_component(MESA3D_ARCHIVE_DIRECTORY "${MESA3D_URL}" NAME_WLE)
if(${ARCH_64BITS})
if(${ARCH_X64})
set(MESA3D_ARCH "x64")
else()
elseif(${ARCH_X86})
set(MESA3D_ARCH "x86")
else()
message(FATAL_ERROR "Mesa 3D does currently not support the target architecture.")
endif()
set(MESA3D_ARCHIVE_PATH "${PROJECT_BINARY_DIR}/${MESA3D_ARCHIVE_DIRECTORY}/${MESA3D_ARCHIVE}")

BIN
extlibs/libs-mingw-ucrt/x64/libFLAC.a vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
extlibs/libs-mingw-ucrt/x86/libFLAC.a vendored Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -5,16 +5,26 @@ include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
if(SFML_OS_WINDOWS)
list(APPEND CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/extlibs/headers")
if(SFML_COMPILER_GCC OR (SFML_COMPILER_CLANG AND MINGW))
if(ARCH_32BITS)
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x86")
elseif(ARCH_64BITS)
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x64")
if(ARCH_X86)
if(SFML_RUNTIME_UCRT)
# taking precendence for provided libraries linking UCRT
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw-ucrt/x86")
endif()
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x86")
elseif(ARCH_X64)
if(SFML_RUNTIME_UCRT)
# taking precendence for provided libraries linking UCRT
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw-ucrt/x64")
endif()
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x64")
endif()
elseif(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
if(ARCH_32BITS)
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x86")
elseif(ARCH_64BITS)
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x64")
if(ARCH_ARM64)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/ARM64")
elseif(ARCH_X86)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x86")
elseif(ARCH_X64)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x64")
endif()
endif()
elseif(SFML_OS_MACOS)

View File

@ -35,6 +35,26 @@
#include <cstring>
namespace
{
std::string getErrorString(DWORD error)
{
PTCHAR buffer = nullptr;
if (FormatMessage(FORMAT_MESSAGE_MAX_WIDTH_MASK | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
nullptr,
error,
0,
reinterpret_cast<PTCHAR>(&buffer),
0,
nullptr) == 0)
return "Unknown error.";
sf::String message = buffer;
LocalFree(buffer);
return message.toAnsiString();
}
}
namespace sf::priv
{
@ -45,13 +65,13 @@ String ClipboardImpl::getString()
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
{
err() << "Failed to get the clipboard data in Unicode format." << std::endl;
err() << "Failed to get the clipboard data in Unicode format: " << getErrorString(GetLastError()) << std::endl;
return text;
}
if (!OpenClipboard(nullptr))
{
err() << "Failed to open the Win32 clipboard." << std::endl;
err() << "Failed to open the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl;
return text;
}
@ -59,7 +79,7 @@ String ClipboardImpl::getString()
if (!clipboardHandle)
{
err() << "Failed to get Win32 handle for clipboard content." << std::endl;
err() << "Failed to get Win32 handle for clipboard content: " << getErrorString(GetLastError()) << std::endl;
CloseClipboard();
return text;
}
@ -77,13 +97,14 @@ void ClipboardImpl::setString(const String& text)
{
if (!OpenClipboard(nullptr))
{
err() << "Failed to open the Win32 clipboard." << std::endl;
err() << "Failed to open the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl;
return;
}
if (!EmptyClipboard())
{
err() << "Failed to empty the Win32 clipboard." << std::endl;
err() << "Failed to empty the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl;
CloseClipboard();
return;
}