Commit 7251f823 authored by Ralf Habacker's avatar Ralf Habacker

Mingw compile fix

- fix finding of bfd, intl, iberty and z library
- fix drkonqi compile issue (missing functions setenv/unsetenv)
  by adding kdewin
- fix include filename case issues on cross compiling
- fix missing includes

BUG:396821
FIXED-IN:5.13.5

Reviewed By: mlaurent
Differential Revision: https://phabricator.kde.org/D14423
parent 08e4b4df
......@@ -27,6 +27,50 @@ find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS I18n CoreAddons Service
find_package(Qt5X11Extras ${QT_MIN_VERSION} CONFIG)
set_package_properties(Qt5X11Extras PROPERTIES TYPE RECOMMENDED PURPOSE "Recommended for better integration on X11.")
if (MINGW)
find_package(ZLIB REQUIRED)
find_library(INTL_LIBRARY NAMES intl)
find_library(IBERTY_LIBRARY NAMES iberty)
find_library(BFD_LIBRARY NAMES bfd)
if (IBERTY_LIBRARY)
set(iberty_FOUND 1)
else()
set(msg "iberty")
endif()
if (BFD_LIBRARY)
set(bfd_FOUND 1)
else()
set(msg "${msg} bfd")
endif()
if (INTL_LIBRARY)
set(intl_FOUND 1)
else()
set(msg "${msg} intl")
endif()
if (msg)
message(FATAL_ERROR "could not find ${msg}")
endif()
add_library(z STATIC IMPORTED)
set_target_properties(z PROPERTIES
IMPORTED_LOCATION ${ZLIB_LIBRARIES}
IMPORTED_INCLUDE_DIRECTORIES ${ZLIB_INCLUDE_DIRS}
)
add_library(intl SHARED IMPORTED)
set_target_properties(intl PROPERTIES
IMPORTED_IMPLIB ${INTL_LIBRARY}
)
add_library(iberty STATIC IMPORTED)
set_target_properties(iberty PROPERTIES
IMPORTED_LOCATION ${IBERTY_LIBRARY}
)
add_library(bfd STATIC IMPORTED)
set_target_properties(bfd PROPERTIES
IMPORTED_LOCATION ${BFD_LIBRARY}
# bfd header requires this to be defined
INTERFACE_COMPILE_DEFINITIONS "PACKAGE;PACKAGE_VERSION"
)
endif()
include_directories("${CMAKE_CURRENT_BINARY_DIR}")
configure_file(config-X11.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-X11.h)
......
......@@ -12,6 +12,9 @@ configure_file (config-drkonqi.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-drkonq
add_subdirectory( data )
add_subdirectory( parser )
if ( WIN32 )
find_package(KDEWin REQUIRED)
# for finding drkonqi_debug.h
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_subdirectory( kdbgwin )
endif ()
......@@ -109,6 +112,10 @@ if (${Qt5X11Extras_FOUND})
)
endif()
if (WIN32)
target_link_libraries(drkonqi kdewin)
endif()
install(TARGETS drkonqi DESTINATION ${KDE_INSTALL_LIBEXECDIR})
configure_file(org.kde.drkonqi.desktop.cmake ${CMAKE_BINARY_DIR}/src/org.kde.drkonqi.desktop)
install(PROGRAMS ${CMAKE_BINARY_DIR}/src/org.kde.drkonqi.desktop DESTINATION ${KDE_INSTALL_APPDIR})
......
......@@ -161,7 +161,7 @@ DebuggerManager *KCrashBackend::constructDebuggerManager()
#ifndef Q_OS_WIN
QString defaultDebuggerName = config.readEntry("Debugger", QStringLiteral("gdb"));
#else
QString defaultDebuggerName = config.readEntry("Debugger", QString("kdbgwin"));
QString defaultDebuggerName = config.readEntry("Debugger", QStringLiteral("kdbgwin"));
#endif
Debugger firstKnownGoodDebugger, preferredDebugger;
......
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/..)
set(kdbgwin_SRCS
common.h
main.cpp
......@@ -9,15 +11,14 @@ set(kdbgwin_SRCS
callbacks.cpp
outputters.h
outputters.cpp
${CMAKE_CURRENT_BINARY_DIR}/../drkonqi_debug.cpp
)
set(COMMON_LIBS dbghelp psapi shlwapi)
if ( MINGW )
# FIXME this should be handled in a higher level cmake with proper find
# scripts and configuration
add_executable(kdbgwin ${kdbgwin_SRCS} mingw_generator.h mingw_generator.cpp)
target_link_libraries(kdbgwin ${COMMON_LIBS} bfd iberty intl z)
target_link_libraries(kdbgwin PRIVATE ${COMMON_LIBS} bfd iberty intl z Qt5::Core)
endif ()
if ( MSVC OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel"))
add_executable(kdbgwin ${kdbgwin_SRCS} msvc_generator.h msvc_generator.cpp)
......
......@@ -50,7 +50,7 @@ QString AbstractBTGenerator::GetModuleName()
return QLatin1String(DEFAULT_MODULE);
}
QStringList list = QString(module.ImageName).split("\\");
QStringList list = QString(QLatin1String(module.ImageName)).split(QStringLiteral("\\"));
return list[list.size() - 1];
}
......@@ -66,7 +66,7 @@ QString AbstractBTGenerator::GetModulePath()
return QLatin1String(DEFAULT_MODULE);
}
return QString(module.ImageName);
return QString(QLatin1String(module.ImageName));
}
void AbstractBTGenerator::Run(HANDLE hThread, bool bFaultingThread)
......
......@@ -28,6 +28,8 @@
#include "common.h"
#include "process.h"
#include <QObject>
const static char* BACKTRACE_FORMAT = "%1!%2() [%3 @ %4] at 0x%5";
// module.dll!KClass::function() [c:\file.cpp @ 10] at 0x0001000
......
......@@ -26,23 +26,25 @@
#pragma once
// the compiler only provides UNICODE. tchar.h checks for the _UNICODE macro
#if defined(UNICODE)
#if defined(MSC_VER) && defined(UNICODE)
#define _UNICODE
#endif
// first: windows & compiler includes
#include <Tchar.h>
#include <Windows.h>
#include <DbgHelp.h>
#include <Assert.h>
#include <Shlwapi.h>
#include <Psapi.h>
#include <TlHelp32.h>
#include <tchar.h>
#include <windows.h>
#include <dbghelp.h>
#include <assert.h>
#include <shlwapi.h>
#include <psapi.h>
#include <tlhelp32.h>
#include "drkonqi_debug.h"
// second: Qt includes
#include <QLoggingCategory>
#include <QString>
#include <QString>
#include <QMap>
// third: KDE includes
......
......@@ -27,12 +27,14 @@
#include "mingw_generator.h"
#include "outputters.h"
#include "process.h"
#include "common.h"
#include <QCoreApplication>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QCoreApplication::setApplicationName("kdbgwin");
QCoreApplication::setApplicationName(QStringLiteral("kdbgwin"));
if (argc != 3)
{
......
......@@ -127,7 +127,7 @@ void MingwGenerator::LoadSymbol(const QString& module, DWORD64 dwBaseAddr)
{
QString symbolFile = module;
symbolFile.truncate(symbolFile.length() - 4);
symbolFile.append(".sym");
symbolFile.append(QStringLiteral(".sym"));
m_symbolsMap[module] = false; // default
QString symbolType;
......
......@@ -27,6 +27,9 @@
#include "common.h"
#include <QString>
#include <QMap>
typedef QMap<DWORD, HANDLE> TThreadsMap;
typedef QMap<QString, HMODULE> TModulesMap;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment