mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Merge branch '2.6.x' into master
This commit is contained in:
commit
1bf092fe6d
@ -137,8 +137,6 @@ if(SFML_USE_SYSTEM_DEPS)
|
|||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
list(REMOVE_DUPLICATES CMAKE_IGNORE_PATH)
|
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()
|
endif()
|
||||||
|
|
||||||
if(SFML_COMPILER_MSVC)
|
if(SFML_COMPILER_MSVC)
|
||||||
@ -387,13 +385,15 @@ if(SFML_OS_WINDOWS)
|
|||||||
|
|
||||||
if(NOT SFML_USE_SYSTEM_DEPS)
|
if(NOT SFML_USE_SYSTEM_DEPS)
|
||||||
# install the binaries of SFML dependencies
|
# 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))
|
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
|
||||||
install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(DIRECTORY extlibs/libs-msvc-universal/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
else()
|
else()
|
||||||
install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(DIRECTORY extlibs/libs-mingw/x86/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
endif()
|
endif()
|
||||||
elseif(ARCH_64BITS)
|
elseif(ARCH_X64)
|
||||||
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
|
if(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
|
||||||
install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
install(DIRECTORY extlibs/libs-msvc-universal/x64/ DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
||||||
else()
|
else()
|
||||||
|
@ -6,10 +6,14 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
|
|||||||
set(OPENGL_ES 0)
|
set(OPENGL_ES 0)
|
||||||
|
|
||||||
# detect the architecture
|
# detect the architecture
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
if(${CMAKE_GENERATOR_PLATFORM} MATCHES "ARM64")
|
||||||
set(ARCH_32BITS 1)
|
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)
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||||
set(ARCH_64BITS 1)
|
set(ARCH_X64 1)
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unsupported architecture")
|
message(FATAL_ERROR "Unsupported architecture")
|
||||||
return()
|
return()
|
||||||
@ -87,11 +91,21 @@ if(MSVC)
|
|||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||||
set(SFML_COMPILER_CLANG 1)
|
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")
|
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
|
||||||
set(SFML_COMPILER_GCC 1)
|
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}")
|
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()
|
else()
|
||||||
message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}. Use at your own risk.")
|
message(WARNING "Unrecognized compiler: ${CMAKE_CXX_COMPILER_ID}. Use at your own risk.")
|
||||||
endif()
|
endif()
|
||||||
|
@ -4,10 +4,12 @@ set(MESA3D_SHA256 "FEF8A643689414A70347AE8027D24674DEFD85E8D6428C8A9D4145BB3F44A
|
|||||||
get_filename_component(MESA3D_ARCHIVE "${MESA3D_URL}" NAME)
|
get_filename_component(MESA3D_ARCHIVE "${MESA3D_URL}" NAME)
|
||||||
get_filename_component(MESA3D_ARCHIVE_DIRECTORY "${MESA3D_URL}" NAME_WLE)
|
get_filename_component(MESA3D_ARCHIVE_DIRECTORY "${MESA3D_URL}" NAME_WLE)
|
||||||
|
|
||||||
if(${ARCH_64BITS})
|
if(${ARCH_X64})
|
||||||
set(MESA3D_ARCH "x64")
|
set(MESA3D_ARCH "x64")
|
||||||
else()
|
elseif(${ARCH_X86})
|
||||||
set(MESA3D_ARCH "x86")
|
set(MESA3D_ARCH "x86")
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Mesa 3D does currently not support the target architecture.")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(MESA3D_ARCHIVE_PATH "${PROJECT_BINARY_DIR}/${MESA3D_ARCHIVE_DIRECTORY}/${MESA3D_ARCHIVE}")
|
set(MESA3D_ARCHIVE_PATH "${PROJECT_BINARY_DIR}/${MESA3D_ARCHIVE_DIRECTORY}/${MESA3D_ARCHIVE}")
|
||||||
|
BIN
extlibs/libs-mingw-ucrt/x64/libFLAC.a
vendored
Normal file
BIN
extlibs/libs-mingw-ucrt/x64/libFLAC.a
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-mingw-ucrt/x64/libfreetype.a
vendored
Normal file
BIN
extlibs/libs-mingw-ucrt/x64/libfreetype.a
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-mingw-ucrt/x86/libFLAC.a
vendored
Normal file
BIN
extlibs/libs-mingw-ucrt/x86/libFLAC.a
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-mingw-ucrt/x86/libfreetype.a
vendored
Normal file
BIN
extlibs/libs-mingw-ucrt/x86/libfreetype.a
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-msvc-universal/ARM64/flac.lib
vendored
Normal file
BIN
extlibs/libs-msvc-universal/ARM64/flac.lib
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-msvc-universal/ARM64/freetype.lib
vendored
Normal file
BIN
extlibs/libs-msvc-universal/ARM64/freetype.lib
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-msvc-universal/ARM64/ogg.lib
vendored
Normal file
BIN
extlibs/libs-msvc-universal/ARM64/ogg.lib
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-msvc-universal/ARM64/vorbis.lib
vendored
Normal file
BIN
extlibs/libs-msvc-universal/ARM64/vorbis.lib
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-msvc-universal/ARM64/vorbisenc.lib
vendored
Normal file
BIN
extlibs/libs-msvc-universal/ARM64/vorbisenc.lib
vendored
Normal file
Binary file not shown.
BIN
extlibs/libs-msvc-universal/ARM64/vorbisfile.lib
vendored
Normal file
BIN
extlibs/libs-msvc-universal/ARM64/vorbisfile.lib
vendored
Normal file
Binary file not shown.
@ -5,16 +5,26 @@ include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)
|
|||||||
if(SFML_OS_WINDOWS)
|
if(SFML_OS_WINDOWS)
|
||||||
list(APPEND CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
list(APPEND CMAKE_INCLUDE_PATH "${PROJECT_SOURCE_DIR}/extlibs/headers")
|
||||||
if(SFML_COMPILER_GCC OR (SFML_COMPILER_CLANG AND MINGW))
|
if(SFML_COMPILER_GCC OR (SFML_COMPILER_CLANG AND MINGW))
|
||||||
if(ARCH_32BITS)
|
if(ARCH_X86)
|
||||||
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x86")
|
if(SFML_RUNTIME_UCRT)
|
||||||
elseif(ARCH_64BITS)
|
# taking precendence for provided libraries linking UCRT
|
||||||
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-mingw/x64")
|
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()
|
endif()
|
||||||
elseif(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
|
elseif(SFML_COMPILER_MSVC OR (SFML_COMPILER_CLANG AND NOT MINGW))
|
||||||
if(ARCH_32BITS)
|
if(ARCH_ARM64)
|
||||||
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x86")
|
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/ARM64")
|
||||||
elseif(ARCH_64BITS)
|
elseif(ARCH_X86)
|
||||||
list(APPEND CMAKE_LIBRARY_PATH "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x64")
|
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()
|
||||||
endif()
|
endif()
|
||||||
elseif(SFML_OS_MACOS)
|
elseif(SFML_OS_MACOS)
|
||||||
|
@ -35,6 +35,26 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#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
|
namespace sf::priv
|
||||||
{
|
{
|
||||||
@ -45,13 +65,13 @@ String ClipboardImpl::getString()
|
|||||||
|
|
||||||
if (!IsClipboardFormatAvailable(CF_UNICODETEXT))
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OpenClipboard(nullptr))
|
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;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,7 +79,7 @@ String ClipboardImpl::getString()
|
|||||||
|
|
||||||
if (!clipboardHandle)
|
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();
|
CloseClipboard();
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
@ -77,13 +97,14 @@ void ClipboardImpl::setString(const String& text)
|
|||||||
{
|
{
|
||||||
if (!OpenClipboard(nullptr))
|
if (!OpenClipboard(nullptr))
|
||||||
{
|
{
|
||||||
err() << "Failed to open the Win32 clipboard." << std::endl;
|
err() << "Failed to open the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!EmptyClipboard())
|
if (!EmptyClipboard())
|
||||||
{
|
{
|
||||||
err() << "Failed to empty the Win32 clipboard." << std::endl;
|
err() << "Failed to empty the Win32 clipboard: " << getErrorString(GetLastError()) << std::endl;
|
||||||
|
CloseClipboard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user