Polytonic / Glitter

Dead Simple OpenGL
http://polytonic.github.io/Glitter/
2.46k stars 416 forks source link

How do I add new source file efficiently? #47

Closed haolly closed 6 years ago

haolly commented 6 years ago

I build vs2017 solution in Build directory, but the source is in the Glitter directory at the same level of Build directory. Every time I add new file, I need first create file in Glitter directory, and then right click Glitter project's Sources and Headers directory to add existing file to it.

When you directly right click Sources folder in Glitter project to add new item, the new created file will be located in Build directory, this is annoying 😞

Polytonic commented 6 years ago

You should be able to add new files in the source directory, then rerun cmake to regenerate your Visual Studio Solution so the new files appear in the Solution Explorer.

If I remember correctly anyway. I’m not at a computer to verify. Give that a shot and let me know if it doesn’t work?

haolly commented 6 years ago

@Polytonic follow your instruction, I created light.cpp and light.h in Sources folder and Hearders folder respectively. Then I regenerated VS solution, the .cpp file appears in Sources folder, but all .h file lost in Headers folder Moreover, this approach is more slower than manually create new files and add them to solution

haolly commented 6 years ago

OK, after google, I realize this could not be avoided when using GLOB . as this SO says https://stackoverflow.com/questions/19351489/in-cmake-how-to-update-the-makefiles-with-new-source-files-without-cleaning-the?rq=1

Polytonic commented 6 years ago

Right, you'll need to rerun cmake to regenerate the solution (headers go in the headers folder, source files go in the source file). You're welcome to change this if you like.

I'm going to go ahead and close this. Feel free to reopen or let me know if you're having any other issues.