tycho: expose meta info via function API

master
an 2019-06-14 12:13:11 -04:00
parent 052679145e
commit 3086ff687d
8 changed files with 44 additions and 15 deletions

View File

@ -53,13 +53,6 @@ target_include_directories(
$ENV{OUT_DIR}
)
target_compile_definitions(
maraiah-tycho-hermes
PUBLIC
-DTYCHO_VERSION=\"$ENV{CARGO_PKG_VERSION}\"
-DTYCHO_AUTHORS=\"$ENV{CARGO_PKG_AUTHORS}\"
)
target_link_libraries(
maraiah-tycho-hermes
Qt5::Core

View File

@ -1,10 +1,8 @@
[package]
name = "maraiah-tycho"
version = "0.1.0"
authors = ["Alison Watson <marrub@greyserv.net>", "Tae Matous"]
description = "Tycho map editor."
edition = "2018"
build = "build.rs"
name = "maraiah-tycho"
version = "0.0.0"
edition = "2018"
build = "build.rs"
[dependencies]
maraiah = {path = "../.."}
@ -12,6 +10,7 @@ memmap = "0.7"
[build-dependencies]
cmake = "0.1"
maraiah = {path = "../.."}
rust_qt_binding_generator = "0.3"
[[bin]]

View File

@ -20,4 +20,12 @@ constexpr std::uint32_t fourCC(std::uint8_t a,
return (a << 24) | (b << 16) | (c << 8) | d;
}
extern "C" {
char const *tychoAuthors();
char const *tychoHomepage();
char const *tychoLicenseText();
char const *tychoRepository();
char const *tychoVersion();
}
// EOF

View File

@ -59,8 +59,8 @@ void Menu::openAbout()
Ui::About about{};
about.setupUi(&dlg);
about.labelVer->setText(tr(TYCHO_VERSION));
about.labelAuthors->setText(tr(TYCHO_AUTHORS).replace(':', '\n'));
about.labelVer->setText(tr(tychoVersion()));
about.labelAuthors->setText(tr(tychoAuthors()).replace(':', '\n'));
dlg.exec();
}

View File

@ -1,5 +1,6 @@
use maraiah::{err::*, ffi};
mod meta;
mod qimpl;
mod qintr;

View File

@ -0,0 +1,25 @@
//! Meta-information exposing functions.
use maraiah::{ffi, meta};
macro_rules! meta_str {
($($name:ident = $e:expr;)*) => {
$(
#[no_mangle]
pub extern "C" fn $name() -> ffi::NT
{
$e
}
)*
}
}
meta_str!(
tychoAuthors = meta::C_AUTHORS;
tychoHomepage = meta::C_HOMEPAGE;
tychoLicenseText = meta::C_LICENSE_TEXT;
tychoRepository = meta::C_REPOSITORY;
tychoVersion = meta::C_VERSION;
);
// EOF

View File

@ -1,3 +1,5 @@
//! Qt implementation.
mod project;
pub use self::project::*;

View File

@ -1,3 +1,4 @@
//! Qt interface.
#![allow(unused_imports)]
#![allow(dead_code)]