gobo-eiffel / gobo

The Gobo Eiffel Project provides the Eiffel community with free and portable Eiffel tools and libraries.
https://sourceforge.net/projects/gobo-eiffel/
Other
59 stars 24 forks source link

Another unsupported compiler #59

Open ghost opened 1 year ago

ghost commented 1 year ago

Different from the previous: https://github.com/gobo-eiffel/gobo/issues/58

It's Pelles C. See: http://www.smorgasbordet.com/pellesc/

There used to be a request to support Pelles C, but closed: https://github.com/gobo-eiffel/gobo/issues/54

Pelles C is very similar to MSVC. But it's much smaller. So more suitable for people doesn't have plenty of disk space to install MSVC. The generated binaries are still fast, comparable to MSVC.

It seems these bootstrap source files are for MSVC in mind. Even though Pelles C is so similar to MSVC, still not work out of the box.

@ebezault Please support Pelles C.

ghost commented 1 year ago

Pelles C has full document about the command line compiler. Install it and check help0009.chm on C:\Program Files\PellesC\Bin\Help

ghost commented 1 year ago

This is pocc.cfg:

-- Command lines
cc: pocc /MD /MT /Ze /D_WIN32_WINNT=0x0500 /DWINVER=0x0500 /D_CRT_SECURE_NO_DEPRECATE /D_UNICODE /DUNICODE /DWIN32_LEAN_AND_MEAN $cflags $includes /I%GOBO%\tool\gec\runtime\c $gc_includes /c $c
link: polink /STACK:5000000 /NODEFAULTLIB:libc $lflags_gui $lflags /out:$exe $objs $libs $gc_libs USER32.lib WS2_32.lib ADVAPI32.lib GDI32.lib SHELL32.lib MSIMG32.lib COMDLG32.lib UUID.lib OLE32.lib OLEAUT32.lib COMCTL32.lib MPR.LIB SHLWAPI.LIB WINSPOOL.LIB
rc: porc /r /Fo$res_file $rc_file

-- File extensions
obj: .obj
exe: .exe

-- Variables
#ifdef EIF_WORKBENCH
cflags: /Od /Zi /FS
lflags: /debug
#else
cflags: /O2
lflags:
#endif
#ifdef EIF_CONSOLE
lflags_gui: /subsystem:console
#else
lflags_gui: /subsystem:windows
#endif
#ifdef GE_USE_BOEHM_GC
gc_includes: /I%BOEHM_GC%\include 
gc_libs: %BOEHM_GC%\gc.lib
#else
gc_includes:
gc_libs:
#endif

You could see. Almost no different to msc.cfg

ghost commented 1 year ago

This is the hack I put on bootstrap.bat:

...
if .%CC%. == .pocc. goto pocc
...
:pocc
    set CC=pocc
    set LD=polink
    set CFLAGS=/MD /MT /Ze /O2 /std:C99 /Wd2215 /Wd2251
    rem /Wd2030 /Wd2114 /Wd2115 /Wd2154 /Wd2205 /Wd2215 /Wd2238 /Wd2251
    set LFLAGS=/subsystem:console
    set LFLAG_OUT=/out:
    set LLIBS=
    echo pocc > %GOBO%\tool\gec\config\c\default.cfg
    goto pocc_compilation
...
:pocc_compilation
    if not .%VERBOSE%. == .-s. echo Compiling gec (bootstrap 0)...
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec9.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec8.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec7.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec6.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec5.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec4.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec3.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec2.c
    %CC% %CFLAGS% /c %BOOTSTRAP_DIR%\gec1.c
    %LD% %LFLAGS% %LFLAG_OUT%gec%EXE% gec*%OBJ% %LLIBS%
    %RM% gec*%OBJ%
    goto install
...
ghost commented 1 year ago

Still gec9.c, it's the most annoying C source file I have ever tried to compile.