diff --git a/.appveyor.yml b/.appveyor.yml index 9d55a59d..3e7b9d3b 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -48,6 +48,7 @@ build_script: -DCUTTER_USE_BUNDLED_RIZIN=ON -DCUTTER_ENABLE_PYTHON=ON -DCUTTER_ENABLE_PYTHON_BINDINGS=ON + -DCUTTER_ENABLE_PACKAGING=ON -DCUTTER_PACKAGE_DEPENDENCIES=ON -DCUTTER_PACKAGE_R2GHIDRA=ON -DCUTTER_PACKAGE_R2DEC=OFF @@ -56,7 +57,7 @@ build_script: -DCMAKE_PREFIX_PATH=%CUTTER_DEPS%\\pyside -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% -G Ninja - ../src" + .." - cmd: cmake --build . --config Release - cmd: cmake --build . --config Release --target package diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index d95156c2..022c846b 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -110,13 +110,13 @@ jobs: -DCUTTER_ENABLE_PYTHON_BINDINGS=OFF \ -DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ - ../src && \ + .. else cmake \ -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ - ../src + .. fi ninja - name: cmake macos @@ -140,7 +140,7 @@ jobs: -DCUTTER_ENABLE_CRASH_REPORTS=ON \ -DCUTTER_USE_BUNDLED_RIZIN=ON \ -DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" \ - ../src && \ + .. && \ make -j4; - name: windows dependencies if: contains(matrix.os, 'windows-latest') @@ -175,7 +175,7 @@ jobs: -DCMAKE_PREFIX_PATH="%CUTTER_DEPS%\pyside" ^ -DCPACK_PACKAGE_FILE_NAME=%PACKAGE_NAME% ^ -G Ninja ^ - ../src + .. cmake --build . --config Release cmake --build . --config Release --target package echo PACKAGE_NAME=%PACKAGE_NAME%.zip >> %GITHUB_ENV% diff --git a/.travis.yml.disabled b/.travis.yml.disabled index 08f13694..fd3032e8 100644 --- a/.travis.yml.disabled +++ b/.travis.yml.disabled @@ -192,13 +192,13 @@ script: -DCUTTER_USE_BUNDLED_RADARE2=OFF -DCUTTER_APPIMAGE_BUILD=ON -DCMAKE_INSTALL_PREFIX=appdir/usr - ../src && + .. && make -j4; elif [[ "$BUILD_SYSTEM" == "cmake_nodep" ]]; then cmake -DCMAKE_BUILD_TYPE=Release -DCUTTER_USE_BUNDLED_RADARE2=ON - ../src && + .. && make -j4; fi elif [[ "$TRAVIS_OS_NAME" == "osx" ]]; then @@ -225,7 +225,7 @@ script: -DCUTTER_ENABLE_CRASH_REPORTS=ON -DCUTTER_USE_BUNDLED_RADARE2=ON -DBREAKPAD_FRAMEWORK_DIR="$BREAKPAD_FRAMEWORK_DIR" - ../src && + .. && make -j4; fi fi diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 00000000..06dcf149 --- /dev/null +++ b/CMakeLists.txt @@ -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() diff --git a/src/cmake/BundledRizin.cmake b/cmake/BundledRizin.cmake similarity index 97% rename from src/cmake/BundledRizin.cmake rename to cmake/BundledRizin.cmake index f06044da..92fed4d4 100644 --- a/src/cmake/BundledRizin.cmake +++ b/cmake/BundledRizin.cmake @@ -1,7 +1,7 @@ include(ExternalProject) -set(RIZIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../rizin") +set(RIZIN_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/rizin") if(WIN32) set(RIZIN_INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}") if ("${CMAKE_GENERATOR}" MATCHES "Visual Studio") diff --git a/src/cmake/CutterConfig.cmake b/cmake/CutterConfig.cmake similarity index 100% rename from src/cmake/CutterConfig.cmake rename to cmake/CutterConfig.cmake diff --git a/src/cmake/CutterInstallDirs.cmake b/cmake/CutterInstallDirs.cmake similarity index 100% rename from src/cmake/CutterInstallDirs.cmake rename to cmake/CutterInstallDirs.cmake diff --git a/src/cmake/DisallowInSource.cmake b/cmake/DisallowInSource.cmake similarity index 100% rename from src/cmake/DisallowInSource.cmake rename to cmake/DisallowInSource.cmake diff --git a/src/cmake/FindBreakpad.cmake b/cmake/FindBreakpad.cmake similarity index 100% rename from src/cmake/FindBreakpad.cmake rename to cmake/FindBreakpad.cmake diff --git a/src/cmake/FindGraphviz.cmake b/cmake/FindGraphviz.cmake similarity index 100% rename from src/cmake/FindGraphviz.cmake rename to cmake/FindGraphviz.cmake diff --git a/src/cmake/FindPySide2.cmake b/cmake/FindPySide2.cmake similarity index 100% rename from src/cmake/FindPySide2.cmake rename to cmake/FindPySide2.cmake diff --git a/src/cmake/FindRizin.cmake b/cmake/FindRizin.cmake similarity index 100% rename from src/cmake/FindRizin.cmake rename to cmake/FindRizin.cmake diff --git a/src/cmake/PythonInfo.cmake b/cmake/PythonInfo.cmake similarity index 100% rename from src/cmake/PythonInfo.cmake rename to cmake/PythonInfo.cmake diff --git a/src/cmake/QMakeConfigureFile.cmake b/cmake/QMakeConfigureFile.cmake similarity index 100% rename from src/cmake/QMakeConfigureFile.cmake rename to cmake/QMakeConfigureFile.cmake diff --git a/src/cmake/QMakeProParse.cmake b/cmake/QMakeProParse.cmake similarity index 100% rename from src/cmake/QMakeProParse.cmake rename to cmake/QMakeProParse.cmake diff --git a/src/cmake/Translations.cmake b/cmake/Translations.cmake similarity index 100% rename from src/cmake/Translations.cmake rename to cmake/Translations.cmake diff --git a/src/cmake/Utils.cmake b/cmake/Utils.cmake similarity index 100% rename from src/cmake/Utils.cmake rename to cmake/Utils.cmake diff --git a/src/cmake/Packaging.cmake b/dist/CMakeLists.txt similarity index 94% rename from src/cmake/Packaging.cmake rename to dist/CMakeLists.txt index cca090d3..5b7fa243 100644 --- a/src/cmake/Packaging.cmake +++ b/dist/CMakeLists.txt @@ -5,13 +5,13 @@ if(WIN32) if (CUTTER_PACKAGE_DEPENDENCIES) if (CUTTER_ENABLE_PYTHON) 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() find_package(PythonInterp REQUIRED) 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 .) endif() - install(SCRIPT cmake/WindowsBundleQt.cmake) + install(SCRIPT WindowsBundleQt.cmake) endif() if (CUTTER_PACKAGE_RZ_GHIDRA) if (CUTTER_ENABLE_DEPENDENCY_DOWNLOADS) @@ -57,7 +57,7 @@ if(WIN32) install(CODE " set(ENV{R_ALT_SRC_DIR} 1) 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} RESULT_VARIABLE SCRIPT_RESULT) if (SCRIPT_RESULT) diff --git a/src/cmake/WindowsBundlePython.cmake b/dist/WindowsBundlePython.cmake similarity index 56% rename from src/cmake/WindowsBundlePython.cmake rename to dist/WindowsBundlePython.cmake index c84837fd..914fec96 100644 --- a/src/cmake/WindowsBundlePython.cmake +++ b/dist/WindowsBundlePython.cmake @@ -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} RESULT_VARIABLE SCRIPT_RESULT) if (SCRIPT_RESULT) diff --git a/src/cmake/WindowsBundleQt.cmake b/dist/WindowsBundleQt.cmake similarity index 100% rename from src/cmake/WindowsBundleQt.cmake rename to dist/WindowsBundleQt.cmake diff --git a/scripts/bundle_python.ps1 b/dist/bundle_python.ps1 similarity index 100% rename from scripts/bundle_python.ps1 rename to dist/bundle_python.ps1 diff --git a/scripts/bundle_r2dec.ps1 b/dist/bundle_r2dec.ps1 similarity index 100% rename from scripts/bundle_r2dec.ps1 rename to dist/bundle_r2dec.ps1 diff --git a/scripts/bundle_openssl.ps1 b/scripts/bundle_openssl.ps1 deleted file mode 100644 index 44273261..00000000 --- a/scripts/bundle_openssl.ps1 +++ /dev/null @@ -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 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 967fd818..015108b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -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) qmake_configure_file("${CMAKE_CURRENT_SOURCE_DIR}/CutterConfig.h.in" "${CMAKE_CURRENT_BINARY_DIR}/CutterConfig.h") - if(CUTTER_ENABLE_PYTHON_BINDINGS) set(BINDINGS_SRC_DIR "${CMAKE_CURRENT_SOURCE_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}) set_target_properties(Cutter PROPERTIES + RUNTIME_OUTPUT_DIRECTORY .. + PDB_OUTPUT_DIRECTORY .. ENABLE_EXPORTS ON CXX_VISIBILITY_PRESET hidden MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/macos/Info.plist") @@ -299,7 +160,7 @@ install(EXPORT CutterTargets DESTINATION "${ConfigPackageLocation}" COMPONENT Devel) install(FILES - cmake/CutterConfig.cmake + ../cmake/CutterConfig.cmake DESTINATION ${ConfigPackageLocation} COMPONENT Devel ) @@ -316,5 +177,3 @@ if(UNIX AND NOT APPLE) DESTINATION "share/applications" COMPONENT Devel) endif() - -include(Packaging)