blob: d818f9504aa21579fc36c1b5f4dde4e8c427c880 [file] [log] [blame]
Brian Smithed30c0d2015-01-23 15:13:17 -08001Build 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
David Benjamin3ce3c362015-02-23 13:06:19 -05006 have both been reported to work. If not found by CMake, it may be configured
7 explicitly by setting PERL_EXECUTABLE.
Brian Smithed30c0d2015-01-23 15:13:17 -08008
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
David Benjamin3ce3c362015-02-23 13:06:19 -050015 * On Windows only, Yasm[4] is required. If not found by CMake, it may be
16 configured explicitly by setting CMAKE_ASM_NASM_COMPILER.
Brian Smithed30c0d2015-01-23 15:13:17 -080017
18 * A C compiler is required. On Windows, MSVC 12 (Visual Studio 2013) or later
Brian Smithdc94b542015-01-27 23:06:00 -080019 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.
Brian Smithed30c0d2015-01-23 15:13:17 -080021
David Benjamind27eda02015-03-05 01:19:27 -050022 * Go[5] is required. If not found by CMake, the go executable may be
23 configured explicitly by setting GO_EXECUTABLE.
Brian Smithed30c0d2015-01-23 15:13:17 -080024
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.
Adam Langley95c29f32014-06-20 12:00:00 -070042
David Benjamin507c1ee2015-01-28 00:50:21 -050043Note that the default build flags in the top-level CMakeLists.txt are for
Adam Langley95c29f32014-06-20 12:00:00 -070044debugging - optimisation isn't enabled.
45
Adam Langley843ab662015-04-28 17:46:58 -070046If 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
Adam Langley95c29f32014-06-20 12:00:00 -070048like this:
49
Adam Langley843ab662015-04-28 17:46:58 -070050 cmake -DCMAKE_TOOLCHAIN_FILE=../util/32-bit-toolchain.cmake -GNinja ..
Adam Langley95c29f32014-06-20 12:00:00 -070051
David Benjamin507c1ee2015-01-28 00:50:21 -050052If 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.
Adam Langleyeb7d2ed2014-07-30 16:02:14 -070056
Adam Langley843ab662015-04-28 17:46:58 -070057
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
Brian Smithed30c0d2015-01-23 15:13:17 -080077Known Limitations on Windows:
David Benjaminbc786a92014-10-31 17:27:40 -040078
Brian Smithed30c0d2015-01-23 15:13:17 -080079 * 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
Brian Smithed30c0d2015-01-23 15:13:17 -080088[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
Brian Smithed30c0d2015-01-23 15:13:17 -080096[5] https://golang.org/dl/