]> git.siccegge.de Git - frida/frida.git/blob - CMakeLists.txt
Basic Debian packaging
[frida/frida.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.0.0)
2 PROJECT(frida)
3
4 set(CMAKE_VERBOSE_MAKEFILE on)
5 set(CMAKE_AUTOMOC ON)
6 set(CMAKE_INCLUDE_CURRENT_DIR ON)
7 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules")
8 include(GNUInstallDirs)
9
10 find_package(Qt5Widgets)
11 find_package(Qt5 CONFIG REQUIRED Widgets Gui)
12 find_package(QuaZip REQUIRED)
13 find_package(LLVM REQUIRED)
14 find_package(PkgConfig)
15 pkg_check_modules(LOG4CXX REQUIRED liblog4cxx)
16 pkg_check_modules(GUILE REQUIRED guile-2.0)
17 FIND_PACKAGE(SWIG REQUIRED)
18 find_program(SWIG_EXECUTABLE NAMES swig3.0)
19 INCLUDE(${SWIG_USE_FILE})
20
21 add_definitions(${LOG4CXX_CFLAGS})
22 add_definitions(${GUILE_CFLAGS})
23
24 add_definitions(${LLVM_CFLAGS})
25 add_definitions(-std=c++11 -Wall -Wextra)
26 add_definitions(-DQT_NO_KEYWORDS)
27
28 separate_arguments(LLVM_LDFLAGS)
29 separate_arguments(LLVM_LIBS)
30
31 INCLUDE_DIRECTORIES("src")
32 include_directories(${CMAKE_CURRENT_BINARY_DIR}/src)
33
34 #####################
35 # Language Bindings #
36 #####################
37
38 SET(CMAKE_SWIG_FLAGS -Linkage passive)
39 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
40 set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DSWIGWORDSIZE64)
41 endif()
42 #FIND_PACKAGE(PythonLibs)
43 #INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})
44 SET_SOURCE_FILES_PROPERTIES(src/bindings/guile/frida.i PROPERTIES CPLUSPLUS ON)
45 SWIG_ADD_MODULE(guile-frida-binding guile src/bindings/guile/frida.i)
46 SWIG_LINK_LIBRARIES(guile-frida-binding ${GUILE_LDFLAGS})
47 qt5_use_modules(guile-frida-binding Widgets)
48
49 #################
50 # Main Programm #
51 #################
52
53 SET(frida_SOURCES
54 src/core/InformationManager.cxx
55 src/core/BasicBlock.cxx
56 src/core/Comment.cxx
57 src/core/Function.cxx
58 src/core/Settings.cxx
59 src/gui/Mainwindow.cxx
60 src/gui/widgets/BasicBlockWidget.cxx
61 src/gui/widgets/CFGScene.cxx
62 src/gui/widgets/FridaDock.cxx
63 src/gui/widgets/LogDock.cxx
64 src/gui/widgets/LogDockAppender.cxx
65 src/gui/widgets/ScriptingDock.cxx
66 src/gui/widgets/FunctionWidget.cxx
67 src/gui/dialogs/NewFunctionDialog.cxx
68 src/gui/dialogs/SimpleStringDialog.cxx
69 src/disassembler/Disassembler.cxx
70 src/disassembler/llvm/LLVMDisassembler.cxx
71 )
72 SET(frida_HEADERS
73 src/include_llvm.hxx
74 src/core/InformationManager.hxx
75 src/core/Settings.hxx
76 src/qt.hxx
77 src/gui/Mainwindow.hxx
78 src/gui/widgets/BasicBlockWidget.hxx
79 src/gui/widgets/CFGScene.hxx
80 src/gui/widgets/FridaDock.hxx
81 src/gui/widgets/LogDock.hxx
82 src/gui/widgets/LogDockAppender.hxx
83 src/gui/widgets/ScriptingDock.hxx
84 src/gui/widgets/FunctionWidget.hxx
85 src/gui/dialogs/NewFunctionDialog.hxx
86 src/gui/dialogs/SimpleStringDialog.hxx
87 src/disassembler/llvm/LLVMDisassembler.hxx
88 src/disassembler/Disassembler.hxx
89 )
90
91 ADD_EXECUTABLE(frida src/main.cxx ${frida_SOURCES} ${frida_HEADERS_MOC})
92
93
94 ADD_DEFINITIONS(${QT_DEFINITIONS})
95
96 qt5_use_modules(frida Widgets)
97
98 TARGET_LINK_LIBRARIES(frida
99 ${QT_LIBRARIES}
100 ${LLVM_LDFLAGS}
101 ${LLVM_DYNAMIC_LIB}
102 ${LLVM_SYSTEM_LIBS}
103 ${LOG4CXX_LDFLAGS}
104 ${QUAZIP_LIBRARIES})
105
106 configure_file(src/Config.hxx.in src/Config.hxx @ONLY)
107
108 ###########
109 # Plugins #
110 ###########
111
112 # GUILE
113
114 set(plugin_guile_SOURCES
115 src/bindings/Guile.cxx)
116
117 set(plugin_guile_HEADERS
118 src/bindings/Interpreter.hxx
119 src/bindings/Guile.hxx)
120
121 add_library(guilePlugin MODULE ${plugin_guile_SOURCES} ${plugin_guile_HEADERS_MOC})
122 qt5_use_modules(guilePlugin Core Widgets)
123 target_link_libraries(guilePlugin ${QT_LIBRARIES} ${GUILE_LDFLAGS})
124
125 ##################
126 # TEST Framework #
127 ##################
128
129 set(fridatest_SOURCES
130 src/test.cxx
131 src/core/tests/BasicBlockTest.cxx
132 src/core/tests/FunctionTest.cxx
133 src/core/tests/CommentTest.cxx
134 src/disassembler/llvm/tests/amd64LinuxDisassemblerTest.cxx
135 src/disassembler/llvm/tests/mipselLinuxDisassemblerTest.cxx
136 src/disassembler/llvm/tests/armelLinuxDisassemblerTest.cxx
137 src/disassembler/llvm/tests/amd64MachODisassemblerTest.cxx
138 ${frida_SOURCES}
139 )
140
141 add_executable(fridatest ${fridatest_SOURCES})
142
143 qt5_use_modules(fridatest Widgets)
144
145 #ADD_SUBDIRECTORY(/usr/src/gtest gtest)
146 ADD_SUBDIRECTORY(/usr/src/gmock gmock)
147 enable_testing()
148 add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR}/testdata)
149 target_link_libraries(fridatest
150 gmock
151 gtest
152 ${QT_LIBRARIES}
153 ${LLVM_LDFLAGS}
154 ${LLVM_DYNAMIC_LIB}
155 ${LLVM_SYSTEM_LIBS}
156 ${LOG4CXX_LDFLAGS}
157 ${GUILE_LDFLAGS}
158 ${QUAZIP_LIBRARIES})
159 target_compile_options(fridatest PRIVATE -DCONFIG_TEST)
160 set_property(TEST fridatest
161 APPEND PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR})
162
163 install(TARGETS frida
164 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
165
166 install(TARGETS guilePlugin
167 DESTINATION ${CMAKE_INSTALL_LIBDIR}/frida/plugins/Interpreter)
168
169 install(TARGETS guile-frida-binding
170 DESTINATION ${CMAKE_INSTALL_LIBDIR})