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} $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( target_link_libraries(
maraiah-tycho-hermes maraiah-tycho-hermes
Qt5::Core Qt5::Core

View File

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

View File

@ -20,4 +20,12 @@ constexpr std::uint32_t fourCC(std::uint8_t a,
return (a << 24) | (b << 16) | (c << 8) | d; 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 // EOF

View File

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

View File

@ -1,5 +1,6 @@
use maraiah::{err::*, ffi}; use maraiah::{err::*, ffi};
mod meta;
mod qimpl; mod qimpl;
mod qintr; 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; mod project;
pub use self::project::*; pub use self::project::*;

View File

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