Fix Swift runtime not being initialized on Linux
This commit is contained in:
parent
13076ab5b8
commit
149e009152
10
build.rs
10
build.rs
|
@ -11,8 +11,15 @@ fn main() {
|
|||
target.paths.runtime_library_paths.iter().for_each(|path| {
|
||||
println!("cargo:rustc-link-arg=-Wl,-rpath={}", path);
|
||||
});
|
||||
// need to link against libswiftCore and libFoundation
|
||||
|
||||
// link in swiftrt.o, which initializes the swift runtime
|
||||
let arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
|
||||
println!(
|
||||
"cargo:rustc-link-arg={}/linux/{}/swiftrt.o",
|
||||
&target.paths.runtime_resource_path, arch
|
||||
);
|
||||
|
||||
// link against the swift stdlib and all th supporting pieces
|
||||
println!("cargo:rustc-link-lib=dylib=BlocksRuntime");
|
||||
println!("cargo:rustc-link-lib=dylib=dispatch");
|
||||
println!("cargo:rustc-link-lib=dylib=FoundationNetworking");
|
||||
|
@ -59,6 +66,7 @@ pub struct SwiftTargetInfo {
|
|||
#[serde(rename_all = "camelCase")]
|
||||
pub struct SwiftPaths {
|
||||
pub runtime_library_paths: Vec<String>,
|
||||
pub runtime_resource_path: String,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
|
@ -7,15 +7,7 @@ public func highlight(codePtr: UnsafePointer<UInt8>, codeLen: UInt64, htmlLenPtr
|
|||
let data = Data(buffer: buf)
|
||||
let code = String(data: data, encoding: .utf8)!
|
||||
|
||||
print("a")
|
||||
debugPrint(MyOutputFormat())
|
||||
let highligher = SyntaxHighlighter(format: MyOutputFormat())
|
||||
withUnsafePointer(to: highligher) { ptr in
|
||||
debugPrint(UnsafeRawPointer(ptr))
|
||||
}
|
||||
print("b")
|
||||
debugPrint(highligher)
|
||||
debugPrint(code)
|
||||
var html = highligher.highlight(code)
|
||||
let outPtr = UnsafeMutableBufferPointer<UInt8>.allocate(capacity: html.utf8.count)
|
||||
_ = html.withUTF8 { buf in
|
||||
|
|
Loading…
Reference in New Issue