[LFC][Integration] Enable markers and highlights
[WebKit-https.git] / Source / ThirdParty / capstone / CMakeLists.txt
1 if(POLICY CMP0042)
2   # http://www.cmake.org/cmake/help/v3.0/policy/CMP0042.html
3   cmake_policy(SET CMP0042 NEW)
4 endif(POLICY CMP0042)
5
6 if (POLICY CMP0048)
7   # use old policy to honor version set using VERSION_* variables to preserve backwards
8   # compatibility. change OLD to NEW when minimum cmake version is updated to 3.* and
9   # set VERSION using project(capstone VERSION 4.0.0).
10   # http://www.cmake.org/cmake/help/v3.0/policy/CMP0048.html
11   cmake_policy (SET CMP0048 OLD)
12 endif()
13
14 add_definitions(-DCAPSTONE_USE_SYS_DYN_MEM)
15
16 ## sources
17 set(SOURCES_ENGINE
18     Source/cs.c
19     Source/MCInst.c
20     Source/MCInstrDesc.c
21     Source/MCRegisterInfo.c
22     Source/SStream.c
23     Source/utils.c
24 )
25 set(HEADERS_ENGINE
26     Source/cs_priv.h
27     Source/LEB128.h
28     Source/MathExtras.h
29     Source/MCDisassembler.h
30     Source/MCFixedLenDisassembler.h
31     Source/MCInst.h
32     Source/MCInstrDesc.h
33     Source/MCRegisterInfo.h
34     Source/SStream.h
35     Source/utils.h
36     )
37
38 set(HEADERS_COMMON
39     Source/include/capstone/arm64.h
40     Source/include/capstone/arm.h
41     Source/include/capstone/capstone.h
42     Source/include/capstone/evm.h
43     Source/include/capstone/mips.h
44     Source/include/capstone/ppc.h
45     Source/include/capstone/x86.h
46     Source/include/capstone/sparc.h
47     Source/include/capstone/systemz.h
48     Source/include/capstone/xcore.h
49     Source/include/capstone/m68k.h
50     Source/include/capstone/tms320c64x.h
51     Source/include/capstone/m680x.h
52     Source/include/capstone/mos65xx.h
53     Source/include/capstone/platform.h
54     )
55
56 ## architecture support
57 if (WTF_CPU_ARM)
58     add_definitions(-DCAPSTONE_HAS_ARM)
59     set(SOURCES_ARM
60         Source/arch/ARM/ARMDisassembler.c
61         Source/arch/ARM/ARMInstPrinter.c
62         Source/arch/ARM/ARMMapping.c
63         Source/arch/ARM/ARMModule.c
64     )
65     set(HEADERS_ARM
66         Source/arch/ARM/ARMAddressingModes.h
67         Source/arch/ARM/ARMBaseInfo.h
68         Source/arch/ARM/ARMDisassembler.h
69         Source/arch/ARM/ARMGenAsmWriter.inc
70         Source/arch/ARM/ARMGenDisassemblerTables.inc
71         Source/arch/ARM/ARMGenInstrInfo.inc
72         Source/arch/ARM/ARMGenRegisterInfo.inc
73         Source/arch/ARM/ARMGenSubtargetInfo.inc
74         Source/arch/ARM/ARMInstPrinter.h
75         Source/arch/ARM/ARMMapping.h
76         Source/arch/ARM/ARMMappingInsn.inc
77         Source/arch/ARM/ARMMappingInsnOp.inc
78         )
79     set(HEADERS_ARM
80         Source/arch/ARM/ARMAddressingModes.h
81         Source/arch/ARM/ARMBaseInfo.h
82         Source/arch/ARM/ARMDisassembler.h
83         Source/arch/ARM/ARMGenAsmWriter.inc
84         Source/arch/ARM/ARMGenDisassemblerTables.inc
85         Source/arch/ARM/ARMGenInstrInfo.inc
86         Source/arch/ARM/ARMGenRegisterInfo.inc
87         Source/arch/ARM/ARMGenSubtargetInfo.inc
88         Source/arch/ARM/ARMInstPrinter.h
89         Source/arch/ARM/ARMMapping.h
90         )
91 endif ()
92
93 if (WTF_CPU_MIPS)
94     add_definitions(-DCAPSTONE_HAS_MIPS)
95     set(SOURCES_MIPS
96         Source/arch/Mips/MipsDisassembler.c
97         Source/arch/Mips/MipsInstPrinter.c
98         Source/arch/Mips/MipsMapping.c
99         Source/arch/Mips/MipsModule.c
100     )
101     set(HEADERS_MIPS
102         Source/arch/Mips/MipsDisassembler.h
103         Source/arch/Mips/MipsGenAsmWriter.inc
104         Source/arch/Mips/MipsGenDisassemblerTables.inc
105         Source/arch/Mips/MipsGenInstrInfo.inc
106         Source/arch/Mips/MipsGenRegisterInfo.inc
107         Source/arch/Mips/MipsGenSubtargetInfo.inc
108         Source/arch/Mips/MipsInstPrinter.h
109         Source/arch/Mips/MipsMapping.h
110         Source/arch/Mips/MipsMappingInsn.inc
111         )
112     set(HEADERS_MIPS
113         Source/arch/Mips/MipsDisassembler.h
114         Source/arch/Mips/MipsGenAsmWriter.inc
115         Source/arch/Mips/MipsGenDisassemblerTables.inc
116         Source/arch/Mips/MipsGenInstrInfo.inc
117         Source/arch/Mips/MipsGenRegisterInfo.inc
118         Source/arch/Mips/MipsGenSubtargetInfo.inc
119         Source/arch/Mips/MipsInstPrinter.h
120         Source/arch/Mips/MipsMapping.h
121         )
122 endif ()
123
124 set(capstone_SOURCES
125     ${SOURCES_ENGINE}
126     ${SOURCES_ARM}
127     ${SOURCES_MIPS}
128     )
129
130 set(capstone_HEADERS
131     ${HEADERS_COMMON}
132     ${HEADERS_ENGINE}
133     ${HEADERS_ARM}
134     ${HEADERS_MIPS}
135     )
136
137 set(capstone_INCLUDE_DIRECTORIES "${THIRDPARTY_DIR}/capstone/Source/include")
138
139 ## targets
140 add_library(capstone STATIC ${capstone_SOURCES} ${capstone_HEADERS})
141 set_property(TARGET capstone PROPERTY OUTPUT_NAME capstone)
142 target_include_directories(capstone PRIVATE ${capstone_INCLUDE_DIRECTORIES})
143
144 if (COMPILER_IS_GCC_OR_CLANG)
145     WEBKIT_ADD_TARGET_C_FLAGS(capstone
146         -Wno-sign-compare
147         -Wno-unused-parameter
148         -Wno-implicit-fallthrough
149         -Wno-missing-field-initializers
150         -Wno-missing-format-attribute
151         -Wno-discarded-qualifiers
152     )
153 endif ()