aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/qtcreatorcdbext/qtcreatorcdbext.pro
blob: 774e889b2ae3bb1d5dc934183309c5f5ded0dbfc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# Build the Qt Creator CDB extension
TEMPLATE = lib

include(../../../qtcreator.pri)
include(cdb_detect.pri)

isEmpty(QTC_KEEP_CDBEXT_DEFAULT_CONFIG): CONFIG += release

VERSION =
CONFIG -= precompile_header
CONFIG += hide_symbols

# Switch to statically linked CRT. Note: There will be only one
# global state of the CRT, reconsider if other DLLs are required!
# TODO: No effect, currently?
QMAKE_CXXFLAGS_RELEASE    -= -MD
QMAKE_CXXFLAGS_DEBUG      -= -MDd
QMAKE_CXXFLAGS_RELEASE    += -MT
QMAKE_CXXFLAGS_DEBUG      += -MTd

BASENAME=qtcreatorcdbext

DEF_FILE=$$PWD/qtcreatorcdbext.def

# Find out whether we are _building_ 64/32bit and determine target
# directories accordingly.
#
# Check for VSCMD_ARG_TGT_ARCH (VS 17) or Platform=X64 (VS 13, 15)
# For older versions, fall back to hacky check on LIBPATH

ENV_TARGET_ARCH=$$(VSCMD_ARG_TGT_ARCH)
isEmpty(ENV_TARGET_ARCH):ENV_TARGET_ARCH = $$(Platform)
ENV_LIBPATH=$$(LIBPATH)

contains(ENV_TARGET_ARCH, .*64$) {
    DIRNAME=$${BASENAME}64
    CDB_PLATFORM=amd64

    exists($$CDB_PATH/lib/amd64) {
        LIBS+= -L$$CDB_PATH/lib/amd64 -ldbgeng
    } else {
        LIBS+= -L$$CDB_PATH/lib/x64 -ldbgeng
    }
} else:isEmpty(ENV_TARGET_ARCH):contains(ENV_LIBPATH, ^.*amd64.*$) {
    DIRNAME=$${BASENAME}64
    CDB_PLATFORM=amd64

    exists($$CDB_PATH/lib/amd64) {
        LIBS+= -L$$CDB_PATH/lib/amd64 -ldbgeng
    } else {
        LIBS+= -L$$CDB_PATH/lib/x64 -ldbgeng
    }
} else {
    DIRNAME=$${BASENAME}32
    CDB_PLATFORM=i386

    exists($$CDB_PATH/lib/i386}) {
        LIBS+= -L$$CDB_PATH/lib/i386 -ldbgeng
    } else {
        LIBS+= -L$$CDB_PATH/lib/x86 -ldbgeng
    }
}

LIBS+=-luser32

DESTDIR=$$IDE_BUILD_TREE/lib/$${DIRNAME}
TARGET = $$BASENAME

message("Compiling Qt Creator CDB extension $$TARGET $$DESTDIR for $$CDB_PLATFORM using $$CDB_PATH")

INCLUDEPATH += $$CDB_PATH/inc

CONFIG -= qt
QT -= gui
QT -= core

SOURCES += qtcreatorcdbextension.cpp \
    extensioncontext.cpp \
    eventcallback.cpp \
    symbolgroupnode.cpp \
    symbolgroup.cpp \
    common.cpp \
    stringutils.cpp \
    gdbmihelpers.cpp \
    outputcallback.cpp \
    symbolgroupvalue.cpp \
    containers.cpp

HEADERS += extensioncontext.h \
    common.h \
    iinterfacepointer.h \
    eventcallback.h \
    symbolgroup.h \
    stringutils.h \
    gdbmihelpers.h \
    outputcallback.h \
    symbolgroupvalue.h \
    containers.h \
    knowntype.h \
    symbolgroupnode.h

isEmpty(PYTHON_INSTALL_DIR):PYTHON_INSTALL_DIR=$$(PYTHON_INSTALL_DIR)
!isEmpty(PYTHON_INSTALL_DIR):exists($$PYTHON_INSTALL_DIR) {
    DEFINES += WITH_PYTHON=1

    INCLUDEPATH += $$PYTHON_INSTALL_DIR/include
    DEPENDPATH += $$PYTHON_INSTALL_DIR/include

    SOURCES += \
        pycdbextmodule.cpp \
        pyfield.cpp \
        pystdoutredirect.cpp \
        pytype.cpp \
        pyvalue.cpp

    HEADERS += \
        pycdbextmodule.h \
        pyfield.h \
        pystdoutredirect.h \
        pytype.h \
        pyvalue.h

    CONFIG(release, debug|release): ABS_PYTHON_DLL = $$files($${PYTHON_INSTALL_DIR}/python??.dll)
    CONFIG(debug, debug|release): ABS_PYTHON_DLL = $$files($${PYTHON_INSTALL_DIR}/python??_d.dll)
    PYTHON_DLL = $$basename(ABS_PYTHON_DLL)
    PYTHON_BASE_NAME = $$replace(PYTHON_DLL, .dll$, )

    LIBS += -L$${PYTHON_INSTALL_DIR}/libs -l$$PYTHON_BASE_NAME

    inst_python.files = $$ABS_PYTHON_DLL
    inst_python.files += $$files($${PYTHON_INSTALL_DIR}/python??.zip)
    inst_python.path = $$QTC_PREFIX/lib/$${DIRNAME}
    inst_python.CONFIG += no_check_exist no_default_install
    INSTALLS += inst_python

    build_pass: deploy_python.depends = install_inst_python
    deploy_python.CONFIG = recursive
    CONFIG(release, debug|release): deploy_python.recurse = Release
    CONFIG(debug, debug|release): deploy_python.recurse = Debug
    QMAKE_EXTRA_TARGETS += deploy_python
} else {
    message("Set PYTHON_INSTALL_DIR pointing to Python 3.5 or greater to enable the python dumpers for cdb.")
}

target.path = $$QTC_PREFIX/lib/$${DIRNAME} # TODO this should go to INSTALL_LIBRARY_PATH/$${DIRNAME}

INSTALLS += target