From 3b9c46bb14f67de655f760ac642aa66eb91d6f49 Mon Sep 17 00:00:00 2001 From: Mathias Parger Date: Mon, 10 Jul 2023 16:14:47 +0200 Subject: [PATCH 1/3] fixed building with vs 2022 --- CMakeLists.txt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 976c3e4dabb..0cf87470e78 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,6 +166,7 @@ if (WIN32) # "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users # a choice to opt for the shared runtime if they want. option(USE_STATIC_CRT "Link against the static runtime libraries." ON) + set(CMAKE_CXX_STANDARD 20) # On Windows we need to instruct cmake to generate the .def in order to get the .lib required # when linking against dlls. CL.EXE will not generate .lib without .def file (or without pragma @@ -452,7 +453,8 @@ endif() # By default, build with Vulkan support on desktop platforms, although clients must request to use # it at run time. -if (WIN32 OR WEBGL OR IOS) +# if (WIN32 OR WEBGL OR IOS) +if (WEBGL OR IOS) option(FILAMENT_SUPPORTS_VULKAN "Include the Vulkan backend" OFF) else() option(FILAMENT_SUPPORTS_VULKAN "Include the Vulkan backend" ON) From 7bb59a6d8ede1a19cc4dc952140cae063ec6befc Mon Sep 17 00:00:00 2001 From: Mathias Parger Date: Mon, 10 Jul 2023 16:14:58 +0200 Subject: [PATCH 2/3] fixed ppm files export on windows containing extra bytes see: https://stackoverflow.com/questions/56032695/why-does-my-ofstream-write-result-in-more-bytes-than-expected --- libs/viewer/src/AutomationEngine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libs/viewer/src/AutomationEngine.cpp b/libs/viewer/src/AutomationEngine.cpp index 19d23ef1681..6cca8395ba7 100644 --- a/libs/viewer/src/AutomationEngine.cpp +++ b/libs/viewer/src/AutomationEngine.cpp @@ -80,7 +80,7 @@ static void exportScreenshot(View* view, Renderer* renderer, std::string filenam convertRGBAtoRGB(buffer, vp.width, vp.height); Path out(state->filename); - std::ofstream ppmStream(out); + std::ofstream ppmStream(out, std::ios_base::binary); ppmStream << "P6 " << vp.width << " " << vp.height << " " << 255 << std::endl; ppmStream.write(static_cast(buffer), vp.width * vp.height * 3); delete[] static_cast(buffer); From cc895ea85f10aae7c577753b8fef863902879b11 Mon Sep 17 00:00:00 2001 From: Mathias Parger Date: Tue, 25 Jul 2023 09:21:01 +0200 Subject: [PATCH 3/3] moving c++20 standard specification to compiler flags section --- CMakeLists.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0cf87470e78..6b95f932d57 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -166,7 +166,6 @@ if (WIN32) # "VCRUNTIME140.dll not found. Try reinstalling the app.", but give users # a choice to opt for the shared runtime if they want. option(USE_STATIC_CRT "Link against the static runtime libraries." ON) - set(CMAKE_CXX_STANDARD 20) # On Windows we need to instruct cmake to generate the .def in order to get the .lib required # when linking against dlls. CL.EXE will not generate .lib without .def file (or without pragma @@ -283,11 +282,11 @@ endif() # ================================================================================================== set(CXX_STANDARD "-std=c++17") if (WIN32) - set(CXX_STANDARD "/std:c++17") + set(CXX_STANDARD "/std:c++20") endif() if (MSVC) - set(CXX_STANDARD "/std:c++latest") + set(CXX_STANDARD "/std:c++20") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} /W0 /Zc:__cplusplus") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CXX_STANDARD} -fstrict-aliasing -Wno-unknown-pragmas -Wno-unused-function -Wno-deprecated-declarations") @@ -453,7 +452,6 @@ endif() # By default, build with Vulkan support on desktop platforms, although clients must request to use # it at run time. -# if (WIN32 OR WEBGL OR IOS) if (WEBGL OR IOS) option(FILAMENT_SUPPORTS_VULKAN "Include the Vulkan backend" OFF) else()