cmake_minimum_required(VERSION 3.0.0) PROJECT(frida) set(CMAKE_VERBOSE_MAKEFILE on) set(CMAKE_AUTOMOC ON) set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules") include(GNUInstallDirs) find_package(Qt5Widgets) find_package(Qt5 CONFIG REQUIRED Widgets Gui) find_package(QuaZip REQUIRED) find_package(LLVM REQUIRED) find_package(PkgConfig) pkg_check_modules(LOG4CXX REQUIRED liblog4cxx) pkg_check_modules(GUILE REQUIRED guile-2.0) FIND_PACKAGE(SWIG REQUIRED) find_program(SWIG_EXECUTABLE NAMES swig3.0) INCLUDE(${SWIG_USE_FILE}) add_definitions(${LOG4CXX_CFLAGS}) add_definitions(${GUILE_CFLAGS}) add_definitions(${LLVM_CFLAGS}) add_definitions(-std=c++11 -Wall -Wextra) add_definitions(-DQT_NO_KEYWORDS) separate_arguments(LLVM_LDFLAGS) separate_arguments(LLVM_LIBS) INCLUDE_DIRECTORIES("src") include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) ##################### # Language Bindings # ##################### SET(CMAKE_SWIG_FLAGS -Linkage passive) if(CMAKE_SIZEOF_VOID_P EQUAL 8) set(CMAKE_SWIG_FLAGS ${CMAKE_SWIG_FLAGS} -DSWIGWORDSIZE64) endif() #FIND_PACKAGE(PythonLibs) #INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH}) SET_SOURCE_FILES_PROPERTIES(src/bindings/guile/frida.i PROPERTIES CPLUSPLUS ON) SWIG_ADD_MODULE(guile-frida-binding guile src/bindings/guile/frida.i) SWIG_LINK_LIBRARIES(guile-frida-binding ${GUILE_LDFLAGS}) ################# # Main Programm # ################# SET(frida_SOURCES src/core/InformationManager.cxx src/core/BasicBlock.cxx src/core/Comment.cxx src/core/Function.cxx src/gui/Mainwindow.cxx src/gui/widgets/BasicBlockWidget.cxx src/gui/widgets/CFGScene.cxx src/gui/widgets/FridaDock.cxx src/gui/widgets/LogDock.cxx src/gui/widgets/LogDockAppender.cxx src/gui/widgets/ScriptingDock.cxx src/gui/widgets/FunctionWidget.cxx src/gui/dialogs/NewFunctionDialog.cxx src/gui/dialogs/SimpleStringDialog.cxx src/disassembler/Disassembler.cxx src/disassembler/llvm/LLVMDisassembler.cxx ) SET(frida_HEADERS src/include_llvm.hxx src/core/InformationManager.hxx src/qt.hxx src/gui/Mainwindow.hxx src/gui/widgets/BasicBlockWidget.hxx src/gui/widgets/CFGScene.hxx src/gui/widgets/FridaDock.hxx src/gui/widgets/LogDock.hxx src/gui/widgets/LogDockAppender.hxx src/gui/widgets/ScriptingDock.hxx src/gui/widgets/FunctionWidget.hxx src/gui/dialogs/NewFunctionDialog.hxx src/gui/dialogs/SimpleStringDialog.hxx src/disassembler/llvm/LLVMDisassembler.hxx src/disassembler/Disassembler.hxx ) ADD_EXECUTABLE(frida src/main.cxx ${frida_SOURCES} ${frida_HEADERS_MOC}) ADD_DEFINITIONS(${QT_DEFINITIONS}) qt5_use_modules(frida Widgets) TARGET_LINK_LIBRARIES(frida ${QT_LIBRARIES} ${LLVM_LDFLAGS} ${LLVM_DYNAMIC_LIB} ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${QUAZIP_LIBRARIES}) configure_file(src/Config.hxx.in src/Config.hxx @ONLY) ########### # Plugins # ########### # GUILE set(plugin_guile_SOURCES src/bindings/Guile.cxx) set(plugin_guile_HEADERS src/bindings/Interpreter.hxx src/bindings/Guile.hxx) add_library(guilePlugin MODULE ${plugin_guile_SOURCES} ${plugin_guile_HEADERS_MOC}) qt5_use_modules(guilePlugin Core) target_link_libraries(guilePlugin ${QT_LIBRARIES} ${GUILE_LDFLAGS}) ################## # TEST Framework # ################## set(fridatest_SOURCES src/test.cxx src/core/tests/BasicBlockTest.cxx src/core/tests/FunctionTest.cxx src/core/tests/CommentTest.cxx src/disassembler/llvm/tests/amd64LinuxDisassemblerTest.cxx src/disassembler/llvm/tests/mipselLinuxDisassemblerTest.cxx src/disassembler/llvm/tests/armelLinuxDisassemblerTest.cxx src/disassembler/llvm/tests/amd64MachODisassemblerTest.cxx ${frida_SOURCES} ) add_executable(fridatest ${fridatest_SOURCES}) qt5_use_modules(fridatest Widgets) #ADD_SUBDIRECTORY(/usr/src/gtest gtest) ADD_SUBDIRECTORY(/usr/src/gmock gmock) enable_testing() add_test(NAME fridatest COMMAND fridatest ${CMAKE_SOURCE_DIR}/testdata) target_link_libraries(fridatest gmock gtest ${QT_LIBRARIES} ${LLVM_LDFLAGS} ${LLVM_DYNAMIC_LIB} ${LLVM_SYSTEM_LIBS} ${LOG4CXX_LDFLAGS} ${GUILE_LDFLAGS} ${QUAZIP_LIBRARIES}) target_compile_options(fridatest PRIVATE -DCONFIG_TEST) set_property(TEST fridatest APPEND PROPERTY ENVIRONMENT LD_LIBRARY_PATH=${CMAKE_CURRENT_BINARY_DIR}) install(TARGETS frida RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) install(TARGETS guilePlugin DESTINATION ${CMAKE_INSTALL_LIBDIR}/frida/plugins/Interpreter) install(TARGETS guile-frida-binding DESTINATION ${CMAKE_INSTALL_LIBDIR})