mirror of
https://github.com/capstone-engine/capstone.git
synced 2024-11-23 13:39:46 +00:00
81 lines
2.8 KiB
Plaintext
81 lines
2.8 KiB
Plaintext
This documentation explains how to compile Capstone with CMake, focus on
|
|
using Microsoft Visual C as the compiler.
|
|
|
|
To compile Capstone on *nix, see COMPILE.TXT.
|
|
|
|
To compile Capstone on Windows using Visual Studio, see COMPILE_MSVC.TXT.
|
|
|
|
*-*-*-*-*-*
|
|
|
|
This documentation requires CMake & Windows SDK or MS Visual Studio installed on
|
|
your machine.
|
|
|
|
Get CMake for free from http://www.cmake.org.
|
|
|
|
|
|
|
|
(0) Tailor Capstone to your need.
|
|
|
|
Out of 8 archtitectures supported by Capstone (Arm, Arm64, Mips, PPC, Sparc,
|
|
SystemZ, X86 & XCore), if you just need several selected archs, run "cmake"
|
|
with the unwanted archs disabled (set to 0) as followings.
|
|
|
|
- ARM_SUPPORT: support ARM. Run cmake with -DARM_SUPPORT=0 to remove ARM.
|
|
- ARM64_SUPPORT: support ARM64. Run cmake with -DARM64_SUPPORT=0 to remove ARM64.
|
|
- MIPS_SUPPORT: support Mips. Run cmake with -DMIPS_SUPPORT=0 to remove Mips.
|
|
- PPC_SUPPORT: support PPC. Run cmake with -DPPC_SUPPORT=0 to remove PPC.
|
|
- SPARC_SUPPORT: support Sparc. Run cmake with -DSPARC_SUPPORT=0 to remove Sparc.
|
|
- SYSZ_SUPPORT: support SystemZ. Run cmake with -DSYSZ_SUPPORT=0 to remove SystemZ.
|
|
- XCORE_SUPPORT: support XCore. Run cmake with -DXCORE_SUPPORT=0 to remove XCore.
|
|
- X86_SUPPORT: support X86. Run cmake with -DX86_SUPPORT=0 to remove X86.
|
|
|
|
By default, all 8 architectures are compiled in.
|
|
|
|
|
|
Besides, Capstone also allows some more customization via following macros.
|
|
|
|
- USE_SYS_DYN_MEM: change this to OFF to use your own dynamic memory management.
|
|
- BUILD_DIET: change this to ON to make the binaries more compact.
|
|
- X86_REDUCE: change this to ON to make X86 binary smaller.
|
|
|
|
By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE
|
|
modes are disable. To use your own memory allocations, turn ON both DIET &
|
|
X86_REDUCE, run "cmake" with: -DUSE_SYS_DYN_MEM=0 -DBUILD_DIET=1 -DX86_REDUCE=1
|
|
|
|
|
|
For each option, refer to docs/README for more details.
|
|
|
|
|
|
|
|
(1) CMake allows you to generate different generators to build Capstone. Below is
|
|
some examples on how to build Capstone on Windows with CMake.
|
|
|
|
|
|
(*) To build Capstone using Nmake of Windows SDK, do:
|
|
|
|
mkdir build
|
|
cd build
|
|
cmake -G "NMake Makefiles" ..
|
|
nmake
|
|
|
|
After this, find the samples test*.exe, libcapstone_static.lib & libcapstone.dll
|
|
in the same directory.
|
|
|
|
|
|
|
|
(*) To build Capstone using Visual Studio, choose the generator accordingly to the
|
|
version of Visual Studio on your machine. For example, with Visual Studio 2013, do:
|
|
|
|
mkdir build
|
|
cd build
|
|
cmake -G "Visual Studio 12" ..
|
|
|
|
After this, find capstone.sln in the same directory. Open it with Visual Studio
|
|
and build the solution including libraries & all test as usual.
|
|
|
|
|
|
|
|
(2) You can make sure the prior steps successfully worked by launching one of the
|
|
testing binary (test*.exe).
|
|
|