fix: fix all Windows warnings so apps will compile with /WX
This commit is contained in:
@@ -39,11 +39,6 @@ and change the minimum deployment target to 13.0:
|
||||
|
||||
</Accordion>
|
||||
|
||||
<Accordion title="Click to open Windows instructions">
|
||||
See the [/windows](/windows) page for steps needed to build on Windows.
|
||||
</Accordion>
|
||||
|
||||
|
||||
2. Add a folder containing your assets (glTF model + skybox ktx) to your `pubspec.yaml` asset list
|
||||
|
||||
```yaml
|
||||
|
||||
@@ -1,17 +1,6 @@
|
||||
## Windows
|
||||
|
||||
## CMakeLists
|
||||
|
||||
You will need to disable the `/WX` compiler flag.
|
||||
|
||||
In your project, open the `windows/CMakeList.txt` file and find the following line:
|
||||
|
||||
`target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")`
|
||||
|
||||
Delete the `/WX`:
|
||||
|
||||
`target_compile_options(${TARGET} PRIVATE /W4 /wd"4100")`
|
||||
|
||||
If you're not a Thermion developer, you can ignore this.
|
||||
|
||||
## ANGLE build (not currently working)
|
||||
To support embedding GPU textures in Flutter (rather than copying to a CPU pixel buffer on every frame), we need to build a slightly customized version of Filament that uses GLES on Windows (rather than the default, which uses OpenGL).
|
||||
|
||||
@@ -326,7 +326,7 @@ BackingWindow::BackingWindow(flutter::PluginRegistrarWindows *pluginRegistrar,
|
||||
::SetWindowLong(_windowHandle, GWL_STYLE, style);
|
||||
|
||||
::SetWindowLongPtr(_windowHandle, GWLP_USERDATA,
|
||||
reinterpret_cast<LONG>(_flutterRootWindow));
|
||||
reinterpret_cast<LONG_PTR>(_flutterRootWindow));
|
||||
|
||||
RECT flutterViewRect;
|
||||
::GetWindowRect(_flutterViewWindow, &flutterViewRect);
|
||||
|
||||
@@ -81,11 +81,13 @@ ResourceBuffer ThermionFlutterPlugin::loadResource(const char *name) {
|
||||
name_str = name_str.substr(8);
|
||||
}
|
||||
|
||||
int size_needed = MultiByteToWideChar(CP_UTF8, 0, name_str.c_str(), -1, nullptr, 0);
|
||||
std::wstring assetPath(size_needed, 0);
|
||||
MultiByteToWideChar(CP_UTF8, 0, name_str.c_str(), -1, &assetPath[0], size_needed);
|
||||
|
||||
TCHAR pBuf[512];
|
||||
size_t len = sizeof(pBuf);
|
||||
int bytes = GetModuleFileName(NULL, pBuf, static_cast<DWORD>(len));
|
||||
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter;
|
||||
std::wstring assetPath = converter.from_bytes(name_str.c_str());
|
||||
GetModuleFileName(NULL, pBuf, static_cast<DWORD>(len));
|
||||
|
||||
std::wstring exePathBuf(pBuf);
|
||||
std::filesystem::path exePath(exePathBuf);
|
||||
@@ -108,8 +110,8 @@ ResourceBuffer ThermionFlutterPlugin::loadResource(const char *name) {
|
||||
is.seekg(0, std::ios::beg);
|
||||
is.read(buffer, length);
|
||||
is.close();
|
||||
auto id = _resources.size();
|
||||
auto rb = ResourceBuffer(buffer, length, id);
|
||||
int32_t id = static_cast<int32_t>(_resources.size());
|
||||
auto rb = ResourceBuffer(buffer, static_cast<int32_t>(length), id);
|
||||
_resources.emplace(id, rb);
|
||||
|
||||
std::wcout << "Loaded resource of length " << length << " from path "
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
flutter::PluginRegistrarWindows *_pluginRegistrar;
|
||||
flutter::TextureRegistrar *_textureRegistrar;
|
||||
std::unique_ptr<flutter::MethodChannel<flutter::EncodableValue>> _channel;
|
||||
std::map<uint32_t, ResourceBuffer> _resources;
|
||||
std::map<int32_t, ResourceBuffer> _resources;
|
||||
|
||||
void CreateTexture(
|
||||
const flutter::MethodCall<flutter::EncodableValue> &methodCall,
|
||||
|
||||
Reference in New Issue
Block a user