Fix width of basic blocks
[frida/frida.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8.9)
2 PROJECT(frida)
3
4 set(CMAKE_VERBOSE_MAKEFILE on)
5
6 set(CMAKE_AUTOMOC ON)
7 set(CMAKE_INCLUDE_CURRENT_DIR ON)
8
9 find_package(Qt5Widgets)
10 find_package(Qt5 CONFIG REQUIRED Widgets Gui)
11 find_package(PkgConfig)
12 pkg_check_modules(LOG4CXX REQUIRED liblog4cxx)
13 pkg_check_modules(GUILE REQUIRED guile-2.0)
14
15 #add_compile_options(${LOG4CXX_CFLAGS})
16 add_definitions(${LOG4CXX_CFLAGS})
17 add_definitions(${GUILE_CFLAGS})
18
19 find_program(LLVM_CONFIG llvm-config-3.5)
20
21 if(NOT LLVM_CONFIG)
22 message(FATAL_ERROR "LLVM not found")
23 endif()
24
25 execute_process(COMMAND ${LLVM_CONFIG} --cxxflags OUTPUT_VARIABLE LLVM_CFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
26 execute_process(COMMAND ${LLVM_CONFIG} --ldflags OUTPUT_VARIABLE LLVM_LDFLAGS OUTPUT_STRIP_TRAILING_WHITESPACE)
27 execute_process(COMMAND ${LLVM_CONFIG} --libs OUTPUT_VARIABLE LLVM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
28 execute_process(COMMAND ${LLVM_CONFIG} --system-libs OUTPUT_VARIABLE LLVM_SYSTEM_LIBS OUTPUT_STRIP_TRAILING_WHITESPACE)
29
30 string(REPLACE -O2 "" LLVM_CFLAGS ${LLVM_CFLAGS})
31 string(REPLACE -fno-exceptions "" LLVM_CFLAGS ${LLVM_CFLAGS})
32 string(REPLACE -fno-rtti "" LLVM_CFLAGS ${LLVM_CFLAGS})
33
34 separate_arguments(LLVM_CFLAGS)
35 add_definitions(${LLVM_CFLAGS})
36 add_definitions(-std=c++11 -Wall)
37 add_definitions(-DQT_NO_KEYWORDS)
38
39 separate_arguments(LLVM_LDFLAGS)
40 separate_arguments(LLVM_LIBS)
41
42 SET(frida_SOURCES
43 src/main.cxx
44 src/core/InformationManager.cxx
45 src/gui/Mainwindow.cxx
46 src/gui/widgets/BasicBlockWidget.cxx
47 src/gui/widgets/CFGScene.cxx
48 src/gui/widgets/ScriptingDock.cxx
49 src/gui/dialogs/NewFunctionDialog.cxx
50 src/disassembler/Disassembler.cxx
51 src/disassembler/llvm/LLVMDisassembler.cxx
52 )
53 SET(frida_HEADERS
54 src/include_llvm.hxx
55 src/core/InformationManager.hxx
56 src/gui/qt.hxx
57 src/gui/Mainwindow.hxx
58 src/gui/widgets/BasicBlockWidget.hxx
59 src/gui/widgets/CFGScene.hxx
60 src/gui/widgets/ScriptingDock.hxx
61 src/gui/dialogs/NewFunctionDialog.hxx
62 src/disassembler/llvm/LLVMDisassembler.hxx
63 src/disassembler/Disassembler.hxx
64 )
65
66 ADD_EXECUTABLE(frida ${frida_SOURCES} ${frida_HEADERS_MOC})
67 #ADD_LIBRARY(llvm SHARED )
68
69 ADD_DEFINITIONS(${QT_DEFINITIONS})
70
71 qt5_use_modules(frida Widgets)
72 INCLUDE_DIRECTORIES("src")
73
74 TARGET_LINK_LIBRARIES(frida ${QT_LIBRARIES} ${LLVM_LDFLAGS} -lLLVM-3.5 ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS})
75
76 ##################
77 # TEST Framework #
78 ##################
79
80 set(fridatest_SOURCES
81 src/test.cxx
82 )
83
84 add_executable(fridatest ${fridatest_SOURCES})
85 #ADD_SUBDIRECTORY(/usr/src/gtest gtest)
86 ADD_SUBDIRECTORY(/usr/src/gmock gmock)
87 enable_testing()
88 target_link_libraries(fridatest gmock gtest gmock_main)
89 add_test( fridatest fridatest )