I'm using #![no_main]
so I can use SDL2main on Windows and Android but I would like to have it conditionally used so I can run Rust's built-in test harness on Linux.
I've tried:
#[cfg(not(test))]
#![no_main]
and
include!(concat!("cfg_test_", cfg!(test), ".rs"));
where cfg_test_false.rs
contains #![no_main]
and cfg_test_true.rs
doesn't.
Neither of them work.
I know I can fall back to generating main.rs
using build.rs
but I'm hoping there is a better way, as from what I know, it will have to generate the main.rs
in the src
directory instead of ${OUT_DIR}
.