blob: 0d413748489a674c24b8f90889bbcc624ff82073 [file] [log] [blame]
Nguyen Anh Quynhf1c3acb2014-05-28 22:39:23 +08001This documentation explains how to compile Capstone with CMake, focus on
2using Microsoft Visual C as the compiler.
3
4To compile Capstone on *nix, see COMPILE.TXT.
5
6To compile Capstone on Windows using Visual Studio, see COMPILE_MSVC.TXT.
7
8 *-*-*-*-*-*
9
10This documentation requires CMake & Windows SDK or MS Visual Studio installed on
11your machine.
12
13Get CMake for free from http://www.cmake.org.
14
15
16
17(0) Tailor Capstone to your need.
18
19 Out of 8 archtitectures supported by Capstone (Arm, Arm64, Mips, PPC, Sparc,
Nguyen Anh Quynhea16de92014-05-29 00:14:50 +080020 SystemZ, X86 & XCore), if you just need several selected archs, run "cmake"
21 with the unwanted archs disabled (set to 0) as followings.
Nguyen Anh Quynhf1c3acb2014-05-28 22:39:23 +080022
Nguyen Anh Quynhea16de92014-05-29 00:14:50 +080023 - ARM_SUPPORT: support ARM. Run cmake with -DARM_SUPPORT=0 to remove ARM.
24 - ARM64_SUPPORT: support ARM64. Run cmake with -DARM64_SUPPORT=0 to remove ARM64.
25 - MIPS_SUPPORT: support Mips. Run cmake with -DMIPS_SUPPORT=0 to remove Mips.
26 - PPC_SUPPORT: support PPC. Run cmake with -DPPC_SUPPORT=0 to remove PPC.
27 - SPARC_SUPPORT: support Sparc. Run cmake with -DSPARC_SUPPORT=0 to remove Sparc.
28 - SYSZ_SUPPORT: support SystemZ. Run cmake with -DSYSZ_SUPPORT=0 to remove SystemZ.
29 - XCORE_SUPPORT: support XCore. Run cmake with -DXCORE_SUPPORT=0 to remove XCore.
30 - X86_SUPPORT: support X86. Run cmake with -DX86_SUPPORT=0 to remove X86.
Nguyen Anh Quynhf1c3acb2014-05-28 22:39:23 +080031
32 By default, all 8 architectures are compiled in.
33
34
35 Besides, Capstone also allows some more customization via following macros.
36
37 - USE_SYS_DYN_MEM: change this to OFF to use your own dynamic memory management.
38 - BUILD_DIET: change this to ON to make the binaries more compact.
39 - X86_REDUCE: change this to ON to make X86 binary smaller.
40
41 By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
Nguyen Anh Quynhea16de92014-05-29 00:14:50 +080042 modes are disable. To use your own memory allocations, turn ON both DIET &
43 X86_REDUCE, run "cmake" with: -DUSE_SYS_DYN_MEM=0 -DBUILD_DIET=1 -DX86_REDUCE=1
Nguyen Anh Quynhf1c3acb2014-05-28 22:39:23 +080044
45
46 For each option, refer to docs/README for more details.
47
48
49
50(1) CMake allows you to generate different generators to build Capstone. Below is
51 some examples on how to build Capstone on Windows with CMake.
52
53
54 - To build Capstone using Nmake of Windows SDK, do f:
55
56 mkdir build
57 cd build
58 cmake -G "NMake Makefiles" ..
59 nmake
60
61 After this, find the samples test*.exe, libcapstone_static.lib & libcapstone.dll
62 in the same directory.
63
64
65
66 - To build Capstone using Visual Studio, choose the generator accordingly to the
67 version of Visual Studio on your machine. For example, with Visual Studio 2013, do:
68
69 mkdir build
70 cd build
71 cmake -G "Visual Studio 12" ..
72
73 After this, find libcapstone.sln in the same directory. Open it with Visual Studio
74 and build the solution as usual.
75
76
77
78(2) You can make sure the prior steps successfully worked by launching one of the
79 testing binary (test*.exe).
80