0027055: Configuration, genconf.tcl - reduce window height to fit into smaller screens
[occt.git] / adm / genconfdeps.tcl
CommitLineData
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 22set ARCH "64"
910970ab 23
24if { "$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
44set SHORTCUT_HEADERS "true"
45
46set HAVE_FREEIMAGE "false"
47set HAVE_GL2PS "false"
48set HAVE_TBB "false"
49set HAVE_OPENCL "false"
50set HAVE_VTK "false"
51set MACOSX_USE_GLX "false"
52set CHECK_QT4 "false"
53set CHECK_JDK "false"
54set PRODUCTS_PATH ""
55set CSF_OPT_INC [list]
56set CSF_OPT_LIB32 [list]
57set CSF_OPT_LIB64 [list]
58set CSF_OPT_BIN32 [list]
59set CSF_OPT_BIN64 [list]
60
c7d774c5 61if { "$tcl_platform(pointerSize)" == "4" } {
62 set ARCH "32"
63}
910970ab 64if { [info exists ::env(ARCH)] } {
65 set ARCH "$::env(ARCH)"
66}
67if { [info exists ::env(VCVER)] } {
68 set VCVER "$::env(VCVER)"
69}
70if { [info exists ::env(VCVARS)] } {
71 set VCVARS "$::env(VCVARS)"
72}
73if { [info exists ::env(SHORTCUT_HEADERS)] } {
74 set SHORTCUT_HEADERS "$::env(SHORTCUT_HEADERS)"
75}
76if { [info exists ::env(HAVE_FREEIMAGE)] } {
77 set HAVE_FREEIMAGE "$::env(HAVE_FREEIMAGE)"
78}
79if { [info exists ::env(HAVE_GL2PS)] } {
80 set HAVE_GL2PS "$::env(HAVE_GL2PS)"
81}
82if { [info exists ::env(HAVE_TBB)] } {
83 set HAVE_TBB "$::env(HAVE_TBB)"
84}
85if { [info exists ::env(HAVE_OPENCL)] } {
86 set HAVE_OPENCL "$::env(HAVE_OPENCL)"
87}
88if { [info exists ::env(HAVE_VTK)] } {
89 set HAVE_VTK "$::env(HAVE_VTK)"
90}
91if { [info exists ::env(MACOSX_USE_GLX)] } {
92 set MACOSX_USE_GLX "$::env(MACOSX_USE_GLX)"
93}
94if { [info exists ::env(CHECK_QT4)] } {
95 set CHECK_QT4 "$::env(CHECK_QT4)"
96}
97if { [info exists ::env(CHECK_JDK)] } {
98 set CHECK_JDK "$::env(CHECK_JDK)"
99}
100if { [info exists ::env(PRODUCTS_PATH)] } {
101 set PRODUCTS_PATH "$::env(PRODUCTS_PATH)"
102}
103if { [info exists ::env(CSF_OPT_INC)] } {
104 set CSF_OPT_INC [split "$::env(CSF_OPT_INC)" $::SYS_PATH_SPLITTER]
105}
106if { [info exists ::env(CSF_OPT_LIB32)] } {
107 set CSF_OPT_LIB32 [split "$::env(CSF_OPT_LIB32)" $::SYS_PATH_SPLITTER]
108}
109if { [info exists ::env(CSF_OPT_LIB64)] } {
110 set CSF_OPT_LIB64 [split "$::env(CSF_OPT_LIB64)" $::SYS_PATH_SPLITTER]
111}
112if { [info exists ::env(CSF_OPT_BIN32)] } {
113 set CSF_OPT_BIN32 [split "$::env(CSF_OPT_BIN32)" $::SYS_PATH_SPLITTER]
114}
115if { [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
120proc 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
138proc 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
183proc 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.
214proc 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
245proc 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
328proc 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
417proc 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"
f0d3b7af 429 set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
430 if { "$aFImageHPath" == "" } {
910970ab 431 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
f0d3b7af 432 if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
910970ab 433 lappend ::CSF_OPT_INC "$aPath/include"
f0d3b7af 434 } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
910970ab 435 lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
f0d3b7af 436 if { [file exists "$aPath/$aFImagePlusDist/FreeImagePlus.h"] } {
437 lappend ::CSF_OPT_INC "$aPath/$aFImagePlusDist"
438 }
910970ab 439 } else {
f0d3b7af 440 lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
910970ab 441 set isFound "false"
442 }
443 }
444
f0d3b7af 445 set aFImagePlusHPath [wokdep:SearchHeader "FreeImagePlus.h"]
446 if { "$::tcl_platform(platform)" == "windows" && "$aFImagePlusHPath" == "" } {
447 lappend anErrInc "Error: 'FreeImagePlus.h' not found (FreeImage)"
448 set isFound "false"
449 }
450
910970ab 451 foreach anArchIter {64 32} {
f0d3b7af 452 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
453 if { "$aFImageLibPath" == "" } {
910970ab 454 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
f0d3b7af 455 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
456 if { "$aFImageLibPath" != "" } {
910970ab 457 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
458 } else {
f0d3b7af 459 set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
460 if { "$aFImageLibPath" != "" } {
910970ab 461 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
f0d3b7af 462 set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/$aFImagePlusDist"]
463 if { "$aFImagePlusLibPath" != "" } {
464 lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImagePlusDist"
465 }
910970ab 466 } else {
f0d3b7af 467 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
910970ab 468 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
469 }
470 }
471 }
472 if { "$::tcl_platform(platform)" == "windows" } {
f0d3b7af 473 set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter"]
474 if { "$aFImagePlusLibPath" == "" } {
475 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimageplus.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
476 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
477 }
478
910970ab 479 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
480 set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter"]
481 if { "$aFImageDllPath" == "" || "$aFImagePlusDllPath" == "" } {
482 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
483 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/bin"]
484 set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter" "$aPath/bin"]
485 if { "$aFImageDllPath" != "" && "$aFImagePlusDllPath" != "" } {
486 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
487 } else {
488 set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter" "$aPath/$aFImageDist"]
489 set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter" "$aPath/$aFImagePlusDist"]
490 if { "$aFImageDllPath" != "" && "$aFImagePlusDllPath" != "" } {
491 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImageDist"
492 lappend ::CSF_OPT_BIN$anArchIter "$aPath/$aFImagePlusDist"
493 } else {
494 lappend anErrBin$anArchIter "Error: 'freeimage.dll' or 'freeimageplus.dll' not found (FreeImage)"
495 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
496 }
497 }
498 }
499 }
500 }
501
502 return "$isFound"
503}
504
505# Search GL2PS library placement
506proc wokdep:SearchGL2PS {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
507 upvar $theErrInc anErrInc
508 upvar $theErrLib32 anErrLib32
509 upvar $theErrLib64 anErrLib64
510 upvar $theErrBin32 anErrBin32
511 upvar $theErrBin64 anErrBin64
512
513 set isFound "true"
514 set aGl2psHPath [wokdep:SearchHeader "gl2ps.h"]
515 if { "$aGl2psHPath" == "" } {
516 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$::ARCH" ]
517 if { "$aPath" != "" && [file exists "$aPath/include/gl2ps.h"] } {
518 lappend ::CSF_OPT_INC "$aPath/include"
519 } else {
520 lappend anErrInc "Error: 'gl2ps.h' not found (GL2PS)"
521 set isFound "false"
522 }
523 }
524
525 foreach anArchIter {64 32} {
526 set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter"]
527 if { "$aGl2psLibPath" == "" } {
528 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ]
529 set aGl2psLibPath [wokdep:SearchLib "gl2ps" "$anArchIter" "$aPath/lib"]
530 if { "$aGl2psLibPath" != "" } {
531 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
532 } else {
533 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}gl2ps.${::SYS_LIB_SUFFIX}' not found (GL2PS)"
534 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
535 }
536 }
537 if { "$::tcl_platform(platform)" == "windows" } {
538 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter"]
539 if { "$aGl2psDllPath" == "" } {
540 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{gl2ps}*] "$::VCVER" "$anArchIter" ]
541 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/bin"]
542 if { "$aGl2psDllPath" != "" } {
543 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
544 } else {
545 set aGl2psDllPath [wokdep:SearchBin "gl2ps.dll" "$anArchIter" "$aPath/lib"]
546 if { "$aGl2psDllPath" != "" } {
547 lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib"
548 } else {
549 lappend anErrBin$anArchIter "Error: 'gl2ps.dll' not found (GL2PS)"
550 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
551 }
552 }
553 }
554 }
555 }
556
557 return "$isFound"
558}
559
560# Search TBB library placement
561proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
562 upvar $theErrInc anErrInc
563 upvar $theErrLib32 anErrLib32
564 upvar $theErrLib64 anErrLib64
565 upvar $theErrBin32 anErrBin32
566 upvar $theErrBin64 anErrBin64
567
568 set isFound "true"
569 set aTbbHPath [wokdep:SearchHeader "tbb/scalable_allocator.h"]
570 if { "$aTbbHPath" == "" } {
571 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$::ARCH" ]
572 if { "$aPath" != "" && [file exists "$aPath/include/tbb/scalable_allocator.h"] } {
573 lappend ::CSF_OPT_INC "$aPath/include"
574 } else {
575 lappend anErrInc "Error: 'tbb/scalable_allocator.h' not found (Intel TBB)"
576 set isFound "false"
577 }
578 }
579
580 foreach anArchIter {64 32} {
581 set aSubDir "ia32"
582 if { "$anArchIter" == "64"} {
583 set aSubDir "intel64"
584 }
585
586 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter"]
587 if { "$aTbbLibPath" == "" } {
588 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
589 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir/${::VCVER}"]
590 if { "$aTbbLibPath" == "" } {
591 # Set the path to the TBB library for Linux
592 if { "$::tcl_platform(platform)" != "windows" } {
593 set aSubDir "$aSubDir/cc4.1.0_libc2.4_kernel2.6.16.21"
594 }
595 set aTbbLibPath [wokdep:SearchLib "tbb" "$anArchIter" "$aPath/lib/$aSubDir"]
596 if { "$aTbbLibPath" != "" } {
597 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir"
598 }
599 } else {
600 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib/$aSubDir/${::VCVER}"
601 }
602 if { "$aTbbLibPath" == "" } {
603 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}tbb.${::SYS_LIB_SUFFIX}' not found (Intel TBB)"
604 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
605 }
606 }
607 if { "$::tcl_platform(platform)" == "windows" } {
608 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter"]
609 if { "$aTbbDllPath" == "" } {
610 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{tbb}*] "$::VCVER" "$anArchIter" ]
611 set aTbbDllPath [wokdep:SearchBin "tbb.dll" "$anArchIter" "$aPath/bin/$aSubDir/${::VCVER}"]
612 if { "$aTbbDllPath" != "" } {
613 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin/$aSubDir/${::VCVER}"
614 } else {
615 lappend anErrBin$anArchIter "Error: 'tbb.dll' not found (Intel TBB)"
616 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
617 }
618 }
619 }
620 }
621
622 return "$isFound"
623}
624
625# Search OpenCL library placement
626proc wokdep:SearchOpenCL {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
627 upvar $theErrInc anErrInc
628 upvar $theErrLib32 anErrLib32
629 upvar $theErrLib64 anErrLib64
630 upvar $theErrBin32 anErrBin32
631 upvar $theErrBin64 anErrBin64
632
633 set isFound "true"
634 if { "$::tcl_platform(os)" == "Darwin" } {
635 # OpenCL framework available since Mac OS X 16
636 return "$isFound"
637 }
638
639 set aCLHPath [wokdep:SearchHeader "CL/cl_gl.h"]
640 if { "$aCLHPath" == "" } {
641 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$::ARCH" ]
642 if { "$aPath" != "" && [file exists "$aPath/include/CL/cl_gl.h"] } {
643 lappend ::CSF_OPT_INC "$aPath/include"
644 } else {
645 lappend anErrInc "Error: 'CL/cl_gl.h' not found (OpenCL)"
646 set isFound "false"
647 }
648 }
649
650 foreach anArchIter {64 32} {
651 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter"]
652 if { "$aCLLibPath" == "" } {
653 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{OpenCL}*] "$::VCVER" "$anArchIter" ]
654 set aCLLibPath [wokdep:SearchLib "OpenCL" "$anArchIter" "$aPath/lib"]
655 if { "$aCLLibPath" != "" } {
656 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
657 } else {
658 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}OpenCL.${::SYS_LIB_SUFFIX}' not found (OpenCL)"
659 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
660 }
661 }
662 }
663
664 return "$isFound"
665}
666
667# Auxiliary function, gets VTK version to set default search directory
668proc wokdep:VtkVersion { thePath } {
669 set aResult "6.1"
670
671 set aVtkRoot [lindex [regexp -all -inline {[0-9.]*} [file tail $thePath]] 0]
672 if { "$aVtkRoot" != "" } {
673 set aVtkRoot [regexp -inline {[0-9]*.[0-9]*} $aVtkRoot]
674 if { "$aVtkRoot" != "" } {
675 set aResult $aVtkRoot
676 }
677 }
678
679 return $aResult
680}
681
682# Search VTK library placement
683proc wokdep:SearchVTK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
684 upvar $theErrInc anErrInc
685 upvar $theErrLib32 anErrLib32
686 upvar $theErrLib64 anErrLib64
687 upvar $theErrBin32 anErrBin32
688 upvar $theErrBin64 anErrBin64
689
690 set isFound "true"
691
692 set aVtkPath ""
693 set aVtkIncPath [wokdep:SearchHeader "vtkConfigure.h"]
694 set aVtkVer [wokdep:VtkVersion $aVtkIncPath]
695 if { "$aVtkIncPath" == ""} {
696 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
697 set aVtkPath [wokdep:Preferred "$aPathList" "$::VCVER" "$::ARCH" ]
698 if { "$aVtkPath" != "" && [file exists "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]/vtkConfigure.h"]} {
699 set aVtkVer [wokdep:VtkVersion $aVtkPath]
700 lappend ::CSF_OPT_INC "$aVtkPath/include/vtk-[wokdep:VtkVersion $aVtkPath]"
701 } else { # try to search in all found paths
702 set isFound "false"
703 foreach anIt $aPathList {
704 if { [file exists "$anIt/include/vtk-[wokdep:VtkVersion $anIt]/vtkConfigure.h"] } {
705 set aVtkPath $anIt
706 set aVtkVer [wokdep:VtkVersion $aVtkPath]
707 lappend ::CSF_OPT_INC "$anIt/include/vtk-[wokdep:VtkVersion $anIt]"
708 set isFound "true"
709 break
710 }
711 }
712
713 # Bad case: we do not found vtkConfigure.h in all paths.
714 if { "$isFound" == "false"} {
715 lappend anErrInc "Error: 'vtkConfigure.h' not found (VTK)"
716 set isFound "false"
717 }
718 }
719 }
720
721 set aVtkLibPath ""
722 foreach anArchIter {64 32} {
723 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter"]
724 if { "$aVtkLibPath" == "" } {
725 set aPathList [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*]
726 set aPath [wokdep:Preferred $aPathList "$::VCVER" "$anArchIter" ]
727 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aPath/lib"]
728 if { "$aVtkLibPath" != "" } {
729 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
730 } else {
731 set aPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$aVtkPath/lib"]
732 if { "$aPath" != "" } {
733 set aLibPath $aVtkIncPath
734 lappend ::CSF_OPT_LIB$anArchIter "$aLibPath/lib"
735 } else {
736 # The last chance: search /lib directory in all found paths
737 foreach anIt $aPathList {
738 set aVtkLibPath [wokdep:SearchLib "vtkCommonCore-$aVtkVer" "$anArchIter" "$anIt/lib"]
739 if { "$aVtkLibPath" != ""} {
740 lappend ::CSF_OPT_LIB$anArchIter "$anIt/lib"
741 break
742 }
743 }
744 if { "$aVtkLibPath" == "" } {
745 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}vtkCommonCore-${aVtkVer}\.${::SYS_LIB_SUFFIX}' not found (VTK)"
746 if { "$::ARCH" == "$anArchIter" } {
747 set isFound "false"
748 }
749 }
750 }
751 }
752 }
753 }
754
755 # Search binary path
756 if { "$::tcl_platform(platform)" == "windows" } {
757 foreach anArchIter {64 32} {
758 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter"]
759 if { "$aVtkBinPath" == "" } {
760 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{VTK}*] "$::VCVER" "$anArchIter" ]
761 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/bin"]
762 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
763 } else {
764 set aVtkBinPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aPath/lib"]
765 if { "$aVtkBinPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aPath/lib" }
766 }
767 }
768 }
769
770 # We didn't find preferred binary path => search through inc path or among all available VTK directories
771 if { "$aVtkBinPath" == "" } {
772 # Try to find in lib path
773 set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/bin"]
774 if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/bin"
775 } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/lib"] != "" } {
776 lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/lib"
777 } else {
778 lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
779 set isFound "false"
780 }
781 }
782 }
783
784 return "$isFound"
785}
786
787# Search Qt4 libraries placement
788proc wokdep:SearchQt4 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
789 upvar $theErrInc anErrInc
790 upvar $theErrLib32 anErrLib32
791 upvar $theErrLib64 anErrLib64
792 upvar $theErrBin32 anErrBin32
793 upvar $theErrBin64 anErrBin64
794
795 set isFound "true"
796 set aQMsgBoxHPath [wokdep:SearchHeader "QtGui/qmessagebox.h"]
797 if { "$aQMsgBoxHPath" == "" } {
798 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$::ARCH" ]
799 if { "$aPath" != "" && [file exists "$aPath/include/QtGui/qmessagebox.h"] } {
800 lappend ::CSF_OPT_INC "$aPath/include"
801 lappend ::CSF_OPT_INC "$aPath/include/Qt"
802 lappend ::CSF_OPT_INC "$aPath/include/QtGui"
803 lappend ::CSF_OPT_INC "$aPath/include/QtCore"
804 } else {
805 if { [file exists "/usr/include/qt4/QtGui/qmessagebox.h"] } {
806 lappend ::CSF_OPT_INC "/usr/include/qt4"
807 lappend ::CSF_OPT_INC "/usr/include/qt4/Qt"
808 lappend ::CSF_OPT_INC "/usr/include/qt4/QtGui"
809 lappend ::CSF_OPT_INC "/usr/include/qt4/QtCore"
810 } else {
811 lappend anErrInc "Error: 'QtGui/qmessagebox.h' not found (Qt4)"
812 set isFound "false"
813 }
814 }
815 }
816
817 set aQtGuiLibName "QtGui"
818 if { "$::tcl_platform(platform)" == "windows" } {
819 set aQtGuiLibName "QtGui4"
820 }
821
822 foreach anArchIter {64 32} {
823 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter"]
824 if { "$aQMsgBoxLibPath" == "" } {
825 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
826 set aQMsgBoxLibPath [wokdep:SearchLib "${aQtGuiLibName}" "$anArchIter" "$aPath/lib"]
827 if { "$aQMsgBoxLibPath" != "" } {
828 lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
829 } else {
830 lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}${aQtGuiLibName}.${::SYS_LIB_SUFFIX}' not found (Qt4)"
831 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
832 }
833 }
834 if { "$::tcl_platform(platform)" == "windows" } {
835 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter"]
836 if { "$aQMsgBoxDllPath" == "" } {
837 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{qt4}*] "$::VCVER" "$anArchIter" ]
838 set aQMsgBoxDllPath [wokdep:SearchBin "QtGui4.dll" "$anArchIter" "$aPath/bin"]
839 if { "$aQMsgBoxDllPath" != "" } {
840 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
841 } else {
842 lappend anErrBin$anArchIter "Error: 'QtGui4.dll' not found (Qt4)"
843 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
844 }
845 }
846 }
847 }
848
849 return "$isFound"
850}
851
852# Search JDK placement
853proc wokdep:SearchJDK {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
854 upvar $theErrInc anErrInc
855 upvar $theErrLib32 anErrLib32
856 upvar $theErrLib64 anErrLib64
857 upvar $theErrBin32 anErrBin32
858 upvar $theErrBin64 anErrBin64
859
860 set isFound "true"
861 set aJniHPath [wokdep:SearchHeader "jni.h"]
862 set aJniMdHPath [wokdep:SearchHeader "jni_md.h"]
863 if { "$aJniHPath" == "" || "$aJniMdHPath" == "" } {
864 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$::ARCH" ]
865 if { "$aPath" != "" && [file exists "$aPath/include/jni.h"] } {
866 lappend ::CSF_OPT_INC "$aPath/include"
867 if { "$::tcl_platform(platform)" == "windows" } {
868 lappend ::CSF_OPT_INC "$aPath/include/win32"
869 } elseif { [file exists "$aPath/include/linux"] } {
870 lappend ::CSF_OPT_INC "$aPath/include/linux"
871 }
872 } else {
873 if { [file exists "/System/Library/Frameworks/JavaVM.framework/Home/include/jni.h"] } {
874 lappend ::CSF_OPT_INC "/System/Library/Frameworks/JavaVM.framework/Home/include"
875 } else {
876 lappend anErrInc "Error: 'jni.h' or 'jni_md.h' not found (JDK)"
877 set isFound "false"
878 }
879 }
880 }
881
882 foreach anArchIter {64 32} {
883 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter"]
884 if { "$aJavacPath" == "" } {
885 set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{jdk,java}*] "$::VCVER" "$anArchIter" ]
886 set aJavacPath [wokdep:SearchBin "javac${::SYS_EXE_SUFFIX}" "$anArchIter" "$aPath/bin"]
887 if { "$aJavacPath" != "" } {
888 lappend ::CSF_OPT_BIN$anArchIter "$aPath/bin"
889 } else {
890 if { "$::ARCH" == "$anArchIter" && [file exists "/System/Library/Frameworks/JavaVM.framework/Home/bin/javac${::SYS_EXE_SUFFIX}"] } {
891 lappend ::CSF_OPT_BIN$anArchIter "/System/Library/Frameworks/JavaVM.framework/Home/bin"
892 } else {
893 lappend anErrBin$anArchIter "Error: 'javac${::SYS_EXE_SUFFIX}' not found (JDK)"
894 if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
895 }
896 }
897 }
898 }
899
900 return "$isFound"
901}
902
903# Search X11 libraries placement
904proc wokdep:SearchX11 {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64} {
905 upvar $theErrInc anErrInc
906 upvar $theErrLib32 anErrLib32
907 upvar $theErrLib64 anErrLib64
908 upvar $theErrBin32 anErrBin32
909 upvar $theErrBin64 anErrBin64
910
911 set isFound "true"
912 if { "$::tcl_platform(platform)" == "windows" || ( "$::tcl_platform(os)" == "Darwin" && "$::MACOSX_USE_GLX" != "true" ) } {
913 return "$isFound"
914 }
915
916 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH"]
917 if { "$aXmuLibPath" == "" } {
918 set aXmuLibPath [wokdep:SearchLib "Xmu" "$::ARCH" "/usr/X11/lib"]
919 if { "$aXmuLibPath" != "" } {
920 #lappend ::CSF_OPT_LIB$::ARCH "/usr/X11/lib"
921 } else {
922 lappend anErrLib$::ARCH "Error: '${::SYS_LIB_PREFIX}Xmu.${::SYS_LIB_SUFFIX}' not found (X11)"
923 set isFound "false"
924 }
925 }
926
927 return "$isFound"
928}
929
930# Generate (override) custom environment file
931proc wokdep:SaveCustom {} {
932 if { "$::tcl_platform(platform)" == "windows" } {
933 set aCustomFilePath "./custom.bat"
934 set aFile [open $aCustomFilePath "w"]
935 puts $aFile "@echo off"
936 puts $aFile "rem This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
937
938 puts $aFile ""
939 puts $aFile "set VCVER=$::VCVER"
940 puts $aFile "set ARCH=$::ARCH"
941 puts $aFile "set VCVARS=$::VCVARS"
942 puts $aFile "set SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
943
944 puts $aFile ""
945 puts $aFile "set \"PRODUCTS_PATH=$::PRODUCTS_PATH\""
946
947 puts $aFile ""
948 puts $aFile "rem Optional 3rd-parties switches"
949 puts $aFile "set HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
950 puts $aFile "set HAVE_GL2PS=$::HAVE_GL2PS"
951 puts $aFile "set HAVE_TBB=$::HAVE_TBB"
952 puts $aFile "set HAVE_OPENCL=$::HAVE_OPENCL"
953 puts $aFile "set HAVE_VTK=$::HAVE_VTK"
954 puts $aFile "set CHECK_QT4=$::CHECK_QT4"
955 puts $aFile "set CHECK_JDK=$::CHECK_JDK"
956
957 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
958 puts $aFile ""
959 puts $aFile "rem Additional headers search paths"
960 puts $aFile "set \"CSF_OPT_INC=$aStringInc\""
961
962 set aStringLib32 [join $::CSF_OPT_LIB32 $::SYS_PATH_SPLITTER]
963 puts $aFile ""
964 puts $aFile "rem Additional libraries (32-bit) search paths"
965 puts $aFile "set \"CSF_OPT_LIB32=$aStringLib32\""
966
967 set aStringLib64 [join $::CSF_OPT_LIB64 $::SYS_PATH_SPLITTER]
968 puts $aFile ""
969 puts $aFile "rem Additional libraries (64-bit) search paths"
970 puts $aFile "set \"CSF_OPT_LIB64=$aStringLib64\""
971
972 set aStringBin32 [join $::CSF_OPT_BIN32 $::SYS_PATH_SPLITTER]
973 puts $aFile ""
974 puts $aFile "rem Additional (32-bit) search paths"
975 puts $aFile "set \"CSF_OPT_BIN32=$aStringBin32\""
976
977 set aStringBin64 [join $::CSF_OPT_BIN64 $::SYS_PATH_SPLITTER]
978 puts $aFile ""
979 puts $aFile "rem Additional (64-bit) search paths"
980 puts $aFile "set \"CSF_OPT_BIN64=$aStringBin64\""
981
982 close $aFile
983 } else {
984 set aCustomFilePath "./custom.sh"
985 set aFile [open $aCustomFilePath "w"]
986 puts $aFile "#!/bin/bash"
987 puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
988
c7d774c5 989 puts $aFile ""
990 puts $aFile "export ARCH=$::ARCH"
991 puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
910970ab 992
993 puts $aFile ""
994 puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""
995
996 puts $aFile ""
997 puts $aFile "# Optional 3rd-parties switches"
998 puts $aFile "export HAVE_FREEIMAGE=$::HAVE_FREEIMAGE"
999 puts $aFile "export HAVE_GL2PS=$::HAVE_GL2PS"
1000 puts $aFile "export HAVE_TBB=$::HAVE_TBB"
1001 puts $aFile "export HAVE_OPENCL=$::HAVE_OPENCL"
1002 puts $aFile "export HAVE_VTK=$::HAVE_VTK"
1003 if { "$::tcl_platform(os)" == "Darwin" } {
1004 puts $aFile "export MACOSX_USE_GLX=$::MACOSX_USE_GLX"
1005 }
1006 puts $aFile "export CHECK_QT4=$::CHECK_QT4"
1007 puts $aFile "export CHECK_JDK=$::CHECK_JDK"
1008
1009 set aStringInc [join $::CSF_OPT_INC $::SYS_PATH_SPLITTER]
1010 puts $aFile ""
1011 puts $aFile "# Additional headers search paths"
1012 puts $aFile "export CSF_OPT_INC=\"$aStringInc\""
1013
1014 set aStringLib$::ARCH [join [set ::CSF_OPT_LIB$::ARCH] $::SYS_PATH_SPLITTER]
1015 puts $aFile ""
1016 puts $aFile "# Additional libraries ($::ARCH-bit) search paths"
1017 puts $aFile "export CSF_OPT_LIB$::ARCH=\"[set aStringLib$::ARCH]\""
1018
1019 set aStringBin$::ARCH [join [set ::CSF_OPT_BIN$::ARCH] $::SYS_PATH_SPLITTER]
1020 puts $aFile ""
1021 puts $aFile "# Additional ($::ARCH-bit) search paths"
1022 puts $aFile "export CSF_OPT_BIN$::ARCH=\"[set aStringBin$::ARCH]\""
1023
1024 close $aFile
1025 }
1026
1027 puts "Configuration saved to file '$aCustomFilePath'"
1028}