set (CSF_gdi32 "gdi32.lib")
set (CSF_user32 "user32.lib")
set (CSF_wsock32 "wsock32.lib")
+ set (CSF_winspool "Winspool.lib")
+ set (CSF_psapi "Psapi.lib")
set (CSF_AviLibs "ws2_32.lib vfw32.lib")
set (CSF_OpenGlLibs "opengl32.lib glu32.lib")
+ if (USE_FREETYPE)
+ set (CSF_FREETYPE "freetype.lib")
+ else()
+ set (CSF_FREETYPE)
+ endif()
+
+ if (USE_FREEIMAGE)
+ set (CSF_FreeImagePlus "freeimage.lib freeimageplus.lib")
+ else()
+ set (CSF_FreeImagePlus)
+ endif()
+
if (USE_TCL)
set (CSF_TclLibs "tcl${3RDPARTY_TCL_LIBRARY_VERSION}.lib")
set (CSF_TclTkLibs "tk${3RDPARTY_TK_LIBRARY_VERSION}.lib")
if (BUILD_SHARED_LIBS)
if (APPLE)
set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
- else()
- set (CMAKE_SHARED_LINKER_FLAGS "-lm -z defs ${CMAKE_SHARED_LINKER_FLAGS}")
+ elseif(NOT WIN32)
+ set (CMAKE_SHARED_LINKER_FLAGS "-lm ${CMAKE_SHARED_LINKER_FLAGS}")
endif()
else()
- if (NOT ANDROID)
+ if (NOT ANDROID AND NOT MINGW)
set (CMAKE_STATIC_LINKER_FLAGS "-lm ${CMAKE_SHARED_STATIC_FLAGS}")
endif()
endif()
endif()
-if (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
+if(MINGW)
+ set (CMAKE_CXX_FLAGS "-std=gnu++0x ${CMAKE_CXX_FLAGS}")
+ add_definitions(-D_WIN32_WINNT=0x0501)
+ # workaround bugs in mingw with vtable export
+ set (CMAKE_SHARED_LINKER_FLAGS "-Wl,--export-all-symbols")
+elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX OR "x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
endif()
endif()
set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNo_Exception")
-set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
\ No newline at end of file
+set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNo_Exception")
# Setting default IDE.
set anTarget ""
+ set aCmpl "gcc"
switch -exact -- "$targetStation" {
"wnt" {set anTarget "$::env(VCVER)"}
"lin" {set anTarget "cbp"}
set anAdmPath "$path/adm"
- OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform"
+ OS:MKPRC "$anAdmPath" "$anTarget" "$aLibType" "$aPlatform" "$aCmpl"
genprojbat "$anTarget"
}
file copy -force -- "$::THE_CASROOT/adm/templates/msvc.bat" "$::path/msvc.bat"
} else {
switch -exact -- "$theIDE" {
- "cbp" { file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh" }
+ "cbp" {
+ file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.sh" "$::path/codeblocks.sh"
+ file copy -force -- "$::THE_CASROOT/adm/templates/codeblocks.bat" "$::path/codeblocks.bat"
+ }
"xcd" { file copy -force -- "$::THE_CASROOT/adm/templates/xcode.sh" "$::path/xcode.sh" }
}
}
set THE_GUIDS_LIST($aTKNullKey) "{00000000-0000-0000-0000-000000000000}"
# Entry function to generate project files and solutions for IDE
-proc OS:MKPRC { {theOutDir {}} {theIDE ""} {theLibType "dynamic"} {thePlatform ""} } {
+# @param theOutDir Root directory for project files
+# @param theIDE IDE code name (vc10 for Visual Studio 2010, cbp for Code::Blocks, xcd for XCode)
+# @param theLibType Library type - dynamic or static
+# @param thePlatform Optional target platform for cross-compiling, e.g. ios for iOS
+# @param theCmpl Compiler option (msvc or gcc)
+proc OS:MKPRC { theOutDir theIDE theLibType thePlatform theCmpl } {
global path targetStation
set aSupportedIDE { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "cbp" "xcd" }
"vc11" -
"vc12" -
"vc14" { OS:MKVC $anOutDir $aModules $anAllSolution $theIDE }
- "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution }
+ "cbp" { OS:MKCBP $anOutDir $aModules $anAllSolution $theCmpl }
"xcd" {
set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
OS:MKXCD $anOutDir $aModules $anAllSolution $theLibType $thePlatform
return $lret
}
+# Collect dependencies map depending on target OS (libraries for CSF_ codenames used in EXTERNLIB) .
+# @param theOS - target OS
# @param theCsfLibsMap - libraries map
# @param theCsfFrmsMap - frameworks map, OS X specific
proc osutils:csfList { theOS theCsfLibsMap theCsfFrmsMap } {
unset theCsfLibsMap
unset theCsfFrmsMap
+ set aLibsMap(CSF_FREETYPE) "freetype"
+ set aLibsMap(CSF_TclLibs) "tcl8.6"
+ set aLibsMap(CSF_TclTkLibs) "tk8.6"
+ if { "$::HAVE_FREEIMAGE" == "true" } {
+ if { "$theOS" == "wnt" } {
+ set aLibsMap(CSF_FreeImagePlus) "FreeImage FreeImagePlus"
+ } else {
+ set aLibsMap(CSF_FreeImagePlus) "freeimage"
+ }
+ }
+ if { "$::HAVE_GL2PS" == "true" } {
+ set aLibsMap(CSF_GL2PS) "gl2ps"
+ }
+ if { "$::HAVE_TBB" == "true" } {
+ set aLibsMap(CSF_TBB) "tbb tbbmalloc"
+ }
+ if { "$::HAVE_VTK" == "true" } {
+ if { "$theOS" == "wnt" } {
+ set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
+ } else {
+ set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
+ }
+ }
+
if { "$theOS" == "wnt" } {
# WinAPI libraries
- set aLibsMap(CSF_kernel32) "kernel32.lib"
- set aLibsMap(CSF_advapi32) "advapi32.lib"
- set aLibsMap(CSF_gdi32) "gdi32.lib"
- set aLibsMap(CSF_user32) "user32.lib"
- set aLibsMap(CSF_opengl32) "opengl32.lib"
- set aLibsMap(CSF_wsock32) "wsock32.lib"
- set aLibsMap(CSF_netapi32) "netapi32.lib"
- set aLibsMap(CSF_AviLibs) "ws2_32.lib vfw32.lib"
- set aLibsMap(CSF_OpenGlLibs) "opengl32.lib"
-
- set aLibsMap(CSF_QT) "QtCore4.lib QtGui4.lib"
-
- # VTK
- set aLibsMap(CSF_VTK) [osutils:vtkCsf "wnt"]
+ set aLibsMap(CSF_kernel32) "kernel32"
+ set aLibsMap(CSF_advapi32) "advapi32"
+ set aLibsMap(CSF_gdi32) "gdi32"
+ set aLibsMap(CSF_user32) "user32 comdlg32"
+ set aLibsMap(CSF_opengl32) "opengl32"
+ set aLibsMap(CSF_wsock32) "wsock32"
+ set aLibsMap(CSF_netapi32) "netapi32"
+ set aLibsMap(CSF_AviLibs) "ws2_32 vfw32"
+ set aLibsMap(CSF_OpenGlLibs) "opengl32"
+ set aLibsMap(CSF_winspool) "Winspool"
+ set aLibsMap(CSF_psapi) "Psapi"
+ set aLibsMap(CSF_d3d9) "d3d9"
+
+ # the naming is different on Windows
+ set aLibsMap(CSF_TclLibs) "tcl86"
+ set aLibsMap(CSF_TclTkLibs) "tk86"
+
+ set aLibsMap(CSF_QT) "QtCore4 QtGui4"
+
+ # tbb headers define different pragma lib depending on debug/release
+ set aLibsMap(CSF_TBB) ""
} else {
- set aLibsMap(CSF_FREETYPE) "freetype"
if { "$theOS" == "mac" } {
set aLibsMap(CSF_objc) "objc"
set aFrmsMap(CSF_Appkit) "Appkit"
set aFrmsMap(CSF_IOKit) "IOKit"
set aFrmsMap(CSF_OpenGlLibs) "OpenGL"
set aFrmsMap(CSF_TclLibs) "Tcl"
+ set aLibsMap(CSF_TclLibs) ""
set aFrmsMap(CSF_TclTkLibs) "Tk"
+ set aLibsMap(CSF_TclTkLibs) ""
} else {
if { "$theOS" == "qnx" } {
- # CSF_ThreadLibs - pthread API is part og libc on QNX
+ # CSF_ThreadLibs - pthread API is part of libc on QNX
set aLibsMap(CSF_OpenGlLibs) "EGL GLESv2"
- set aLibsMap(CSF_TclLibs) "tcl8.6"
- set aLibsMap(CSF_TclTkLibs) "tk8.6"
} else {
set aLibsMap(CSF_ThreadLibs) "pthread rt"
set aLibsMap(CSF_OpenGlLibs) "GL"
- set aLibsMap(CSF_TclLibs) "tcl8.6"
set aLibsMap(CSF_TclTkLibs) "X11 tk8.6"
set aLibsMap(CSF_XwLibs) "X11 Xext Xmu Xi"
set aLibsMap(CSF_MotifLibs) "X11"
}
}
-
- # optional 3rd-parties
- if { "$::HAVE_TBB" == "true" } {
- set aLibsMap(CSF_TBB) "tbb tbbmalloc"
- }
- if { "$::HAVE_FREEIMAGE" == "true" } {
- set aLibsMap(CSF_FreeImagePlus) "freeimage"
- }
- if { "$::HAVE_GL2PS" == "true" } {
- set aLibsMap(CSF_GL2PS) "gl2ps"
- }
- if { "$::HAVE_VTK" == "true" } {
- set aLibsMap(CSF_VTK) [osutils:vtkCsf "unix"]
- }
}
}
proc osutils:vtkCsf {{theOS ""}} {
set aVtkVer "6.1"
- set aLibSuffix ""
set aPathSplitter ":"
-
if {"$theOS" == "wnt"} {
set aPathSplitter ";"
- set aLibSuffix ".lib"
}
set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"]
# Additional suffices for the libraries
set anIdx 0
foreach anItem $aLibArray {
- lset aLibArray $anIdx $anItem-$aVtkVer$aLibSuffix
+ lset aLibArray $anIdx $anItem-$aVtkVer
incr anIdx
}
}
regsub -all -- {__PROJECT_GUID__} $theProjTmpl $aGuidsMap($theToolKit) theProjTmpl
- set aCommonUsedTK [list]
+ set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit] {
- lappend aCommonUsedTK "${tkx}.lib"
+ lappend aUsedLibs "${tkx}.lib"
}
osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks
- set aUsedToolKits [concat $aCommonUsedTK $aLibs]
+ foreach aLibIter $aLibs {
+ lappend aUsedLibs "${aLibIter}.lib"
+ }
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
- regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
+ regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
# and put this list to project file
- #puts "$theToolKit requires $aUsedToolKits"
+ #puts "$theToolKit requires $aUsedLibs"
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
- set aUsedToolKits [join $aUsedToolKits {;}]
+ set aUsedLibs [join $aUsedLibs {;}]
}
- regsub -all -- {__TKDEP__} $theProjTmpl $aUsedToolKits theProjTmpl
+ regsub -all -- {__TKDEP__} $theProjTmpl $aUsedLibs theProjTmpl
set anIncPaths "..\\..\\..\\inc"
set aTKDefines ""
}
regsub -all -- {__PROJECT_GUID__} $aProjTmpl $aGuidsMap($aProjName) aProjTmpl
- set aCommonUsedTK [list]
+ set aUsedLibs [list]
foreach tkx [osutils:commonUsedTK $theToolKit] {
- lappend aCommonUsedTK "${tkx}.lib"
+ lappend aUsedLibs "${tkx}.lib"
}
osutils:usedOsLibs $theToolKit "wnt" aLibs aFrameworks
- set aUsedToolKits [concat $aCommonUsedTK $aLibs]
+ foreach aLibIter $aLibs {
+ lappend aUsedLibs "${aLibIter}.lib"
+ }
# correct names of referred third-party libraries that are named with suffix
# depending on VC version
- regsub -all -- {vc[0-9]+} $aUsedToolKits $theVcVer aUsedToolKits
+ regsub -all -- {vc[0-9]+} $aUsedLibs $theVcVer aUsedLibs
-# puts "$aProjName requires $aUsedToolKits"
+# puts "$aProjName requires $aUsedLibs"
if { "$theVcVer" != "vc7" && "$theVcVer" != "vc8" && "$theVcVer" != "vc9" } {
- set aUsedToolKits [join $aUsedToolKits {;}]
+ set aUsedLibs [join $aUsedLibs {;}]
}
- regsub -all -- {__TKDEP__} $aProjTmpl $aUsedToolKits aProjTmpl
+ regsub -all -- {__TKDEP__} $aProjTmpl $aUsedLibs aProjTmpl
set aFilesSection ""
set aVcFilesX(units) ""
####### CODEBLOCK ###################################################################
# Function to generate Code Blocks workspace and project files
-proc OS:MKCBP { theOutDir {theModules {}} {theAllSolution ""} } {
+proc OS:MKCBP { theOutDir theModules theAllSolution theCmpl } {
puts stderr "Generating project files for Code Blocks"
# Generate projects for toolkits and separate workspace for each module
foreach aModule $theModules {
- OS:cworkspace $aModule $aModule $theOutDir
- OS:cbp $aModule $theOutDir
+ OS:cworkspace $aModule $aModule $theOutDir
+ OS:cbp $theCmpl $aModule $theOutDir
}
# Generate single workspace "OCCT" containing projects from all modules
}
# Generate Code Blocks projects
-proc OS:cbp { theModules theOutDir } {
+proc OS:cbp { theCmpl theModules theOutDir } {
set aProjectFiles {}
foreach aModule $theModules {
foreach aToolKit [${aModule}:toolkits] {
- lappend aProjectFiles [osutils:cbptk $theOutDir $aToolKit ]
+ lappend aProjectFiles [osutils:cbptk $theCmpl $theOutDir $aToolKit ]
}
foreach anExecutable [OS:executable ${aModule}] {
- lappend aProjectFiles [osutils:cbpx $theOutDir $anExecutable]
+ lappend aProjectFiles [osutils:cbpx $theCmpl $theOutDir $anExecutable]
}
}
return $aProjectFiles
}
# Generate Code::Blocks project file for ToolKit
-proc osutils:cbptk { theOutDir theToolKit } {
- set aUsedToolKits [list]
+proc osutils:cbptk { theCmpl theOutDir theToolKit } {
+ set aUsedLibs [list]
set aFrameworks [list]
set anIncPaths [list]
set aTKDefines [list]
set aTKSrcFiles [list]
- osutils:tkinfo "../../.." $theToolKit aUsedToolKits aFrameworks anIncPaths aTKDefines aTKSrcFiles
+ global path targetStation
+ set aWokStation "$targetStation"
+
+ # collect list of referred libraries to link with
+ osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
+ set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
+ foreach tkx $aDepToolkits {
+ lappend aUsedLibs "${tkx}"
+ }
+
+ lappend anIncPaths "../../../inc"
+ set listloc [osutils:tk:units $theToolKit]
+
+ if { [llength $listloc] == 0 } {
+ set listloc $theToolKit
+ }
+
+ if { "$aWokStation" == "wnt" } {
+ set resultloc [osutils:justwnt $listloc]
+ } else {
+ set resultloc [osutils:justunix $listloc]
+ }
+ if [array exists written] { unset written }
+ foreach fxlo $resultloc {
+ set xlo $fxlo
+ set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
+ foreach aSrcFile [lsort $aSrcFiles] {
+ if { ![info exists written([file tail $aSrcFile])] } {
+ set written([file tail $aSrcFile]) 1
+ lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
+ } else {
+ puts "Warning : more than one occurences for [file tail $aSrcFile]"
+ }
+ }
+
+ # macros for correct DLL exports
+ if { "$aWokStation" == "wnt" } {
+ lappend aTKDefines "__${xlo}_DLL"
+ }
+ }
- return [osutils:cbp $theOutDir $theToolKit $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines]
+ return [osutils:cbp $theCmpl $theOutDir $theToolKit $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines]
}
# Generates Code Blocks workspace.
}
# Generate Code::Blocks project file for Executable
-proc osutils:cbpx { theOutDir theToolKit } {
+proc osutils:cbpx { theCmpl theOutDir theToolKit } {
global path targetStation
set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)"
set aCbpFiles {}
foreach aSrcFile [osutils:tk:files $theToolKit osutils:compilable 0] {
# collect list of referred libraries to link with
- set aUsedToolKits [list]
+ set aUsedLibs [list]
set aFrameworks [list]
set anIncPaths [list]
set aTKDefines [list]
set aTKSrcFiles [list]
set aProjName [file rootname [file tail $aSrcFile]]
- osutils:usedOsLibs $theToolKit "$aWokStation" aUsedToolKits aFrameworks
+ osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
+
set aDepToolkits [LibToLinkX $theToolKit $aProjName]
foreach tkx $aDepToolkits {
if {[_get_type $tkx] == "t"} {
- lappend aUsedToolKits "${tkx}"
+ lappend aUsedLibs "${tkx}"
}
if {[lsearch [glob -tails -directory "$path/src" -types d *] $tkx] == "-1"} {
- lappend aUsedToolKits "${tkx}"
+ lappend aUsedLibs "${tkx}"
}
}
if { ![info exists written([file tail $aSrcFile])] } {
set written([file tail $aSrcFile]) 1
- lappend aTKSrcFiles $aSrcFile
+ lappend aTKSrcFiles "../../../[wokUtils:FILES:wtail $aSrcFile 3]"
} else {
puts "Warning : in cbp there are more than one occurences for [file tail $aSrcFile]"
}
# common include paths
lappend anIncPaths "../../../inc"
- # extra macros
- if { "$aWokStation" == "wnt" } {
- lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
- } else {
- lappend aTKDefines "OCC_CONVERT_SIGNALS"
- #lappend aTKDefines "_GNU_SOURCE=1"
- }
-
- lappend aCbpFiles [osutils:cbp $theOutDir $aProjName $aTKSrcFiles $aUsedToolKits $aFrameworks $anIncPaths $aTKDefines $isExecutable]
+ lappend aCbpFiles [osutils:cbp $theCmpl $theOutDir $aProjName $aTKSrcFiles $aUsedLibs $aFrameworks $anIncPaths $aTKDefines $isExecutable]
}
return $aCbpFiles
}
-proc osutils:optinal_libs { } {
- return [list tbb.lib tbbmalloc.lib FreeImage.lib FreeImagePlus.lib gl2ps.lib]
-}
-
# This function intended to generate Code::Blocks project file
+# @param theCmpl - the compiler (gcc or msvc)
# @param theOutDir - output directory to place project file
# @param theProjName - project name
# @param theSrcFiles - list of source files
# @param theIncPaths - header search paths
# @param theDefines - compiler macro definitions
# @param theIsExe - flag to indicate executable / library target
-proc osutils:cbp { theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
+proc osutils:cbp { theCmpl theOutDir theProjName theSrcFiles theLibsList theFrameworks theIncPaths theDefines {theIsExe "false"} } {
global targetStation
set aWokStation "$targetStation"
set aWokArch "$::env(ARCH)"
- set aCbpFilePath "${theOutDir}/${theProjName}.cbp"
+ set aCmplCbp "gcc"
+ set aCmplFlags [list]
+ set aCmplFlagsRelease [list]
+ set aCmplFlagsDebug [list]
+ set toPassArgsByFile 0
+ set aLibPrefix "lib"
+ if { "$aWokStation" == "wnt" || "$aWokStation" == "qnx" } {
+ set toPassArgsByFile 1
+ }
+ if { "$theCmpl" == "msvc" } {
+ set aCmplCbp "msvc8"
+ set aLibPrefix ""
+ }
+
+ if { "$theCmpl" == "msvc" } {
+ set aCmplFlags "-arch:SSE2 -EHsc -W4 -MP"
+ set aCmplFlagsRelease "-MD -O2"
+ set aCmplFlagsDebug "-MDd -Od -Zi"
+ lappend aCmplFlags "-D_CRT_SECURE_NO_WARNINGS"
+ lappend aCmplFlags "-D_CRT_NONSTDC_NO_DEPRECATE"
+ } elseif { "$theCmpl" == "gcc" } {
+ if { "$aWokStation" != "qnx" } {
+ set aCmplFlags "-mmmx -msse -msse2 -mfpmath=sse"
+ }
+ set aCmplFlagsRelease "-O2"
+ set aCmplFlagsDebug "-O0 -g"
+ if { "$aWokStation" == "wnt" } {
+ lappend aCmplFlags "-std=gnu++0x"
+ lappend aCmplFlags "-D_WIN32_WINNT=0x0501"
+ } else {
+ lappend aCmplFlags "-std=c++0x"
+ lappend aCmplFlags "-fPIC"
+ lappend aCmplFlags "-DOCC_CONVERT_SIGNALS"
+ }
+ lappend aCmplFlags "-Wall"
+ lappend aCmplFlags "-fexceptions"
+ }
+ lappend aCmplFlagsRelease "-DNDEBUG"
+ lappend aCmplFlagsRelease "-DNo_Exception"
+ lappend aCmplFlagsDebug "-D_DEBUG"
+ if { "$aWokStation" == "qnx" } {
+ lappend aCmplFlags "-D_QNX_SOURCE"
+ }
+
+ set aCbpFilePath "${theOutDir}/${theProjName}.cbp"
+ set aLnkFileName "${theProjName}_obj.link"
+ set aLnkDebFileName "${theProjName}_objd.link"
+ set aLnkFilePath "${theOutDir}/${aLnkFileName}"
+ set aLnkDebFilePath "${theOutDir}/${aLnkDebFileName}"
set aFile [open $aCbpFilePath "w"]
puts $aFile "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\" ?>"
puts $aFile "<CodeBlocks_project_file>"
puts $aFile "\t<Project>"
puts $aFile "\t\t<Option title=\"$theProjName\" />"
puts $aFile "\t\t<Option pch_mode=\"2\" />"
- if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t<Option compiler=\"msvc8\" />"
- } else {
- puts $aFile "\t\t<Option compiler=\"gcc\" />"
- }
+ puts $aFile "\t\t<Option compiler=\"$aCmplCbp\" />"
puts $aFile "\t\t<Build>"
# Release target configuration
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bin/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/lib/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/lib/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/obj\" />"
+ puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
+ puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
+ puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
- puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
+ puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
- puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
- puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
- if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-MD\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-arch:SSE2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-EHsc\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-W4\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
- } else {
- puts $aFile "\t\t\t\t\t<Add option=\"-O2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
- if { "$aWokStation" != "qnx" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
- }
+ foreach aFlagIter $aCmplFlagsRelease {
+ puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
- puts $aFile "\t\t\t\t\t<Add option=\"-DNDEBUG\" />"
- if { "$aWokStation" == "qnx" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
- }
- puts $aFile "\t\t\t\t\t<Add option=\"-DNo_Exception\" />"
-
puts $aFile "\t\t\t\t</Compiler>"
puts $aFile "\t\t\t\t<Linker>"
+ if { $toPassArgsByFile == 1 } {
+ puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkFileName\" />"
+ }
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/lib\" />"
- if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} {
- puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+ if { "$aWokStation" == "mac" } {
+ if { [ lsearch $theLibsList X11 ] >= 0} {
+ puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+ }
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch})\" />"
puts $aFile "\t\t\t\t</Linker>"
puts $aFile "\t\t\t\t<Option type=\"1\" />"
} else {
if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/${theProjName}\" prefix_auto=\"1\" extension_auto=\"1\" />"
+ puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/bind/${aLibPrefix}${theProjName}\" imp_lib=\"../../../${aWokStation}/cbp/libd/\$(TARGET_OUTPUT_BASENAME)\" prefix_auto=\"1\" extension_auto=\"1\" />"
} else {
puts $aFile "\t\t\t\t<Option output=\"../../../${aWokStation}/cbp/libd/lib${theProjName}.so\" prefix_auto=\"0\" extension_auto=\"0\" />"
}
puts $aFile "\t\t\t\t<Option type=\"3\" />"
}
puts $aFile "\t\t\t\t<Option object_output=\"../../../${aWokStation}/cbp/objd\" />"
+ puts $aFile "\t\t\t\t<Option compiler=\"$aCmplCbp\" />"
+ puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t\t\t<Option compiler=\"msvc8\" />"
+ puts $aFile "\t\t\t\t<Option createStaticLib=\"1\" />"
} else {
- puts $aFile "\t\t\t\t<Option compiler=\"gcc\" />"
+ puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
}
- puts $aFile "\t\t\t\t<Option createDefFile=\"0\" />"
- puts $aFile "\t\t\t\t<Option createStaticLib=\"0\" />"
# compiler options per TARGET (including defines)
puts $aFile "\t\t\t\t<Compiler>"
- if { "$aWokStation" == "wnt" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-MDd\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-arch:SSE2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-EHsc\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-Od\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-Zi\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-W4\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-MP\" />"
- } else {
- puts $aFile "\t\t\t\t\t<Add option=\"-O0\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-std=c++0x\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-g\" />"
- if { "$aWokStation" != "qnx" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-mmmx\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-msse2\" />"
- puts $aFile "\t\t\t\t\t<Add option=\"-mfpmath=sse\" />"
- }
+ foreach aFlagIter $aCmplFlagsDebug {
+ puts $aFile "\t\t\t\t\t<Add option=\"$aFlagIter\" />"
}
foreach aMacro $theDefines {
puts $aFile "\t\t\t\t\t<Add option=\"-D${aMacro}\" />"
}
- puts $aFile "\t\t\t\t\t<Add option=\"-D_DEBUG\" />"
- if { "$aWokStation" == "qnx" } {
- puts $aFile "\t\t\t\t\t<Add option=\"-D_QNX_SOURCE\" />"
- }
- puts $aFile "\t\t\t\t\t<Add option=\"-DDEB\" />"
puts $aFile "\t\t\t\t</Compiler>"
puts $aFile "\t\t\t\t<Linker>"
+ if { $toPassArgsByFile == 1 } {
+ puts $aFile "\t\t\t\t\t<Add option=\"\@$aLnkDebFileName\" />"
+ }
puts $aFile "\t\t\t\t\t<Add directory=\"../../../${aWokStation}/cbp/libd\" />"
- if { "$aWokStation" == "mac" && [ lsearch $theLibsList X11 ] >= 0} {
- puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+ if { "$aWokStation" == "mac" } {
+ if { [ lsearch $theLibsList X11 ] >= 0} {
+ puts $aFile "\t\t\t\t\t<Add directory=\"/usr/X11/lib\" />"
+ }
}
puts $aFile "\t\t\t\t\t<Add option=\"\$(CSF_OPT_LNK${aWokArch}D)\" />"
puts $aFile "\t\t\t\t</Linker>"
# COMMON compiler options
puts $aFile "\t\t<Compiler>"
- puts $aFile "\t\t\t<Add option=\"-Wall\" />"
- puts $aFile "\t\t\t<Add option=\"-fexceptions\" />"
- puts $aFile "\t\t\t<Add option=\"-fPIC\" />"
+ foreach aFlagIter $aCmplFlags {
+ puts $aFile "\t\t\t<Add option=\"$aFlagIter\" />"
+ }
puts $aFile "\t\t\t<Add option=\"\$(CSF_OPT_CMPL)\" />"
foreach anIncPath $theIncPaths {
puts $aFile "\t\t\t<Add directory=\"$anIncPath\" />"
# COMMON linker options
puts $aFile "\t\t<Linker>"
+ if { "$aWokStation" == "wnt" && "$theCmpl" == "gcc" } {
+ puts $aFile "\t\t\t<Add option=\"-Wl,--export-all-symbols\" />"
+ }
foreach aFrameworkName $theFrameworks {
if { "$aFrameworkName" != "" } {
puts $aFile "\t\t\t<Add option=\"-framework $aFrameworkName\" />"
}
foreach aLibName $theLibsList {
if { "$aLibName" != "" } {
- puts $aFile "\t\t\t<Add library=\"$aLibName\" />"
+ if { "$theCmpl" == "msvc" } {
+ puts $aFile "\t\t\t<Add library=\"${aLibName}.lib\" />"
+ } else {
+ puts $aFile "\t\t\t<Add library=\"${aLibName}\" />"
+ }
}
}
puts $aFile "\t\t</Linker>"
# list of sources
+
+ set aFileLnkObj ""
+ set aFileLnkObjd ""
+ set isFirstSrcFile 1
+ if { $toPassArgsByFile == 1 } {
+ set aFileLnkObj [open $aLnkFilePath "w"]
+ set aFileLnkObjd [open $aLnkDebFilePath "w"]
+ }
+
foreach aSrcFile $theSrcFiles {
if {[string equal -nocase [file extension $aSrcFile] ".mm"]} {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
puts $aFile "\t\t\t<Option compilerVar=\"CC\" />"
puts $aFile "\t\t</Unit>"
+ } elseif { $toPassArgsByFile == 1 && $isFirstSrcFile == 0 && [string equal -nocase [file extension $aSrcFile] ".cxx" ] } {
+ # pass at list single source file to Code::Blocks as is
+ # and pack the list of other files into the dedicated file to workaround process arguments limits on systems like Windows
+ puts $aFile "\t\t<Unit filename=\"$aSrcFile\">"
+ puts $aFile "\t\t\t<Option link=\"0\" />"
+ puts $aFile "\t\t</Unit>"
+
+ set aFileObj [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/obj/src/"] $aSrcFile]]
+ set aFileObjd [string map {.cxx .o} [string map [list "/src/" "/$aWokStation/cbp/objd/src/"] $aSrcFile]]
+ puts -nonewline $aFileLnkObj "$aFileObj "
+ puts -nonewline $aFileLnkObjd "$aFileObjd "
} else {
puts $aFile "\t\t<Unit filename=\"$aSrcFile\" />"
+ set isFirstSrcFile 0
}
}
+ if { "$aWokStation" == "wnt" } {
+ close $aFileLnkObj
+ close $aFileLnkObjd
+ }
+
puts $aFile "\t</Project>"
puts $aFile "</CodeBlocks_project_file>"
close $aFile
return $aCbpFilePath
}
-# Auxiliary function to achieve complete information to build Toolkit
-# @param theRelativePath - relative path to CASROOT
-# @param theToolKit - Toolkit name
-# @param theUsedLib - dependencies (libraries list)
-# @param theFrameworks - dependencies (frameworks list, Mac OS X specific)
-# @param theIncPaths - header search paths
-# @param theTKDefines - compiler macro definitions
-# @param theTKSrcFiles - list of source files
-proc osutils:tkinfo { theRelativePath theToolKit theUsedLib theFrameworks theIncPaths theTKDefines theTKSrcFiles } {
- global path targetStation
- set aWokStation "$targetStation"
-
- # collect list of referred libraries to link with
- upvar $theUsedLib aUsedLibs
- upvar $theFrameworks aFrameworks
- upvar $theIncPaths anIncPaths
- upvar $theTKDefines aTKDefines
- upvar $theTKSrcFiles aTKSrcFiles
-
- osutils:usedOsLibs $theToolKit "$aWokStation" aUsedLibs aFrameworks
- set aDepToolkits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
- foreach tkx $aDepToolkits {
- lappend aUsedLibs "${tkx}"
- }
-
- lappend anIncPaths "$theRelativePath/inc"
- set listloc [osutils:tk:units $theToolKit]
-
- if { [llength $listloc] == 0 } {
- set listloc $theToolKit
- }
-
- if { "$aWokStation" == "wnt" } {
- set resultloc [osutils:justwnt $listloc]
- } else {
- set resultloc [osutils:justunix $listloc]
- }
- if [array exists written] { unset written }
- foreach fxlo $resultloc {
- set xlo $fxlo
- set aSrcFiles [osutils:tk:files $xlo osutils:compilable 0]
- foreach aSrcFile [lsort $aSrcFiles] {
- if { ![info exists written([file tail $aSrcFile])] } {
- set written([file tail $aSrcFile]) 1
- lappend aTKSrcFiles "${theRelativePath}/[wokUtils:FILES:wtail $aSrcFile 3]"
- } else {
- puts "Warning : more than one occurences for [file tail $aSrcFile]"
- }
- }
-
- # macros for correct DLL exports
- if { "$aWokStation" == "wnt" } {
- lappend aTKDefines "__${xlo}_DLL"
- }
-
- # common include paths
-# lappend anIncPaths "${theRelativePath}/src/${xlo}"
- }
-
- # extra macros
- if { "$aWokStation" == "wnt" } {
- lappend aTKDefines "_CRT_SECURE_NO_DEPRECATE"
- } else {
- lappend aTKDefines "OCC_CONVERT_SIGNALS"
- #lappend aTKDefines "_GNU_SOURCE=1"
- }
-}
-
# Define libraries to link using only EXTERNLIB file
proc LibToLinkX {thePackage theDummyName} {
set aToolKits [LibToLink $thePackage]
upvar $theDepsRefGuids aDepsRefGuids
set aBuildFileSection ""
- set aUsedToolKits [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
+ set aUsedLibs [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]]
set aDepToolkits [lappend [wokUtils:LIST:Purge [osutils:tk:close $theToolKit]] $theToolKit]
if { "$theTargetType" == "executable" } {
}
osutils:usedOsLibs $theToolKit "mac" aLibs aFrameworks
- set aUsedToolKits [concat $aUsedToolKits $aLibs]
- set aUsedToolKits [concat $aUsedToolKits $aFrameworks]
- foreach tkx $aUsedToolKits {
+ set aUsedLibs [concat $aUsedLibs $aLibs]
+ set aUsedLibs [concat $aUsedLibs $aFrameworks]
+ foreach tkx $aUsedLibs {
set aDepLib "${tkx}_Dep"
set aDepLibRef "${tkx}_DepRef"
--- /dev/null
+@echo off
+
+rem Setup environment
+call "%~dp0env.bat" %1 %2 %3
+
+rem Define path to project file
+set "PRJFILE=%~dp0\adm\wnt\cbp\OCCT.workspace"
+if not exist "%PRJFILE%" set "PRJFILE=%~dp0\adm\wnt\cbp\Products.workspace"
+if not "%4" == "" (
+ set "PRJFILE=%4"
+)
+
+if "%CB_PATH%"=="" if exist "%PROGRAMFILES%\CodeBlocks" set "CB_PATH=%PROGRAMFILES%\CodeBlocks\codeblocks.exe"
+if "%CB_PATH%"=="" set "CB_PATH=codeblocks.exe"
+
+set "CASBIN=wnt\cbp"
+set "PATH=%~dp0%CASBIN%\bin%CASDEB%;%PATH%"
+
+start "" "%CB_PATH%" "%PRJFILE%"
goto :eof
:concatLib32
-set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
+rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
+rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
+set "OPT_LIB32=%OPT_LIB32% -L%1"
goto :eof
:concatLib64
-set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
+rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
+rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
+set "OPT_LIB64=%OPT_LIB64% -L%1"
goto :eof
gp_Dir aTextDir = gce_MakeDir (theFirstAttach, theSecondAttach);
// Drawing text
- DrawText (thePresentation,
+ drawText (thePresentation,
aTextPos,
aTextDir,
theText,
: GetCenterOnArc (aFirstAttach, aSecondAttach, myCenterPoint);
gp_Dir aTextDir = aDimensionDir;
- DrawText (thePresentation,
+ drawText (thePresentation,
aTextPos,
aTextDir,
aLabelString,
if (aTitle.Length())
{
aTitleHeight += myTextHeight + aSpacer;
- DrawText (thePresentation, aTitle, (Standard_Integer)myXPos + aSpacer, myHeight - ((Standard_Integer)myYPos - 2 * aSpacer + aTitleHeight), aFgColor);
+ drawText (thePresentation, aTitle, (Standard_Integer)myXPos + aSpacer, myHeight - ((Standard_Integer)myYPos - 2 * aSpacer + aTitleHeight), aFgColor);
}
Standard_Boolean toReverse = IsReversed();
aGroup->AddPrimitiveArray (aPrim);
if (aStep > 0)
- DrawFrame (thePresentation, aX - 1, (Standard_Integer)(myYPos + anOffset - 1), aColorBreadth + 2, (Standard_Integer)(aColors.Length() * aStep + 2), aFgColor);
+ drawFrame (thePresentation, aX - 1, (Standard_Integer)(myYPos + anOffset - 1), aColorBreadth + 2, (Standard_Integer)(aColors.Length() * aStep + 2), aFgColor);
// Draw Labels
anOffset = 1.0 * Abs (aLabCount - aNum - 1) * ( aStep - aTextHeight ) / 2 + 1.0 * Abs (aLabCount - aNum - 1) * aTextHeight / 2;
Standard_Integer aPos2 = aLabCount - 1 - i2;
if (aFilter && !( aPos1 % aFilter ))
{
- DrawText (thePresentation, aLabels.Value (i1 + 1), aX, (Standard_Integer)( myYPos + i1 * aStep + anAscent + anOffset ), aFgColor);
+ drawText (thePresentation, aLabels.Value (i1 + 1), aX, (Standard_Integer)( myYPos + i1 * aStep + anAscent + anOffset ), aFgColor);
aLast1 = i1;
}
if (aFilter && !( aPos2 % aFilter ))
{
- DrawText (thePresentation, aLabels.Value (i2 + 1), aX, (Standard_Integer)( myYPos + i2 * aStep + anAscent + anOffset ), aFgColor);
+ drawText (thePresentation, aLabels.Value (i2 + 1), aX, (Standard_Integer)( myYPos + i2 * aStep + anAscent + anOffset ), aFgColor);
aLast2 = i2;
}
i1++;
}
if (i0 != -1)
- DrawText (thePresentation, aLabels.Value (i0 + 1), aX, (Standard_Integer)( myYPos + i0 * aStep + anAscent + anOffset ), aFgColor);
+ drawText (thePresentation, aLabels.Value (i0 + 1), aX, (Standard_Integer)( myYPos + i0 * aStep + anAscent + anOffset ), aFgColor);
}
}
//=======================================================================
-//function : DrawFrame
+//function : drawFrame
//purpose :
//=======================================================================
-void AIS_ColorScale::DrawFrame (const Handle(Prs3d_Presentation)& thePresentation,
+void AIS_ColorScale::drawFrame (const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theX, const Standard_Integer theY,
const Standard_Integer theWidth, const Standard_Integer theHeight,
const Quantity_Color& theColor)
}
//=======================================================================
-//function : DrawText
+//function : drawText
//purpose :
//=======================================================================
-void AIS_ColorScale::DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+void AIS_ColorScale::drawText (const Handle(Prs3d_Presentation)& thePresentation,
const TCollection_ExtendedString& theText,
const Standard_Integer theX, const Standard_Integer theY,
const Quantity_Color& theColor)
//! @param theWidth [in] the width of frame.
//! @param theHeight [in] the height of frame.
//! @param theColor [in] the color of frame.
- Standard_EXPORT void DrawFrame (const Handle(Prs3d_Presentation)& thePresentation,
+ Standard_EXPORT void drawFrame (const Handle(Prs3d_Presentation)& thePresentation,
const Standard_Integer theX, const Standard_Integer theY,
const Standard_Integer theWidth, const Standard_Integer theHeight,
const Quantity_Color& theColor);
//! @param theX [in] the X coordinate of text position.
//! @param theY [in] the Y coordinate of text position.
//! @param theColor [in] the color of text.
- Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+ Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation,
const TCollection_ExtendedString& theText,
const Standard_Integer theX, const Standard_Integer theY,
const Quantity_Color& theColor);
}
//=======================================================================
-//function : DrawText
-//purpose :
+//function : drawText
+//purpose :
//=======================================================================
-void AIS_Dimension::DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+void AIS_Dimension::drawText (const Handle(Prs3d_Presentation)& thePresentation,
const gp_Pnt& theTextPos,
const gp_Dir& theTextDir,
const TCollection_ExtendedString& theText,
gp_Pnt aTextPos = ElCLib::Value (theExtensionSize, anExtensionLine);
gp_Dir aTextDir = theExtensionDir;
- DrawText (thePresentation,
+ drawText (thePresentation,
aTextPos,
aTextDir,
theLabelString,
// add text primitives
if (theMode == ComputeMode_All || theMode == ComputeMode_Text)
{
- DrawText (thePresentation,
+ drawText (thePresentation,
aTextPos,
aTextDir,
aLabelString,
//! @param theLabelPosition [in] the text label vertical and horizontal positioning option
//! respectively to the main dimension line.
//! @return text width relative to the dimension working plane. For 2d text this value will be zero.
- Standard_EXPORT void DrawText (const Handle(Prs3d_Presentation)& thePresentation,
+ Standard_EXPORT void drawText (const Handle(Prs3d_Presentation)& thePresentation,
const gp_Pnt& theTextPos,
const gp_Dir& theTextDir,
const TCollection_ExtendedString& theText,
Standard_Integer& ipv2,
TopOpeBRepDS_Kind& pvk2)
{
+ ipv1 = ipv2 = 0;
+ pvk1 = pvk2 = TopOpeBRepDS_UNKNOWN;
+
// myHB->ChangeBuilder();
TopOpeBRepDS_DataStructure& DS = myHDS->ChangeDS();
TopOpeBRepDS_Kind kind = TopOpeBRepDS_POINT;
TColStd_Array1OfInteger& NewMults,
TColStd_Array1OfReal& NewPoles)
{
- Standard_Integer i, nbpoles, nbknots;
+ Standard_Integer i, nbpoles=0, nbknots=0;
Standard_Real kk[2];
Standard_Integer mm[2];
TColStd_Array1OfReal K( kk[0], 1, 2 );
#ifdef _WIN32
TCollection_ExtendedString hd=UTL::xgetenv("HOMEDRIVE");
- if(hd.Length() != NULL) {
+ if(hd.Length() != 0) {
theDefaultFolder=hd;
theDefaultFolder+=UTL::xgetenv("HOMEPATH");
}
else { stat = stat2; reslev = lev2; return; }
}
}
- else if (car < thecars[0]) { acell = this; stat = -1; return; }
+ else /*if (car < thecars[0])*/{ acell = this; stat = -1; return; }
}
{
char buffer[COMMANDSIZE];
POINT pos;
- BOOL rep;
+ BOOL rep = 0;
static LRESULT nbline; // Process the buffer of the edit window
LRESULT index;
}
TCollection_AsciiString aPluginLibrary("");
-#ifndef _WIN32
+#if !defined(_WIN32) || defined(__MINGW32__)
aPluginLibrary += "lib";
#endif
aPluginLibrary += aPluginResource->Value(theKey.ToCString());
commercial license or contractual agreement.
*/
-#ifdef _MSC_VER
+#ifdef _WIN32
//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
di << "Cygwin\n";
#endif
#if defined(__MINGW64__)
- di << "MinGW 64 " << __MINGW64_MAJOR_VERSION << "." << __MINGW64_MINOR_VERSION << "\n";
+ di << "MinGW 64 " << __MINGW64_VERSION_MAJOR << "." << __MINGW64_VERSION_MINOR << "\n";
#elif defined(__MINGW32__)
di << "MinGW 32 " << __MINGW32_MAJOR_VERSION << "." << __MINGW32_MINOR_VERSION << "\n";
#endif
#endif
// for capturing of cout and cerr (dup(), dup2())
-#ifdef _MSC_VER
+#ifdef _WIN32
#include <io.h>
#endif
return;
// restore normal descriptors of console stream
+ #ifdef _WIN32
+ _dup2(save_fd, std_fd);
+ _close(save_fd);
+ #else
dup2(save_fd, std_fd);
close(save_fd);
+ #endif
// extract all output and copy it to log and optionally to cout
const int BUFSIZE = 2048;
extern Draw_Viewer dout;
-static char* ColorNames[MAXCOLOR] = {
- "White","Red","Green","Blue","Cyan","Gold","Magenta",
- "Maroon","Orange","Pink","Salmon","Violet","Yellow","Khaki","Coral"
- };
-
-static Standard_Boolean XLoop;
-
// extern Standard_IMPORT Standard_Boolean Draw_Interprete(char* command); //for C21
Standard_IMPORT Standard_Boolean Draw_Interprete(const char* command); //for C30
// true if complete command
}
//________________________
-DrawWindow::DrawWindow(char* title,
+DrawWindow::DrawWindow(const char* title,
Standard_Integer X, Standard_Integer Y,
Standard_Integer dX,Standard_Integer dY) :
win(0), next(firstWindow), previous(NULL), myMemHbm(NULL), myUseBuffer(Standard_False)
Init(X, Y, dX, dY);
SetTitle(title);
}
-DrawWindow::DrawWindow(char* title,
+DrawWindow::DrawWindow(const char* title,
Standard_Integer X, Standard_Integer Y,
Standard_Integer dX,Standard_Integer dY,
HWND theWin) :
/*--------------------------------------------------------*\
| SetTitle
\*--------------------------------------------------------*/
-void DrawWindow::SetTitle(char* title)
+void DrawWindow::SetTitle(const char* title)
{
SetWindowText(win, title);
}
Standard_EXPORT static void RemoveCallbackBeforeTerminate(FCallbackBeforeTerminate theCB);
__Draw_API DrawWindow();
- __Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer,
+ __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
Standard_Integer, Standard_Integer);
- __Draw_API DrawWindow(char*, Standard_Integer, Standard_Integer,
+ __Draw_API DrawWindow(const char*, Standard_Integer, Standard_Integer,
Standard_Integer, Standard_Integer, HWND);
//destructeur
- __Draw_API ~DrawWindow();
+ __Draw_API virtual ~DrawWindow();
//methods
public:
__Draw_API void SetUseBuffer(Standard_Boolean);
// Turns on/off usage of off-screen image buffer (can be used for redrawing optimization)
- __Draw_API Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
+ Standard_Boolean GetUseBuffer() const { return myUseBuffer; }
// Returns Standard_True if off-screen image buffer is being used
//taille et position
__Draw_API Standard_Integer WidthWin() const;
//Title
- __Draw_API void SetTitle(char*);
+ __Draw_API void SetTitle(const char*);
__Draw_API char* GetTitle();
//Affichage
__Draw_API void Hide();
__Draw_API void Destroy();
__Draw_API void Clear();
- __Draw_API static void Flush() {} ;
+ static void Flush() {} ;
// save snapshot
__Draw_API Standard_Boolean Save(const char* theFileName) const;
{
Handle(DrawTrSurf_Point)
N = Handle(DrawTrSurf_Point)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
ios::fmtflags F = OS.flags();
OS.setf(ios::scientific,ios::floatfield);
OS.precision(15);
OS << "0 ";
OS << P.X() << " " << P.Y() << "\n";
}
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F);
#else
OS.setf(form);
{
Handle(DrawTrSurf_Triangulation)
T = Handle(DrawTrSurf_Triangulation)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
ios::fmtflags F = OS.flags();
OS.setf(ios::scientific,ios::floatfield);
OS.precision(15);
std::streamsize prec = OS.precision(15);
#endif
Poly::Write(T->Triangulation(),OS);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F);
#else
OS.setf(form);
{
Handle(DrawTrSurf_Polygon3D)
T = Handle(DrawTrSurf_Polygon3D)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
ios::fmtflags F = OS.flags();
OS.setf(ios::scientific,ios::floatfield);
OS.precision(15);
std::streamsize prec = OS.precision(15);
#endif
Poly::Write(T->Polygon3D(),OS);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F);
#else
OS.setf(form);
{
Handle(DrawTrSurf_Polygon2D)
T = Handle(DrawTrSurf_Polygon2D)::DownCast(d);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
ios::fmtflags F = OS.flags();
OS.setf(ios::scientific, ios::floatfield);
OS.precision(15);
std::streamsize prec = OS.precision(15);
#endif
Poly::Write(T->Polygon2D(),OS);
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
OS.setf(F);
#else
OS.setf(form);
void DrawTrSurf_Point::Dump(Standard_OStream& S) const
{
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
ios::fmtflags F = S.flags();
S.setf(ios::scientific,ios::floatfield);
S.precision(15);
S << "Point : " << myPoint.X() << ", " << myPoint.Y() << ", " << myPoint.Z() <<endl;
else
S << "Point 2d : " << myPoint.X() << ", " << myPoint.Y() <<endl;
-#if !defined(_WIN32) && !defined(__sgi) && !defined(IRIX)
+#if !defined(_MSC_VER) && !defined(__sgi) && !defined(IRIX)
S.setf(F);
#else
S.setf(form);
if (OpenMode() == Storage_VSNone) {
-#ifdef _WIN32
+#if defined(_MSC_VER)
TCollection_ExtendedString aWName(aName);
if (aMode == Storage_VSRead) {
myStream.open( (const wchar_t*) aWName.ToExtString(),ios::in); // ios::nocreate is not portable
TMultiply(X3,Y3,Z3);
return Standard_True;
}
+ X3 = Y3 = Z3 = XTI3 = YTI3 = ZTI3 = coef3 = U3 = 0.;
return Standard_False;
}
if((Theta<DomainInf) ||
((Theta>DomainSup) && (!TwoCurves)) ||
(Theta>(DomainSup+DomainSup-DomainInf+0.00000000000001))) {
+ SigneSqrtDis = 0.;
Standard_DomainError::Raise("IntAna_Curve::Domain");
}
#include <TColStd_PackedMapOfInteger.hxx>
#include <TColStd_SequenceOfInteger.hxx>
+#ifdef _WIN32
+ #include <malloc.h> // for alloca()
+#endif
+
IMPLEMENT_STANDARD_RTTIEXT(MeshVS_MeshPrsBuilder,MeshVS_PrsBuilder)
//================================================================
IMPLEMENT_STANDARD_RTTIEXT(Message_PrinterOStream,Message_Printer)
-#ifndef _WIN32
+#if !defined(_MSC_VER)
#include <strings.h>
#endif
break;
case MoniTool_ValueEnum : {
def.AssignCat("Enum");
- Standard_Integer startcase, endcase; Standard_Boolean match;
+ Standard_Integer startcase=0, endcase=0;
+ Standard_Boolean match=0;
EnumDef (startcase,endcase,match);
Sprintf(mess," [%s%d-%d]",(match ? "in " : ""),startcase,endcase);
def.AssignCat(mess);
NCollection_UtfIterator.lxx
NCollection_UtfString.hxx
NCollection_UtfString.lxx
+NCollection_UtfString.cxx
NCollection_Vec2.hxx
NCollection_Vec3.hxx
NCollection_Vec4.hxx
--- /dev/null
+// Created on: 2016-02-23
+// Created by: Kirill Gavrilov
+// Copyright (c) 2016 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.
+
+#if defined(_WIN32)
+ #include <windows.h>
+#endif
+
+#include <NCollection_UtfString.hxx>
+
+//=======================================================================
+//function : ~NCollection_UtfStringTool
+//purpose :
+//=======================================================================
+NCollection_UtfStringTool::~NCollection_UtfStringTool()
+{
+ delete[] myWideBuffer;
+}
+
+//=======================================================================
+//function : FromLocale()
+//purpose :
+//=======================================================================
+wchar_t* NCollection_UtfStringTool::FromLocale (const char* theString)
+{
+ if (myWideBuffer != NULL)
+ {
+ delete[] myWideBuffer;
+ myWideBuffer = NULL;
+ }
+
+#if defined(_WIN32)
+ // use WinAPI
+ int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0);
+ if (aWideSize <= 0)
+ {
+ return NULL;
+ }
+
+ myWideBuffer = new wchar_t[aWideSize + 1];
+ MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, myWideBuffer, aWideSize);
+ myWideBuffer[aWideSize] = L'\0';
+#else
+ // this is size in bytes but should probably be enough to store string in wide chars
+ // notice that these functions are sensitive to locale set by application!
+ int aMbLen = mblen (theString, MB_CUR_MAX);
+ if (aMbLen <= 0)
+ {
+ return NULL;
+ }
+
+ myWideBuffer = new wchar_t[aMbLen + 1];
+ mbstowcs (myWideBuffer, theString, aMbLen);
+ myWideBuffer[aMbLen] = L'\0';
+#endif
+ return myWideBuffer;
+}
+
+//=======================================================================
+//function : ToLocale()
+//purpose :
+//=======================================================================
+bool NCollection_UtfStringTool::ToLocale (const wchar_t* theWideString,
+ char* theBuffer,
+ const Standard_Integer theSizeBytes)
+{
+#if defined(_WIN32)
+ int aMbBytes = WideCharToMultiByte (CP_ACP, 0, theWideString, -1, theBuffer, theSizeBytes, NULL, NULL);
+#else
+ std::size_t aMbBytes = std::wcstombs (theBuffer, theWideString, theSizeBytes);
+#endif
+ if (aMbBytes <= 0)
+ {
+ *theBuffer = '\0';
+ return false;
+ }
+ return true;
+}
strFree (anOldBuffer);
}
+//! Auxiliary convertion tool.
+class NCollection_UtfStringTool
+{
+public:
+ //! Empty constructor.
+ NCollection_UtfStringTool() : myWideBuffer (NULL) {}
+
+ //! Destructor for temporary resources.
+ Standard_EXPORT ~NCollection_UtfStringTool();
+
+ //! Convert the string from current locale into UNICODE (wide characters) using system APIs.
+ //! Returned pointer will be released by this tool.
+ Standard_EXPORT wchar_t* FromLocale (const char* theString);
+
+ //! Convert the UNICODE (wide characters) string into locale using system APIs.
+ Standard_EXPORT static bool ToLocale (const wchar_t* theWideString,
+ char* theBuffer,
+ const Standard_Integer theSizeBytes);
+private:
+ wchar_t* myWideBuffer; //!< temporary variable
+};
+
// =======================================================================
// function : FromLocale
// purpose :
void NCollection_UtfString<Type>::FromLocale (const char* theString,
const Standard_Integer theLength)
{
-#if(defined(_WIN32) || defined(__WIN32__))
- // use WinAPI
- int aWideSize = MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, NULL, 0);
- if (aWideSize <= 0)
- {
- Clear();
- return;
- }
- wchar_t* aWideBuffer = new wchar_t[aWideSize + 1];
- MultiByteToWideChar (CP_ACP, MB_PRECOMPOSED, theString, -1, aWideBuffer, aWideSize);
- aWideBuffer[aWideSize] = L'\0';
- FromUnicode (aWideBuffer, theLength);
- delete[] aWideBuffer;
-#else
- // this is size in bytes but should probably be enough to store string in wide chars
- // notice that these functions are sensitive to locale set by application!
- int aMbLen = mblen (theString, MB_CUR_MAX);
- if (aMbLen <= 0)
+ NCollection_UtfStringTool aConvertor;
+ wchar_t* aWideBuffer = aConvertor.FromLocale (theString);
+ if (aWideBuffer == NULL)
{
Clear();
return;
}
- wchar_t* aWideBuffer = new wchar_t[aMbLen + 1];
- mbstowcs (aWideBuffer, theString, aMbLen);
- aWideBuffer[aMbLen] = L'\0';
FromUnicode (aWideBuffer, theLength);
- delete[] aWideBuffer;
-#endif
}
// =======================================================================
const Standard_Integer theSizeBytes) const
{
NCollection_UtfString<wchar_t> aWideCopy (myString, myLength);
-#if(defined(_WIN32) || defined(__WIN32__))
- int aMbBytes = WideCharToMultiByte (CP_ACP, 0, aWideCopy.ToCString(), -1, theBuffer, theSizeBytes, NULL, NULL);
-#else
- std::size_t aMbBytes = std::wcstombs (theBuffer, aWideCopy.ToCString(), theSizeBytes);
-#endif
- if (aMbBytes <= 0)
- {
- *theBuffer = '\0';
- return false;
- }
- return true;
+ return NCollection_UtfStringTool::ToLocale (aWideCopy.ToCString(), theBuffer, theSizeBytes);
}
// =======================================================================
#endif
myToZeroMemory (Standard_False)
{
-#if(defined(_WIN32) || defined(__WIN32__))
+#if defined(_WIN32) && (_WIN32_WINNT >= 0x0501)
// activate LHF to improve small size allocations
ULONG aHeapInfo = 2;
HeapSetInformation (myHeapH, HeapCompatibilityInformation,
void OSD_DirectoryIterator :: Next () {
- if ( myFirstCall && !( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ||
- !myFirstCall
- ) {
+ if ( ! myFirstCall || ! ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
do {
// --------------------------------------------------------------------------
// Read content of a file
// --------------------------------------------------------------------------
-void OSD_File::Read( Standard_Address& Buffer,
+void OSD_File::Read(const Standard_Address Buffer,
const Standard_Integer Nbyte,
Standard_Integer& Readbyte)
{
#if defined(__CYGWIN32__) || defined(__MINGW32__)
#define VAC
-#define _int64 int
#endif
-#pragma comment( lib, "WSOCK32.LIB" )
-#pragma comment( lib, "WINSPOOL.LIB" )
+#if defined(_MSC_VER)
+ #pragma comment( lib, "WSOCK32.LIB" )
+ #pragma comment( lib, "WINSPOOL.LIB" )
+#endif
#define ACE_HEADER_SIZE ( sizeof ( ACCESS_ALLOWED_ACE ) - sizeof ( DWORD ) )
}
Standard_Integer NbyteRead;
- Standard_Address buff;
TEST_RAISE( "Read" );
- buff = ( Standard_Address )new Standard_Character[ Nbyte + 1 ];
+ char* buff = new Standard_Character[ Nbyte + 1 ];
Read ( buff, Nbyte, NbyteRead );
- ( ( Standard_PCharacter )buff )[ NbyteRead ] = 0;
+ buff[ NbyteRead ] = 0;
if ( NbyteRead != 0 )
- Buffer = ( Standard_PCharacter )buff;
+ Buffer = buff;
else
// --------------------------------------------------------------------------
void OSD_File :: Read (
- Standard_Address& Buffer,
+ const Standard_Address Buffer,
const Standard_Integer Nbyte, Standard_Integer& Readbyte
) {
typedef struct _osd_wnt_key {
HKEY hKey;
- LPTSTR keyPath;
+ const char* keyPath;
} OSD_WNT_KEY;
// Return size of a file
// --------------------------------------------------------------------------
-Standard_Size OSD_File :: Size () {
-
- Standard_Integer retVal;
-
- TEST_RAISE( "Size" );
-
- LARGE_INTEGER aSize;
- aSize.QuadPart = 0;
- retVal = GetFileSizeEx (myFileHandle, &aSize);
-
- if ( retVal == 0 )
-
- _osd_wnt_set_error ( myError, OSD_WFile );
-
- return (Standard_Size)aSize.QuadPart;
-
-} // end OSD_File :: Size
+Standard_Size OSD_File::Size()
+{
+ TEST_RAISE("Size");
+#if (_WIN32_WINNT >= 0x0500)
+ LARGE_INTEGER aSize;
+ aSize.QuadPart = 0;
+ if (GetFileSizeEx (myFileHandle, &aSize) == 0)
+ {
+ _osd_wnt_set_error (myError, OSD_WFile);
+ }
+ return (Standard_Size)aSize.QuadPart;
+#else
+ DWORD aSize = GetFileSize (myFileHandle, NULL);
+ if (aSize == INVALID_FILE_SIZE)
+ {
+ _osd_wnt_set_error (myError, OSD_WFile);
+ }
+ return aSize;
+#endif
+}
// --------------------------------------------------------------------------
// Print contains of a file
DWORD dwAccessOwner;
DWORD dwAccessWorld;
DWORD dwAccessAdminDir;
- DWORD dwAccessGroupDir;
+// DWORD dwAccessGroupDir;
DWORD dwAccessOwnerDir;
- DWORD dwAccessWorldDir;
+// DWORD dwAccessWorldDir;
DWORD dwACLsize = sizeof ( ACL );
DWORD dwIndex = 0;
PTOKEN_OWNER pTkOwner = NULL;
dwAccessWorld = _get_access_mask ( prot.World () );
dwAccessAdminDir = _get_dir_access_mask ( prot.System () );
- dwAccessGroupDir = _get_dir_access_mask ( prot.Group () );
+// dwAccessGroupDir = _get_dir_access_mask ( prot.Group () );
dwAccessOwnerDir = _get_dir_access_mask ( prot.User () );
- dwAccessWorldDir = _get_dir_access_mask ( prot.World () );
+// dwAccessWorldDir = _get_dir_access_mask ( prot.World () );
if ( dwAccessGroup != 0 ) {
//! may be less than Nbyte if the number of bytes left in the file
//! is less than Nbyte bytes. For this reason the output
//! parameter Readbyte will contain the number of read bytes.
- Standard_EXPORT void Read (Standard_Address& Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte);
+ Standard_EXPORT void Read (const Standard_Address Buffer, const Standard_Integer Nbyte, Standard_Integer& Readbyte);
//! Attempts to write Nbyte bytes from the AsciiString to the file
//! associated to the object File.
void OSD_FileIterator :: Next () {
- if ( myFirstCall && ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ||
- !myFirstCall
- ) {
+ if ( ! myFirstCall || ( _FD -> dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) ) {
do {
#include <OSD_Host.hxx>
-#pragma comment( lib, "WSOCK32.LIB" )
+#if defined(_MSC_VER)
+ #pragma comment( lib, "WSOCK32.LIB" )
+#endif
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
myCounters[anIter] = Standard_Size(-1);
}
-#if (defined(_WIN32) || defined(__WIN32__))
+#if defined(_WIN32)
+#if (_WIN32_WINNT >= 0x0500)
MEMORYSTATUSEX aStatEx;
aStatEx.dwLength = sizeof(aStatEx);
GlobalMemoryStatusEx (&aStatEx);
myCounters[MemVirtual] = Standard_Size(aStatEx.ullTotalVirtual - aStatEx.ullAvailVirtual);
+#else
+ MEMORYSTATUS aStat;
+ aStat.dwLength = sizeof(aStat);
+ GlobalMemoryStatus (&aStat);
+ myCounters[MemVirtual] = Standard_Size(aStat.dwTotalVirtual - aStat.dwAvailVirtual);
+#endif
// use Psapi library
HANDLE aProcess = GetCurrentProcess();
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
+#ifdef _WIN32
+ #include <windows.h>
+#endif
+
#include <OSD_OpenFile.hxx>
#include <TCollection_ExtendedString.hxx>
#include <NCollection_UtfString.hxx>
const char* theMode)
{
FILE* aFile = 0;
-#ifdef _WIN32
+#if defined(_WIN32)
// file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
const char* theMode)
{
FILE* aFile = 0;
-#ifdef _WIN32
+#if defined(_WIN32)
const TCollection_ExtendedString aFileModeW (theMode, Standard_True);
aFile = ::_wfopen ((const wchar_t* )theName.ToExtString(),
(const wchar_t* )aFileModeW.ToExtString());
const char* theName,
const std::ios_base::openmode theMode)
{
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
// file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
theBuff.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode)
{
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
theBuff.open ((const wchar_t* )theName.ToExtString(), theMode);
#else
// conversion in UTF-8 for linux
const char* theName,
const std::ios_base::openmode theMode)
{
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
// file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
theStream.open ((const wchar_t* )aFileNameW.ToExtString(), theMode);
const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode)
{
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
theStream.open ((const wchar_t* )theName.ToExtString(), theMode);
#else
// conversion in UTF-8 for linux
const char* theName,
const std::ios_base::openmode theMode)
{
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
// file name is treated as UTF-8 string and converted to UTF-16 one
const TCollection_ExtendedString aFileNameW (theName, Standard_True);
theStream.open ((const wchar_t*)aFileNameW.ToExtString(), theMode);
const TCollection_ExtendedString& theName,
const std::ios_base::openmode theMode)
{
-#ifdef _WIN32
+#if defined(_WIN32) && defined(_MSC_VER)
theStream.open ((const wchar_t*)theName.ToExtString(), theMode);
#else
// conversion in UTF-8 for linux
Standard_Integer i = 1;
Standard_Integer retVal = 0;
- if ( myTrek.IsEmpty () || myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|' )
+ if ( myTrek.IsEmpty () || (myTrek.Length () == 1 && myTrek.Value ( 1 ) == '|') )
return retVal;
#include <OSD_WNT_1.hxx>
#include <LMCONS.H> /// pour UNLEN ( see MSDN about GetUserName() )
-
-#pragma warning( disable : 4700 )
+#if defined(_MSC_VER)
+ #pragma warning( disable : 4700 )
+#endif
void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
# endif
# endif /* OSDAPI */
-#if defined(__CYGWIN32__) || defined(__MINGW32__)
-#define _TINT int
-#endif
-
# ifdef __cplusplus
extern "C" {
# endif /* __cplusplus */
#endif
#include <windows.h>
+#ifndef STATUS_FLOAT_MULTIPLE_FAULTS
+ // <ntstatus.h>
+ #define STATUS_FLOAT_MULTIPLE_FAULTS (0xC00002B4L)
+ #define STATUS_FLOAT_MULTIPLE_TRAPS (0xC00002B5L)
+#endif
+
#include <OSD_Exception_ACCESS_VIOLATION.hxx>
#include <OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx>
#include <OSD_Exception_ILLEGAL_INSTRUCTION.hxx>
#if defined(HAVE_EGL)
return (void* )eglGetProcAddress (theFuncName);
#elif defined(_WIN32)
- return wglGetProcAddress (theFuncName);
+ return (void* )wglGetProcAddress (theFuncName);
#elif defined(__APPLE__) && !defined(MACOSX_USE_GLX)
return (myGlLibHandle != NULL) ? dlsym (myGlLibHandle, theFuncName) : NULL;
#else
#include <Standard_Assert.hxx>
#include <TCollection_AsciiString.hxx>
+#ifdef _WIN32
+ #include <malloc.h> // for alloca()
+#endif
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderObject,OpenGl_Resource)
#include <OpenGl_GlCore32.hxx>
+#ifdef _WIN32
+ #include <malloc.h> // for alloca()
+#endif
+
IMPLEMENT_STANDARD_RTTIEXT(OpenGl_ShaderProgram,OpenGl_Resource)
OpenGl_VariableSetterSelector OpenGl_ShaderProgram::mySetterSelector = OpenGl_VariableSetterSelector();
chr = dir.Value ( i );
switch ( chr ) {
-
- case _TEXT( '|' ):
- dirRet += _TEXT( "/" );
+
+ case '|':
+ dirRet += "/";
break;
-
- case _TEXT( '^' ):
-
- dirRet += _TEXT( ".." );
+
+ case '^':
+
+ dirRet += "..";
break;
default:
#endif
// this code does not work with optimize mode on Windows
-#ifdef _WIN32
+#if defined(_MSC_VER)
#pragma optimize( "", off )
#endif
static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
return 0;
}
-#ifdef _WIN32
+#if defined(_MSC_VER)
#pragma optimize( "", on )
#endif
aVar = getenv ("MMGT_OPT");
Standard_Integer anAllocId = (aVar ? atoi (aVar): OCCT_MMGT_OPT_DEFAULT);
-#if defined(_WIN32) && !defined(_WIN64)
+#if defined(_WIN32) && !defined(_WIN64) && !defined(__MINGW32__)
static const DWORD _SSE2_FEATURE_BIT(0x04000000);
if ( anAllocId == 2 )
{
// User messages are activated in debug mode only
#ifdef _DEBUG
#if (defined(_WIN32) || defined(__WIN32__))
- #if defined(_MSC_VER)
+ #if defined(_MSC_VER) || defined(__MINGW64__)
// VS-specific intrinsic
#define Standard_ASSERT_DBGBREAK_() __debugbreak()
#else
CLocalePtr()
#ifdef HAVE_XLOCALE_H
: myLocale (newlocale (LC_ALL_MASK, "C", NULL))
- #elif defined(_WIN32)
+ #elif defined(_WIN32) && !defined(__MINGW32__)
: myLocale (_create_locale (LC_ALL, "C"))
#else
: myLocale (NULL)
{
#ifdef HAVE_XLOCALE_H
freelocale (myLocale);
- #elif defined(_WIN32)
+ #elif defined(_WIN32) && !defined(__MINGW32__)
_free_locale (myLocale);
#endif
}
#ifdef HAVE_XLOCALE_H
typedef locale_t clocale_t;
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__MINGW32__)
typedef _locale_t clocale_t;
#else
typedef void* clocale_t;
#ifdef __APPLE__
// There are a lot of *_l functions availalbe on Mac OS X - we use them
#define SAVE_TL()
-#elif defined(_WIN32)
+#elif defined(_WIN32) && !defined(__MINGW32__)
// MSVCRT has equivalents with slightly different syntax
#define SAVE_TL()
#define strtod_l(thePtr, theNextPtr, theLocale) _strtod_l(thePtr, theNextPtr, theLocale)
// glibc version for android platform use locale-independent implementation of
// strtod, strtol, strtoll functions. For other system with locale-depended
// implementations problems may appear if "C" locale is not set explicitly.
- #if !defined(__ANDROID__) && !defined(__QNX__)
+ #if !defined(__ANDROID__) && !defined(__QNX__) && !defined(__MINGW32__)
#error System does not support xlocale. Import/export could be broken if C locale did not specified by application.
#endif
#define strtod_l(thePtr, theNextPtr, theLocale) strtod(thePtr, theNextPtr)
#ifndef _Standard_values_HeaderFile
# define _Standard_values_HeaderFile
-#ifdef _WIN32
+#if defined(_MSC_VER)
# include <limits>
#else
# include <limits.h>
// Create an asciistring from a Standard_CString
// ----------------------------------------------------------------------------
TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring)
- : mystring(0)
+ : mystring(0), mylength(0)
{
if (astring) {
mylength = Standard_Integer( strlen(astring) );
// ----------------------------------------------------------------------------
TCollection_AsciiString::TCollection_AsciiString(const Standard_CString astring,
const Standard_Integer aLen )
- : mystring(0)
+ : mystring(0), mylength(aLen)
{
if (astring) {
- mylength = aLen ;
mystring = Allocate(mylength+1);
strncpy( mystring , astring , mylength );
mystring [ mylength ] = '\0' ;
TCollection_ExtendedString::TCollection_ExtendedString
(const Standard_CString astring,
const Standard_Boolean isMultiByte)
+ : mystring(0), mylength(0)
{
if (astring) {
if(!isMultiByte) {
//--------------------------------------------------------------------------
TCollection_ExtendedString::TCollection_ExtendedString
(const Standard_ExtString astring)
+ : mystring(0), mylength(0)
{
if (astring) {
CSF_OpenGlLibs
CSF_user32
CSF_gdi32
+CSF_d3d9
CSF_gdi32
CSF_user32
CSF_TBB
-CSF_dl
\ No newline at end of file
+CSF_dl
+CSF_wsock32
+CSF_winspool
+CSF_psapi
void TopOpeBRepBuild_GIter::Current(TopAbs_State& s1, TopAbs_State& s2) const
{
- if ( !More() ) return;
+ if ( !More() )
+ {
+ s1 = s2 = TopAbs_UNKNOWN;
+ return;
+ }
Standard_Integer i1,i2;
MYGTOPO.Index(myII,i1,i2);
s1 = MYGTOPO.GState(i1);
Standard_Boolean TopOpeBRepBuild_GTopo::Value(const Standard_Integer II) const
{
- Standard_Integer i1,i2; Index(II,i1,i2);
+ Standard_Integer i1=0,i2=0;
+ Index(II,i1,i2);
Standard_Boolean b = Value(i1,i2);
return b;
}
Standard_Boolean is3d = Standard_False;
for (; itF.More(); itF.Next()){
const Handle(TopOpeBRepDS_Interference)& IF = itF.Value();
- TopOpeBRepDS_Kind GTF,STF; Standard_Integer GF,SF; FDS_data(IF,GTF,GF,STF,SF);
+ TopOpeBRepDS_Kind GTF,STF;
+ Standard_Integer GF=0,SF=0;
+ FDS_data(IF,GTF,GF,STF,SF);
if (GE != GF) continue;
if (SF==isb) {
is3d = Standard_True;
#ifdef _WIN32
#include <windows.h>
-#pragma comment( lib, "comdlg32.lib" )
+#if defined(_MSC_VER)
+ #pragma comment( lib, "comdlg32.lib" )
+#endif
#endif
#include <TColStd_HArray1OfAsciiString.hxx>
#include <TColStd_HSequenceOfAsciiString.hxx>
-#ifdef _WIN32
+#if defined(_MSC_VER)
# define _CRT_SECURE_NO_DEPRECATE
# pragma warning (disable:4996)
#endif
#if defined(_WIN32)
if (theWClass.IsNull())
{
- theWClass = new WNT_WClass ("GW3D_Class", AdvViewerWindowProc,
+ theWClass = new WNT_WClass ("GW3D_Class", (Standard_Address )AdvViewerWindowProc,
CS_VREDRAW | CS_HREDRAW, 0, 0,
::LoadCursor (NULL, IDC_ARROW));
}
Standard_Boolean toExit = Standard_False;
MSG aMsg;
- while (PeekMessage (&aMsg, NULL, NULL, NULL, PM_REMOVE))
+ while (PeekMessage (&aMsg, NULL, 0, 0, PM_REMOVE))
{
if (aMsg.message == WM_KEYDOWN && (aMsg.wParam == 0x0d || aMsg.wParam == 0x1b))
{
lpszName = new char[ strlen ( aClassName ) + 1 ];
strcpy ( (Standard_PCharacter)lpszName, aClassName );
- lpfnWndProc = wc.lpfnWndProc;
+ lpfnWndProc = (void* )wc.lpfnWndProc;
} // end constructor
if (wp.showCmd != SW_SHOWMINIMIZED)
{
- if (Abs (wp.rcNormalPosition.left - aXLeft ) > 2) mask |= 1;
- if (Abs (wp.rcNormalPosition.right - aXRight ) > 2) mask |= 2;
- if (Abs (wp.rcNormalPosition.top - aYTop ) > 2) mask |= 4;
- if (Abs (wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8;
+ if (Abs ((int )wp.rcNormalPosition.left - aXLeft ) > 2) mask |= 1;
+ if (Abs ((int )wp.rcNormalPosition.right - aXRight ) > 2) mask |= 2;
+ if (Abs ((int )wp.rcNormalPosition.top - aYTop ) > 2) mask |= 4;
+ if (Abs ((int )wp.rcNormalPosition.bottom - aYBottom) > 2) mask |= 8;
switch (mask)
{
chr = dir.Value ( i );
switch ( chr ) {
-
- case _TEXT( '|' ):
- dirRet += _TEXT( "/" );
+
+ case '|':
+ dirRet += "/";
break;
-
- case _TEXT( '^' ):
-
- dirRet += _TEXT( ".." );
+
+ case '^':
+
+ dirRet += "..";
break;
default: