SanderMertens / flecs

A fast entity component system (ECS) for C & C++
https://www.flecs.dev
Other
6.47k stars 454 forks source link

Support MinGW-w64 (MSYS2) #523

Closed KenthJohan closed 1 year ago

KenthJohan commented 3 years ago

_MSC_VER is not defined on MinGW-w64 (MSYS2). __MINGW32__ and WIN32 is defined on MinGW-w64 (MSYS2). I don't know which one is better to use. Maybe WIN32 could be used for code that works both on __MINGW32__ and _MSC_VER.

Option 1

- #ifdef _MSC_VER
+ #if defined(_MSC_VER) | defined(__MINGW32__)
- #ifndef _MSC_VER
+ #if !defined(_MSC_VER) & !defined(__MINGW32__)

Option 2

- #ifdef _MSC_VER
+ #ifdef WIN32
- #ifndef _MSC_VER
+ #ifndef WIN32

Only these need to be changed to make it work for MinGW-w64 (MSYS2): https://github.com/SanderMertens/flecs/blob/3667290095250af280f9be2c1de1585afcdc73ca/src/addons/http.c#L37-L43 https://github.com/SanderMertens/flecs/blob/3667290095250af280f9be2c1de1585afcdc73ca/src/addons/http.c#L198-L200 https://github.com/SanderMertens/flecs/blob/3667290095250af280f9be2c1de1585afcdc73ca/src/addons/http.c#L644-L658 https://github.com/SanderMertens/flecs/blob/3667290095250af280f9be2c1de1585afcdc73ca/src/addons/http.c#L842-L846

SanderMertens commented 3 years ago

Thanks for the sugggestions! I'll give them a try ASAP :)

ghost commented 2 years ago

Hi @KenthJohan I hope you are doing well. I actually faced the same problem on the same setup. You may check my pull here and I will appreciate your opinion. https://github.com/SanderMertens/flecs/pull/582

Thanks!

KenthJohan commented 2 years ago

Hey @wobes1 thanks. Isn't WSAStartup required also?

ghost commented 2 years ago

Hello @KenthJohan are you referring to this? https://github.com/SanderMertens/flecs/pull/584 if so, yes I was missing it!

ghost commented 2 years ago

@SanderMertens @KenthJohan I believe this can be moved to "Done" since it is supported in https://github.com/SanderMertens/flecs/pull/582 and https://github.com/SanderMertens/flecs/pull/596

I am myself on MSYS64 with MingGW and latest flecs compiles flawlessly with these two.

ZeroErrors commented 1 year ago

Seems like this has been dealt with and can now be closed? @KenthJohan