Different files for different boards?

If i have folders for different boards inside my project with thier own src,include,lib and test folders, how do i make platformio (as an atom package to be exact) build only specified directory, and to find it in the first place?

Yes, use src_filter,build_flags, lib_extra_dirs and test_filter.

I tried using src_filter, with default_src_filter in [common] set up like this:
-<.git/> -<.svn/> -<example/> -<examples/> -<test/> -<tests/>
and src_filter set up in [env:megaatmega2560] like this (given that megaatmega2560 is a
directory inside project folder, and there are src,include,lib and test folders, with valid main.cpp inside of src):
src_filter = ${common.default_src_filter} +<megaatmega2560/>
But it gives me an error about unknown references to setup and loop functions
I also tried:
src_filter = ${common.default_src_filter} +<megaatmega2560/*>
src_filter = ${common.default_src_filter} +<megaatmega2560/src> +<megaatmega2560/include> +<megaatmega2560/lib> +<megaatmega2560/test>

But same error was thrown:
ccNueZ26.ltrans0.ltrans.o: In function main: <artificial>:(.text.startup+0xe0): undefined reference to setup <artificial>:(.text.startup+0xe8): undefined reference to loop collect2.exe: error: ld returned 1 exit status *** [.pio\build\megaatmega2560\firmware.elf] Error 1

Figured it out, i should not have many subdirectories with their own src include lib and test folders, but have subdirectories inside of root src include lib and test folder, so instead of this:
board1/src board1/lib board1/include board1/test
i should have
src/board1 include/board1 lib/board1 test/board1