From 64106c4d3d4ddba8c7bc2af75376e6d3d3d75601 Mon Sep 17 00:00:00 2001 From: Date: Mon, 29 Jun 2015 20:16:15 +0000 Subject: Update documentation --- gcc/fn.compile_library.html | 113 +++++++++++++++++++++++++++++++ gcc/index.html | 161 ++++++++++++++++++++++++++++++++++++++++++++ gcc/sidebar-items.js | 1 + gcc/struct.Config.html | 160 +++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 435 insertions(+) create mode 100644 gcc/fn.compile_library.html create mode 100644 gcc/index.html create mode 100644 gcc/sidebar-items.js create mode 100644 gcc/struct.Config.html (limited to 'gcc') diff --git a/gcc/fn.compile_library.html b/gcc/fn.compile_library.html new file mode 100644 index 0000000..c5b651e --- /dev/null +++ b/gcc/fn.compile_library.html @@ -0,0 +1,113 @@ + + + + + + + + + + gcc::compile_library - Rust + + + + + + + + + + + + + + + +
+

Function gcc::compile_library + + [] + + [src]

+
pub fn compile_library(output: &str, files: &[&str])

Compile a library from the given set of input C files.

+ +

This will simply compile all files into object files and then assemble them +into the output. This will read the standard environment variables to detect +cross compilations and such.

+ +

This function will also print all metadata on standard output for Cargo.

+ +

Example

+gcc::compile_library("libfoo.a", &["foo.c", "bar.c"]);
+
+
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gcc/index.html b/gcc/index.html new file mode 100644 index 0000000..1953b95 --- /dev/null +++ b/gcc/index.html @@ -0,0 +1,161 @@ + + + + + + + + + + gcc - Rust + + + + + + + + + + + + + + + +
+

Crate gcc + + [] + + [src]

+

A library for build scripts to compile custom C code

+ +

This library is intended to be used as a build-dependencies entry in +Cargo.toml:

+ +
[build-dependencies]
+gcc = "0.2"
+
+ +

The purpose of this crate is to provide the utility functions necessary to +compile C code into a static archive which is then linked into a Rust crate. +The top-level compile_library function serves as a convenience and more +advanced configuration is available through the Config builder.

+ +

This crate will automatically detect situations such as cross compilation or +other environment variables set by Cargo and will build code appropriately.

+ +

Examples

+

Use the default configuration:

+
+extern crate gcc;
+
+fn main() {
+    gcc::compile_library("libfoo.a", &["src/foo.c"]);
+}
+
+ +

Use more advanced configuration:

+
+extern crate gcc;
+
+fn main() {
+    gcc::Config::new()
+                .file("src/foo.c")
+                .define("FOO", Some("bar"))
+                .include("src")
+                .compile("libfoo.a");
+}
+
+

Structs

+ + + + + +
Config +

Extra configuration to pass to gcc.

+ +

Functions

+ + + + + +
compile_library +

Compile a library from the given set of input C files.

+ +
+ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/gcc/sidebar-items.js b/gcc/sidebar-items.js new file mode 100644 index 0000000..dcb451c --- /dev/null +++ b/gcc/sidebar-items.js @@ -0,0 +1 @@ +initSidebarItems({"fn":[["compile_library","Compile a library from the given set of input C files."]],"struct":[["Config","Extra configuration to pass to gcc."]]}); \ No newline at end of file diff --git a/gcc/struct.Config.html b/gcc/struct.Config.html new file mode 100644 index 0000000..3675d21 --- /dev/null +++ b/gcc/struct.Config.html @@ -0,0 +1,160 @@ + + + + + + + + + + gcc::Config - Rust + + + + + + + + + + + + + + + +
+

Struct gcc::Config + + [] + + [src]

+
pub struct Config {
+    // some fields omitted
+}

Extra configuration to pass to gcc.

+

Methods

impl Config

fn new() -> Config

+

Construct a new instance of a blank set of configuration.

+ +

This builder is finished with the compile function.

+

fn include<P: AsRef<Path>>(&mut self, dir: P) -> &mut Config

+

Add a directory to the -I or include path for headers

+

fn define(&mut self, var: &str, val: Option<&str>) -> &mut Config

+

Specify a -D variable with an optional value.

+

fn object<P: AsRef<Path>>(&mut self, obj: P) -> &mut Config

+

Add an arbitrary object file to link in

+

fn flag(&mut self, flag: &str) -> &mut Config

+

Add an arbitrary flag to the invocation of the compiler

+

fn file<P: AsRef<Path>>(&mut self, p: P) -> &mut Config

+

Add a file which will be compiled

+

fn cpp(&mut self, cpp: bool) -> &mut Config

+

Set C++ support.

+ +

The other cpp_* options will only become active if this is set to +true.

+
+

Set the standard library to link against when compiling with C++ +support.

+ +

The default value of this property depends on the current target: On +OS X Some("c++") is used, when compiling for a Visual Studio based +target None is used and for other targets Some("stdc++") is used.

+ +

A value of None indicates that no automatic linking should happen, +otherwise cargo will link against the specified library.

+ +

The given library name must not contain the lib prefix.

+

fn cpp_set_stdlib(&mut self, cpp_set_stdlib: Option<&str>) -> &mut Config

+

Force the C++ compiler to use the specified standard library.

+ +

Setting this option will automatically set cpp_link_stdlib to the same +value.

+ +

The default value of this option is always None.

+ +

This option has no effect when compiling for a Visual Studio based +target.

+ +

This option sets the -stdlib flag, which is only supported by some +compilers (clang, icc) but not by others (gcc). The library will not +detect which compiler is used, as such it is the responsibility of the +caller to ensure that this option is only used in conjuction with a +compiler which supports the -stdlib flag.

+ +

A value of None indicates that no specific C++ standard library should +be used, otherwise -stdlib is added to the compile invocation.

+ +

The given library name must not contain the lib prefix.

+

fn compile(&self, output: &str)

+

Run the compiler, generating the file output

+ +

The name output must begin with lib and end with .a

+
+ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3