Use example instead of bin

This commit is contained in:
Maximilian Ammann 2021-12-23 15:08:37 +01:00
parent 83bea5663b
commit 2d12d79f3e
14 changed files with 31 additions and 38 deletions

View File

@ -24,7 +24,7 @@ jobs:
- name: Install Dependencies
run: sudo apt-get install -y libwayland-dev libxkbcommon-dev
- name: Build
run: cargo build --bin mapr
run: cargo build --example desktop
- uses: actions/upload-artifact@v2
with:
name: mapr

View File

@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run mapr" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --bin mapr" />
<configuration default="false" name="Run desktop" type="CargoCommandRunConfiguration" factoryName="Cargo Command">
<option name="command" value="run --example desktop" />
<option name="workingDirectory" value="file://$PROJECT_DIR$" />
<option name="channel" value="DEFAULT" />
<option name="requiredFeatures" value="true" />

View File

@ -15,9 +15,6 @@ edition = "2021"
resolver = "2"
build = "build.rs"
[lib]
crate-type = [ "rlib", "cdylib", "staticlib" ] # staticlib is used for apple
[package.metadata.wasm-pack.profile.release]
wasm-opt = true
@ -95,6 +92,9 @@ test-env-log = "0.2"
wgsl-validate = { path = "./libs/wgsl_validate" }
mapr-utils = { path = "./libs/mapr_utils" }
[[bin]]
name = "mapr"
path = "src/main.rs"
[lib]
crate-type = [ "rlib", "cdylib", "staticlib" ] # staticlib is used for apple
[[example]]
name = "desktop"
crate-type = ["bin"]

View File

@ -96,7 +96,7 @@ cargo build
After that you can run it on your desktop:
```bash
cargo run --bin mapr --
cargo run --example desktop --
```
More information about building for different platforms can be

View File

@ -5,7 +5,7 @@
The setup normal desktop is very simple. You just have to run the following:
```bash
cargo run --bin mapr --
cargo run --example desktop --
```
## Android

View File

@ -1,14 +1,6 @@
use winit::event_loop::EventLoop;
use winit::window::WindowBuilder;
mod fps_meter;
mod platform;
mod render;
mod io;
mod setup;
#[cfg(target_arch = "wasm32")]
mod web;
use mapr::setup;
fn main() {
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));

View File

@ -2,13 +2,4 @@ mod fps_meter;
mod platform;
mod render;
mod io;
mod setup;
#[cfg(target_arch = "wasm32")]
mod web;
#[cfg(target_arch = "aarch64")]
mod apple;
#[cfg(target_os = "android")]
mod android;
pub mod setup;

View File

@ -1,5 +0,0 @@
#[cfg(target_arch = "wasm32")]
pub use instant::Instant;
#[cfg(not(target_arch = "wasm32"))]
pub use std::time::Instant;

View File

@ -1,8 +1,8 @@
use winit::event_loop::EventLoop;
use winit::window::WindowBuilder;
#[no_mangle]
fn mapr_apple_main() {
use winit::event_loop::EventLoop;
use winit::window::WindowBuilder;
env_logger::init_from_env(env_logger::Env::default().default_filter_or("info"));
let event_loop = EventLoop::new();

15
src/platform/mod.rs Normal file
View File

@ -0,0 +1,15 @@
#[cfg(target_arch = "wasm32")]
pub mod web;
#[cfg(target_arch = "aarch64")]
pub mod apple;
#[cfg(target_os = "android")]
pub mod android;
#[cfg(target_arch = "wasm32")]
pub use instant::Instant;
#[cfg(not(target_arch = "wasm32"))]
pub use std::time::Instant;