Merge pull request #469 from rafzi/upstream
[dyninst.git] / dyninstAPI / CMakeLists.txt
1 # CMake configuration for dyninstAPI directory
2
3 include_directories (
4   src
5   h
6   ${PROJECT_SOURCE_DIR}/proccontrol/h
7   )
8
9 set (SRC_LIST
10      src/BPatch.C 
11      src/BPatch_image.C 
12      src/BPatch_function.C 
13      src/BPatch_snippet.C 
14      src/BPatch_thread.C 
15      src/BPatch_process.C 
16      src/BPatch_type.C 
17      src/BPatch_module.C 
18      src/BPatch_object.C 
19      src/BPatch_point.C 
20      src/BPatch_collections.C 
21      src/BPatch_sourceBlock.C 
22      src/BPatch_basicBlock.C 
23      src/BPatch_basicBlockLoop.C 
24      src/BPatch_edge.C 
25      src/BPatch_loopTreeNode.C 
26      src/BPatch_flowGraph.C 
27      src/BPatch_frame.C 
28      src/BPatch_parRegion.C 
29      src/BPatch_statement.C 
30      src/BPatch_addressSpace.C 
31      src/BPatch_binaryEdit.C 
32      src/BPatch_memoryAccess.C 
33 #     src/dummy.C
34      src/debug.C 
35      src/ast.C 
36      src/registerSpace.C 
37      src/codegen.C 
38      src/inst.C 
39      src/instPoint.C 
40      src/baseTramp.C 
41      src/addressSpace.C 
42      src/binaryEdit.C 
43      src/infHeap.C 
44      src/frame.C 
45      src/codeRange.C 
46      src/image.C 
47      src/parse-cfg.C 
48      src/mapped_object.C 
49      src/mapped_module.C 
50      src/function.C 
51      src/block.C 
52      src/edge.C 
53      src/variable.C 
54      src/util.C 
55      src/BPatch_instruction.C 
56      src/parRegion.C 
57      src/Parsing.C 
58      src/Parsing-arch.C 
59      src/hybridInstrumentation.C 
60      src/hybridOverwrites.C 
61      src/hybridCallbacks.C 
62      src/dynProcess.C 
63      src/dynThread.C 
64      src/pcEventHandler.C 
65      src/pcEventMuxer.C 
66      src/Relocation/CodeMover.C 
67      src/Relocation/CFG/RelocGraph.C 
68      src/Relocation/CFG/RelocBlock.C 
69      src/Relocation/CFG/RelocEdge.C 
70      src/Relocation/CFG/RelocTarget.C 
71      src/Relocation/Springboard.C 
72      src/Relocation/Widgets/ASTWidget.C 
73      src/Relocation/Widgets/CFWidget.C 
74      src/Relocation/Widgets/CallbackWidget.C 
75      src/Relocation/Widgets/InsnWidget.C 
76      src/Relocation/Widgets/InstWidget.C 
77      src/Relocation/Widgets/PCWidget.C 
78      src/Relocation/Widgets/RelDataWidget.C 
79      src/Relocation/Widgets/StackModWidget.C
80      src/Relocation/Transformers/Transformer.C 
81      src/Relocation/Transformers/Instrumenter.C 
82      src/Relocation/Transformers/Modification.C 
83      src/Relocation/Transformers/Movement-adhoc.C 
84      src/Relocation/Transformers/Movement-analysis.C 
85      src/Relocation/CodeTracker.C 
86      src/Relocation/CodeBuffer.C 
87      src/Relocation/patchapi_debug.C 
88      src/Relocation/DynObject.C 
89      src/Relocation/DynAddrSpace.C 
90      src/Relocation/DynPointMaker.C 
91      src/Relocation/DynCFGMaker.C 
92      src/Relocation/DynInstrumenter.C 
93      src/Patching.C
94      src/frameChecker.C
95      src/BPatch_memoryAccessAdapter.C
96 )
97
98 # This is just .. messy. Sorry.
99
100 get_directory_property(local_comp_defs COMPILE_DEFINITIONS)
101 list (FIND local_comp_defs cap_stack_mods cap_stack_mods_found)
102 if (cap_stack_mods_found GREATER -1)
103 set (SRC_LIST ${SRC_LIST}
104      src/StackMod/OffsetVector.C
105      src/StackMod/StackAccess.C
106      src/StackMod/StackLocation.C
107      src/StackMod/StackMod.C
108      src/StackMod/StackModExpr.C
109      src/StackMod/StackModChecker.C
110      src/StackMod/TMap.C
111 )
112 endif ()
113
114 if (PLATFORM MATCHES i386 OR PLATFORM MATCHES amd64 OR PLATFORM MATCHES x86_64)
115 set (SRC_LIST ${SRC_LIST}
116      src/RegisterConversion-x86.C
117      src/Relocation/Widgets/CFWidget-x86.C
118      src/inst-x86.C
119      src/emit-x86.C
120      src/codegen-x86.C
121      src/stackwalk-x86.C
122      src/dynProcess-x86.C
123      src/parse-x86.C 
124      src/IAPI_to_AST.C 
125 )
126 elseif (PLATFORM MATCHES ppc)
127 set (SRC_LIST ${SRC_LIST}
128      src/inst-power.C 
129      src/codegen-power.C 
130      src/parse-power.C 
131      src/RegisterConversion-ppc.C 
132      src/stackwalk-ppc.C
133      src/Relocation/Widgets/CFWidget-ppc.C
134 )
135 elseif (PLATFORM MATCHES aarch64)
136 set (SRC_LIST ${SRC_LIST}
137      src/inst-aarch64.C 
138      src/codegen-aarch64.C 
139      src/parse-aarch64.C 
140      src/RegisterConversion-aarch64.C 
141      src/stackwalk-aarch64.C
142      src/Relocation/Widgets/CFWidget-aarch64.C
143 )
144 endif ()
145
146 if (PLATFORM MATCHES freebsd)
147 set (SRC_LIST ${SRC_LIST} 
148      src/freebsd.C
149      src/unix.C
150      src/freebsd-x86.C
151      src/syscallNotification.C 
152      src/syscall-freebsd.C
153 )
154 elseif (PLATFORM MATCHES linux OR PLATFORM MATCHES bgq)
155 set (SRC_LIST ${SRC_LIST}
156      src/linux.C
157      src/inst-linux.C
158      src/unix.C
159      src/syscallNotification.C 
160      src/syscall-linux.C
161 )
162   if (PLATFORM MATCHES i386 OR PLATFORM MATCHES x86_64)
163     set (SRC_LIST ${SRC_LIST} src/linux-x86.C)
164   elseif (PLATFORM MATCHES ppc)
165     set (SRC_LIST ${SRC_LIST} src/linux-power.C)
166   elseif (PLATFORM MATCHES aarch64)
167     set (SRC_LIST ${SRC_LIST} src/linux-aarch64.C)
168   endif()
169 elseif(PLATFORM MATCHES windows OR PLATFORM MATCHES nt)
170     set (SRC_LIST ${SRC_LIST}
171                 src/hybridCallbacks.C
172                 src/hybridInstrumentation.C
173                 src/hybridOverwrites.C
174         src/inst-winnt.C
175         src/pdwinnt.C
176         src/syscall-nt.C
177                 src/MemoryEmulator/memEmulator.C
178                 src/MemoryEmulator/memEmulatorTransformer.C
179                 src/MemoryEmulator/memEmulatorWidget.C
180                 src/Relocation/DynAddrSpace.C
181                 src/Relocation/DynCFGMaker.C
182                 src/Relocation/DynInstrumenter.C
183                 src/Relocation/DynObject.C
184                 src/Relocation/DynPointMaker.C
185         )
186 endif()
187
188 set_source_files_properties(${SRC_LIST} PROPERTIES LANGUAGE CXX)
189 add_definitions(-DBPATCH_DLL_BUILD)
190 if (PLATFORM MATCHES i386 AND UNIX)
191 set (SRC_LIST ${SRC_LIST} src/cpuid-x86.S)
192 set_source_files_properties(src/cpuid-x86.S PROPERTIES LANGUAGE C)
193 endif ()
194
195 dyninst_library(dyninstAPI common instructionAPI stackwalk pcontrol patchAPI parseAPI symtabAPI)
196
197 target_link_private_libraries(dyninstAPI ${Boost_LIBRARIES})
198 if (UNIX)
199   # Boost auto-links on Windows; don't double-link
200   target_link_private_libraries (dyninstAPI pthread)
201 else()
202   target_link_private_libraries(dyninstAPI dbghelp WS2_32 imagehlp)
203 endif()
204 if (USE_COTIRE)
205     cotire(dyninstAPI)
206 endif()
207
208 install(SCRIPT "${RT_BINARY_DIR}/cmake_install.cmake")