Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/script_trigger/cmake/FindTCL.cmake @ 2114

Last change on this file since 2114 was 1214, checked in by landauf, 17 years ago

merged console-branch back to trunk.
IMPORTANT: update your media directory!

you need TCL to compile. TCL is available here: http://www.tcl.tk/
another option is to check out https://svn.orxonox.net/ogre/tcl8.5.2/ and compile it by yourself. makefiles are in the 'macosx', 'unix' and 'win' subfolders.
FindTCL.cmake searches in the usual locations and in ../libs/tcl8.5.2/

the orxonox console can be activated with numpad-enter. whatever you enter will be parsed by TCL. if TCL doesn't know a command, it gets executed by orxonox.

simple tcl commands are: "puts text" to write "text" into the console, "expr 1+1" to calculate the result of the given expression. just try it by yourself with "puts [expr 1+1]".
[x] means: evaluate x and use the returnvalue as an argument. in this case the returned value is "2" and the resulting command therefore "puts 2".

you can combine orxonox and tcl commands. a simple orxonox command is "log text" that writes text into the console and the logfile. test it with "log [expr 1+1]" to write "2" into all output channels of orxonox. something more advanced: "log [clock seconds]" writes the seconds since 1970 into the logfile. feel free to combine both: "log [clock seconds]: 1+1 is [expr 1+1]"

TCL uses variables. to set a new variable, use "set varname value". you can use the variable wherever you want with $varname. with this we can make the above command a bit more elegant:
set myexpression 1+1
log [clock seconds]: $myexpression is [expr $myexpression]

read more about tcl in the wiki: http://wiki.tcl.tk/

File size: 5.2 KB
Line 
1# - Find Tcl includes and libraries.
2# This module finds if TCL is installed and determines where the
3# include files and libraries are. It also determines what the name of
4# the library is. This code sets the following variables:
5#  TCL_LIBRARY        = path to Tcl library (tcl tcl80)
6#  TCL_LIBRARY_DEBUG  = path to Tcl library (debug)
7#  TCL_STUB_LIBRARY   = path to Tcl stub library
8#  TCL_STUB_LIBRARY_DEBUG = path to debug stub library
9#  TCL_INCLUDE_PATH   = path to where tcl.h can be found
10#  TCL_TCLSH          = path to tclsh binary (tcl tcl80)
11#  TK_LIBRARY         = path to Tk library (tk tk80 etc)
12#  TK_LIBRARY_DEBUG   = path to Tk library (debug)
13#  TK_STUB_LIBRARY    = path to Tk stub library
14#  TK_STUB_LIBRARY_DEBUG = path to debug Tk stub library
15#  TK_INCLUDE_PATH    = path to where tk.h can be found
16#  TK_INTERNAL_PATH   = path to where tkWinInt.h is found
17#  TK_WISH            = full path to the wish executable
18
19INCLUDE(CMakeFindFrameworks)
20INCLUDE(FindTclsh)
21INCLUDE(FindWish)
22
23GET_FILENAME_COMPONENT(TCL_TCLSH_PATH "${TCL_TCLSH}" PATH)
24GET_FILENAME_COMPONENT(TK_WISH_PATH "${TK_WISH}" PATH)
25
26SET (TCLTK_POSSIBLE_LIB_PATHS
27  "${TCL_TCLSH_PATH}/../lib"
28  "${TK_WISH_PATH}/../lib"
29  "${TCL_INCLUDE_PATH}/../lib"
30  "${TK_INCLUDE_PATH}/../lib"
31  "$ENV{ProgramFiles}/Tcl/Lib"
32  "C:/Program Files/Tcl/lib" 
33  "C:/Tcl/lib" 
34  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib
35  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/lib
36  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/lib
37  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/lib
38  /usr/lib 
39  /usr/local/lib
40  /usr/pack/tcltk-8.4.9.linux-mo/lib
41  ../libs/tcl8.5.2/win
42  ../libs/tcl8.5.2/unix
43  ../libs/tcl8.5.2/macosx
44)
45
46FIND_LIBRARY(TCL_LIBRARY
47  NAMES tcl tcl85 tcl8.5 tcl84 tcl8.4 tcl83 tcl8.3 tcl82 tcl8.2 tcl80 tcl8.0
48  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
49)
50
51FIND_LIBRARY(TCL_LIBRARY_DEBUG
52  NAMES tcld tcl85d tcl8.5d tcl84d tcl8.4d tcl83d tcl8.3d tcl82d tcl8.2d tcl80d tcl8.0d
53  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
54)
55
56FIND_LIBRARY(TCL_STUB_LIBRARY
57  NAMES tclstub tclstub84 tclstub8.4 tclstub83 tclstub8.3 tclstub82 tclstub8.2 tclstub80 tclstub8.0
58  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
59)
60
61FIND_LIBRARY(TCL_STUB_LIBRARY_DEBUG
62  NAMES tclstubd tclstub84d tclstub8.4d tclstub83d tclstub8.3d tclstub82d tclstub8.2d tclstub80d tclstub8.0d
63  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
64)
65
66FIND_LIBRARY(TK_LIBRARY 
67  NAMES tk tk84 tk8.4 tk83 tk8.3 tk82 tk8.2 tk80 tk8.0
68  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
69)
70
71FIND_LIBRARY(TK_LIBRARY_DEBUG
72  NAMES tkd tk84d tk8.4d tk83d tk8.3d tk82d tk8.2d tk80d tk8.0d
73  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
74)
75
76FIND_LIBRARY(TK_STUB_LIBRARY 
77  NAMES tkstub tkstub84 tkstub8.4 tkstub83 tkstub8.3 tkstub82 tkstub8.2 tkstub80 tkstub8.0
78  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
79)
80
81FIND_LIBRARY(TK_STUB_LIBRARY_DEBUG
82  NAMES tkstubd tkstub84d tkstub8.4d tkstub83d tkstub8.3d tkstub82d tkstub8.2d tkstub80d tkstub8.0d
83  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
84)
85
86CMAKE_FIND_FRAMEWORKS(Tcl)
87CMAKE_FIND_FRAMEWORKS(Tk)
88
89SET(TCL_FRAMEWORK_INCLUDES)
90IF(Tcl_FRAMEWORKS)
91  IF(NOT TCL_INCLUDE_PATH)
92    FOREACH(dir ${Tcl_FRAMEWORKS})
93      SET(TCL_FRAMEWORK_INCLUDES ${TCL_FRAMEWORK_INCLUDES} ${dir}/Headers)
94    ENDFOREACH(dir)
95  ENDIF(NOT TCL_INCLUDE_PATH)
96ENDIF(Tcl_FRAMEWORKS)
97
98SET(TK_FRAMEWORK_INCLUDES)
99IF(Tk_FRAMEWORKS)
100  IF(NOT TK_INCLUDE_PATH)
101    FOREACH(dir ${Tk_FRAMEWORKS})
102      SET(TK_FRAMEWORK_INCLUDES ${TK_FRAMEWORK_INCLUDES}
103        ${dir}/Headers ${dir}/PrivateHeaders)
104    ENDFOREACH(dir)
105  ENDIF(NOT TK_INCLUDE_PATH)
106ENDIF(Tk_FRAMEWORKS)
107
108GET_FILENAME_COMPONENT(TCL_LIBRARY_PATH "${TCL_LIBRARY}" PATH)
109GET_FILENAME_COMPONENT(TK_LIBRARY_PATH "${TK_LIBRARY}" PATH)
110
111SET (TCLTK_POSSIBLE_INCLUDE_PATHS
112  ${TCL_TCLSH_PATH}/../include
113  ${TK_WISH_PATH}/../include
114  "${TCL_LIBRARY_PATH}/../include"
115  "${TK_LIBRARY_PATH}/../include"
116  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include
117  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.3;Root]/include
118  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.2;Root]/include
119  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.0;Root]/include
120  "$ENV{ProgramFiles}/Tcl/include"
121  "C:/Program Files/Tcl/include"
122  C:/Tcl/include
123  /usr/include
124  /usr/local/include
125  /usr/include/tcl8.4
126  /usr/include/tcl8.3
127  /usr/include/tcl8.2
128  /usr/include/tcl8.0
129  ../libs/tcl8.5.2/generic
130)
131
132FIND_PATH(TCL_INCLUDE_PATH tcl.h
133  ${TCL_FRAMEWORK_INCLUDES} ${TCLTK_POSSIBLE_INCLUDE_PATHS}
134)
135
136FIND_PATH(TK_INCLUDE_PATH tk.h
137  ${TK_FRAMEWORK_INCLUDES} ${TCLTK_POSSIBLE_INCLUDE_PATHS}
138)
139
140IF (WIN32)
141  FIND_PATH(TK_INTERNAL_PATH tkWinInt.h
142    ${TCLTK_POSSIBLE_INCLUDE_PATHS}
143  )
144  MARK_AS_ADVANCED(TK_INTERNAL_PATH)
145ENDIF(WIN32)
146
147MARK_AS_ADVANCED(
148    TCL_TCLSH_PATH
149    TK_WISH_PATH
150    TCL_INCLUDE_PATH
151    TK_INCLUDE_PATH
152    TCL_LIBRARY
153    TCL_LIBRARY_DEBUG
154    TK_LIBRARY 
155    TK_LIBRARY_DEBUG
156  TCL_STUB_LIBRARY
157  TCL_STUB_LIBRARY_DEBUG
158  TK_STUB_LIBRARY 
159  TK_STUB_LIBRARY
160  TK_STUB_LIBRARY_DEBUG
161  )
162
163IF(TCL_INCLUDE_PATH)
164  IF(TK_INCLUDE_PATH)
165    IF(TCL_LIBRARY)
166      IF(TK_LIBRARY)
167        SET(TCL_FOUND 1)
168      ENDIF(TK_LIBRARY)
169    ENDIF(TCL_LIBRARY)
170  ENDIF(TK_INCLUDE_PATH)
171ENDIF(TCL_INCLUDE_PATH)
Note: See TracBrowser for help on using the repository browser.