make example deps properly optional

This commit is contained in:
lifning 2021-10-15 21:37:48 -07:00
parent 55725b28e1
commit b735e5f4e5
2 changed files with 21 additions and 6 deletions

View File

@ -11,12 +11,23 @@ cc = "^1"
libretro-sys = "0.1"
libloading = "0.5"
num_enum = "0.4"
crossbeam-channel = { version = "0.4", optional = true }
[dev-dependencies]
# examples (both)
structopt = { version = "0.3", optional = true }
# example: sdl2_emulator
sdl2 = "0.32"
crossbeam-channel = "0.4"
structopt = "0.3"
sdl2 = { version = "0.32", optional = true }
crossbeam-channel = { version = "0.4", optional = true }
# example: ffmpeg_recorder
ffmpeg-next = "4.3.8"
ffmpeg-next = { version = "4.3.8", optional = true }
[features]
example_sdl2 = ["sdl2", "crossbeam-channel", "structopt"]
example_ffmpeg = ["ffmpeg-next", "structopt"]
[[example]]
name = "sdl2_emulator"
required-features = ["example_sdl2"]
[[example]]
name = "ffmpeg_recorder"
required-features = ["example_ffmpeg"]

View File

@ -23,3 +23,7 @@ structopt = "0.3"
[features]
ffmpeg_comp = ["ffmpeg-next"]
sdl2_comp = ["sdl2", "gl", "crossbeam-channel"]
[[example]]
name = "multifunction_emulator"
required-features = ["sdl2_comp", "ffmpeg_comp"]