To get the target_os etc:
target_os
rustc --print cfg
In src/lib.rs add the matching based on the cfg data.
src/lib.rs
cfg
Create src/<new_platform>.
src/<new_platform>