Vcpkg 无法使用 mingw windows
Vcpkg isn't working on windows with mingw
我实际上正在尝试使用 cmake 和 MinGW 制作 vcpkg windows 但他似乎不想使用 MinGW
这是错误:
-- Running vcpkg install - done
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:771 (_find_package):
Could not find a configuration file for package "glfw3" that is compatible
with requested version "".
The following configuration files were considered but not accepted:
C:/Users/ErikT/Desktop/ManiaEngine/build/vcpkg_installed/x64-windows/share/glfw3/glfw3Config.cmake, version: 3.3.4 (64bit)
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
这是我的 cmake
cmake_minimum_required(VERSION 3.20)
project(ManiaEngine)
SET(CMAKE_CXX_STANDARD 17)
## Find dependencies
find_package(glfw3 REQUIRED)
find_package(glm REQUIRED)
find_package(Vulkan REQUIRED)
## Create ManiaEngine executable
add_executable(ManiaEngine
source/Launch.cpp
source/Window.cpp
)
target_include_directories(ManiaEngine
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/source"
)
target_link_libraries(
ManiaEngine
PRIVATE
glfw
glm::glm
Vulkan::Vulkan
)
我使用 CMakePresets 来编译 vcpkg :
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "unix",
"displayName": "Default Config",
"description": "Default build using Make and vcpkg",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "msvc",
"displayName": "Default MSVC",
"description": "Default build using Visual Studio and vcpkg",
"generator": "Visual Studio 16 2019",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "mingw",
"displayName": "Default MinGW",
"description": "Default build using MinGW and vcpkg",
"generator": "MinGW Makefiles",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
}
]
}
对于项目的规范,安装了vulkan SDK,我使用的是github上最新的VCPKG项目CMAKE 20.05。除了 VULKAN,我所有的库都是项目的子模块,我安装了 visual studio build tools 2019。
我不想使用 visual studio 这就是我使用 mingw 作为生成器的原因。
如果您需要有关该项目的更多信息,可以在 github 此处找到:
https://github.com/real2k/ManiaEngine
提前致谢
您需要通过以下变量告诉 vcpkg 使用哪个三元组:
export VCPKG_DEFAULT_TRIPLET=x64-mingw-dynamic
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-dynamic
这些也可以在您的预设中设置。
在此处的 vcpkg 文档中查看更多信息:https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md
您使用的是 mingw x86 工具链,而错误消息中的配置文件是针对 x64 的,因此被拒绝了。
我实际上正在尝试使用 cmake 和 MinGW 制作 vcpkg windows 但他似乎不想使用 MinGW
这是错误:
-- Running vcpkg install - done
-- The C compiler identification is GNU 8.1.0
-- The CXX compiler identification is GNU 8.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/gcc.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/mingw-w64/i686-8.1.0-posix-dwarf-rt_v6-rev0/mingw32/bin/g++.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:771 (_find_package):
Could not find a configuration file for package "glfw3" that is compatible
with requested version "".
The following configuration files were considered but not accepted:
C:/Users/ErikT/Desktop/ManiaEngine/build/vcpkg_installed/x64-windows/share/glfw3/glfw3Config.cmake, version: 3.3.4 (64bit)
Call Stack (most recent call first):
CMakeLists.txt:7 (find_package)
这是我的 cmake
cmake_minimum_required(VERSION 3.20)
project(ManiaEngine)
SET(CMAKE_CXX_STANDARD 17)
## Find dependencies
find_package(glfw3 REQUIRED)
find_package(glm REQUIRED)
find_package(Vulkan REQUIRED)
## Create ManiaEngine executable
add_executable(ManiaEngine
source/Launch.cpp
source/Window.cpp
)
target_include_directories(ManiaEngine
PRIVATE
"${CMAKE_CURRENT_LIST_DIR}/source"
)
target_link_libraries(
ManiaEngine
PRIVATE
glfw
glm::glm
Vulkan::Vulkan
)
我使用 CMakePresets 来编译 vcpkg :
{
"version": 2,
"cmakeMinimumRequired": {
"major": 3,
"minor": 20,
"patch": 0
},
"configurePresets": [
{
"name": "unix",
"displayName": "Default Config",
"description": "Default build using Make and vcpkg",
"generator": "Unix Makefiles",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "msvc",
"displayName": "Default MSVC",
"description": "Default build using Visual Studio and vcpkg",
"generator": "Visual Studio 16 2019",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
},
{
"name": "mingw",
"displayName": "Default MinGW",
"description": "Default build using MinGW and vcpkg",
"generator": "MinGW Makefiles",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake"
}
}
]
}
对于项目的规范,安装了vulkan SDK,我使用的是github上最新的VCPKG项目CMAKE 20.05。除了 VULKAN,我所有的库都是项目的子模块,我安装了 visual studio build tools 2019。
我不想使用 visual studio 这就是我使用 mingw 作为生成器的原因。
如果您需要有关该项目的更多信息,可以在 github 此处找到:
https://github.com/real2k/ManiaEngine
提前致谢
您需要通过以下变量告诉 vcpkg 使用哪个三元组:
export VCPKG_DEFAULT_TRIPLET=x64-mingw-dynamic
export VCPKG_DEFAULT_HOST_TRIPLET=x64-mingw-dynamic
这些也可以在您的预设中设置。
在此处的 vcpkg 文档中查看更多信息:https://github.com/microsoft/vcpkg/blob/master/docs/users/mingw.md
您使用的是 mingw x86 工具链,而错误消息中的配置文件是针对 x64 的,因此被拒绝了。