Can a custom scons file be added to a private library?

So I have a library at /lib/mylib, which contains files generated with codegeneration:

/
  lib/
    mylib/
        mylib.proto
        mylib.pb.h  # generated
        mylib.pb.c  # generated
        SConstruct  # doesn't seem to run?

Where something like protoc mylib.proto generates the two files

I’ve worked out that I can do it like this in build.py

from SCons.Script import DefaultEnvironment

env = DefaultEnvironment()

env['PROTOC'] = ...

# rebuild protobuf files
env.Command(
    ['messages.pb.c', 'messages.pb.h'],
    'messages.proto',
    r'$PROTOC --nanopb_out=. $SOURCES'
)

Adding extra_script = lib/mylib/build.py to my .ini file.

Is there any way to contain this config in the library folder?

Solved!

Adding a library.json to mylib containing:

{
	"name": "mylib",
	"build": {
		"extraScript": "build.py"
	}
}

Does the trick