vector-of-bool / cmrc

A Resource Compiler in a Single CMake Script
MIT License
674 stars 74 forks source link

Failure to compile long strings on MSVC #3

Closed JoshCollins746 closed 6 years ago

JoshCollins746 commented 6 years ago

Building the current repository with Visual Studio 2017 fails:

$ mkdir build
$ cd build
$ cmake "Visual Studio 15 2017 Win64" ..
$ cmake --build .

Gives:

Microsoft (R) Build Engine version 15.7.177.53362 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 18/05/2018 9:02:30 AM.
Project "C:\work\cmrc\build\ALL_BUILD.vcxproj" on node 1 (default targets).
Project "C:\work\cmrc\build\ALL_BUILD.vcxproj" (1) is building "C:\work\cmrc\build\ZERO_CHECK.vcxproj" (2) on node 1 (d
efault targets).
PrepareForBuild:
  Creating directory "x64\Debug\ZERO_CHECK\".
  Creating directory "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\".
InitializeBuildStatus:
  Creating "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
CustomBuild:
  Checking Build System
  CMake does not need to re-run because C:/work/cmrc/build/CMakeFiles/generate.stamp is up-to-date.
FinalizeBuildStatus:
  Deleting file "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\unsuccessfulbuild".
  Touching "x64\Debug\ZERO_CHECK\ZERO_CHECK.tlog\ZERO_CHECK.lastbuildstate".
Done Building Project "C:\work\cmrc\build\ZERO_CHECK.vcxproj" (default targets).

Project "C:\work\cmrc\build\ALL_BUILD.vcxproj" (1) is building "C:\work\cmrc\build\flower.vcxproj" (3) on node 1 (defau
lt targets).
Project "C:\work\cmrc\build\flower.vcxproj" (3) is building "C:\work\cmrc\build\hello.vcxproj" (4) on node 1 (default t
argets).
PrepareForBuild:
  Creating directory "hello.dir\Debug\".
  Creating directory "C:\work\cmrc\build\Debug\".
  Creating directory "hello.dir\Debug\hello.tlog\".
InitializeBuildStatus:
  Creating "hello.dir\Debug\hello.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ComputeCustomBuildOutput:
  Creating directory "C:\work\cmrc\build\hello\intermediate\".
CustomBuild:
  Generating hello resource loader
  Generating intermediate file for C:/work/cmrc/hello.txt
  Generating intermediate file for C:/work/cmrc/flower.jpg
  Building Custom Rule C:/work/cmrc/CMakeLists.txt
  CMake does not need to re-run because C:/work/cmrc/build/CMakeFiles/generate.stamp is up-to-date.
ClCompile:
  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.14.26428\bin\HostX86\x64\CL.exe /c /IC
  :\work\cmrc\build\_cmrc\include /Zi /nologo /W3 /WX- /diagnostics:classic /Od /Ob0 /D WIN32 /D _WINDOWS /D "CMAKE_INT
  DIR=\"Debug\"" /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR /Fo"hello.dir\D
  ebug\\" /Fd"hello.dir\Debug\hello.pdb" /Gd /TP /FC /errorReport:queue C:\work\cmrc\build\hello\lib.cpp C:\work\cmrc\b
  uild\hello\intermediate\hello.txt.cpp C:\work\cmrc\build\hello\intermediate\flower.jpg.cpp
  lib.cpp
  hello.txt.cpp
  flower.jpg.cpp
c:\work\cmrc\build\hello\intermediate\flower.jpg.cpp(1): error C2026: string too big, trailing characters truncated [C:
\work\cmrc\build\hello.vcxproj]
  Generating Code...
Done Building Project "C:\work\cmrc\build\hello.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\work\cmrc\build\flower.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\work\cmrc\build\ALL_BUILD.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\work\cmrc\build\ALL_BUILD.vcxproj" (default target) (1) ->
"C:\work\cmrc\build\flower.vcxproj" (default target) (3) ->
"C:\work\cmrc\build\hello.vcxproj" (default target) (4) ->
(ClCompile target) ->
  c:\work\cmrc\build\hello\intermediate\flower.jpg.cpp(1): error C2026: string too big, trailing characters truncated [
C:\work\cmrc\build\hello.vcxproj]

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:04.11

We can fix this by reverting back to an array of chars in the intermediate representation rather than using a string literal.

vector-of-bool commented 6 years ago

Sorry to leave this silent. I reverted to using a char array a while ago, so it should be usable now. I also did some other big refactors, so you may want to the module from a few commits ago before my big changes, unless you want to go through the upgrade path (which I still haven't documented. I'm in the midst of the refactor.)

vector-of-bool commented 6 years ago

Oh wait, you're the one who opened the PR for that fix. Heh. I'll go ahead and close this issue.