blob: 0a45ef0cc33a73cd4f506e5d42d0e55ae10c5bad (
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
|
if (NOT WIN32 OR NOT MSVC)
return()
endif()
find_library(DbgEngLib dbgeng)
set(ArchSuffix 32)
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ArchSuffix 64)
endif()
# statically link MSVC runtime
# see https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#how-can-i-build-my-msvc-application-with-a-static-runtime
# TODO change to MSVC_RUNTIME_LIBRARY when CMake 3.15 is required
# set_property(TARGET qtcreatorcdbext PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
foreach(flag_var
CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
add_qtc_library(qtcreatorcdbext
COMPONENT qtcreatorcdbext
BUILD_BY_DEFAULT
UNVERSIONED
DEPENDS ${DbgEngLib}
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
SOURCES
common.cpp common.h
containers.cpp containers.h
eventcallback.cpp eventcallback.h
extensioncontext.cpp extensioncontext.h
gdbmihelpers.cpp gdbmihelpers.h
iinterfacepointer.h
knowntype.h
outputcallback.cpp outputcallback.h
qtcreatorcdbext.def
qtcreatorcdbextension.cpp
stringutils.cpp stringutils.h
symbolgroup.cpp symbolgroup.h
symbolgroupnode.cpp symbolgroupnode.h
symbolgroupvalue.cpp symbolgroupvalue.h
)
qtc_library_enabled(_library_enabled qtcreatorcdbext)
if (_library_enabled)
find_package(PythonLibs 3.5)
if (NOT ${PYTHONLIBS_FOUND})
message(WARNING "PythonLibs (at least version 3.5) not found. qtcreatorcdbext will be built without Python support.")
return()
endif()
set(PythonRegex "^(.*)/(.*)/(python([0-9]+))${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(PythonRegex "^(.*)/(.*)/(python([0-9]+)_d)${CMAKE_IMPORT_LIBRARY_SUFFIX}$")
endif()
foreach(lib IN LISTS PYTHON_LIBRARIES)
if (lib MATCHES ${PythonRegex})
set(PythonDll "${CMAKE_MATCH_1}/${CMAKE_MATCH_3}${CMAKE_SHARED_LIBRARY_SUFFIX}")
set(PythonZip "${CMAKE_MATCH_1}/python${CMAKE_MATCH_4}.zip")
break()
endif()
endforeach()
if (NOT PythonDll)
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
message(WARNING "The Debug build of Qt Creator requires Debug Python libraries. Please check your Python installation")
endif()
message(WARNING "PythonDll not found. qtcreatorcdbext will be built without Python support.")
return()
endif()
extend_qtc_library(qtcreatorcdbext
DEPENDS "${PYTHON_LIBRARIES}"
INCLUDES "${PYTHON_INCLUDE_DIR}"
DEFINES WITH_PYTHON=1
SOURCES
pycdbextmodule.cpp pycdbextmodule.h
pyfield.cpp pyfield.h
pystdoutredirect.cpp pystdoutredirect.h
pytype.cpp pytype.h
pyvalue.cpp pyvalue.h
)
install(FILES
"${PythonDll}"
"${PythonZip}"
DESTINATION lib/qtcreatorcdbext${ArchSuffix}/
COMPONENT qtcreatorcdbext)
add_custom_target(copy_python_dll ALL VERBATIM)
add_custom_command(TARGET copy_python_dll POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonDll}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
COMMAND "${CMAKE_COMMAND}" -E copy "${PythonZip}" "${PROJECT_BINARY_DIR}/lib/qtcreatorcdbext${ArchSuffix}/"
VERBATIM
)
endif()
|