2017-03-30 16:58:57 +00:00
|
|
|
|
|
|
|
cmake_minimum_required(VERSION 3.1)
|
|
|
|
|
2017-07-17 12:04:32 +00:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
include(DisallowInSource)
|
|
|
|
|
2018-08-25 10:16:04 +00:00
|
|
|
project(Cutter VERSION 1.7.1)
|
2017-03-30 16:58:57 +00:00
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
option(CUTTER_ENABLE_JUPYTER "Enable Jupyter integration. Requires Python >= 3.3." ON)
|
|
|
|
option(CUTTER_ENABLE_QTWEBENGINE "Use QtWebEngine for in-app Jupyter Browser. Unused if CUTTER_ENABLE_JUPYTER=OFF." ON)
|
|
|
|
|
|
|
|
|
2017-03-30 16:58:57 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
set(CMAKE_AUTOMOC ON)
|
2017-04-09 18:33:33 +00:00
|
|
|
set(CMAKE_AUTOUIC ON)
|
2017-03-30 16:58:57 +00:00
|
|
|
set(CMAKE_AUTORCC ON)
|
2018-03-02 13:15:53 +00:00
|
|
|
find_package(Qt5 REQUIRED COMPONENTS Core Widgets Gui Svg)
|
|
|
|
if(CUTTER_ENABLE_JUPYTER AND CUTTER_ENABLE_QTWEBENGINE)
|
|
|
|
find_package(Qt5 COMPONENTS WebEngineWidgets)
|
|
|
|
if(NOT Qt5_FOUND)
|
|
|
|
message(FATAL_ERROR "QtWebEngine could not be found which is required for the in-app Jupyter Browser.
|
|
|
|
If you do not want to enable this in-app Browser, re-run CMake with -DCUTTER_ENABLE_QTWEBENGINE=OFF.")
|
|
|
|
endif()
|
2018-03-02 16:34:03 +00:00
|
|
|
add_definitions(-DCUTTER_ENABLE_QTWEBENGINE)
|
2018-03-02 13:15:53 +00:00
|
|
|
endif()
|
2017-03-30 16:58:57 +00:00
|
|
|
|
2017-03-31 11:28:27 +00:00
|
|
|
|
|
|
|
if(WIN32)
|
2017-03-31 14:52:26 +00:00
|
|
|
# use radare2 libraries from submodule on windows
|
2017-09-25 17:51:49 +00:00
|
|
|
set(CUTTER_WIN32_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../cutter_win32")
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH "${CUTTER_WIN32_DIR}")
|
2017-04-01 09:11:39 +00:00
|
|
|
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8) # 64 bit
|
2017-09-25 17:51:49 +00:00
|
|
|
list(APPEND CMAKE_LIBRARY_PATH "${CUTTER_WIN32_DIR}/radare2/lib64")
|
2017-04-01 09:11:39 +00:00
|
|
|
else()
|
2017-09-25 17:51:49 +00:00
|
|
|
list(APPEND CMAKE_LIBRARY_PATH "${CUTTER_WIN32_DIR}/radare2/lib32")
|
2017-04-01 09:11:39 +00:00
|
|
|
endif()
|
|
|
|
|
2017-09-25 17:51:49 +00:00
|
|
|
set(RADARE2_INCLUDE_DIRS "${CUTTER_WIN32_DIR}/radare2/include/libr" "${CUTTER_WIN32_DIR}/include")
|
2017-03-31 11:28:27 +00:00
|
|
|
endif()
|
|
|
|
|
2017-05-05 11:09:38 +00:00
|
|
|
|
|
|
|
find_package(Radare2 REQUIRED)
|
2017-04-25 21:49:10 +00:00
|
|
|
include_directories(${RADARE2_INCLUDE_DIRS})
|
2017-05-05 11:09:38 +00:00
|
|
|
link_directories(${RADARE2_LIBRARY_DIRS})
|
2017-04-25 21:49:10 +00:00
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
if(CUTTER_ENABLE_JUPYTER)
|
|
|
|
find_package(PythonLibs 3.3)
|
|
|
|
if(NOT PythonLibs_FOUND)
|
|
|
|
message(FATAL_ERROR "Python >= 3.3 could not be found which is required for Jupyter integration.
|
|
|
|
If you do not want to enable Jupyter, re-run CMake with -DCUTTER_ENABLE_JUPYTER=OFF.")
|
|
|
|
endif()
|
2017-04-25 21:49:10 +00:00
|
|
|
|
2018-03-02 13:15:53 +00:00
|
|
|
include_directories(${PYTHON_INCLUDE_DIRS})
|
|
|
|
add_definitions(-DCUTTER_ENABLE_JUPYTER)
|
|
|
|
endif()
|
2018-02-09 15:48:02 +00:00
|
|
|
|
|
|
|
|
2017-04-28 14:18:43 +00:00
|
|
|
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU"
|
|
|
|
OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
|
2017-05-06 10:46:28 +00:00
|
|
|
add_definitions(-Wall -Wextra)
|
2017-04-28 14:18:43 +00:00
|
|
|
endif()
|
|
|
|
|
2017-03-31 11:28:27 +00:00
|
|
|
|
2018-03-04 17:42:02 +00:00
|
|
|
# Parse Cutter.pro to get filenames
|
2017-04-12 15:53:40 +00:00
|
|
|
include(QMakeProParse)
|
2018-03-04 17:42:02 +00:00
|
|
|
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Cutter.pro"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/Cutter.pro"
|
|
|
|
COPYONLY) # trigger reconfigure if Cutter.pro changes
|
|
|
|
parse_qmake_pro("${CMAKE_CURRENT_BINARY_DIR}/Cutter.pro" CUTTER_PRO)
|
2017-09-25 17:51:49 +00:00
|
|
|
set(SOURCE_FILES ${CUTTER_PRO_SOURCES})
|
|
|
|
set(HEADER_FILES ${CUTTER_PRO_HEADERS})
|
|
|
|
set(UI_FILES ${CUTTER_PRO_FORMS})
|
|
|
|
set(QRC_FILES ${CUTTER_PRO_RESOURCES})
|
2017-04-12 15:53:40 +00:00
|
|
|
|
2018-03-04 17:42:02 +00:00
|
|
|
message(STATUS "sources from Cutter.pro: ${SOURCE_FILES}")
|
|
|
|
message(STATUS "headers from Cutter.pro: ${HEADER_FILES}")
|
|
|
|
message(STATUS "forms from Cutter.pro: ${UI_FILES}")
|
|
|
|
message(STATUS "resources from Cutter.pro: ${QRC_FILES}")
|
2017-03-30 16:58:57 +00:00
|
|
|
|
|
|
|
|
2017-09-25 17:51:49 +00:00
|
|
|
set(CUTTER_VERSION_SUFFIX "-dev")
|
|
|
|
set(CUTTER_VERSION_FULL "${PROJECT_VERSION}${CUTTER_VERSION_SUFFIX}")
|
|
|
|
message(STATUS "Building Cutter version ${CUTTER_VERSION_FULL}")
|
|
|
|
add_definitions("-DAPP_VERSION=\"${CUTTER_VERSION_FULL}\"")
|
2017-03-30 16:58:57 +00:00
|
|
|
|
|
|
|
|
2018-03-04 17:42:02 +00:00
|
|
|
add_executable(Cutter ${UI_FILES} ${QRC_FILES} ${SOURCE_FILES} ${HEADER_FILES})
|
2018-05-27 14:38:08 +00:00
|
|
|
|
|
|
|
target_link_libraries(Cutter Qt5::Core Qt5::Widgets Qt5::Gui Qt5::Svg)
|
2018-03-04 17:42:02 +00:00
|
|
|
target_link_libraries(Cutter ${RADARE2_LIBRARIES})
|
2018-03-02 13:15:53 +00:00
|
|
|
if(CUTTER_ENABLE_JUPYTER)
|
2018-03-04 17:42:02 +00:00
|
|
|
target_link_libraries(Cutter ${PYTHON_LIBRARIES})
|
2018-03-02 13:15:53 +00:00
|
|
|
if(CUTTER_ENABLE_QTWEBENGINE)
|
2018-05-27 14:38:08 +00:00
|
|
|
target_link_libraries(Cutter Qt5::WebEngineWidgets)
|
2018-03-02 13:15:53 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2017-04-25 21:49:10 +00:00
|
|
|
|