mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
Add Rojo C API experiment
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,6 +1,9 @@
|
||||
# Rust output directory
|
||||
/target
|
||||
|
||||
# Headers for clibrojo
|
||||
/include
|
||||
|
||||
# Roblox model and place files in the root, used for debugging
|
||||
/*.rbxm
|
||||
/*.rbxmx
|
||||
|
||||
7
Cargo.lock
generated
7
Cargo.lock
generated
@@ -181,6 +181,13 @@ dependencies = [
|
||||
"vec_map 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clibrojo"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"rojo 0.6.0-dev",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "clicolors-control"
|
||||
version = "1.0.1"
|
||||
|
||||
@@ -26,12 +26,14 @@ user-plugins = []
|
||||
members = [
|
||||
"rojo-test",
|
||||
"rojo-insta-ext",
|
||||
"clibrojo",
|
||||
]
|
||||
|
||||
default-members = [
|
||||
".",
|
||||
"rojo-test",
|
||||
"rojo-insta-ext",
|
||||
"clibrojo",
|
||||
]
|
||||
|
||||
[lib]
|
||||
|
||||
13
clibrojo/Cargo.toml
Normal file
13
clibrojo/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "clibrojo"
|
||||
version = "0.1.0"
|
||||
authors = ["Lucien Greathouse <me@lpghatguy.com>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
||||
[dependencies]
|
||||
rojo = { path = ".." }
|
||||
4
clibrojo/README.md
Normal file
4
clibrojo/README.md
Normal file
@@ -0,0 +1,4 @@
|
||||
# Rojo as a C Library
|
||||
This is an experiment to expose a C API for Rojo that would be suitable for embedding it into an existing C/C++ application.
|
||||
|
||||
I'm hoping to expand it to drop the HTTP layer and communicate through a channel, which could make it feasible to embed into an existing Roblox IDE with minimal changes or additional code.
|
||||
14
clibrojo/src/lib.rs
Normal file
14
clibrojo/src/lib.rs
Normal file
@@ -0,0 +1,14 @@
|
||||
use std::{ffi::CStr, os::raw::c_char, path::PathBuf};
|
||||
|
||||
use librojo::commands::{serve, ServeOptions};
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn rojo_serve(path: *const c_char) {
|
||||
let path = unsafe { PathBuf::from(CStr::from_ptr(path).to_str().unwrap()) };
|
||||
|
||||
serve(&ServeOptions {
|
||||
fuzzy_project_path: path,
|
||||
port: None,
|
||||
})
|
||||
.unwrap();
|
||||
}
|
||||
Reference in New Issue
Block a user