diff --git a/source/tycho/CMakeLists.txt b/source/tycho/CMakeLists.txt index d905cc5..9be20d5 100644 --- a/source/tycho/CMakeLists.txt +++ b/source/tycho/CMakeLists.txt @@ -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 diff --git a/source/tycho/Cargo.toml b/source/tycho/Cargo.toml index a62ac1f..ef63210 100644 --- a/source/tycho/Cargo.toml +++ b/source/tycho/Cargo.toml @@ -1,10 +1,8 @@ [package] -name = "maraiah-tycho" -version = "0.1.0" -authors = ["Alison Watson ", "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]] diff --git a/source/tycho/cc_headers/tycho.h b/source/tycho/cc_headers/tycho.h index 8f372b1..9349140 100644 --- a/source/tycho/cc_headers/tycho.h +++ b/source/tycho/cc_headers/tycho.h @@ -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 diff --git a/source/tycho/cc_source/menu.cc b/source/tycho/cc_source/menu.cc index 8bb48fc..e98dd6d 100644 --- a/source/tycho/cc_source/menu.cc +++ b/source/tycho/cc_source/menu.cc @@ -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(); } diff --git a/source/tycho/source/main.rs b/source/tycho/source/main.rs index e9de90d..15625f4 100644 --- a/source/tycho/source/main.rs +++ b/source/tycho/source/main.rs @@ -1,5 +1,6 @@ use maraiah::{err::*, ffi}; +mod meta; mod qimpl; mod qintr; diff --git a/source/tycho/source/meta.rs b/source/tycho/source/meta.rs new file mode 100644 index 0000000..06e2c3e --- /dev/null +++ b/source/tycho/source/meta.rs @@ -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 diff --git a/source/tycho/source/qimpl.rs b/source/tycho/source/qimpl.rs index eab3ea9..42fb7f5 100644 --- a/source/tycho/source/qimpl.rs +++ b/source/tycho/source/qimpl.rs @@ -1,3 +1,5 @@ +//! Qt implementation. + mod project; pub use self::project::*; diff --git a/source/tycho/source/qintr.rs b/source/tycho/source/qintr.rs index 06341b8..5351b6a 100644 --- a/source/tycho/source/qintr.rs +++ b/source/tycho/source/qintr.rs @@ -1,3 +1,4 @@ +//! Qt interface. #![allow(unused_imports)] #![allow(dead_code)]