CGRU / cgru

CGRU - AFANASY
http://cgru.info/
GNU Lesser General Public License v3.0
278 stars 111 forks source link

MSVC Build Failure Caused by Erroneous vcxproj Settings #559

Closed Anti-Distinctlyminty closed 1 year ago

Anti-Distinctlyminty commented 1 year ago

Edit: I believe this is related to my trying to circumvent https://github.com/CGRU/cgru/issues/552. For some reason on my system invoking python via cmd hangs.


I have made a script that will clone the repo and build it from source. All seems to work well up until the build, where I invoke

MSBuild.exe afanasy.sln -property:Configuration=Release

And the following errors always occurs

...
Target CustomBuild:
  Building Custom Rule C:/Users/luke/AppData/Local/Temp/cgru/afanasy/src/project.cmake/libafanasy/CMakeLists.txt
Target GetReferencedVCProjectsInfo:
Target ClCompile:
  getrevision.py
  c1xx : fatal error C1083: Cannot open source file: 'getrevision.py': No such file or directory
  src
  c1xx : fatal error C1083: Cannot open source file: 'C:\Users\luke\AppData\Local\Temp\cgru\afanasy\src': No such file or directory
...

If I allow it to continue, then build again it will compile without the errors. However, circumventing the error this way does not work as I'm trying to automate this process and it will fail 100% of the time on the first build (it also fails on every rebuild).

I was trying to find the source of this error and the generated afanasy\src\project.cmake\libafanasy\afanasy.vcxproj file contains the following strange settings:

Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions contains CGRU_REVISION=python; Configuration Properties > C/C++ > Command Line > Additional Options is %(AdditionalOptions) getrevision.py C:\Users\luke\AppData\Local\Temp\cgru\afanasy\src

Now, as an educated guess I removed the additional options and added it to the preprocessor definitions, so that we have

Configuration Properties > C/C++ > Preprocessor > Preprocessor Definitions contains CGRU_REVISION=python getrevision.py C:\Users\luke\AppData\Local\Temp\cgru\afanasy\src; and additional options is now empty.

(This is a complete guess and I have no idea whether preprocessor definitions can be defined dynamically like this) After this the compiling always rebuilt without any issues.

I tried to find out hos the afanasy.vcxproj file is generated, but I've yet to find it.

So

  1. Is my guess about CGRU_REVISION above correct?
  2. How do we fix the generated afanasy.vcxproj?
Anti-Distinctlyminty commented 1 year ago

Closing and reopening #552