build: fix x64-mingw-static for MSYS2 CLANG64
Don't set the compilers to `gcc` for MinGW vcpkg triplets, because it may be CLANG64 with MinGW. Link FAudio using the `-static` target or the normal target only. Use `ghc::filesystem::path::c_str()` to pass paths to `std::fstream` as there is a conversion problem with this toolchain. Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
parent
99f2530d37
commit
5702bc5102
|
@ -26,7 +26,7 @@ if(NOT DEFINED VCPKG_TARGET_TRIPLET)
|
|||
|
||||
foreach(path $ENV{PATH})
|
||||
if(path MATCHES "[Hh]ost[Xx]64")
|
||||
set(VCPKG_HOST_TRIPLET "x64-windows-static" CACHE STRING "Vcpkg host triplet" FORCE)
|
||||
set(VCPKG_HOST_TRIPLET "x64-windows" CACHE STRING "Vcpkg host triplet" FORCE)
|
||||
set(VCPKG_USE_HOST_TOOLS ON CACHE BOOL "Use vcpkg host tools" FORCE)
|
||||
break()
|
||||
endif()
|
||||
|
@ -635,14 +635,10 @@ function(vcpkg_set_toolchain)
|
|||
endif()
|
||||
|
||||
if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio" AND NOT DEFINED CMAKE_CXX_COMPILER)
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-windows-")
|
||||
if(VCPKG_TARGET_TRIPLET MATCHES "-windows-")
|
||||
# set toolchain to VS for e.g. Ninja or jom
|
||||
set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE)
|
||||
set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE)
|
||||
elseif(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-mingw-")
|
||||
# set toolchain to MinGW for e.g. Ninja or jom
|
||||
set(CMAKE_C_COMPILER gcc CACHE STRING "MinGW GCC C Compiler" FORCE)
|
||||
set(CMAKE_CXX_COMPILER g++ CACHE STRING "MinGW G++ C++ Compiler" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -308,19 +308,15 @@ function(configure_wx_target target)
|
|||
# FAudio.
|
||||
if(ENABLE_FAUDIO)
|
||||
_add_compile_definitions(VBAM_ENABLE_FAUDIO)
|
||||
if(MSVC)
|
||||
|
||||
if(VBAM_STATIC)
|
||||
_add_link_libraries(FAudio::FAudio-static)
|
||||
else()
|
||||
_add_link_libraries(FAudio::FAudio)
|
||||
else()
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
if(MINGW AND VBAM_STATIC)
|
||||
_add_link_libraries(FAudio.a)
|
||||
else()
|
||||
_add_link_libraries(FAudio)
|
||||
endif()
|
||||
_add_link_libraries(dxguid uuid winmm ole32 advapi32 user32 mfplat mfreadwrite mfuuid propsys)
|
||||
else()
|
||||
_add_link_libraries(FAudio)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
|
|
@ -299,7 +299,7 @@ Ftp::Response Ftp::download(const ghc::filesystem::path& remoteFile, const ghc::
|
|||
{
|
||||
// Create the file and truncate it if necessary
|
||||
const ghc::filesystem::path filepath = localPath / remoteFile.filename();
|
||||
std::ofstream file(filepath, std::ios_base::binary | std::ios_base::trunc);
|
||||
std::ofstream file(filepath.c_str(), std::ios_base::binary | std::ios_base::trunc);
|
||||
if (!file)
|
||||
return Response(Response::Status::InvalidFile);
|
||||
|
||||
|
@ -329,7 +329,7 @@ Ftp::Response Ftp::upload(const ghc::filesystem::path& localFile,
|
|||
bool append)
|
||||
{
|
||||
// Get the contents of the file to send
|
||||
std::ifstream file(localFile, std::ios_base::binary);
|
||||
std::ifstream file(localFile.c_str(), std::ios_base::binary);
|
||||
if (!file)
|
||||
return Response(Response::Status::InvalidFile);
|
||||
|
||||
|
|
Loading…
Reference in New Issue