Help with coding a custom plugin

I am trying to code a custom godot addon to use 3d spacemouse under linux extending tripodsan addons that already works on MacOS ( GitHub - tripodsan/godot-spacemouse-extension: godot plugin to support 3dconnexion spacemouse ).

Since no official 3Dconnexion lib is available on linux I am using FreeSpacenav libspnav to communicate with spacenavd.

My question is how to I include compile directives in SConstruct file ?

I did something like :

if platform == "linux" or platform == "linux2":
    env.Append(CFLAGS=["-I/usr/local/include"])
    env.Append(LINKFLAGS=['-L/usr/local/lib'])
    env.Append(LINKFLAGS=['-lspnav'])
else:
    # Add the 3DconnexionClient library
    env.Append(CPPPATH=["/Library/Frameworks/3DconnexionClient.framework/Headers"])
    env.Append(LINKFLAGS=['-F/Library/Frameworks'])
    env.Append(LINKFLAGS=['-framework'])
    env.Append(LINKFLAGS=['3DconnexionClient'])

but seems not to work since in Godot when opening and lauching the addon I get:

Godot Engine v4.5.1.stable.official (c) 2007-present Juan Linietsky, Ariel Manzur & Godot Contributors.

--- Debug adapter server started on port 6006 ---

ERROR: Can't open dynamic library: /home/user/project/addons/spacemouse/bin/./linux/libspacemouse.linux.template_debug.x86_64.so. Error: /home/user/project/addons/spacemouse/bin/./linux/libspacemouse.linux.template_debug.x86_64.so: undefined symbol: spnav_open.

ERROR: Can't open GDExtension dynamic library: 'res://addons/spacemouse/bin/spacemouse.gdextension'.

ERROR: res://addons/spacemouse/SpaceMouse.gd:4 - Parse Error: Could not find type "SpacemouseDevice" in the current scope.

ERROR: res://addons/spacemouse/SpaceMouse.gd:4 - Parse Error: Identifier "SpacemouseDevice" not declared in the current scope.

ERROR: modules/gdscript/gdscript.cpp:3041 - Failed to load script "res://addons/spacemouse/SpaceMouse.gd" with error "Parse error".

so I guess the scons command is not including the spnav library when compiling the addon , since I get an undefined symbol on calling spnav_open() function that is a spnav lib function, if I do not refer to any spnav lib function the addon compiles and runs without any issue.

Anyone can help me with SConstruct file way of specify library linking in this case?

Thanks

ok fixed by myself , for anyone interested here it is the solution just used this code in SConstruct file :

if env["platform"] == "linux":
    env.Append(CPPPATH=["/usr/local/include"])
    env.Append(LIBS = ['spnav'])
else:
    # Add the 3DconnexionClient library
    env.Append(CPPPATH=["/Library/Frameworks/3DconnexionClient.framework/Headers"])
    env.Append(LINKFLAGS=['-F/Library/Frameworks'])
    env.Append(LINKFLAGS=['-framework'])
    env.Append(LINKFLAGS=['3DconnexionClient'])