Nguyen Anh Quynh | 6f9b113 | 2014-05-19 17:06:44 +0800 | [diff] [blame] | 1 | This documentation explains how to compile Capstone on Windows using |
| 2 | Microsoft Visual Studio version 2010 or newer. |
Nguyen Anh Quynh | 61882e5 | 2014-05-18 00:39:49 +0800 | [diff] [blame] | 3 | |
Nguyen Anh Quynh | f1c3acb | 2014-05-28 22:39:23 +0800 | [diff] [blame] | 4 | To compile Capstone on *nix, see COMPILE.TXT |
| 5 | |
| 6 | To compile Capstone with CMake, see COMPILE_CMAKE.TXT |
| 7 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 8 | *-*-*-*-*-* |
| 9 | |
| 10 | 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] | 11 | Open the Visual Studio solution "msvc/capstone.sln" and follow the instructions |
| 12 | below. |
| 13 | |
| 14 | NOTE: This requires Visual Studio 2010 or newer versions. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 15 | |
| 16 | |
| 17 | (0) Tailor Capstone to your need. |
| 18 | |
Nguyen Anh Quynh | c80d840 | 2014-05-26 23:02:48 +0800 | [diff] [blame] | 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 Visual Studio solution "msvc\capstone.sln", |
| 22 | then directly editing the projects "capstone_static" & "capstone_dll" for static |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 23 | and dynamic libraries, respectively. This must be done before going to the |
| 24 | next steps. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 25 | |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 26 | In VisualStudio interface, modify the preprocessor definitions via |
| 27 | "Project Properties" -> "Configuration Propertis" -> "C/C++" -> "Preprocessor" |
| 28 | to customize Capstone library, as followings. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 29 | |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 30 | - CAPSTONE_HAS_ARM: support ARM. Delete this to remove ARM support. |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 31 | - CAPSTONE_HAS_ARM64: support ARM64. Delete this to remove ARM64 support. |
| 32 | - CAPSTONE_HAS_MIPS: support Mips. Delete this to remove Mips support. |
| 33 | - CAPSTONE_HAS_PPC: support PPC. Delete this to remove PPC support. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 34 | - CAPSTONE_HAS_SPARC: support Sparc. Delete this to remove Sparc support. |
| 35 | - CAPSTONE_HAS_SYSZ: support SystemZ. Delete this to remove SystemZ support. |
| 36 | - CAPSTONE_HAS_X86: support X86. Delete this to remove X86 support. |
Nguyen Anh Quynh | c80d840 | 2014-05-26 23:02:48 +0800 | [diff] [blame] | 37 | - CAPSTONE_HAS_XCORE: support XCore. Delete this to remove XCore support. |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 38 | |
Nguyen Anh Quynh | c80d840 | 2014-05-26 23:02:48 +0800 | [diff] [blame] | 39 | By default, all 8 architectures are compiled in. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 40 | |
| 41 | |
| 42 | Besides, Capstone also allows some more customization via following macros. |
| 43 | |
| 44 | - 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] | 45 | - CAPSTONE_DIET_NO: rename this to "CAPSTONE_DIET" to make the binaries more compact. |
| 46 | - CAPSTONE_X86_REDUCE_NO: rename this to "CAPSTONE_X86_REDUCE" to make X86 binary smaller. |
obs | cb8e40c | 2014-08-17 21:07:13 +0200 | [diff] [blame] | 47 | - CAPSTONE_X86_ATT_DISABLE_NO: rename this to "CAPSTONE_X86_ATT_DISABLE" to disable |
| 48 | AT&T syntax on x86. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 49 | |
Nguyen Anh Quynh | 01f4839 | 2014-05-15 11:06:43 +0800 | [diff] [blame] | 50 | By default, Capstone use system dynamic memory management, and both DIET and X86_REDUCE |
| 51 | modes are disable. |
Nguyen Anh Quynh | ba37f33 | 2014-05-14 07:48:50 +0800 | [diff] [blame] | 52 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 53 | |
| 54 | For each option, refer to docs/README for more details. |
| 55 | |
Nguyen Anh Quynh | 9c02b27 | 2014-05-14 08:00:22 +0800 | [diff] [blame] | 56 | |
| 57 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 58 | (1) Compile from source on Windows with Visual Studio |
| 59 | |
Nguyen Anh Quynh | 9c02b27 | 2014-05-14 08:00:22 +0800 | [diff] [blame] | 60 | - Choose the configuration and the platform you want: Release/Debug & Win32/Win64. |
| 61 | - Build only the libraries, or the libraries along with all the tests. |
| 62 | |
| 63 | |
Axel 0vercl0k Souchet | 27e9cc4 | 2014-05-10 14:41:45 +0100 | [diff] [blame] | 64 | |
Nguyen Anh Quynh | 726f99c | 2014-05-10 23:22:59 +0800 | [diff] [blame] | 65 | (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] | 66 | testing binary (test*.exe). |