sirus20x6 / stargen

Stargen is a program that generates random solar systems
5 stars 1 forks source link

Compiling for Windows with Either Cygwin or Visual Studio? #17

Open PlutonianEmpire opened 1 month ago

PlutonianEmpire commented 1 month ago

When setting up Cygwin or VS to be able to compile the various StarGen versions, what libraries do we need to install for Cygwin/VS to be able to compile StarGen? I lost an SSD cuz I kept uninstalling/re-installing multi-GB libraries trying to find the right libraries and the SSD gave out.

For my own version, I compiled it with Cygwin last year, but StarGen complained of missing dll's, and when I got the missing dll's off the web, StarGen was extremely slow

sirus20x6 commented 1 month ago

that sounds like a linker issue. I'm actually not sure how to compile in windows. extremely slow sounds normal. especially if you're setting it to only return earth like planets. some day I'd like to make it multithreaded. I'll see if I can get access to a windows computer and get it to compile. windows development is really obnoxious though.

sirus20x6 commented 1 month ago

it appears it's not just a compiler issue but a standard library issue. the microsoft standard library doesn't have constexpr versions of their math functions. I could write my own, but I think the easiest thing is just to use the preprocessor to remove constexpr for windows builds. I kinda hate this though because it's non-standard, weird, idiosyncratic, and just plain dumb. oh and it means the windows version will be slower

PlutonianEmpire commented 1 month ago

That's interesting, cuz the last version compiled by Omega13a is faster than the one I compiled, and they're both for Windows

sirus20x6 commented 1 month ago

I did change some of the planet resonance calculations to be more accurate instead of using a lookup table. it's possible that's causing slowdown. I should work on trying to get performance tracing working again. that would reveal a lot. also there is a lot of dynamic memory usage with dust lanes that can probably be made static that would speed things up a lot

sirus20x6 commented 1 month ago

I think I fixed the performance issue. it was a partially implemented object pooling function that I commited. I reverted it and it seems to be much better

ajtribick commented 3 weeks ago

This also can't be compiled in Clang. Constexpr math functions are mostly a C++26 feature (https://wg21.link/P1383R2), with a limited subset available in C++23 (https://wg21.link/P0533R9). This project specifies C++20. GCC implements this as a non-standard extension since C++11, other compilers do not.