blob: 85c40ee050a5ebb20a2f1f9ead7dfce038c7ae3c [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,
20 SystemZ, X86 & XCore), if you just need several selected archs, choose the ones
21 you want to compile in by opening CMakeLists.txt, then directly editing
22 the options there. This must be done before going to the
23 next steps.
24
25 Capstone has following compile-time options.
26
27 - ARM_SUPPORT: support ARM. Change this to OFF to remove ARM support.
28 - ARM64_SUPPORT: support ARM64. Change this to OFF to remove ARM64 support.
29 - MIPS_SUPPORT: support Mips. Change this to OFF to remove Mips support.
30 - PPC_SUPPORT: support PPC. Change this to OFF to remove PPC support.
31 - SPARC_SUPPORT: support Sparc. Change this to OFF to remove Sparc support.
32 - SYSZ_SUPPORT: support SystemZ. Change this to OFF to remove SystemZ support.
33 - XCORE_SUPPORT: support XCore. Change this to OFF to remove XCore support.
34 - X86_SUPPORT: support X86. Change this to OFF to remove X86 support.
35
36 By default, all 8 architectures are compiled in.
37
38
39 Besides, Capstone also allows some more customization via following macros.
40
41 - USE_SYS_DYN_MEM: change this to OFF to use your own dynamic memory management.
42 - BUILD_DIET: change this to ON to make the binaries more compact.
43 - X86_REDUCE: change this to ON to make X86 binary smaller.
44
45 By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
46 modes are disable.
47
48
49 For each option, refer to docs/README for more details.
50
51
52
53(1) CMake allows you to generate different generators to build Capstone. Below is
54 some examples on how to build Capstone on Windows with CMake.
55
56
57 - To build Capstone using Nmake of Windows SDK, do f:
58
59 mkdir build
60 cd build
61 cmake -G "NMake Makefiles" ..
62 nmake
63
64 After this, find the samples test*.exe, libcapstone_static.lib & libcapstone.dll
65 in the same directory.
66
67
68
69 - To build Capstone using Visual Studio, choose the generator accordingly to the
70 version of Visual Studio on your machine. For example, with Visual Studio 2013, do:
71
72 mkdir build
73 cd build
74 cmake -G "Visual Studio 12" ..
75
76 After this, find libcapstone.sln in the same directory. Open it with Visual Studio
77 and build the solution as usual.
78
79
80
81(2) You can make sure the prior steps successfully worked by launching one of the
82 testing binary (test*.exe).
83