mirror of
https://github.com/maplibre/maplibre-rs.git
synced 2025-12-08 19:05:57 +00:00
Fix compilation
This commit is contained in:
parent
61e12a8c9a
commit
8c7a1f32d0
@ -7,7 +7,7 @@ use maplibre::{
|
||||
render::settings::{Backends, WgpuSettings},
|
||||
MapBuilder,
|
||||
};
|
||||
use maplibre_winit::winit::WinitMapWindowConfig;
|
||||
use maplibre_winit::winit::{run_headed_map, WinitMapWindowConfig};
|
||||
|
||||
#[cfg(not(target_os = "android"))]
|
||||
compile_error!("android works only on android.");
|
||||
@ -16,20 +16,8 @@ compile_error!("android works only on android.");
|
||||
pub fn android_main() {
|
||||
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
|
||||
|
||||
run_multithreaded(async {
|
||||
MapBuilder::new()
|
||||
.with_map_window_config(WinitMapWindowConfig::new("maplibre android".to_string()))
|
||||
.with_http_client(ReqwestHttpClient::new(None))
|
||||
.with_scheduler(TokioScheduler::new())
|
||||
.with_wgpu_settings(WgpuSettings {
|
||||
backends: Some(Backends::VULKAN),
|
||||
..WgpuSettings::default()
|
||||
})
|
||||
.build()
|
||||
.initialize()
|
||||
.await
|
||||
.run()
|
||||
})
|
||||
// TODO: Maybe requires: Some(Backends::VULKAN)
|
||||
run_headed_map(None);
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
use maplibre::io::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::{
|
||||
platform::{http_client::ReqwestHttpClient, run_multithreaded, scheduler::TokioScheduler},
|
||||
MapBuilder,
|
||||
};
|
||||
use maplibre_winit::winit::{WinitEventLoop, WinitMapWindow, WinitMapWindowConfig, WinitWindow};
|
||||
use maplibre_winit::winit::{
|
||||
run_headed_map, WinitEnvironment, WinitEventLoop, WinitMapWindow, WinitMapWindowConfig,
|
||||
WinitWindow,
|
||||
};
|
||||
|
||||
#[cfg(not(any(target_os = "macos", target_os = "ios")))]
|
||||
compile_error!("apple works only on macOS and iOS.");
|
||||
@ -11,14 +15,5 @@ compile_error!("apple works only on macOS and iOS.");
|
||||
pub fn maplibre_apple_main() {
|
||||
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
|
||||
|
||||
run_multithreaded(async {
|
||||
MapBuilder::new()
|
||||
.with_map_window_config(WinitMapWindowConfig::new("maplibre apple".to_string()))
|
||||
.with_http_client(ReqwestHttpClient::new(None))
|
||||
.with_scheduler(TokioScheduler::new())
|
||||
.build()
|
||||
.initialize()
|
||||
.await
|
||||
.run()
|
||||
})
|
||||
run_headed_map(None);
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
use std::collections::HashSet;
|
||||
|
||||
use criterion::{criterion_group, criterion_main, Criterion};
|
||||
use maplibre::io::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::{
|
||||
coords::{WorldTileCoords, ZoomLevel},
|
||||
error::Error,
|
||||
@ -20,19 +21,26 @@ use maplibre::{
|
||||
fn headless_render(c: &mut Criterion) {
|
||||
c.bench_function("headless_render", |b| {
|
||||
let mut map = run_multithreaded(async {
|
||||
let mut map = MapBuilder::new()
|
||||
.with_map_window_config(HeadlessMapWindowConfig {
|
||||
size: WindowSize::new(1000, 1000).unwrap(),
|
||||
})
|
||||
.with_http_client(ReqwestHttpClient::new(None))
|
||||
.with_scheduler(TokioScheduler::new())
|
||||
.with_renderer_settings(RendererSettings {
|
||||
texture_format: TextureFormat::Rgba8UnormSrgb,
|
||||
..RendererSettings::default()
|
||||
})
|
||||
.build()
|
||||
.initialize_headless()
|
||||
.await;
|
||||
let client = ReqwestHttpClient::new(None);
|
||||
|
||||
let mut map =
|
||||
MapBuilder::<WinitEnvironment<_, _, _, SchedulerAsyncProcedureCall<_, _>>>::new()
|
||||
.with_map_window_config(HeadlessMapWindowConfig {
|
||||
size: WindowSize::new(1000, 1000).unwrap(),
|
||||
})
|
||||
.with_http_client(client.clone())
|
||||
.with_apc(SchedulerAsyncProcedureCall::new(
|
||||
client,
|
||||
TokioScheduler::new(),
|
||||
))
|
||||
.with_scheduler(TokioScheduler::new())
|
||||
.with_renderer_settings(RendererSettings {
|
||||
texture_format: TextureFormat::Rgba8UnormSrgb,
|
||||
..RendererSettings::default()
|
||||
})
|
||||
.build()
|
||||
.initialize_headless()
|
||||
.await;
|
||||
|
||||
map.map_schedule
|
||||
.fetch_process(&WorldTileCoords::from((0, 0, ZoomLevel::default())))
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
use maplibre::{
|
||||
io::{apc::SchedulerAsyncProcedureCall, transferables::DefaultTransferables},
|
||||
platform::{http_client::ReqwestHttpClient, scheduler::TokioScheduler},
|
||||
MapBuilder,
|
||||
};
|
||||
use maplibre_winit::winit::{WinitEnvironment, WinitMapWindowConfig};
|
||||
|
||||
pub async fn run_headed() {
|
||||
let client = ReqwestHttpClient::new(None);
|
||||
MapBuilder::<WinitEnvironment<_, _, _, SchedulerAsyncProcedureCall<_, _>>>::new()
|
||||
.with_map_window_config(WinitMapWindowConfig::new("maplibre".to_string()))
|
||||
.with_http_client(client.clone())
|
||||
.with_apc(SchedulerAsyncProcedureCall::new(
|
||||
client,
|
||||
TokioScheduler::new(),
|
||||
))
|
||||
.with_scheduler(TokioScheduler::new())
|
||||
.build()
|
||||
.initialize()
|
||||
.await
|
||||
.run()
|
||||
}
|
||||
@ -2,10 +2,10 @@ use std::io::ErrorKind;
|
||||
|
||||
use clap::{builder::ValueParser, Parser, Subcommand};
|
||||
use maplibre::{coords::LatLon, platform::run_multithreaded};
|
||||
use maplibre_winit::winit::run_headed_map;
|
||||
|
||||
use crate::{headed::run_headed, headless::run_headless};
|
||||
use crate::headless::run_headless;
|
||||
|
||||
mod headed;
|
||||
mod headless;
|
||||
|
||||
#[derive(Parser)]
|
||||
@ -61,9 +61,7 @@ fn main() {
|
||||
// You can check for the existence of subcommands, and if found use their
|
||||
// matches just as you would the top level cmd
|
||||
match &cli.command {
|
||||
Commands::Headed {} => {
|
||||
run_multithreaded(async { run_headed().await });
|
||||
}
|
||||
Commands::Headed {} => run_headed_map(None),
|
||||
Commands::Headless {
|
||||
tile_size,
|
||||
min,
|
||||
|
||||
@ -3,7 +3,13 @@
|
||||
//! * Platform Events like suspend/resume
|
||||
//! * Render a new frame
|
||||
|
||||
use crate::winit::WinitEnvironment;
|
||||
use maplibre::io::apc::SchedulerAsyncProcedureCall;
|
||||
use maplibre::platform::http_client::ReqwestHttpClient;
|
||||
use maplibre::platform::run_multithreaded;
|
||||
use maplibre::platform::scheduler::TokioScheduler;
|
||||
use maplibre::window::{HeadedMapWindow, MapWindow, MapWindowConfig, WindowSize};
|
||||
use maplibre::MapBuilder;
|
||||
use winit::window::WindowBuilder;
|
||||
|
||||
use super::{WinitEventLoop, WinitMapWindow, WinitMapWindowConfig, WinitWindow};
|
||||
@ -47,3 +53,21 @@ impl MapWindowConfig for WinitMapWindowConfig {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn run_headed_map(cache_path: Option<String>) {
|
||||
run_multithreaded(async {
|
||||
let client = ReqwestHttpClient::new(cache_path);
|
||||
MapBuilder::<WinitEnvironment<_, _, _, SchedulerAsyncProcedureCall<_, _>>>::new()
|
||||
.with_map_window_config(WinitMapWindowConfig::new("maplibre".to_string()))
|
||||
.with_http_client(client.clone())
|
||||
.with_apc(SchedulerAsyncProcedureCall::new(
|
||||
client,
|
||||
TokioScheduler::new(),
|
||||
))
|
||||
.with_scheduler(TokioScheduler::new())
|
||||
.build()
|
||||
.initialize()
|
||||
.await
|
||||
.run()
|
||||
})
|
||||
}
|
||||
|
||||
@ -36,7 +36,7 @@ impl<E: Environment> InteractiveMapSchedule<E> {
|
||||
map_window_config: E::MapWindowConfig,
|
||||
window_size: WindowSize,
|
||||
renderer: Option<Renderer>,
|
||||
scheduler: E::Scheduler,
|
||||
scheduler: E::Scheduler, // TODO: unused
|
||||
apc: E::AsyncProcedureCall,
|
||||
http_client: E::HttpClient,
|
||||
style: Style,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user