The first method is suitable for relatively small-sized programs, micro benchmarks, test cases, or already gyp-ified projects, while the latter works best for large projects that are hard to convert to gyp. First Method: Gyp-based LLVM BinariesBuilding the LLVM BinariesAll Cloud9 built-in testing targets reside under
$CLOUD9_ROOT/src/testing_targets . We will call that $TARGETS_ROOT . The gclient sync command automatically generates Makefiles for them. However, if new targets are added, the build files need to be regenerated:$ $TARGETS_ROOT/build/gyp_testing_targets The targets are build all at once by running:
$ $TARGETS_ROOT/build/make_all NOTE: OpenType Sanitizer, part of the bundled testing targets, requires the libfreetype6-dev package to build properly.Adding new LLVM Testing TargetsCloud9's LLVM build system is based on the gyp build files generator system, similar in goals with CMake or SCons. Documenting the gyp syntax is beyond our scope, so please consult the tool's own documentation. To add your code to the LLVM build system, you need to:
Do not forget to regenerate the project files and rebuild. You should find your LLVM binary in the out/Default directory (relative to the testing_targets directory).Second Method: In Situ LLVM BinariesCloud9 makes it easy to build LLVM binaries for external programs. Assuming that the program is compiled using the standard
./configure && make procedure, one generates LLVM binaries as follows:
For each final executable binary, this procedure generates both a native x86 form program, as well as an LLVM bitcode version program.bc. The .bc file is used by Cloud9 for testing. Advanced LLVM BuildingCloud9 uses a set of proxy scripts that play the role of the building tools (
gcc , g++ , ar , ranlib , nm ). When run, these scripts invoke in turn the corresponding actual tools, based on a set of rules. By default, the tools invoked are configured to produce LLVM binaries.In some cases, you may need to change the behavior of the proxy scripts. Cloud9 offers 3 possible configurations, which are set through the
LLVM_BUILD_MODE environment variable:
For instance, if we need to run the
./configure part of the building process using GCC, so the configuration would detect GCC specific features, we execute:$ source $TARGETS_ROOT/build/prepare_build_env.sh $ export LLVM_BUILD_MODE="gcc" $ ./configure $ export LLVM_BUILD_MODE="llvm" $ make ./configure script picks up the proxy scripts as the building tools. This means that we don't have to change anything in the generated configuration, since the same tools are used for the building process, except that they would behave differently depending on the value of LLVM_BUILD_MODE .Compiling C++ ProgramsClang's libcxx is part of the Cloud9 LLVM testing targets, and thus it is build automatically. To build C++ programs, you need to either:
|
Testing Programs >