d1a67b9d |
1 | # ======================================================================= |
2 | # Created on: 2012-01-26 |
3 | # Created by: Kirill GAVRILOV |
4 | # Copyright (c) 2012 OPEN CASCADE SAS |
5 | # |
6 | # This file is part of Open CASCADE Technology software library. |
7 | # |
8 | # This library is free software; you can redistribute it and/or modify it under |
9 | # the terms of the GNU Lesser General Public License version 2.1 as published |
10 | # by the Free Software Foundation, with special exception defined in the file |
11 | # OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT |
12 | # distribution for complete text of the license and disclaimer of any warranty. |
13 | # |
14 | # Alternatively, this file may be used under the terms of Open CASCADE |
15 | # commercial license or contractual agreement. |
16 | |
17 | # ======================================================================= |
18 | # Tools for search of third-party libraries and generation on environment |
19 | # customization script |
20 | # ======================================================================= |
910970ab |
21 | |
c7d774c5 |
22 | set ARCH "64" |
910970ab |
23 | |
24 | if { "$tcl_platform(platform)" == "unix" } { |
25 | set SYS_PATH_SPLITTER ":" |
26 | set SYS_LIB_PREFIX "lib" |
27 | set SYS_EXE_SUFFIX "" |
28 | if { "$tcl_platform(os)" == "Darwin" } { |
29 | set SYS_LIB_SUFFIX "dylib" |
30 | } else { |
31 | set SYS_LIB_SUFFIX "so" |
32 | } |
33 | set VCVER "gcc" |
34 | set VCVARS "" |
35 | } elseif { "$tcl_platform(platform)" == "windows" } { |
36 | set SYS_PATH_SPLITTER ";" |
37 | set SYS_LIB_PREFIX "" |
38 | set SYS_LIB_SUFFIX "lib" |
39 | set SYS_EXE_SUFFIX ".exe" |
40 | set VCVER "vc10" |
41 | set VCVARS "" |
42 | } |
43 | |
44 | set SHORTCUT_HEADERS "true" |
45 | |
46 | set HAVE_FREEIMAGE "false" |
47 | set HAVE_GL2PS "false" |
48 | set HAVE_TBB "false" |
49 | set HAVE_OPENCL "false" |
50 | set HAVE_VTK "false" |
51 | set MACOSX_USE_GLX "false" |
52 | set CHECK_QT4 "false" |
53 | set CHECK_JDK "false" |
54 | set PRODUCTS_PATH "" |
55 | set CSF_OPT_INC [list] |
56 | set CSF_OPT_LIB32 [list] |
57 | set CSF_OPT_LIB64 [list] |
58 | set CSF_OPT_BIN32 [list] |
59 | set CSF_OPT_BIN64 [list] |
60 | |
c7d774c5 |
61 | if { "$tcl_platform(pointerSize)" == "4" } { |
62 | set ARCH "32" |
63 | } |
910970ab |
64 | if { [info exists ::env(ARCH)] } { |
65 | set ARCH "$::env(ARCH)" |
66 | } |
67 | if { [info exists ::env(VCVER)] } { |
68 | set VCVER "$::env(VCVER)" |
69 | } |
70 | if { [info exists ::env(VCVARS)] } { |
71 | set VCVARS "$::env(VCVARS)" |
72 | } |
73 | if { [info exists ::env(SHORTCUT_HEADERS)] } { |
74 | set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)" |
75 | } |
76 | if { [info exists ::env(HAVE_FREEIMAGE)] } { |
77 | set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)" |
78 | } |
79 | if { [info exists ::env(HAVE_GL2PS)] } { |
80 | set HAVE_GL2PS "$::env(HAVE_GL2PS)" |
81 | } |
82 | if { [info exists ::env(HAVE_TBB)] } { |
83 | set HAVE_TBB "$::env(HAVE_TBB)" |
84 | } |
85 | if { [info exists ::env(HAVE_OPENCL)] } { |
86 | set HAVE_OPENCL "$::env(HAVE_OPENCL)" |
87 | } |
88 | if { [info exists ::env(HAVE_VTK)] } { |
89 | set HAVE_VTK "$::env(HAVE_VTK)" |
90 | } |
91 | if { [info exists ::env(MACOSX_USE_GLX)] } { |
92 | set MACOSX_USE_GLX "$::env(MACOSX_USE_GLX)" |
93 | } |
94 | if { [info exists ::env(CHECK_QT4)] } { |
95 | set CHECK_QT4 "$::env(CHECK_QT4)" |
96 | } |
97 | if { [info exists ::env(CHECK_JDK)] } { |
98 | set CHECK_JDK "$::env(CHECK_JDK)" |
99 | } |
100 | if { [info exists ::env(PRODUCTS_PATH)] } { |
101 | set PRODUCTS_PATH "$::env(PRODUCTS_PATH)" |
102 | } |
103 | if { [info exists ::env(CSF_OPT_INC)] } { |
104 | set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER] |
105 | } |
106 | if { [info exists ::env(CSF_OPT_LIB32)] } { |
107 | set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER] |
108 | } |
109 | if { [info exists ::env(CSF_OPT_LIB64)] } { |
110 | set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER] |
111 | } |
112 | if { [info exists ::env(CSF_OPT_BIN32)] } { |
113 | set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER] |
114 | } |
115 | if { [info exists ::env(CSF_OPT_BIN64)] } { |
116 | set CSF_OPT_BIN64 [split "$::env(CSF_OPT_BIN64)" $::SYS_PATH_SPLITTER] |
117 | } |
118 | |
119 | # Search header file in $::CSF_OPT_INC and standard paths |
120 | proc wokdep:SearchHeader {theHeader} { |
121 | # search in custom paths |
122 | foreach anIncPath $::CSF_OPT_INC { |
123 | set aPath "${anIncPath}/${theHeader}" |
124 | if { [file exists "$aPath"] } { |
125 | return "$aPath" |
126 | } |
127 | } |
128 | |
129 | # search in system |
130 | set aPath "/usr/include/${theHeader}" |
131 | if { [file exists "$aPath"] } { |
132 | return "$aPath" |
133 | } |
134 | return "" |
135 | } |
136 | |
137 | # Search library file in $::CSF_OPT_LIB* and standard paths |
138 | proc wokdep:SearchLib {theLib theBitness {theSearchPath ""}} { |
139 | if { "$theSearchPath" != "" } { |
140 | set aPath "${theSearchPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}" |
141 | if { [file exists "$aPath"] } { |
142 | return "$aPath" |
143 | } else { |
144 | return "" |
145 | } |
146 | } |
147 | |
148 | # search in custom paths |
149 | foreach aLibPath [set ::CSF_OPT_LIB$theBitness] { |
150 | set aPath "${aLibPath}/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}" |
151 | if { [file exists "$aPath"] } { |
152 | return "$aPath" |
153 | } |
154 | } |
155 | |
156 | # search in system |
157 | if { "$::ARCH" == "$theBitness"} { |
158 | set aPath "/usr/lib/${::SYS_LIB_PREFIX}${theLib}.${::SYS_LIB_SUFFIX}" |
159 | if { [file exists "$aPath"] } { |
160 | return "$aPath" |
161 | } |
162 | } |
163 | |
c7d774c5 |
164 | |
165 | if { "$::tcl_platform(os)" == "Linux" } { |
910970ab |
166 | if { "$theBitness" == "64" } { |
167 | set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so" |
168 | if { [file exists "$aPath"] } { |
169 | return "$aPath" |
170 | } |
171 | } else { |
172 | set aPath "/usr/lib/i386-linux-gnu/lib${theLib}.so" |
173 | if { [file exists "$aPath"] } { |
174 | return "$aPath" |
175 | } |
176 | } |
177 | } |
178 | |
179 | return "" |
180 | } |
181 | |
182 | # Search file in $::CSF_OPT_BIN* and standard paths |
183 | proc wokdep:SearchBin {theBin theBitness {theSearchPath ""}} { |
184 | if { "$theSearchPath" != "" } { |
185 | set aPath "${theSearchPath}/${theBin}" |
186 | if { [file exists "$aPath"] } { |
187 | return "$aPath" |
188 | } else { |
189 | return "" |
190 | } |
191 | } |
192 | |
193 | # search in custom paths |
194 | foreach aBinPath [set ::CSF_OPT_BIN$theBitness] { |
195 | set aPath "${aBinPath}/${theBin}" |
196 | if { [file exists "$aPath"] } { |
197 | return "$aPath" |
198 | } |
199 | } |
200 | |
201 | # search in system |
202 | if { "$::ARCH" == "$theBitness"} { |
203 | set aPath "/usr/bin/${theBin}" |
204 | if { [file exists "$aPath"] } { |
205 | return "$aPath" |
206 | } |
207 | } |
208 | |
209 | return "" |
210 | } |
211 | |
212 | # Detect compiler C-runtime version 'vc*' and architecture '32'/'64' |
213 | # to determine preferred path. |
214 | proc wokdep:Preferred {theList theCmpl theArch} { |
215 | if { [llength $theList] == 0 } { |
216 | return "" |
217 | } |
218 | |
219 | set aShortList {} |
220 | foreach aPath $theList { |
221 | if { [string first "$theCmpl" "$aPath"] != "-1" } { |
222 | lappend aShortList "$aPath" |
223 | } |
224 | } |
225 | |
226 | if { [llength $aShortList] == 0 } { |
227 | #return [lindex $theList 0] |
228 | set aShortList $theList |
229 | } |
230 | |
231 | set aVeryShortList {} |
232 | foreach aPath $aShortList { |
233 | if { [string first "$theArch" "$aPath"] != "-1" } { |
234 | lappend aVeryShortList "$aPath" |
235 | } |
236 | } |
237 | if { [llength $aVeryShortList] == 0 } { |
238 | return [lindex [lsort -decreasing $aShortList] 0] |
239 | } |
240 | |
241 | return [lindex [lsort -decreasing $aVeryShortList] 0] |
242 | } |
243 | |
244 | # Search Tcl/Tk libraries placement |
245 | proc wokdep:SearchTclTk {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
246 | upvar $theErrInc anErrInc |
247 | upvar $theErrLib32 anErrLib32 |
248 | upvar $theErrLib64 anErrLib64 |
249 | upvar $theErrBin32 anErrBin32 |
250 | upvar $theErrBin64 anErrBin64 |
251 | |
252 | set tclver_maj 8 |
253 | set tclver_min 6 |
254 | |
255 | set isFound "true" |
256 | set aTclHPath [wokdep:SearchHeader "tcl.h"] |
257 | set aTkHPath [wokdep:SearchHeader "tk.h"] |
258 | if { "$aTclHPath" == "" || "$aTkHPath" == "" } { |
259 | if { [file exists "/usr/include/tcl8.6/tcl.h"] |
260 | && [file exists "/usr/include/tcl8.6/tk.h" ] } { |
261 | lappend ::CSF_OPT_INC "/usr/include/tcl8.6" |
262 | set aTclHPath "/usr/include/tcl8.6/tcl.h" |
263 | } else { |
264 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$::ARCH" ] |
265 | if { "$aPath" != "" && [file exists "$aPath/include/tcl.h"] && [file exists "$aPath/include/tk.h"] } { |
266 | lappend ::CSF_OPT_INC "$aPath/include" |
267 | set aTclHPath "$aPath/include/tcl.h" |
268 | } else { |
269 | lappend anErrInc "Error: 'tcl.h' or 'tk.h' not found (Tcl/Tk)" |
270 | set isFound "false" |
271 | } |
272 | } |
273 | } |
274 | |
275 | # detect tcl version by parsing header file |
276 | if { $isFound } { |
277 | set fh [open $aTclHPath] |
278 | set tcl_h [read $fh] |
279 | close $fh |
280 | regexp {define\s+TCL_MAJOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_maj |
281 | regexp {define\s+TCL_MINOR_VERSION\s+([0-9]+)} $tcl_h dummy tclver_min |
282 | } |
283 | |
284 | if { "$::tcl_platform(platform)" == "windows" } { |
285 | set aTclLibName "tcl${tclver_maj}${tclver_min}" |
286 | set aTkLibName "tk${tclver_maj}${tclver_min}" |
287 | } else { |
288 | set aTclLibName "tcl${tclver_maj}.${tclver_min}" |
289 | set aTkLibName "tk${tclver_maj}.${tclver_min}" |
290 | } |
291 | |
292 | foreach anArchIter {64 32} { |
293 | set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter"] |
294 | set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter"] |
295 | if { "$aTclLibPath" == "" || "$aTkLibPath" == "" } { |
296 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ] |
297 | set aTclLibPath [wokdep:SearchLib "$aTclLibName" "$anArchIter" "$aPath/lib"] |
298 | set aTkLibPath [wokdep:SearchLib "$aTkLibName" "$anArchIter" "$aPath/lib"] |
299 | if { "$aTclLibPath" != "" && "$aTkLibPath" != "" } { |
300 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
301 | } else { |
302 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aTclLibName}.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}${aTkLibName}.${::SYS_LIB_SUFFIX}' not found (Tcl/Tk)" |
303 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
304 | } |
305 | } |
306 | |
307 | if { "$::tcl_platform(platform)" == "windows" } { |
308 | set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter"] |
309 | set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter"] |
310 | if { "$aTclDllPath" == "" || "$aTkDllPath" == "" } { |
311 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tcl}*] "$::VCVER" "$anArchIter" ] |
312 | set aTclDllPath [wokdep:SearchBin "${aTclLibName}.dll" "$anArchIter" "$aPath/bin"] |
313 | set aTkDllPath [wokdep:SearchBin "${aTkLibName}.dll" "$anArchIter" "$aPath/bin"] |
314 | if { "$aTclDllPath" != "" && "$aTkDllPath" != "" } { |
315 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
316 | } else { |
317 | lappend anErrBin$anArchIter "Error: '${aTclLibName}.dll' or '${aTkLibName}.dll' not found (Tcl/Tk)" |
318 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
319 | } |
320 | } |
321 | } |
322 | } |
323 | |
324 | return "$isFound" |
325 | } |
326 | |
327 | # Search FreeType library placement |
328 | proc wokdep:SearchFreeType {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
329 | upvar $theErrInc anErrInc |
330 | upvar $theErrLib32 anErrLib32 |
331 | upvar $theErrLib64 anErrLib64 |
332 | upvar $theErrBin32 anErrBin32 |
333 | upvar $theErrBin64 anErrBin64 |
334 | |
335 | set isFound "true" |
336 | set aFtBuildPath [wokdep:SearchHeader "ft2build.h"] |
337 | |
910970ab |
338 | if { "$aFtBuildPath" == "" } { |
339 | # TODO - use `freetype-config --cflags` instead |
340 | set aSysFreeType "/usr/include/freetype2" |
c7d774c5 |
341 | if { [file exists "$aSysFreeType/ft2build.h"] } { |
910970ab |
342 | lappend ::CSF_OPT_INC "$aSysFreeType" |
343 | } elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } { |
344 | lappend ::CSF_OPT_INC "$aSysFreeType/freetype2" |
345 | } else { |
346 | set aSysFreeType "/usr/X11/include/freetype2" |
347 | if { [file exists "$aSysFreeType/ft2build.h"] } { |
348 | lappend ::CSF_OPT_INC "/usr/X11/include" |
349 | lappend ::CSF_OPT_INC "$aSysFreeType" |
350 | } else { |
351 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$::ARCH" ] |
352 | if {"$aPath" != ""} { |
353 | if {[file exists "$aPath/include/ft2build.h"]} { |
354 | lappend ::CSF_OPT_INC "$aPath/include" |
355 | } elseif {[file exists "$aPath/include/freetype2/ft2build.h"]} { |
356 | lappend ::CSF_OPT_INC "$aPath/include/freetype2" |
357 | } |
358 | } else { |
359 | lappend anErrInc "Error: 'freetype.h' not found (FreeType2)" |
360 | set isFound "false" |
361 | } |
362 | } |
363 | } |
364 | } |
365 | |
366 | # parse 'freetype-config --libs' |
367 | set aConfLibPath "" |
368 | if { [catch { set aConfLibs [exec freetype-config --libs] } ] == 0 } { |
369 | foreach aPath [split $aConfLibs " "] { |
370 | if { [string first "-L" "$aPath"] == 0 } { |
371 | set aConfLibPath [string range "$aPath" 2 [string length "$aPath"]] |
372 | } |
373 | } |
374 | } |
375 | |
376 | foreach anArchIter {64 32} { |
377 | set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter"] |
378 | if { "$aFtLibPath" == "" } { |
379 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ] |
380 | set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aPath/lib"] |
381 | if { "$aFtLibPath" != "" } { |
382 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
383 | } else { |
384 | set aFtLibPath [wokdep:SearchLib "freetype" "$anArchIter" "$aConfLibPath"] |
385 | if { "$aFtLibPath" != "" } { |
386 | lappend ::CSF_OPT_LIB$anArchIter "$aConfLibPath" |
387 | } else { |
388 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freetype.${::SYS_LIB_SUFFIX}' not found (FreeType2)" |
389 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
390 | } |
391 | } |
392 | } |
393 | if { "$::tcl_platform(platform)" == "windows" } { |
394 | set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter"] |
395 | if { "$aFtDllPath" == "" } { |
396 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freetype}*] "$::VCVER" "$anArchIter" ] |
397 | set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/bin"] |
398 | if { "$aFtDllPath" != "" } { |
399 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
400 | } else { |
401 | set aFtDllPath [wokdep:SearchBin "freetype.dll" "$anArchIter" "$aPath/lib"] |
402 | if { "$aFtDllPath" != "" } { |
403 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" |
404 | } else { |
405 | lappend anErrBin$anArchIter "Error: 'freetype.dll' not found (FreeType2)" |
406 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
407 | } |
408 | } |
409 | } |
410 | } |
411 | } |
412 | |
413 | return "$isFound" |
414 | } |
415 | |
416 | # Search FreeImage library placement |
417 | proc wokdep:SearchFreeImage {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
418 | upvar $theErrInc anErrInc |
419 | upvar $theErrLib32 anErrLib32 |
420 | upvar $theErrLib64 anErrLib64 |
421 | upvar $theErrBin32 anErrBin32 |
422 | upvar $theErrBin64 anErrBin64 |
423 | |
424 | # binary distribution has another layout |
425 | set aFImageDist "Dist" |
426 | set aFImagePlusDist "Wrapper/FreeImagePlus/dist" |
427 | |
428 | set isFound "true" |
429 | set aFImageHPath [wokdep:SearchHeader "FreeImage.h"] |
430 | set aFImagePlusHPath [wokdep:SearchHeader "FreeImagePlus.h"] |
431 | if { "$aFImageHPath" == "" || "$aFImagePlusHPath" == "" } { |
432 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ] |
433 | if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] && [file exists "$aPath/include/FreeImagePlus.h"] } { |
434 | lappend ::CSF_OPT_INC "$aPath/include" |
435 | } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] && [file exists "$aPath/$aFImagePlusDist/FreeImagePlus.h"] } { |
436 | lappend ::CSF_OPT_INC "$aPath/$aFImageDist" |
437 | lappend ::CSF_OPT_INC "$aPath/$aFImagePlusDist" |
438 | } else { |
439 | lappend anErrInc "Error: 'FreeImage.h' or 'FreeImagePlus.h' not found (FreeImage)" |
440 | set isFound "false" |
441 | } |
442 | } |
443 | |
444 | foreach anArchIter {64 32} { |
445 | set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"] |
446 | set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter"] |
447 | if { "$aFImageLibPath" == "" || "$aFImagePlusLibPath" == "" } { |
448 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ] |
449 | set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"] |
450 | set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/lib"] |
451 | if { "$aFImageLibPath" != "" && "$aFImagePlusLibPath" != "" } { |
452 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
453 | } else { |
454 | set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"] |
455 | set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/$aFImagePlusDist"] |
456 | if { "$aFImageLibPath" != "" && "$aFImagePlusLibPath" != "" } { |
457 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist" |
458 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImagePlusDist" |
459 | } else { |
460 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}freeimageplus.${::SYS_LIB_SUFFIX}' not found (FreeImage)" |
461 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
462 | } |
463 | } |
464 | } |
465 | if { "$::tcl_platform(platform)" == "windows" } { |
466 | set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"] |
467 | set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter"] |
468 | if { "$aFImageDllPath" == "" || "$aFImagePlusDllPath" == "" } { |
469 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ] |
470 | set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"] |
471 | set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter" "$aPath/bin"] |
472 | if { "$aFImageDllPath" != "" && "$aFImagePlusDllPath" != "" } { |
473 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
474 | } else { |
475 | set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"] |
476 | set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter" "$aPath/$aFImagePlusDist"] |
477 | if { "$aFImageDllPath" != "" && "$aFImagePlusDllPath" != "" } { |
478 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist" |
479 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImagePlusDist" |
480 | } else { |
481 | lappend anErrBin$anArchIter "Error: 'freeimage.dll' or 'freeimageplus.dll' not found (FreeImage)" |
482 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
483 | } |
484 | } |
485 | } |
486 | } |
487 | } |
488 | |
489 | return "$isFound" |
490 | } |
491 | |
492 | # Search GL2PS library placement |
493 | proc wokdep:SearchGL2PS {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
494 | upvar $theErrInc anErrInc |
495 | upvar $theErrLib32 anErrLib32 |
496 | upvar $theErrLib64 anErrLib64 |
497 | upvar $theErrBin32 anErrBin32 |
498 | upvar $theErrBin64 anErrBin64 |
499 | |
500 | set isFound "true" |
501 | set aGl2psHPath [wokdep:SearchHeader "gl2ps.h"] |
502 | if { "$aGl2psHPath" == "" } { |
503 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$::ARCH" ] |
504 | if { "$aPath" != "" && [file exists "$aPath/include/gl2ps.h"] } { |
505 | lappend ::CSF_OPT_INC "$aPath/include" |
506 | } else { |
507 | lappend anErrInc "Error: 'gl2ps.h' not found (GL2PS)" |
508 | set isFound "false" |
509 | } |
510 | } |
511 | |
512 | foreach anArchIter {64 32} { |
513 | set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter"] |
514 | if { "$aGl2psLibPath" == "" } { |
515 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ] |
516 | set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter" "$aPath/lib"] |
517 | if { "$aGl2psLibPath" != "" } { |
518 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
519 | } else { |
520 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}gl2ps.${::SYS_LIB_SUFFIX}' not found (GL2PS)" |
521 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
522 | } |
523 | } |
524 | if { "$::tcl_platform(platform)" == "windows" } { |
525 | set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter"] |
526 | if { "$aGl2psDllPath" == "" } { |
527 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ] |
528 | set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/bin"] |
529 | if { "$aGl2psDllPath" != "" } { |
530 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
531 | } else { |
532 | set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/lib"] |
533 | if { "$aGl2psDllPath" != "" } { |
534 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" |
535 | } else { |
536 | lappend anErrBin$anArchIter "Error: 'gl2ps.dll' not found (GL2PS)" |
537 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
538 | } |
539 | } |
540 | } |
541 | } |
542 | } |
543 | |
544 | return "$isFound" |
545 | } |
546 | |
547 | # Search TBB library placement |
548 | proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
549 | upvar $theErrInc anErrInc |
550 | upvar $theErrLib32 anErrLib32 |
551 | upvar $theErrLib64 anErrLib64 |
552 | upvar $theErrBin32 anErrBin32 |
553 | upvar $theErrBin64 anErrBin64 |
554 | |
555 | set isFound "true" |
556 | set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"] |
557 | if { "$aTbbHPath" == "" } { |
558 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ] |
559 | if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } { |
560 | lappend ::CSF_OPT_INC "$aPath/include" |
561 | } else { |
562 | lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)" |
563 | set isFound "false" |
564 | } |
565 | } |
566 | |
567 | foreach anArchIter {64 32} { |
568 | set aSubDir "ia32" |
569 | if { "$anArchIter" == "64"} { |
570 | set aSubDir "intel64" |
571 | } |
572 | |
573 | set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"] |
574 | if { "$aTbbLibPath" == "" } { |
575 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ] |
576 | set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"] |
577 | if { "$aTbbLibPath" == "" } { |
578 | # Set the path to the TBB library for Linux |
579 | if { "$::tcl_platform(platform)" != "windows" } { |
580 | set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21" |
581 | } |
582 | set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"] |
583 | if { "$aTbbLibPath" != "" } { |
584 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir" |
585 | } |
586 | } else { |
587 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}" |
588 | } |
589 | if { "$aTbbLibPath" == "" } { |
590 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)" |
591 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
592 | } |
593 | } |
594 | if { "$::tcl_platform(platform)" == "windows" } { |
595 | set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"] |
596 | if { "$aTbbDllPath" == "" } { |
597 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ] |
598 | set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"] |
599 | if { "$aTbbDllPath" != "" } { |
600 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}" |
601 | } else { |
602 | lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)" |
603 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
604 | } |
605 | } |
606 | } |
607 | } |
608 | |
609 | return "$isFound" |
610 | } |
611 | |
612 | # Search OpenCL library placement |
613 | proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
614 | upvar $theErrInc anErrInc |
615 | upvar $theErrLib32 anErrLib32 |
616 | upvar $theErrLib64 anErrLib64 |
617 | upvar $theErrBin32 anErrBin32 |
618 | upvar $theErrBin64 anErrBin64 |
619 | |
620 | set isFound "true" |
621 | if { "$::tcl_platform(os)" == "Darwin" } { |
622 | # OpenCL framework available since Mac OS X 16 |
623 | return "$isFound" |
624 | } |
625 | |
626 | set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"] |
627 | if { "$aCLHPath" == "" } { |
628 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ] |
629 | if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } { |
630 | lappend ::CSF_OPT_INC "$aPath/include" |
631 | } else { |
632 | lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)" |
633 | set isFound "false" |
634 | } |
635 | } |
636 | |
637 | foreach anArchIter {64 32} { |
638 | set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"] |
639 | if { "$aCLLibPath" == "" } { |
640 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ] |
641 | set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"] |
642 | if { "$aCLLibPath" != "" } { |
643 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
644 | } else { |
645 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)" |
646 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
647 | } |
648 | } |
649 | } |
650 | |
651 | return "$isFound" |
652 | } |
653 | |
654 | # Auxiliary function, gets VTK version to set default search directory |
655 | proc wokdep:VtkVersion { thePath } { |
656 | set aResult "6.1" |
657 | |
658 | set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0] |
659 | if { "$aVtkRoot" != "" } { |
660 | set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot] |
661 | if { "$aVtkRoot" != "" } { |
662 | set aResult $aVtkRoot |
663 | } |
664 | } |
665 | |
666 | return $aResult |
667 | } |
668 | |
669 | # Search VTK library placement |
670 | proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
671 | upvar $theErrInc anErrInc |
672 | upvar $theErrLib32 anErrLib32 |
673 | upvar $theErrLib64 anErrLib64 |
674 | upvar $theErrBin32 anErrBin32 |
675 | upvar $theErrBin64 anErrBin64 |
676 | |
677 | set isFound "true" |
678 | |
679 | set aVtkPath "" |
680 | set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"] |
681 | set aVtkVer [wokdep:VtkVersion $aVtkIncPath] |
682 | if { "$aVtkIncPath" == ""} { |
683 | set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] |
684 | set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ] |
685 | if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} { |
686 | set aVtkVer [wokdep:VtkVersion $aVtkPath] |
687 | lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]" |
688 | } else { # try to search in all found paths |
689 | set isFound "false" |
690 | foreach anIt $aPathList { |
691 | if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } { |
692 | set aVtkPath $anIt |
693 | set aVtkVer [wokdep:VtkVersion $aVtkPath] |
694 | lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]" |
695 | set isFound "true" |
696 | break |
697 | } |
698 | } |
699 | |
700 | # Bad case: we do not found vtkConfigure.h in all paths. |
701 | if { "$isFound" == "false"} { |
702 | lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)" |
703 | set isFound "false" |
704 | } |
705 | } |
706 | } |
707 | |
708 | set aVtkLibPath "" |
709 | foreach anArchIter {64 32} { |
710 | set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"] |
711 | if { "$aVtkLibPath" == "" } { |
712 | set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] |
713 | set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ] |
714 | set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"] |
715 | if { "$aVtkLibPath" != "" } { |
716 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
717 | } else { |
718 | set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"] |
719 | if { "$aPath" != "" } { |
720 | set aLibPath $aVtkIncPath |
721 | lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib" |
722 | } else { |
723 | # The last chance: search /lib directory in all found paths |
724 | foreach anIt $aPathList { |
725 | set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"] |
726 | if { "$aVtkLibPath" != ""} { |
727 | lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib" |
728 | break |
729 | } |
730 | } |
731 | if { "$aVtkLibPath" == "" } { |
732 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)" |
733 | if { "$::ARCH" == "$anArchIter" } { |
734 | set isFound "false" |
735 | } |
736 | } |
737 | } |
738 | } |
739 | } |
740 | } |
741 | |
742 | # Search binary path |
743 | if { "$::tcl_platform(platform)" == "windows" } { |
744 | foreach anArchIter {64 32} { |
745 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"] |
746 | if { "$aVtkBinPath" == "" } { |
747 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ] |
748 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"] |
749 | if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
750 | } else { |
751 | set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"] |
752 | if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" } |
753 | } |
754 | } |
755 | } |
756 | |
757 | # We didn't find preferred binary path => search through inc path or among all available VTK directories |
758 | if { "$aVtkBinPath" == "" } { |
759 | # Try to find in lib path |
760 | set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/bin"] |
761 | if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/bin" |
762 | } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/lib"] != "" } { |
763 | lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/lib" |
764 | } else { |
765 | lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)" |
766 | set isFound "false" |
767 | } |
768 | } |
769 | } |
770 | |
771 | return "$isFound" |
772 | } |
773 | |
774 | # Search Qt4 libraries placement |
775 | proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
776 | upvar $theErrInc anErrInc |
777 | upvar $theErrLib32 anErrLib32 |
778 | upvar $theErrLib64 anErrLib64 |
779 | upvar $theErrBin32 anErrBin32 |
780 | upvar $theErrBin64 anErrBin64 |
781 | |
782 | set isFound "true" |
783 | set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"] |
784 | if { "$aQMsgBoxHPath" == "" } { |
785 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ] |
786 | if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } { |
787 | lappend ::CSF_OPT_INC "$aPath/include" |
788 | lappend ::CSF_OPT_INC "$aPath/include/Qt" |
789 | lappend ::CSF_OPT_INC "$aPath/include/QtGui" |
790 | lappend ::CSF_OPT_INC "$aPath/include/QtCore" |
791 | } else { |
792 | if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } { |
793 | lappend ::CSF_OPT_INC "/usr/include/qt4" |
794 | lappend ::CSF_OPT_INC "/usr/include/qt4/Qt" |
795 | lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui" |
796 | lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore" |
797 | } else { |
798 | lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)" |
799 | set isFound "false" |
800 | } |
801 | } |
802 | } |
803 | |
804 | set aQtGuiLibName "QtGui" |
805 | if { "$::tcl_platform(platform)" == "windows" } { |
806 | set aQtGuiLibName "QtGui4" |
807 | } |
808 | |
809 | foreach anArchIter {64 32} { |
810 | set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"] |
811 | if { "$aQMsgBoxLibPath" == "" } { |
812 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ] |
813 | set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"] |
814 | if { "$aQMsgBoxLibPath" != "" } { |
815 | lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib" |
816 | } else { |
817 | lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)" |
818 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
819 | } |
820 | } |
821 | if { "$::tcl_platform(platform)" == "windows" } { |
822 | set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"] |
823 | if { "$aQMsgBoxDllPath" == "" } { |
824 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ] |
825 | set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"] |
826 | if { "$aQMsgBoxDllPath" != "" } { |
827 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
828 | } else { |
829 | lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)" |
830 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
831 | } |
832 | } |
833 | } |
834 | } |
835 | |
836 | return "$isFound" |
837 | } |
838 | |
839 | # Search JDK placement |
840 | proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
841 | upvar $theErrInc anErrInc |
842 | upvar $theErrLib32 anErrLib32 |
843 | upvar $theErrLib64 anErrLib64 |
844 | upvar $theErrBin32 anErrBin32 |
845 | upvar $theErrBin64 anErrBin64 |
846 | |
847 | set isFound "true" |
848 | set aJniHPath [wokdep:SearchHeader "jni.h"] |
849 | set aJniMdHPath [wokdep:SearchHeader "jni_md.h"] |
850 | if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } { |
851 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ] |
852 | if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } { |
853 | lappend ::CSF_OPT_INC "$aPath/include" |
854 | if { "$::tcl_platform(platform)" == "windows" } { |
855 | lappend ::CSF_OPT_INC "$aPath/include/win32" |
856 | } elseif { [file exists "$aPath/include/linux"] } { |
857 | lappend ::CSF_OPT_INC "$aPath/include/linux" |
858 | } |
859 | } else { |
860 | if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } { |
861 | lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include" |
862 | } else { |
863 | lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)" |
864 | set isFound "false" |
865 | } |
866 | } |
867 | } |
868 | |
869 | foreach anArchIter {64 32} { |
870 | set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"] |
871 | if { "$aJavacPath" == "" } { |
872 | set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ] |
873 | set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"] |
874 | if { "$aJavacPath" != "" } { |
875 | lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin" |
876 | } else { |
877 | if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } { |
878 | lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin" |
879 | } else { |
880 | lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)" |
881 | if { "$::ARCH" == "$anArchIter"} { set isFound "false" } |
882 | } |
883 | } |
884 | } |
885 | } |
886 | |
887 | return "$isFound" |
888 | } |
889 | |
890 | # Search X11 libraries placement |
891 | proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} { |
892 | upvar $theErrInc anErrInc |
893 | upvar $theErrLib32 anErrLib32 |
894 | upvar $theErrLib64 anErrLib64 |
895 | upvar $theErrBin32 anErrBin32 |
896 | upvar $theErrBin64 anErrBin64 |
897 | |
898 | set isFound "true" |
899 | if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } { |
900 | return "$isFound" |
901 | } |
902 | |
903 | set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"] |
904 | if { "$aXmuLibPath" == "" } { |
905 | set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"] |
906 | if { "$aXmuLibPath" != "" } { |
907 | #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib" |
908 | } else { |
909 | lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)" |
910 | set isFound "false" |
911 | } |
912 | } |
913 | |
914 | return "$isFound" |
915 | } |
916 | |
917 | # Generate (override) custom environment file |
918 | proc wokdep:SaveCustom {} { |
919 | if { "$::tcl_platform(platform)" == "windows" } { |
920 | set aCustomFilePath "./custom.bat" |
921 | set aFile [open $aCustomFilePath "w"] |
922 | puts $aFile "@echo off" |
923 | puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]" |
924 | |
925 | puts $aFile "" |
926 | puts $aFile "set VCVER=$::VCVER" |
927 | puts $aFile "set ARCH=$::ARCH" |
928 | puts $aFile "set VCVARS=$::VCVARS" |
929 | puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS" |
930 | |
931 | puts $aFile "" |
932 | puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\"" |
933 | |
934 | puts $aFile "" |
935 | puts $aFile "rem Optional 3rd-parties switches" |
936 | puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE" |
937 | puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS" |
938 | puts $aFile "set HAVE_TBB=$::HAVE_TBB" |
939 | puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL" |
940 | puts $aFile "set HAVE_VTK=$::HAVE_VTK" |
941 | puts $aFile "set CHECK_QT4=$::CHECK_QT4" |
942 | puts $aFile "set CHECK_JDK=$::CHECK_JDK" |
943 | |
944 | set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER] |
945 | puts $aFile "" |
946 | puts $aFile "rem Additional headers search paths" |
947 | puts $aFile "set \"CSF_OPT_INC=$aStringInc\"" |
948 | |
949 | set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER] |
950 | puts $aFile "" |
951 | puts $aFile "rem Additional libraries (32-bit) search paths" |
952 | puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\"" |
953 | |
954 | set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER] |
955 | puts $aFile "" |
956 | puts $aFile "rem Additional libraries (64-bit) search paths" |
957 | puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\"" |
958 | |
959 | set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER] |
960 | puts $aFile "" |
961 | puts $aFile "rem Additional (32-bit) search paths" |
962 | puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\"" |
963 | |
964 | set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER] |
965 | puts $aFile "" |
966 | puts $aFile "rem Additional (64-bit) search paths" |
967 | puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\"" |
968 | |
969 | close $aFile |
970 | } else { |
971 | set aCustomFilePath "./custom.sh" |
972 | set aFile [open $aCustomFilePath "w"] |
973 | puts $aFile "#!/bin/bash" |
974 | puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]" |
975 | |
c7d774c5 |
976 | puts $aFile "" |
977 | puts $aFile "export ARCH=$::ARCH" |
978 | puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS" |
910970ab |
979 | |
980 | puts $aFile "" |
981 | puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\"" |
982 | |
983 | puts $aFile "" |
984 | puts $aFile "# Optional 3rd-parties switches" |
985 | puts $aFile "export HAVE_FREEIMAGE=$::HAVE_FREEIMAGE" |
986 | puts $aFile "export HAVE_GL2PS=$::HAVE_GL2PS" |
987 | puts $aFile "export HAVE_TBB=$::HAVE_TBB" |
988 | puts $aFile "export HAVE_OPENCL=$::HAVE_OPENCL" |
989 | puts $aFile "export HAVE_VTK=$::HAVE_VTK" |
990 | if { "$::tcl_platform(os)" == "Darwin" } { |
991 | puts $aFile "export MACOSX_USE_GLX=$::MACOSX_USE_GLX" |
992 | } |
993 | puts $aFile "export CHECK_QT4=$::CHECK_QT4" |
994 | puts $aFile "export CHECK_JDK=$::CHECK_JDK" |
995 | |
996 | set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER] |
997 | puts $aFile "" |
998 | puts $aFile "# Additional headers search paths" |
999 | puts $aFile "export CSF_OPT_INC=\"$aStringInc\"" |
1000 | |
1001 | set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER] |
1002 | puts $aFile "" |
1003 | puts $aFile "# Additional libraries ($::ARCH-bit) search paths" |
1004 | puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\"" |
1005 | |
1006 | set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER] |
1007 | puts $aFile "" |
1008 | puts $aFile "# Additional ($::ARCH-bit) search paths" |
1009 | puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\"" |
1010 | |
1011 | close $aFile |
1012 | } |
1013 | |
1014 | puts "Configuration saved to file '$aCustomFilePath'" |
1015 | } |