Nguyen Anh Quynh | 61882e5 | 2014-05-18 00:39:49 +0800 | [diff] [blame] | 1 | How To compile Capstone on Windows using Microsoft Visual Studio. |
| 2 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 3 | *-*-*-*-*-* |
| 4 | |
| 5 | Capstone requires no prerequisite packages, so it is easy to compile & install. |
Nguyen Anh Quynh | 61882e5 | 2014-05-18 00:39:49 +0800 | [diff] [blame] | 6 | Open the Visual Studio solution "msvc/capstone.sln" and follow the instructions |
| 7 | below. |
| 8 | |
| 9 | NOTE: This requires Visual Studio 2010 or newer versions. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 10 | |
| 11 | |
| 12 | (0) Tailor Capstone to your need. |
| 13 | |
| 14 | Out of 7 archtitectures supported by Capstone (Arm, Arm64, Mips, PPC, Sparc, |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 15 | SystemZ & X86), if you just need several selected archs, choose the ones you |
| 16 | want to compile in by opening Visual Studio solution "msvc\capstone.sln", then |
| 17 | directly editing the projects "capstone_static" & "capstone_dll" for static |
| 18 | and dynamic libraries, respectively. This must be done before going to the |
| 19 | next steps. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 20 | |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 21 | In VisualStudio interface, modify the preprocessor definitions via |
| 22 | "Project Properties" -> "Configuration Propertis" -> "C/C++" -> "Preprocessor" |
| 23 | to customize Capstone library, as followings. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 24 | |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 25 | - CAPSTONE_HAS_ARM: support ARM. Delete this to remove ARM support. |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 26 | - CAPSTONE_HAS_ARM64: support ARM64. Delete this to remove ARM64 support. |
| 27 | - CAPSTONE_HAS_MIPS: support Mips. Delete this to remove Mips support. |
| 28 | - CAPSTONE_HAS_PPC: support PPC. Delete this to remove PPC support. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 29 | - CAPSTONE_HAS_SPARC: support Sparc. Delete this to remove Sparc support. |
| 30 | - CAPSTONE_HAS_SYSZ: support SystemZ. Delete this to remove SystemZ support. |
| 31 | - CAPSTONE_HAS_X86: support X86. Delete this to remove X86 support. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 32 | |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 33 | By default, all 7 architectures are compiled in. |
| 34 | |
| 35 | |
| 36 | Besides, Capstone also allows some more customization via following macros. |
| 37 | |
| 38 | - CAPSTONE_USE_SYS_DYN_MEM: delete this to use your own dynamic memory management. |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 39 | - CAPSTONE_DIET_NO: rename this to "CAPSTONE_DIET" to make the binaries more compact. |
| 40 | - CAPSTONE_X86_REDUCE_NO: rename this to "CAPSTONE_X86_REDUCE" to make X86 binary smaller. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 41 | |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 42 | By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE |
| 43 | modes are disable. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 44 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 45 | |
| 46 | For each option, refer to docs/README for more details. |
| 47 | |
Nguyen Anh Quynh | 9c02b27 | 2014-05-14 08:00:22 +0800 | [diff] [blame] | 48 | |
| 49 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 50 | (1) Compile from source on Windows with Visual Studio |
| 51 | |
Nguyen Anh Quynh | 9c02b27 | 2014-05-14 08:00:22 +0800 | [diff] [blame] | 52 | - Choose the configuration and the platform you want: Release/Debug & Win32/Win64. |
| 53 | - Build only the libraries, or the libraries along with all the tests. |
| 54 | |
| 55 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 56 | |
Nguyen Anh Quynh | 726f99c | 2014-05-10 23:22:59 +0800 | [diff] [blame] | 57 | (2) You can make sure the prior steps successfully worked by launching one of the |
Nguyen Anh Quynh | 9c02b27 | 2014-05-14 08:00:22 +0800 | [diff] [blame] | 58 | testing binary (test*.exe). |