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