pub fn from_cargo_env(build: &BuildConfiguration) -> Self {
        let features = &build.features;
        let target = cargo::target();

        let mut built_libraries = Vec::new();
        let mut additional_files = Vec::new();
        let feature_ids = features.ids();

        if features.text_layout {
            if target.is_windows() {
                additional_files.push(ICUDTL_DAT.into());
            }
            built_libraries.push(lib::SK_PARAGRAPH.into());
            built_libraries.push(lib::SK_SHAPER.into());
        }

        let mut link_libraries = Vec::new();

        match target.as_strs() {
            (_, "unknown", "linux", _) => {
                link_libraries.extend(vec!["stdc++", "fontconfig", "freetype"]);
                if features.gl {
                    if features.egl {
                        link_libraries.push("EGL");
                    }

                    if features.x11 {
                        link_libraries.push("GL");
                    }

                    if features.wayland {
                        link_libraries.push("wayland-egl");
                        link_libraries.push("GLESv2");
                    }
                }
            }
            (_, "apple", "darwin", _) => {
                link_libraries.extend(vec!["c++", "framework=ApplicationServices"]);
                if features.gl {
                    link_libraries.push("framework=OpenGL");
                }
                if features.metal {
                    link_libraries.push("framework=Metal");
                    // MetalKit was added in m87 BUILD.gn.
                    link_libraries.push("framework=MetalKit");
                    link_libraries.push("framework=Foundation");
                }
            }
            (_, _, "windows", Some("msvc")) => {
                link_libraries.extend(&["usp10", "ole32", "user32", "gdi32", "fontsub"]);
                if features.gl {
                    link_libraries.push("opengl32");
                }
                if features.d3d {
                    link_libraries.extend(&["d3d12", "dxgi", "d3dcompiler"]);
                }
            }
            (_, "linux", "android", _) | (_, "linux", "androideabi", _) => {
                link_libraries.extend(android::link_libraries(features));
            }
            (_, "apple", "ios", _) => {
                link_libraries.extend(ios::link_libraries(features));
            }
            _ => panic!("unsupported target: {:?}", cargo::target()),
        };

        let output_directory = cargo::output_directory()
            .join(SKIA_OUTPUT_DIR)
            .to_str()
            .unwrap()
            .into();

        built_libraries.push(lib::SKIA.into());
        built_libraries.push(lib::SKIA_BINDINGS.into());

        BinariesConfiguration {
            feature_ids: feature_ids.into_iter().map(|f| f.to_string()).collect(),
            output_directory,
            link_libraries: link_libraries
                .into_iter()
                .map(|lib| lib.to_string())
                .collect(),
            built_libraries,
            additional_files,
            skia_debug: build.skia_debug,
        }
    }
/// Build a binaries configuration based on the current environment cargo
/// supplies us with and a Skia build configuration.
Build a binaries configuration based on the current environment cargo
supplies us with and a Skia build configuration.
Build a binaries configuration based on the current environment cargo supplies us with and a Skia build configuration .
pub fn from_cargo_env(build: &BuildConfiguration) -> Self {
        let features = &build.features;
        let target = cargo::target();
        let mut built_libraries = Vec::new();
        let mut additional_files = Vec::new();
        let feature_ids = features.ids();
        if features.text_layout {
            if target.is_windows() {
                additional_files.push(ICUDTL_DAT.into());
            }
            built_libraries.push(lib::SK_PARAGRAPH.into());
            built_libraries.push(lib::SK_SHAPER.into());
        }
        let mut link_libraries = Vec::new();
        match target.as_strs() {
            (_, "unknown", "linux", _) => {
                link_libraries.extend(vec!["stdc++", "fontconfig", "freetype"]);
                if features.gl {
                    if features.egl {
                        link_libraries.push("EGL");
                    }
                    if features.x11 {
                        link_libraries.push("GL");
                    }
                    if features.wayland {
                        link_libraries.push("wayland-egl");
                        link_libraries.push("GLESv2");
                    }
                }
            }
            (_, "apple", "darwin", _) => {
                link_libraries.extend(vec!["c++", "framework=ApplicationServices"]);
                if features.gl {
                    link_libraries.push("framework=OpenGL");
                }
                if features.metal {
                    link_libraries.push("framework=Metal");
                    // MetalKit was added in m87 BUILD.gn.
                    link_libraries.push("framework=MetalKit");
                    link_libraries.push("framework=Foundation");
                }
            }
            (_, _, "windows", Some("msvc")) => {
                link_libraries.extend(&["usp10", "ole32", "user32", "gdi32", "fontsub"]);
                if features.gl {
                    link_libraries.push("opengl32");
                }
                if features.d3d {
                    link_libraries.extend(&["d3d12", "dxgi", "d3dcompiler"]);
                }
            }
            (_, "linux", "android", _) | (_, "linux", "androideabi", _) => {
                link_libraries.extend(android::link_libraries(features));
            }
            (_, "apple", "ios", _) => {
                link_libraries.extend(ios::link_libraries(features));
            }
            _ => panic!("unsupported target: {:?}", cargo::target()),
        };
        let output_directory = cargo::output_directory()
            .join(SKIA_OUTPUT_DIR)
            .to_str()
            .unwrap()
            .into();
        built_libraries.push(lib::SKIA.into());
        built_libraries.push(lib::SKIA_BINDINGS.into());
        BinariesConfiguration {
            feature_ids: feature_ids.into_iter().map(|f| f.to_string()).collect(),
            output_directory,
            link_libraries: link_libraries
                .into_iter()
                .map(|lib| lib.to_string())
                .collect(),
            built_libraries,
            additional_files,
            skia_debug: build.skia_debug,
        }
    }
pub fn from_cargo_env ( build : & BuildConfiguration ) -> Self { let features = & build . features ; let target = cargo :: target ( ) ; let mut built_libraries = Vec :: new ( ) ; let mut additional_files = Vec :: new ( ) ; let feature_ids = features . ids ( ) ; if features . text_layout { if target . is_windows ( ) { additional_files . push ( ICUDTL_DAT . into ( ) ) ; } built_libraries . push ( lib :: SK_PARAGRAPH . into ( ) ) ; built_libraries . push ( lib :: SK_SHAPER . into ( ) ) ; } let mut link_libraries = Vec :: new ( ) ; match target . as_strs ( ) { ( _ , " " , " " , _ ) => { link_libraries . extend ( vec ! [ " " " " " " ] ) ; if features . gl { if features . egl { link_libraries . push ( " " ) ; } if features . x11 { link_libraries . push ( " " ) ; } if features . wayland { link_libraries . push ( " " ) ; link_libraries . push ( " " ) ; } } } ( _ , " " , " " , _ ) => { link_libraries . extend ( vec ! [ " " " " ] ) ; if features . gl { link_libraries . push ( " " ) ; } if features . metal { link_libraries . push ( " " ) ; // MetalKit was added in m87 BUILD.gn. link_libraries . push ( " " ) ; link_libraries . push ( " " ) ; } } ( _ , _ , " " , Some ( " " ) ) => { link_libraries . extend ( & [ " " , " " , " " , " " , " " ] ) ; if features . gl { link_libraries . push ( " " ) ; } if features . d3d { link_libraries . extend ( & [ " " , " " , " " ] ) ; } } ( _ , " " , " " , _ ) | ( _ , " " , " " , _ ) => { link_libraries . extend ( android :: link_libraries ( features ) ) ; } ( _ , " " , " " , _ ) => { link_libraries . extend ( ios :: link_libraries ( features ) ) ; } _ => panic ! ( " " cargo target ( ) ) , } ; let output_directory = cargo :: output_directory ( ) . join ( SKIA_OUTPUT_DIR ) . to_str ( ) . unwrap ( ) . into ( ) ; built_libraries . push ( lib :: SKIA . into ( ) ) ; built_libraries . push ( lib :: SKIA_BINDINGS . into ( ) ) ; BinariesConfiguration { feature_ids : feature_ids . into_iter ( ) . map ( | f | f . to_string ( ) ) . collect ( ) , output_directory , link_libraries : link_libraries . into_iter ( ) . map ( | lib | lib . to_string ( ) ) . collect ( ) , built_libraries , additional_files , skia_debug : build . skia_debug , } }
Build a binaries configuration based on the current environment cargo
supplies us with and a Skia build configuration.
Build a binaries configuration based on the current environment cargo supplies us with and a Skia build configuration .
build
&BuildConfiguration
build
&BuildConfiguration