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 @@
+
+
+
+
+
+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.
+
+
+gcc::compile_library("libfoo.a", &["foo.c", "bar.c"]);
+
+
+
+
+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.
+
+
+
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");
+}
+
+
+
+
+ Config |
+
+ Extra configuration to pass to gcc.
+
+ |
+
+
+
+
+ compile_library |
+
+ Compile a library from the given set of input C files.
+
+ |
+
+
+
+
+pub struct Config {
+ // some fields omitted
+}
Extra configuration to pass to gcc.
+
Methods
+
Construct a new instance of a blank set of configuration.
+
+
This builder is finished with the compile
function.
+
+
Add a directory to the -I
or include path for headers
+
+
Specify a -D
variable with an optional value.
+
+
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
+
+
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.
+
+
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
+
+