Skip to content

Commit

Permalink
Work around VS2022 module build bug after upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
fdwr committed Jul 7, 2023
1 parent a40bcf7 commit 7ac5326
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
18 changes: 18 additions & 0 deletions CMakeLists.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!--
Upgrading to VS 2022 broke the project with:
std.ixx(147,1): fatal error C1010: unexpected end of file while looking for precompiled header. ...
Even though this project does not even use C++ modules, just standard #include's. So, disable them explicitly.
https://stackoverflow.com/questions/76296911/precompiled-header-errors-in-visual-studio-2022-version-17-6
-->
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<ItemDefinitionGroup>
<ClCompile>
<BuildStlModules>false</BuildStlModules>
</ClCompile>
</ItemDefinitionGroup>
</Project>
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ set(CMAKE_RUNTIME_LIBRARY_DIRECTORY "$<0:DummyString>")

project(LunaSvgTest VERSION 1.0.0 LANGUAGES CXX C)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_C_STANDARD 11)

set(BUILD_SHARED_LIBS OFF)

set(PLUTOVG_BGRA_PIXEL_ORDER ON CACHE BOOL "Use BGRA order instead of RGBA, useful for Windows GDI." FORCE)
add_subdirectory(external/lunasvg)
# Unfortunately this doesn't fix the VS build bug. So setting set(CMAKE_CXX_STANDARD 20) instead of 23.
set_property(TARGET lunasvg PROPERTY VS_USER_PROPS CMakeLists.props)

add_executable(LunaSvgTest
source/precomp.h
Expand Down Expand Up @@ -61,6 +63,8 @@ message(CMAKE_CURRENT_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
message(CMAKE_CURRENT_BINARY_DIR="${CMAKE_CURRENT_BINARY_DIR}")
message(RUNTIME_OUTPUT_DIRECTORY="${RUNTIME_OUTPUT_DIRECTORY}")

set_property(TARGET LunaSvgTest PROPERTY VS_USER_PROPS CMakeLists.props)

#set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT LunaSvgTest)

if(WIN32)
Expand Down

0 comments on commit 7ac5326

Please sign in to comment.