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
|
#-------------------------------------------------
#
# Project created by QtCreator 2014-07-19T12:58:14
#
#-------------------------------------------------
include($$PWD/../../SQLiteStudio3/plugins.pri)
QT -= gui
TARGET = ScriptingTcl
TEMPLATE = lib
DEFINES += SCRIPTINGTCL_LIBRARY
SOURCES += scriptingtcl.cpp
HEADERS += scriptingtcl.h\
scriptingtcl_global.h
OTHER_FILES += \
scriptingtcl.json
linux: {
# Find tclsh
TCLSH = $$system(echo "puts 1" | tclsh)
!contains(TCLSH, 1): {
error("Could not find tclsh executable. ScriptingTcl plugin requires it to find out all Tcl libraries and headers. Make tclsh available in PATH.")
}
TCLSH = $$system(which tclsh)
# Find its version
TCL_VERSION = $$system(echo "puts [info tclversion]" | tclsh)
#message("Found tclsh: $$TCLSH (version: $$TCL_VERSION)")
# Find tclConfig.sh
TCL_CONFIG_DIR = $$system(echo "puts [info library]" | tclsh)
TCL_CONFIG = $$TCL_CONFIG_DIR/tclConfig.sh
message("Looking for $$TCL_CONFIG")
!exists($$TCL_CONFIG) {
# Debian case
DEBIAN_ARCH_PATH=$$system(dpkg-architecture -qDEB_HOST_MULTIARCH)
TCL_CONFIG = /usr/lib/$$DEBIAN_ARCH_PATH/tcl$$TCL_VERSION/tclConfig.sh
}
message("Looking for $$TCL_CONFIG")
!exists($$TCL_CONFIG) {
error("Could not find tclConfig.sh file. You can define its absolute path by qmake parameter: TCL_CONFIG=/path/to/tclConfig.sh")
}
message("Using tclconfig: $$TCL_CONFIG")
# Define other libs required when linking with Tcl
eval($$system(cat $$TCL_CONFIG | grep TCL_LIBS))
eval(LIBS += $$TCL_LIBS)
# Define headers dir
eval($$system(cat $$TCL_CONFIG | grep TCL_INCLUDE_SPEC))
INCLUDEPATH += $$replace(TCL_INCLUDE_SPEC, -I/, /)
DEPENDPATH += $$replace(TCL_INCLUDE_SPEC, -I/, /)
# Find static library
eval($$system(cat $$TCL_CONFIG | grep TCL_STUB_LIB_PATH))
STATIC_LIB = $$replace(TCL_STUB_LIB_PATH, tclstub, tcl)
# If found static lib, we link statically
exists($$STATIC_LIB) {
#message("Static linking of libtcl: $$STATIC_LIB")
LIBS += $$STATIC_LIB
}
# If not found, use dynamic linking flags
!exists($$STATIC_LIB) {
eval($$system(cat $$TCL_CONFIG | grep TCL_LIB_SPEC))
#message("Dynamic linking of libtcl: $$TCL_LIB_SPEC")
eval(LIBS += $$TCL_LIB_SPEC)
}
}
macx: {
# Find tclsh
TCLSH = $$system(echo "puts 1" | tclsh)
!contains(TCLSH, 1): {
error("Could not find tclsh executable. ScriptingTcl plugin requires it to find out all Tcl libraries and headers. Make tclsh available in PATH.")
}
TCLSH = $$system(which tclsh)
# Find its version
TCL_VERSION = $$system(echo "puts [info tclversion]" | tclsh)
#message("Found tclsh: $$TCLSH (version: $$TCL_VERSION)")
# Find tclConfig.sh
TCL_CONFIG_DIR = $$system(echo "puts [info library]" | tclsh)
TCL_CONFIG = $$TCL_CONFIG_DIR/../../tclConfig.sh
# Define other libs required when linking with Tcl
eval($$system(cat $$TCL_CONFIG | grep TCL_LIBS))
eval(LIBS += $$TCL_LIBS)
# Define headers dir
eval($$system(cat $$TCL_CONFIG | grep TCL_INCLUDE_SPEC))
INCLUDEPATH += $$replace(TCL_INCLUDE_SPEC, -I/, /)
DEPENDPATH += $$replace(TCL_INCLUDE_SPEC, -I/, /)
# Find static library
eval($$system(cat $$TCL_CONFIG | grep TCL_STUB_LIB_PATH))
STATIC_LIB = $$replace(TCL_STUB_LIB_PATH, tclstub, tcl)
# If found static lib, we link statically
exists($$STATIC_LIB) {
#message("Static linking of libtcl: $$STATIC_LIB")
LIBS += $$STATIC_LIB
}
# If not found, use dynamic linking flags
!exists($$STATIC_LIB) {
eval($$system(cat $$TCL_CONFIG | grep TCL_LIB_SPEC))
#message("Dynamic linking of libtcl: $$TCL_LIB_SPEC")
eval(LIBS += $$TCL_LIB_SPEC)
}
}
win32: {
# Under Windows we don't do the research. We just assume we have everything in the lib/ and include/
# directories, which contain all other dependencies for SQLiteStudio. Get them from any Tcl installation you want.
# Lib files required for compilation of this plugin:
# - tcl86.lib
# - tcl86.dll
# Include files required for compilation:
# - tcl.h
# - tclDecls.h
# - tclPlatDecls.h
# Lib files required for the runtime in applications directory:
# - tcl86.dll
# The "86" part may vary, depending on Tcl version you're linking with.
LIBS += -ltcl86
}
RESOURCES += \
scriptingtcl.qrc
TRANSLATIONS += ScriptingTcl_pl.ts
|