lab132 / krepel

2 stars 0 forks source link

Build System Rewrite #18

Closed Manuzor closed 8 years ago

Manuzor commented 8 years ago

Bield and the old CMake scripts have been replaced with something much simpler. A new output and third-party directory structure is assumed. Add third-party headers.

Manuzor commented 8 years ago

Precompiled headers are not set up and working yet. They should work in theory, but I get strange errors.

To reproduce, open code/krEngine/CMakeLists.txt and somewhere around line 3, remove the comment to add kr_set_pch(...) again, re-run CMake and compile krEngine.

For me, it says: C:\[...]\code\Foundation/Types/Implementation/DelegateHelper_inl.h(62): error C2857: '#include' statement specified with the /YcC:/[...]/code/krEngine/pch.h command-line option was not found in the source file

This also happens when I set up the precompiled header manually.

pampersrocker commented 8 years ago

You need to include "pch.h" instead of krEngine/pch.h

Manuzor commented 8 years ago

About the PCH thing again. In krEngine/pch.cpp, when I change the include to #include "pch.h", I get the same error. Why would it break down in the middle of an ezEngine header anyway? I mean it's even giving me a line number! Weird.

pampersrocker commented 8 years ago

C2857 means, that your first #include is not exactly what is set in the /Yc"yourPCH.file". This is a string compare, so putting an absolute path there needs you to put the absolute path in every cpp file. I've changed now kr_set_pch to not modify the header file parameter and now everything works with krEngine/pch.h

Manuzor commented 8 years ago

It's always astonishing how unhelpful some error messages from msvc are...

Manuzor commented 8 years ago

By the way, using cmake, we can set up the project so the pch does not have to be #included by hand at all. The compiler switch /FI can be used to force the inclusion of a header, which can be used in conjunction with a pch. We could even remove pch.cpp file from the source tree since we could just generate it.

I suppose we should at least test this.

pampersrocker commented 8 years ago

:+1: for testing

Manuzor commented 8 years ago

I just noticed, that I have already set it up with the /FI flag, so you could actually start testing right away if you want :smile: The .cpp file is not generated automatically though :stuck_out_tongue:

pampersrocker commented 8 years ago

If that's the case, then it does not work, it complains about missing include of the pch.

Manuzor commented 8 years ago

I've just tested it here and it worked. I removed the first line from extractionBuffer.cpp. Rebuild works as well.

Manuzor commented 8 years ago

To reduce friction when creating new prototypes/games using krepel, I have created a python script: create_krepel_project.py. It generates a CMake ready project on your machine that expects the krepel repo to exist somewhere else on your machine.

Proper documentation will come soon.