Skip to content

Commit

Permalink
refactor(client_core): ♻️ Port FFE to Rust and remove all C++ code (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
zmerp authored Nov 21, 2024
1 parent ec82fc3 commit d7f69a6
Show file tree
Hide file tree
Showing 401 changed files with 337 additions and 64,094 deletions.
3 changes: 0 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
* text=auto eol=lf

alvr/client_core/cpp/VrApi_* linguist-vendored
alvr/client_core/cpp/glm/** linguist-vendored
alvr/client_core/cpp/tinygltf/** linguist-vendored
alvr/server_openvr/cpp/alvr_server/include/** linguist-vendored
alvr/server_openvr/cpp/alvr_server/nvEncodeAPI.h linguist-vendored
alvr/server_openvr/cpp/platform/win32/NvCodecUtils.h linguist-vendored
Expand Down
48 changes: 1 addition & 47 deletions alvr/client_core/build.rs
Original file line number Diff line number Diff line change
@@ -1,59 +1,13 @@
use std::{env, path::PathBuf};

fn main() {
let platform_name = env::var("CARGO_CFG_TARGET_OS").unwrap();
let platform_name = std::env::var("CARGO_CFG_TARGET_OS").unwrap();

if platform_name == "android" {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());

let cpp_paths = walkdir::WalkDir::new("cpp")
.into_iter()
.filter_map(|maybe_entry| maybe_entry.ok())
.map(|entry| entry.into_path())
.collect::<Vec<_>>();

if cfg!(feature = "use-cpp") {
let source_files_paths = cpp_paths
.iter()
.filter(|&path| {
path.extension()
.filter(|ext| ext.to_string_lossy() == "cpp")
.is_some()
})
.cloned()
.collect::<Vec<_>>();

cc::Build::new()
.cpp(true)
.files(source_files_paths)
.include("cpp")
.include("cpp/gl_render_utils")
.flag("-std=c++17")
.flag("-fexceptions")
.flag("-frtti")
.cpp_link_stdlib("c++_static")
.compile("bindings");

bindgen::builder()
.clang_arg("-xc++")
.header("cpp/bindings.h")
.derive_default(true)
.generate()
.unwrap()
.write_to_file(out_dir.join("bindings.rs"))
.unwrap();
}

println!("cargo:rustc-link-lib=log");
println!("cargo:rustc-link-lib=EGL");
println!("cargo:rustc-link-lib=GLESv3");
println!("cargo:rustc-link-lib=android");

#[cfg(feature = "link-stdcpp-shared")]
println!("cargo:rustc-link-lib=c++_shared");

for path in cpp_paths {
println!("cargo:rerun-if-changed={}", path.to_string_lossy());
}
}
}
123 changes: 0 additions & 123 deletions alvr/client_core/cpp/VrApi_Config.h

This file was deleted.

Loading

0 comments on commit d7f69a6

Please sign in to comment.