-#!/usr/bin/tclsh
-
-set ARCH "32"
+# =======================================================================
+# Created on: 2012-01-26
+# Created by: Kirill GAVRILOV
+# Copyright (c) 2012 OPEN CASCADE SAS
+#
+# This file is part of Open CASCADE Technology software library.
+#
+# This library is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License version 2.1 as published
+# by the Free Software Foundation, with special exception defined in the file
+# OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+# distribution for complete text of the license and disclaimer of any warranty.
+#
+# Alternatively, this file may be used under the terms of Open CASCADE
+# commercial license or contractual agreement.
+
+# =======================================================================
+# Tools for search of third-party libraries and generation on environment
+# customization script
+# =======================================================================
+
+set ARCH "64"
if { "$tcl_platform(platform)" == "unix" } {
set SYS_PATH_SPLITTER ":"
set CSF_OPT_BIN32 [list]
set CSF_OPT_BIN64 [list]
+if { "$tcl_platform(pointerSize)" == "4" } {
+ set ARCH "32"
+}
if { [info exists ::env(ARCH)] } {
set ARCH "$::env(ARCH)"
}
}
}
- if { "$::tcl_platform(platform)" == "linux" } {
+
+ if { "$::tcl_platform(os)" == "Linux" } {
if { "$theBitness" == "64" } {
set aPath "/usr/lib/x86_64-linux-gnu/lib${theLib}.so"
if { [file exists "$aPath"] } {
set isFound "true"
set aFtBuildPath [wokdep:SearchHeader "ft2build.h"]
- # new layout of headers in Freetype 2.5.x
- if { "$aFtBuildPath" == "" } {
- set aFtBuildPath [wokdep:SearchHeader "freetype2/ft2build.h"]
- }
-
if { "$aFtBuildPath" == "" } {
# TODO - use `freetype-config --cflags` instead
set aSysFreeType "/usr/include/freetype2"
- if { [file exists "$aSysFreeType/ftbuild.h"] } {
+ if { [file exists "$aSysFreeType/ft2build.h"] } {
lappend ::CSF_OPT_INC "$aSysFreeType"
} elseif { [file exists "$aSysFreeType/freetype2/ft2build.h"] } {
lappend ::CSF_OPT_INC "$aSysFreeType/freetype2"
set aFImagePlusDist "Wrapper/FreeImagePlus/dist"
set isFound "true"
- set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
- set aFImagePlusHPath [wokdep:SearchHeader "FreeImagePlus.h"]
- if { "$aFImageHPath" == "" || "$aFImagePlusHPath" == "" } {
+ set aFImageHPath [wokdep:SearchHeader "FreeImage.h"]
+ if { "$aFImageHPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$::ARCH" ]
- if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] && [file exists "$aPath/include/FreeImagePlus.h"] } {
+ if { "$aPath" != "" && [file exists "$aPath/include/FreeImage.h"] } {
lappend ::CSF_OPT_INC "$aPath/include"
- } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] && [file exists "$aPath/$aFImagePlusDist/FreeImagePlus.h"] } {
+ } elseif { "$aPath" != "" && [file exists "$aPath/$aFImageDist/FreeImage.h"] } {
lappend ::CSF_OPT_INC "$aPath/$aFImageDist"
- lappend ::CSF_OPT_INC "$aPath/$aFImagePlusDist"
+ if { [file exists "$aPath/$aFImagePlusDist/FreeImagePlus.h"] } {
+ lappend ::CSF_OPT_INC "$aPath/$aFImagePlusDist"
+ }
} else {
- lappend anErrInc "Error: 'FreeImage.h' or 'FreeImagePlus.h' not found (FreeImage)"
+ lappend anErrInc "Error: 'FreeImage.h' not found (FreeImage)"
set isFound "false"
}
}
+ set aFImagePlusHPath [wokdep:SearchHeader "FreeImagePlus.h"]
+ if { "$::tcl_platform(platform)" == "windows" && "$aFImagePlusHPath" == "" } {
+ lappend anErrInc "Error: 'FreeImagePlus.h' not found (FreeImage)"
+ set isFound "false"
+ }
+
foreach anArchIter {64 32} {
- set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
- set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter"]
- if { "$aFImageLibPath" == "" || "$aFImagePlusLibPath" == "" } {
+ set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter"]
+ if { "$aFImageLibPath" == "" } {
set aPath [wokdep:Preferred [glob -nocomplain -directory "$::PRODUCTS_PATH" -type d *{freeimage}*] "$::VCVER" "$anArchIter" ]
- set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
- set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/lib"]
- if { "$aFImageLibPath" != "" && "$aFImagePlusLibPath" != "" } {
+ set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/lib"]
+ if { "$aFImageLibPath" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/lib"
} else {
- set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
- set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/$aFImagePlusDist"]
- if { "$aFImageLibPath" != "" && "$aFImagePlusLibPath" != "" } {
+ set aFImageLibPath [wokdep:SearchLib "freeimage" "$anArchIter" "$aPath/$aFImageDist"]
+ if { "$aFImageLibPath" != "" } {
lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImageDist"
- lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImagePlusDist"
+ set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter" "$aPath/$aFImagePlusDist"]
+ if { "$aFImagePlusLibPath" != "" } {
+ lappend ::CSF_OPT_LIB$anArchIter "$aPath/$aFImagePlusDist"
+ }
} else {
- lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' or '${::SYS_LIB_PREFIX}freeimageplus.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
+ lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimage.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
}
}
}
if { "$::tcl_platform(platform)" == "windows" } {
+ set aFImagePlusLibPath [wokdep:SearchLib "freeimageplus" "$anArchIter"]
+ if { "$aFImagePlusLibPath" == "" } {
+ lappend anErrLib$anArchIter "Error: '${::SYS_LIB_PREFIX}freeimageplus.${::SYS_LIB_SUFFIX}' not found (FreeImage)"
+ if { "$::ARCH" == "$anArchIter"} { set isFound "false" }
+ }
+
set aFImageDllPath [wokdep:SearchBin "freeimage.dll" "$anArchIter"]
set aFImagePlusDllPath [wokdep:SearchBin "freeimageplus.dll" "$anArchIter"]
if { "$aFImageDllPath" == "" || "$aFImagePlusDllPath" == "" } {
# We didn't find preferred binary path => search through inc path or among all available VTK directories
if { "$aVtkBinPath" == "" } {
# Try to find in lib path
- set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/bin"]
- if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/bin"
- } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aLibPath/lib"] != "" } {
- lappend ::CSF_OPT_BIN$anArchIter "$aLibPath/lib"
+ set aPath [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/bin"]
+ if { "$aPath" != "" } { lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/bin"
+ } elseif { [wokdep:SearchBin "vtkCommonCore-${aVtkVer}.dll" "$anArchIter" "$aVtkLibPath/lib"] != "" } {
+ lappend ::CSF_OPT_BIN$anArchIter "$aVtkLibPath/lib"
} else {
lappend anErrBin$anArchIter "Error: 'vtkCommonCore-${aVtkVer}.dll' not found (VTK)"
set isFound "false"
puts $aFile "#!/bin/bash"
puts $aFile "# This environment file was generated by wok_depsgui.tcl script at [clock format [clock seconds] -format "%Y.%m.%d %H:%M"]"
- #puts $aFile ""
- #puts $aFile "export ARCH=$::ARCH"
+ puts $aFile ""
+ puts $aFile "export ARCH=$::ARCH"
+ puts $aFile "export SHORTCUT_HEADERS=$::SHORTCUT_HEADERS"
puts $aFile ""
puts $aFile "export PRODUCTS_PATH=\"$::PRODUCTS_PATH\""