dungeons-of-moria / umoria

Moria: a roguelike Dungeon Crawler game | Umoria Source Code
https://umoria.org
GNU General Public License v3.0
353 stars 76 forks source link

Cygwin: headers.h "Unknown compiler" error #65

Closed smbhax closed 7 months ago

smbhax commented 1 year ago

Trying to compile the latest Umoria code in the latest Cygwin under Windows 11, I get an error:

$ make
Consolidate compiler generated dependencies of target umoria
[  1%] Building CXX object CMakeFiles/umoria.dir/src/config.cpp.o
In file included from /home/smbhax/umoria/src/config.cpp:7:
/home/smbhax/umoria/src/headers.h:28:5: error: #error "Unknown compiler"
   28 | #   error "Unknown compiler"
      |     ^~~~~
make[2]: *** [CMakeFiles/umoria.dir/build.make:76: CMakeFiles/umoria.dir/src/config.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/umoria.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

(I found I am able to avoid the error with the following crude workaround in my src/headers.h:

which changes

#ifdef _WIN32
    #define _CRT_SECURE_NO_WARNINGS
    #define _CRT_NONSTDC_NO_DEPRECATE
    #define WIN32_LEAN_AND_MEAN

    #include <windows.h>

    #include <io.h>
    #include <sys/types.h>

#elif __APPLE__ ||  __linux__ || __NetBSD__ || __MORPHOS__

    #include <pwd.h>
    #include <unistd.h>
    #include <sys/param.h>

#else
#   error "Unknown compiler"
#endif

to

#ifdef _WIN32
    #define _CRT_SECURE_NO_WARNINGS
    #define _CRT_NONSTDC_NO_DEPRECATE
    #define WIN32_LEAN_AND_MEAN

    #include <windows.h>

    #include <io.h>
    #include <sys/types.h>

//#elif __APPLE__ ||  __linux__ || __NetBSD__ || __MORPHOS__
#else
    #include <pwd.h>
    #include <unistd.h>
    #include <sys/param.h>

//#else
//#   error "Unknown compiler"
#endif

)

mrcook commented 1 year ago

Hi Ben, thanks for the issue. I'll take a look the next time I get a chance to test this on windows.

mrcook commented 7 months ago

Hi @smbhax, unfortunately since I updated to an Arm macbook I no longer have access to Windows to be able to check this. However, commenting out those line is probably not the best approach.

As this issue has been open for a long time with no other input I will close it.