Skip to content

Commit

Permalink
fbc: add -gfx command line arg to link against libfbgfx
Browse files Browse the repository at this point in the history
This already existed as an internal flag, I simply exposed it.  It's useful
under emscripten where we can't write objinfo to wasm (nor js) files. Of course
if you're using emscripten you'd know that you (currently) need libfbgfx.a
specifically, but this is a lot cleaner for portable build systems and
future-proof.
  • Loading branch information
rversteegen committed Jun 23, 2023
1 parent d3f7f1a commit f54efd9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Expand Up @@ -3,6 +3,7 @@ Version 1.10.1
[changed]

[added]
- fbc: '-gfx' command line option to link against correct libfbgfx variant, for platforms (emscripten) where it's not automatic due to missing objinfo support

[fixed]
- sf.net #982: Array descriptors emitted incorrectly in gcc backend
Expand Down
9 changes: 8 additions & 1 deletion src/compiler/fbc.bas
Expand Up @@ -1717,6 +1717,7 @@ enum
OPT_FPU
OPT_G
OPT_GEN
OPT_GFX
OPT_HELP
OPT_I
OPT_INCLUDE
Expand Down Expand Up @@ -1799,6 +1800,7 @@ dim shared as FBC_CMDLINE_OPTION cmdlineOptionTB(0 to (OPT__COUNT - 1)) = _
( TRUE , TRUE , TRUE , TRUE ), _ '' OPT_FPU affects major initialization,affects code generation, affects second stage compile, affects link
( FALSE, TRUE , TRUE , FALSE ), _ '' OPT_G affects code generation, affects link
( TRUE , TRUE , TRUE , TRUE ), _ '' OPT_GEN affects major initialization
( FALSE, TRUE , FALSE, FALSE ), _ '' OPT_GFX affects link
( FALSE, FALSE, FALSE, FALSE ), _ '' OPT_HELP never allow, real command line only, makes no sense to have in source
( TRUE , TRUE , TRUE , TRUE ), _ '' OPT_I add include path before the default one
( TRUE , TRUE , TRUE , TRUE ), _ '' OPT_INCLUDE restart required to inject preInclude
Expand Down Expand Up @@ -2007,6 +2009,9 @@ private sub handleOpt _
hFatalInvalidOption( arg, is_source )
end select

case OPT_GFX
fbSetOption( FB_COMPOPT_GFX, TRUE )

case OPT_HELP
fbc.showhelp = TRUE

Expand Down Expand Up @@ -2390,6 +2395,7 @@ private function parseOption(byval opt as zstring ptr) as integer
case asc("g")
ONECHAR(OPT_G)
CHECK("gen", OPT_GEN)
CHECK("gfx", OPT_GFX)

case asc( "h" )
CHECK( "help", OPT_HELP )
Expand Down Expand Up @@ -4094,14 +4100,15 @@ private sub hPrintOptions( byval verbose as integer )
if( verbose ) then
print " -fpmode fast|precise Select floating-point math accuracy/speed"
print " -fpu x87|sse Set target FPU"
endif
end if
print " -g Add debug info, enable __FB_DEBUG__, and enable assert()"

if( verbose ) then
print " -gen gas Select GNU gas 32-bit assembler backend"
print " -gen gas64 Select GNU gas 64-bit assembler backend"
print " -gen gcc Select GNU gcc C backend"
print " -gen llvm Select LLVM backend"
print " -gfx Link to the appropriate libfbgfx variant (normally automatic)"
else
print " -gen gas|gas64|gcc|llvm Select code generation backend"
end if
Expand Down
2 changes: 1 addition & 1 deletion tests/unit-tests.mk
Expand Up @@ -105,7 +105,7 @@ ifneq ($(GEN),)
FBC_CFLAGS += -gen $(GEN)
endif

FBC_LFLAGS := $(FBCU_LIBS) -p $(FBCU_LIB) -x $(MAINEXE)
FBC_LFLAGS := $(FBCU_LIBS) -p $(FBCU_LIB) -x $(MAINEXE) -v
ifdef DEBUG
FBC_LFLAGS += -g
endif
Expand Down

0 comments on commit f54efd9

Please sign in to comment.