(De)serialization of Comments
[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
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/gui/Mainwindow.cxx
59 src/gui/widgets/BasicBlockWidget.cxx
60 src/gui/widgets/CFGScene.cxx
61 src/gui/widgets/FridaDock.cxx
62 src/gui/widgets/LogDock.cxx
63 src/gui/widgets/LogDockAppender.cxx
64 src/gui/widgets/ScriptingDock.cxx
65 src/gui/widgets/FunctionWidget.cxx
66 src/gui/dialogs/NewFunctionDialog.cxx
67 src/gui/dialogs/SimpleStringDialog.cxx
68 src/disassembler/Disassembler.cxx
69 src/disassembler/llvm/LLVMDisassembler.cxx
70 )
71 SET(frida_HEADERS
72 src/include_llvm.hxx
73 src/core/InformationManager.hxx
74 src/gui/qt.hxx
75 src/gui/Mainwindow.hxx
76 src/gui/widgets/BasicBlockWidget.hxx
77 src/gui/widgets/CFGScene.hxx
78 src/gui/widgets/FridaDock.hxx
79 src/gui/widgets/LogDock.hxx
80 src/gui/widgets/LogDockAppender.hxx
81 src/gui/widgets/ScriptingDock.hxx
82 src/gui/widgets/FunctionWidget.hxx
83 src/gui/dialogs/NewFunctionDialog.hxx
84 src/gui/dialogs/SimpleStringDialog.hxx
85 src/disassembler/llvm/LLVMDisassembler.hxx
86 src/disassembler/Disassembler.hxx
87 )
88
89 ADD_EXECUTABLE(frida src/main.cxx ${frida_SOURCES} ${frida_HEADERS_MOC})
90
91
92 ADD_DEFINITIONS(${QT_DEFINITIONS})
93
94 qt5_use_modules(frida Widgets)
95
96 TARGET_LINK_LIBRARIES(frida
97 ${QT_LIBRARIES}
98 ${LLVM_LDFLAGS}
99 -lLLVM-3.5
100 ${LLVM_SYSTEM_LIBS}
101 ${LOG4CXX_LDFLAGS}
102 ${QUAZIP_LIBRARIES})
103
104 configure_file(src/Config.hxx.in src/Config.hxx @ONLY)
105
106 ###########
107 # Plugins #
108 ###########
109
110 # GUILE
111
112 set(plugin_guile_SOURCES
113 src/bindings/Guile.cxx)
114
115 set(plugin_guile_HEADERS
116 src/bindings/Interpreter.hxx
117 src/bindings/Guile.hxx)
118
119 add_library(guilePlugin MODULE ${plugin_guile_SOURCES} ${plugin_guile_HEADERS_MOC})
120 qt5_use_modules(guilePlugin Core)
121 target_link_libraries(guilePlugin ${QT_LIBRARIES} ${GUILE_LDFLAGS})
122
123 ##################
124 # TEST Framework #
125 ##################
126
127 set(fridatest_SOURCES
128 src/test.cxx
129 src/core/tests/BasicBlockTest.cxx
130 src/core/tests/FunctionTest.cxx
131 src/core/tests/CommentTest.cxx
132 ${frida_SOURCES}
133 )
134
135 add_executable(fridatest ${fridatest_SOURCES})
136
137 qt5_use_modules(fridatest Widgets)
138
139 #ADD_SUBDIRECTORY(/usr/src/gtest gtest)
140 ADD_SUBDIRECTORY(/usr/src/gmock gmock)
141 enable_testing()
142 add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR}/testdata)
143 target_link_libraries(fridatest gmock gtest ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES})
144 target_compile_options(fridatest PRIVATE -DCONFIG_TEST)
145 set_property(TEST fridatest
146 APPEND PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR})
147
148 install(TARGETS frida
149 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
150
151 install(TARGETS guilePlugin
152 DESTINATION ${CMAKE_INSTALL_LIBDIR}/frida/plugins/Interpreter)
153
154 install(TARGETS guile-frida-binding
155 DESTINATION ${CMAKE_INSTALL_LIBDIR})