xref: /aosp_15_r20/external/capstone/cmake.sh (revision 9a0e4156d50a75a99ec4f1653a0e9602a5d45c18)
1#!/bin/sh
2
3# Capstone disassembler engine (www.capstone-engine.org)
4# Build Capstone libs for specified architecture, or all if none is specified (libcapstone.so & libcapstone.a) on *nix with CMake & make
5# By Nguyen Anh Quynh, Jorn Vernee, 2019
6
7FLAGS="-DCMAKE_BUILD_TYPE=Release"
8# Uncomment below line to compile in Diet mode
9# FLAGS+=" -DCAPSTONE_BUILD_DIET=ON"
10
11case $1 in
12  ARM)
13    ARCH=ARM
14    ;;
15  ARM64)
16    ARCH=ARM64
17    ;;
18  M68K)
19    ARCH=M68K
20    ;;
21  MIPS)
22    ARCH=MIPS
23    ;;
24  PowerPC)
25    ARCH=PPC
26    ;;
27  Sparc)
28    ARCH=SPARC
29    ;;
30  SystemZ)
31    ARCH=SYSZ
32    ;;
33  XCore)
34    ARCH=XCORE
35    ;;
36  x86)
37    ARCH=X86
38    ;;
39  TMS320C64x)
40    ARCH=TMS320C64X
41    ;;
42  M680x)
43    ARCH=M680X
44    ;;
45  EVM)
46    ARCH=EVM
47    ;;
48  MOS65XX)
49    ARCH=MOS65XX
50    ;;
51  *)
52    ;;
53esac
54
55if [ "x${ARCH}" = "x" ]; then
56  FLAGS+=" -DCAPSTONE_ARCHITECTURE_DEFAULT=ON"
57else
58  FLAGS+=" -DCAPSTONE_ARCHITECTURE_DEFAULT=OFF -DCAPSTONE_${ARCH}_SUPPORT=ON"
59fi
60
61cmake $FLAGS ..
62
63make -j8
64