mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-03 16:44:33 +00:00
add preprocess host cli option
This commit is contained in:
parent
f0e3d65bc9
commit
8e86640bd7
3 changed files with 52 additions and 7 deletions
|
@ -4,9 +4,10 @@ use roc_build::link::LinkType;
|
|||
use roc_build::program::{check_file, CodeGenBackend};
|
||||
use roc_cli::{
|
||||
build_app, format_files, format_src, test, BuildConfig, FormatMode, CMD_BUILD, CMD_CHECK,
|
||||
CMD_DEV, CMD_DOCS, CMD_FORMAT, CMD_GEN_STUB_LIB, CMD_GLUE, CMD_REPL, CMD_RUN, CMD_TEST,
|
||||
CMD_VERSION, DIRECTORY_OR_FILES, FLAG_CHECK, FLAG_DEV, FLAG_LIB, FLAG_NO_LINK, FLAG_OUTPUT,
|
||||
FLAG_STDIN, FLAG_STDOUT, FLAG_TARGET, FLAG_TIME, GLUE_DIR, GLUE_SPEC, ROC_FILE,
|
||||
CMD_DEV, CMD_DOCS, CMD_FORMAT, CMD_GEN_STUB_LIB, CMD_GLUE, CMD_PREPROCESS_HOST, CMD_REPL,
|
||||
CMD_RUN, CMD_TEST, CMD_VERSION, DIRECTORY_OR_FILES, FLAG_CHECK, FLAG_DEV, FLAG_LIB,
|
||||
FLAG_NO_LINK, FLAG_OUTPUT, FLAG_STDIN, FLAG_STDOUT, FLAG_TARGET, FLAG_TIME, GLUE_DIR,
|
||||
GLUE_SPEC, ROC_FILE,
|
||||
};
|
||||
use roc_docs::generate_docs_html;
|
||||
use roc_error_macros::user_error;
|
||||
|
@ -131,7 +132,33 @@ fn main() -> io::Result<()> {
|
|||
RocCacheDir::Persistent(cache::roc_cache_dir().as_path()),
|
||||
&target.to_triple(),
|
||||
function_kind,
|
||||
)
|
||||
);
|
||||
Ok(0)
|
||||
}
|
||||
Some((CMD_PREPROCESS_HOST, matches)) => {
|
||||
let input_path = matches.get_one::<PathBuf>(ROC_FILE).unwrap();
|
||||
let target = matches
|
||||
.get_one::<String>(FLAG_TARGET)
|
||||
.and_then(|s| Target::from_str(s).ok())
|
||||
.unwrap_or_default();
|
||||
|
||||
let triple = target.to_triple();
|
||||
let function_kind = FunctionKind::LambdaSet;
|
||||
let (platform_path, stub_lib, stub_dll_symbols) = roc_linker::generate_stub_lib(
|
||||
&input_path,
|
||||
RocCacheDir::Persistent(cache::roc_cache_dir().as_path()),
|
||||
&triple,
|
||||
function_kind,
|
||||
);
|
||||
|
||||
roc_linker::preprocess_host(
|
||||
&triple,
|
||||
&platform_path.with_file_name("main.roc"),
|
||||
&platform_path.with_file_name("linux-x64.rh"),
|
||||
&stub_lib,
|
||||
&stub_dll_symbols,
|
||||
);
|
||||
Ok(0)
|
||||
}
|
||||
Some((CMD_BUILD, matches)) => {
|
||||
let target = matches
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue