Add missing file

master
Jos van den Oever 2018-09-28 12:24:30 +02:00
parent d7e4f1362d
commit d6e88b0ab6
2 changed files with 31 additions and 22 deletions

View File

@ -1,22 +0,0 @@
if (ECM_FOUND)
ecm_create_qm_loader(rust_qt_binding_generator_QM_LOADER rust_qt_binding_generator_qt)
endif()
add_executable(rust_qt_binding_generator main.cpp
parseJson.cpp cpp.cpp rust.cpp helper.cpp
${rust_qt_binding_generator_QM_LOADER}
)
target_link_libraries(rust_qt_binding_generator
Qt5::Core
)
set_target_properties(rust_qt_binding_generator PROPERTIES
CXX_STANDARD 11
CXX_STANDARD_REQUIRED ON
)
if (ECM_FOUND)
install(TARGETS rust_qt_binding_generator ${KDE_INSTALL_TARGETS_DEFAULT_ARGS})
else()
install(TARGETS rust_qt_binding_generator RUNTIME DESTINATION bin)
endif()

View File

@ -0,0 +1,31 @@
extern crate clap;
extern crate rust_qt_binding_generator;
use clap::{Arg, App};
use rust_qt_binding_generator::*;
fn main() {
let matches = App::new("rust_qt_binding_generator")
.version("0.1.0")
.about("Generates bindings between Qt and Rust")
.arg(
Arg::with_name("overwrite-implementation")
.long("overwrite-implementation")
.help("Overwrite existing implementation."),
)
.arg(
Arg::with_name("config")
.multiple(true)
.required(true)
.takes_value(true)
.help("Configuration file(s)"),
)
.get_matches();
let overwrite_implementation = matches.is_present("overwrite-implementation");
for config in matches.values_of("config").unwrap() {
if let Err(e) = generate_rust_qt_bindings(config, overwrite_implementation) {
eprintln!("{}", e);
::std::process::exit(1);
}
}
}