• Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Build Prerequisites:
2
3  * CMake[1] 2.8.8 or later is required.
4
5  * Perl 5.6.1 or later is required. On Windows, Strawberry Perl and MSYS Perl
6    have both been reported to work. If not found by CMake, it may be configured
7    explicitly by setting PERL_EXECUTABLE.
8
9  * On Windows you currently must use Ninja[2] to build; on other platforms,
10    it is not required, but recommended, because it makes builds faster.
11
12  * If you need to build Ninja from source, then a recent version of
13    Python[3] is required (Python 2.7.5 works).
14
15  * On Windows only, Yasm[4] is required. If not found by CMake, it may be
16    configured explicitly by setting CMAKE_ASM_NASM_COMPILER.
17
18  * A C compiler is required. On Windows, MSVC 12 (Visual Studio 2013) or later
19    with Platform SDK 8.1 or later are supported. Recent versions of GCC and
20    Clang should work on non-Windows platforms, and maybe on Windows too.
21
22  * Go[5] is required. If not found by CMake, the go executable may be
23    configured explicitly by setting GO_EXECUTABLE.
24
25Using Ninja (note the 'N' is capitalized in the cmake invocation):
26
27  mkdir build
28  cd build
29  cmake -GNinja ..
30  ninja
31
32Using makefiles (does not work on Windows):
33
34  mkdir build
35  cd build
36  cmake ..
37  make
38
39You usually don't need to run cmake again after changing CMakeLists.txt files
40because the build scripts will detect changes to them and rebuild themselves
41automatically.
42
43Note that the default build flags in the top-level CMakeLists.txt are for
44debugging - optimisation isn't enabled.
45
46If you want to cross-compile then there is an example toolchain file for
4732-bit Intel in util/. Wipe out the build directory, recreate it and run cmake
48like this:
49
50  cmake -DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake -GNinja ..
51
52If you want to build as a shared library, pass -DBUILD_SHARED_LIBS=1. On
53Windows, where functions need to be tagged with "dllimport" when coming from a
54shared library, define BORINGSSL_SHARED_LIBRARY in any code which #includes the
55BoringSSL headers.
56
57
58Building for Android:
59
60It's possible to build BoringSSL with the Android NDK using CMake. This has
61been tested with version 10d of the NDK.
62
63Unpack the Android NDK somewhere and export ANDROID_NDK to point to the
64directory. Clone https://github.com/taka-no-me/android-cmake into util/.
65Then make a build directory as above and run CMake *twice* like this:
66
67  cmake -DANDROID_NATIVE_API_LEVEL=android-9 \
68        -DANDROID_ABI=armeabi-v7a \
69        -DCMAKE_TOOLCHAIN_FILE=../util/android-cmake/android.toolchain.cmake \
70        -GNinja ..
71
72Once you've run that twice, ninja should produce Android-compatible binaries.
73You can replace "armeabi-v7a" in the above with "arm64-v8a" to build aarch64
74binaries.
75
76
77Known Limitations on Windows:
78
79  * Versions of cmake since 3.0.2 have a bug in its Ninja generator that causes
80    yasm to output warnings "yasm: warning: can open only one input file, only
81    the last file will be processed". These warnings can be safely ignored.
82    The cmake bug is http://www.cmake.org/Bug/view.php?id=15253.
83
84  * cmake can generate Visual Studio projects, but the generated project files
85    don't have steps for assembling the assembly language source files, so they
86    currently cannot be used to build BoringSSL.
87
88[1] http://www.cmake.org/download/
89
90[2] https://martine.github.io/ninja/
91
92[3] https://www.python.org/downloads/
93
94[4] http://yasm.tortall.net/
95
96[5] https://golang.org/dl/
97