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