Restructure CMake files to start in the root of the tree (#6)

This commit is contained in:
Florian Märkl 2020-12-02 18:53:17 +01:00
parent 85042000e8
commit 8c35ebb837
No known key found for this signature in database
GPG Key ID: 125BC8A5A6A1E857
24 changed files with 162 additions and 163 deletions

View File

@ -48,6 +48,7 @@ build_script:
-DCUTTER_USE_BUNDLED_RIZIN=ON -DCUTTER_USE_BUNDLED_RIZIN=ON
-DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON=ON
-DCUTTER_ENABLE_PYTHON_BINDINGS=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON
-DCUTTER_ENABLE_PACKAGING=ON
-DCUTTER_PACKAGE_DEPENDENCIES=ON -DCUTTER_PACKAGE_DEPENDENCIES=ON
-DCUTTER_PACKAGE_R2GHIDRA=ON -DCUTTER_PACKAGE_R2GHIDRA=ON
-DCUTTER_PACKAGE_R2DEC=OFF -DCUTTER_PACKAGE_R2DEC=OFF
@ -56,7 +57,7 @@ build_script:
-DCMAKE_PREFIX_PATH=%CUTTER_DEPS%\\pyside -DCMAKE_PREFIX_PATH=%CUTTER_DEPS%\\pyside
-DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME%
-G Ninja -G Ninja
../src" .."
- cmd: cmake --build . --config Release - cmd: cmake --build . --config Release
- cmd: cmake --build . --config Release --target package - cmd: cmake --build . --config Release --target package

View File

@ -110,13 +110,13 @@ jobs:
-DCUTTER_ENABLE_PYTHON_BINDINGS=OFF \ -DCUTTER_ENABLE_PYTHON_BINDINGS=OFF \
-DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_ENABLE_CRASH_REPORTS=ON \
-DCUTTER_USE_BUNDLED_RIZIN=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \
../src && \ ..
else else
cmake \ cmake \
-G Ninja \ -G Ninja \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DCUTTER_USE_BUNDLED_RIZIN=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \
../src ..
fi fi
ninja ninja
- name: cmake macos - name: cmake macos
@ -140,7 +140,7 @@ jobs:
-DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_ENABLE_CRASH_REPORTS=ON \
-DCUTTER_USE_BUNDLED_RIZIN=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \
-DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" \ -DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" \
../src && \ .. && \
make -j4; make -j4;
- name: windows dependencies - name: windows dependencies
if: contains(matrix.os, 'windows-latest') if: contains(matrix.os, 'windows-latest')
@ -175,7 +175,7 @@ jobs:
-DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^ -DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^
-DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^ -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^
-G Ninja ^ -G Ninja ^
../src ..
cmake --build . --config Release cmake --build . --config Release
cmake --build . --config Release --target package cmake --build . --config Release --target package
echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV% echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV%

View File

@ -192,13 +192,13 @@ script:
-DCUTTER_USE_BUNDLED_RADARE2=OFF -DCUTTER_USE_BUNDLED_RADARE2=OFF
-DCUTTER_APPIMAGE_BUILD=ON -DCUTTER_APPIMAGE_BUILD=ON
-DCMAKE_INSTALL_PREFIX=appdir/usr -DCMAKE_INSTALL_PREFIX=appdir/usr
../src && .. &&
make -j4; make -j4;
elif [[ "$BUILD_SYSTEM" == "cmake_nodep" ]]; then elif [[ "$BUILD_SYSTEM" == "cmake_nodep" ]]; then
cmake cmake
-DCMAKE_BUILD_TYPE=Release -DCMAKE_BUILD_TYPE=Release
-DCUTTER_USE_BUNDLED_RADARE2=ON -DCUTTER_USE_BUNDLED_RADARE2=ON
../src && .. &&
make -j4; make -j4;
fi fi
elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
@ -225,7 +225,7 @@ script:
-DCUTTER_ENABLE_CRASH_REPORTS=ON -DCUTTER_ENABLE_CRASH_REPORTS=ON
-DCUTTER_USE_BUNDLED_RADARE2=ON -DCUTTER_USE_BUNDLED_RADARE2=ON
-DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" -DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR"
../src && .. &&
make -j4; make -j4;
fi fi
fi fi

145
CMakeLists.txt Normal file
View File

@ -0,0 +1,145 @@
cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(DisallowInSource)
include(Utils)
set(CUTTER_PYTHON_MIN 3.5)
option(CUTTER_USE_BUNDLED_RIZIN "Use rizin from src/rizin submodule instead of searching for it on the system" OFF)
option(CUTTER_USE_ADDITIONAL_RIZIN_PATHS "Search rizin in additional paths which are not part of default system library paths.\
Disable this option if you are linking against rizin pacakged as proper system library or in a custom path and additional are paths causing problems." ON)
option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF)
option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF)
option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF)
option(CUTTER_APPIMAGE_BUILD "Enable Appimage specific changes. Doesn't cause building of Appimage itself." OFF)
tri_option(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING "Use KSyntaxHighlighting" AUTO)
tri_option(CUTTER_ENABLE_GRAPHVIZ "Enable use of graphviz for graph layout" AUTO)
set(SHIBOKEN_EXTRA_OPTIONS "" CACHE STRING "Extra options for shiboken generator")
set(CUTTER_EXTRA_PLUGIN_DIRS "" CACHE STRING "List of addition plugin locations")
option(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS "Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by rizin build." OFF)
option(CUTTER_ENABLE_PACKAGING "Enable building platform-specific packages for distributing" OFF)
option(CUTTER_PACKAGE_DEPENDENCIES "During install step include the third party dependencies." OFF)
option(CUTTER_PACKAGE_RZ_GHIDRA "Compile and install rz-ghidra during install step." OFF)
option(CUTTER_PACKAGE_R2DEC "Compile and install r2dec during install step." OFF)
OPTION(CUTTER_QT6 "Use QT6" OFF)
if(NOT CUTTER_ENABLE_PYTHON)
set(CUTTER_ENABLE_PYTHON_BINDINGS OFF)
endif()
# Parse Cutter.pro to get filenames
include(QMakeProParse)
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/src/Cutter.pro"
"${CMAKE_CURRENT_BINARY_DIR}/src/Cutter.pro"
COPYONLY) # trigger reconfigure if Cutter.pro changes
parse_qmake_pro("${CMAKE_CURRENT_BINARY_DIR}/src/Cutter.pro" CUTTER_PRO)
# TODO: These variables, exception the versions should be moved to src/CMakeLists.txt after qmake was removed
set(SOURCE_FILES ${CUTTER_PRO_SOURCES})
set(HEADER_FILES ${CUTTER_PRO_HEADERS})
set(UI_FILES ${CUTTER_PRO_FORMS})
set(QRC_FILES ${CUTTER_PRO_RESOURCES})
set(CUTTER_VERSION_MAJOR "${CUTTER_PRO_CUTTER_VERSION_MAJOR}")
set(CUTTER_VERSION_MINOR "${CUTTER_PRO_CUTTER_VERSION_MINOR}")
set(CUTTER_VERSION_PATCH "${CUTTER_PRO_CUTTER_VERSION_PATCH}")
set(CUTTER_VERSION_FULL "${CUTTER_VERSION_MAJOR}.${CUTTER_VERSION_MINOR}.${CUTTER_VERSION_PATCH}")
project(Cutter VERSION "${CUTTER_VERSION_FULL}")
set(CMAKE_CXX_STANDARD 11)
include(CutterInstallDirs)
if(CUTTER_USE_BUNDLED_RIZIN)
include(BundledRizin)
set(RIZIN_TARGET Rizin)
else()
find_package(Rizin REQUIRED)
set(RIZIN_TARGET Rizin::librz)
endif()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
if (CUTTER_QT6)
set(QT_PREFIX Qt6)
else()
set(QT_PREFIX Qt5)
endif()
find_package(${QT_PREFIX} REQUIRED COMPONENTS Core Widgets Gui Svg Network)
if(CUTTER_ENABLE_PYTHON)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs ${CUTTER_PYTHON_MIN} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
add_definitions(-DCUTTER_ENABLE_PYTHON)
if(CUTTER_ENABLE_PYTHON_BINDINGS)
# 5.12.3 => 5.12
if("${Qt5_VERSION}" MATCHES "^([0-9]+\\.[0-9]+)\\.[0-9]+")
set(Shiboken2_VERSION_REQUIRED "${CMAKE_MATCH_1}")
else()
message(FATAL_ERROR "Failed to recognize Qt version")
endif()
find_package(Shiboken2 "${Shiboken2_VERSION_REQUIRED}" REQUIRED)
find_package(PySide2 "${Shiboken2_VERSION_REQUIRED}" REQUIRED)
get_target_property(PYSIDE_INCLUDE_DIR PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)
list(GET PYSIDE_INCLUDE_DIR 0 PYSIDE_INCLUDE_DIR)
include_directories(${PYSIDE_INCLUDE_DIR}
${PYSIDE_INCLUDE_DIR}/QtCore
${PYSIDE_INCLUDE_DIR}/QtGui
${PYSIDE_INCLUDE_DIR}/QtWidgets)
add_definitions(-DCUTTER_ENABLE_PYTHON_BINDINGS)
endif()
endif()
if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING)
if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING STREQUAL AUTO)
find_package(KF5SyntaxHighlighting)
if(KF5SyntaxHighlighting_FOUND)
set(KSYNTAXHIGHLIGHTING_STATUS ON)
else()
set(KSYNTAXHIGHLIGHTING_STATUS "OFF (KSyntaxHighlighting not found)")
endif()
else()
find_package(KF5SyntaxHighlighting REQUIRED)
set(KSYNTAXHIGHLIGHTING_STATUS ON)
endif()
else()
set(KSYNTAXHIGHLIGHTING_STATUS OFF)
endif()
if (CUTTER_ENABLE_GRAPHVIZ)
if (CUTTER_ENABLE_GRAPHVIZ STREQUAL AUTO)
find_package(Graphviz)
else()
find_package(Graphviz REQUIRED)
endif()
set (CUTTER_ENABLE_GRAPHVIZ ${Graphviz_FOUND})
endif()
message(STATUS "")
message(STATUS "Building Cutter version ${CUTTER_VERSION_FULL}")
message(STATUS "Options:")
message(STATUS "- Bundled rizin: ${CUTTER_USE_BUNDLED_RIZIN}")
message(STATUS "- Python: ${CUTTER_ENABLE_PYTHON}")
message(STATUS "- Python Bindings: ${CUTTER_ENABLE_PYTHON_BINDINGS}")
message(STATUS "- Crash Handling: ${CUTTER_ENABLE_CRASH_REPORTS}")
message(STATUS "- KSyntaxHighlighting: ${KSYNTAXHIGHLIGHTING_STATUS}")
message(STATUS "- Graphviz: ${CUTTER_ENABLE_GRAPHVIZ}")
message(STATUS "")
add_subdirectory(src)
if(CUTTER_ENABLE_PACKAGING)
add_subdirectory(dist)
endif()

View File

@ -1,7 +1,7 @@
include(ExternalProject) include(ExternalProject)
set(RIZIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../rizin") set(RIZIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rizin")
if(WIN32) if(WIN32)
set(RIZIN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}") set(RIZIN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}")
if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio")

View File

@ -5,13 +5,13 @@ if(WIN32)
if (CUTTER_PACKAGE_DEPENDENCIES) if (CUTTER_PACKAGE_DEPENDENCIES)
if (CUTTER_ENABLE_PYTHON) if (CUTTER_ENABLE_PYTHON)
if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS) if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
set(CPACK_INSTALL_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/cmake/WindowsBundlePython.cmake) set(CPACK_INSTALL_SCRIPTS ${CMAKE_CURRENT_SOURCE_DIR}/WindowsBundlePython.cmake)
endif() endif()
find_package(PythonInterp REQUIRED) find_package(PythonInterp REQUIRED)
install(DIRECTORY ${CUTTER_DEPS}/pyside/lib/site-packages DESTINATION "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}") install(DIRECTORY ${CUTTER_DEPS}/pyside/lib/site-packages DESTINATION "python${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}")
install(FILES ${CUTTER_DEPS}/pyside/bin/shiboken2.abi3.dll ${CUTTER_DEPS}/pyside/bin/pyside2.abi3.dll DESTINATION .) install(FILES ${CUTTER_DEPS}/pyside/bin/shiboken2.abi3.dll ${CUTTER_DEPS}/pyside/bin/pyside2.abi3.dll DESTINATION .)
endif() endif()
install(SCRIPT cmake/WindowsBundleQt.cmake) install(SCRIPT WindowsBundleQt.cmake)
endif() endif()
if (CUTTER_PACKAGE_RZ_GHIDRA) if (CUTTER_PACKAGE_RZ_GHIDRA)
if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS) if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS)
@ -57,7 +57,7 @@ if(WIN32)
install(CODE " install(CODE "
set(ENV{R_ALT_SRC_DIR} 1) set(ENV{R_ALT_SRC_DIR} 1)
set(ENV{PATH} \"\${CMAKE_INSTALL_PREFIX};\$ENV{PATH}\") set(ENV{PATH} \"\${CMAKE_INSTALL_PREFIX};\$ENV{PATH}\")
execute_process(COMMAND powershell ../scripts/bundle_r2dec.ps1 \"\${CMAKE_INSTALL_PREFIX}\" execute_process(COMMAND powershell \"${CMAKE_CURRENT_SOURCE_DIR}/bundle_r2dec.ps1\" \"\${CMAKE_INSTALL_PREFIX}\"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE SCRIPT_RESULT) RESULT_VARIABLE SCRIPT_RESULT)
if (SCRIPT_RESULT) if (SCRIPT_RESULT)

View File

@ -1,4 +1,4 @@
execute_process(COMMAND powershell "${CMAKE_CURRENT_LIST_DIR}/../../scripts/bundle_python.ps1" x64 "${CMAKE_INSTALL_PREFIX}" execute_process(COMMAND powershell "${CMAKE_CURRENT_LIST_DIR}/bundle_python.ps1" x64 "${CMAKE_INSTALL_PREFIX}"
WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY} WORKING_DIRECTORY ${CPACK_PACKAGE_DIRECTORY}
RESULT_VARIABLE SCRIPT_RESULT) RESULT_VARIABLE SCRIPT_RESULT)
if (SCRIPT_RESULT) if (SCRIPT_RESULT)

View File

@ -1,6 +0,0 @@
$arch = $args[0]
$dist = $args[1]
$libpath = If ($arch -eq "x64") {"C:\OpenSSL-Win64\bin"} Else {"C:\OpenSSL-Win32\bin"}
Copy-Item $libpath\libeay32.dll -Destination $dist
Copy-Item $libpath\ssleay32.dll -Destination $dist

View File

@ -1,148 +1,7 @@
cmake_minimum_required(VERSION 3.5)
if(POLICY CMP0074)
cmake_policy(SET CMP0074 NEW)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(DisallowInSource)
include(Utils)
set(CUTTER_PYTHON_MIN 3.5)
option(CUTTER_USE_BUNDLED_RIZIN "Use rizin from src/rizin submodule instead of searching for it on the system" OFF)
option(CUTTER_USE_ADDITIONAL_RIZIN_PATHS "Search rizin in additional paths which are not part of default system library paths.\
Disable this option if you are linking against rizin pacakged as proper system library or in a custom path and additional are paths causing problems." ON)
option(CUTTER_ENABLE_PYTHON "Enable Python integration. Requires Python >= ${CUTTER_PYTHON_MIN}." OFF)
option(CUTTER_ENABLE_PYTHON_BINDINGS "Enable generating Python bindings with Shiboken2. Unused if CUTTER_ENABLE_PYTHON=OFF." OFF)
option(CUTTER_ENABLE_CRASH_REPORTS "Enable crash report system. Unused if CUTTER_ENABLE_CRASH_REPORTS=OFF" OFF)
option(CUTTER_APPIMAGE_BUILD "Enable Appimage specific changes. Doesn't cause building of Appimage itself." OFF)
tri_option(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING "Use KSyntaxHighlighting" AUTO)
tri_option(CUTTER_ENABLE_GRAPHVIZ "Enable use of graphviz for graph layout" AUTO)
set(SHIBOKEN_EXTRA_OPTIONS "" CACHE STRING "Extra options for shiboken generator")
set(CUTTER_EXTRA_PLUGIN_DIRS "" CACHE STRING "List of addition plugin locations")
option(CUTTER_ENABLE_DEPENDENCY_DOWNLOADS "Enable downloading of dependencies. Setting to OFF doesn't affect any downloads done by r2 build." OFF)
option(CUTTER_PACKAGE_DEPENDENCIES "During install step include the third party dependencies." OFF)
option(CUTTER_PACKAGE_RZ_GHIDRA "Compile and install rz-ghidra during install step." OFF)
option(CUTTER_PACKAGE_R2DEC "Compile and install r2dec during install step." OFF)
OPTION(CUTTER_QT6 "Use QT6" OFF)
if(NOT CUTTER_ENABLE_PYTHON)
set(CUTTER_ENABLE_PYTHON_BINDINGS OFF)
endif()
# Parse Cutter.pro to get filenames
include(QMakeProParse)
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)
set(SOURCE_FILES ${CUTTER_PRO_SOURCES})
set(HEADER_FILES ${CUTTER_PRO_HEADERS})
set(UI_FILES ${CUTTER_PRO_FORMS})
set(QRC_FILES ${CUTTER_PRO_RESOURCES})
set(CUTTER_VERSION_MAJOR "${CUTTER_PRO_CUTTER_VERSION_MAJOR}")
set(CUTTER_VERSION_MINOR "${CUTTER_PRO_CUTTER_VERSION_MINOR}")
set(CUTTER_VERSION_PATCH "${CUTTER_PRO_CUTTER_VERSION_PATCH}")
set(CUTTER_VERSION_FULL "${CUTTER_VERSION_MAJOR}.${CUTTER_VERSION_MINOR}.${CUTTER_VERSION_PATCH}")
project(Cutter VERSION "${CUTTER_VERSION_FULL}")
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
if (CUTTER_QT6)
set(QT_PREFIX Qt6)
else()
set(QT_PREFIX Qt5)
endif()
find_package(${QT_PREFIX} REQUIRED COMPONENTS Core Widgets Gui Svg Network)
include(CutterInstallDirs)
if(CUTTER_USE_BUNDLED_RIZIN)
include(BundledRizin)
set(RIZIN_TARGET Rizin)
else()
find_package(Rizin REQUIRED)
set(RIZIN_TARGET Rizin::librz)
endif()
if(CUTTER_ENABLE_PYTHON)
find_package(PythonInterp REQUIRED)
find_package(PythonLibs ${CUTTER_PYTHON_MIN} REQUIRED)
include_directories(${PYTHON_INCLUDE_DIRS})
add_definitions(-DCUTTER_ENABLE_PYTHON)
if(CUTTER_ENABLE_PYTHON_BINDINGS)
# 5.12.3 => 5.12
if("${Qt5_VERSION}" MATCHES "^([0-9]+\\.[0-9]+)\\.[0-9]+")
set(Shiboken2_VERSION_REQUIRED "${CMAKE_MATCH_1}")
else()
message(FATAL_ERROR "Failed to recognize Qt version")
endif()
find_package(Shiboken2 "${Shiboken2_VERSION_REQUIRED}" REQUIRED)
find_package(PySide2 "${Shiboken2_VERSION_REQUIRED}" REQUIRED)
get_target_property(PYSIDE_INCLUDE_DIR PySide2::pyside2 INTERFACE_INCLUDE_DIRECTORIES)
list(GET PYSIDE_INCLUDE_DIR 0 PYSIDE_INCLUDE_DIR)
include_directories(${PYSIDE_INCLUDE_DIR}
${PYSIDE_INCLUDE_DIR}/QtCore
${PYSIDE_INCLUDE_DIR}/QtGui
${PYSIDE_INCLUDE_DIR}/QtWidgets)
add_definitions(-DCUTTER_ENABLE_PYTHON_BINDINGS)
endif()
endif()
if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING)
if(CUTTER_ENABLE_KSYNTAXHIGHLIGHTING STREQUAL AUTO)
find_package(KF5SyntaxHighlighting)
if(KF5SyntaxHighlighting_FOUND)
set(KSYNTAXHIGHLIGHTING_STATUS ON)
else()
set(KSYNTAXHIGHLIGHTING_STATUS "OFF (KSyntaxHighlighting not found)")
endif()
else()
find_package(KF5SyntaxHighlighting REQUIRED)
set(KSYNTAXHIGHLIGHTING_STATUS ON)
endif()
else()
set(KSYNTAXHIGHLIGHTING_STATUS OFF)
endif()
if (CUTTER_ENABLE_GRAPHVIZ)
if (CUTTER_ENABLE_GRAPHVIZ STREQUAL AUTO)
find_package(Graphviz)
else()
find_package(Graphviz REQUIRED)
endif()
set (CUTTER_ENABLE_GRAPHVIZ ${Graphviz_FOUND})
endif()
message(STATUS "")
message(STATUS "Building Cutter version ${CUTTER_VERSION_FULL}")
message(STATUS "Options:")
message(STATUS "- Bundled rizin: ${CUTTER_USE_BUNDLED_RIZIN}")
message(STATUS "- Python: ${CUTTER_ENABLE_PYTHON}")
message(STATUS "- Python Bindings: ${CUTTER_ENABLE_PYTHON_BINDINGS}")
message(STATUS "- Crash Handling: ${CUTTER_ENABLE_CRASH_REPORTS}")
message(STATUS "- KSyntaxHighlighting: ${KSYNTAXHIGHLIGHTING_STATUS}")
message(STATUS "- Graphviz: ${CUTTER_ENABLE_GRAPHVIZ}")
message(STATUS "")
include(QMakeConfigureFile) include(QMakeConfigureFile)
qmake_configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CutterConfig.h.in" qmake_configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CutterConfig.h.in"
"${CMAKE_CURRENT_BINARY_DIR}/CutterConfig.h") "${CMAKE_CURRENT_BINARY_DIR}/CutterConfig.h")
if(CUTTER_ENABLE_PYTHON_BINDINGS) if(CUTTER_ENABLE_PYTHON_BINDINGS)
set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bindings") set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/bindings")
set(BINDINGS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/bindings") set(BINDINGS_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}/bindings")
@ -190,6 +49,8 @@ endif()
add_executable(Cutter MACOSX_BUNDLE ${UI_FILES} ${QRC_FILES} ${PLATFORM_RESOURCES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE}) add_executable(Cutter MACOSX_BUNDLE ${UI_FILES} ${QRC_FILES} ${PLATFORM_RESOURCES} ${SOURCE_FILES} ${HEADER_FILES} ${BINDINGS_SOURCE})
set_target_properties(Cutter PROPERTIES set_target_properties(Cutter PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ..
PDB_OUTPUT_DIRECTORY ..
ENABLE_EXPORTS ON ENABLE_EXPORTS ON
CXX_VISIBILITY_PRESET hidden CXX_VISIBILITY_PRESET hidden
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist") MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist")
@ -299,7 +160,7 @@ install(EXPORT CutterTargets
DESTINATION "${ConfigPackageLocation}" DESTINATION "${ConfigPackageLocation}"
COMPONENT Devel) COMPONENT Devel)
install(FILES install(FILES
cmake/CutterConfig.cmake ../cmake/CutterConfig.cmake
DESTINATION ${ConfigPackageLocation} DESTINATION ${ConfigPackageLocation}
COMPONENT Devel COMPONENT Devel
) )
@ -316,5 +177,3 @@ if(UNIX AND NOT APPLE)
DESTINATION "share/applications" DESTINATION "share/applications"
COMPONENT Devel) COMPONENT Devel)
endif() endif()
include(Packaging)