# Copyright: 2016-2023 Paul Obermeier (obermeier@tcl3d.org) # Distributed under BSD license. # # BuildType Windows: MsBuild / vs (3.1.2) # BuildType Windows: CMake / vs (>= 3.2.2) # CMake / gcc (>= 3.2.2) # BuildType Linux : MSys / gcc # BuildType Darwin : MSys / gcc # Changes: # Added folders VC14 and VC15 in projects/Win32 to compile with Visual Studio 2015 and 2017. # These are simply copies of folder VC12 with all occurrences of VC12 replaced with VC14 or VC15. # Note: Versions 3.2 and newer now support CMake, so there is no need to add VisualStudio # specific project folders anymore. proc Init_Xerces { libName libVersion } { SetScriptAuthor $libName "Paul Obermeier" "obermeier@tcl3d.org" SetLibHomepage $libName "http://xerces.apache.org/" SetLibDependencies $libName "CMake" SetPlatforms $libName "All" SetWinCompilers $libName "gcc" "vs" } proc Build_Xerces { libName libVersion buildDir instDir devDir distDir } { set haveCMake false if { [VersionCompare "3.2.0" $libVersion] < 0 } { set haveCMake true } else { if { [IsWindows] && [UseWinCompiler $libName "gcc"] } { SetErrorMessage "$libName versions < 3.2.0 not supported with MinGW gcc." return false } } if { [UseStage "Extract" $libName] } { ExtractLibrary $libName $buildDir } if { [UseStage "Configure" $libName] } { if { [IsUnix] } { MSysConfig $libName $buildDir $instDir "" "--enable-shared=yes" } if { [IsWindows] && $haveCMake } { CMakeConfig $libName "$buildDir" "$buildDir" "$instDir" \ "-DBUILD_SHARED_LIBS=ON" \ [GetCMakeMSysOption $libName] } } if { [UseStage "Compile" $libName] || [UseStage "Distribute" $libName] } { if { [IsWindows] && $haveCMake == false } { switch -exact [GetCompilerVersion -vs] { "vs2008" { set msvc "VC9" } "vs2010" { set msvc "VC10" } "vs2012" { set msvc "VC11" } "vs2013" { set msvc "VC12" } "vs2015" { set msvc "VC14" } "vs2017" { set msvc "VC15" } default { ErrorAppend "$libName: Unsupported Visual Studio version \"[GetCompilerVersion -vs]\"" "FATAL" } } } } if { [UseStage "Compile" $libName] } { if { [IsWindows] } { if { $haveCMake } { CMakeBuild $libName "$buildDir" "install" [GetBuildType] \ [GetCMakeMSysOption $libName] if { [NeedDll2Lib $libName] } { Dll2Lib $libName "$instDir/bin" "libxerces-c.dll" "xerces-c.def" "$instDir/lib/xerces-c.lib" } } else { MsBuild $libName "$buildDir/projects/Win32/$msvc/xerces-all" \ "xerces-all.sln" [GetBuildType] "all" } } else { MSysBuild $libName $buildDir "install" } } if { [UseStage "Distribute" $libName] } { if { [IsWindows] } { if { $haveCMake } { StripLibraries "$instDir" MultiFileCopy "$instDir/bin" "$devDir/lib" "*.dll" true MultiFileCopy "$instDir/bin" "$distDir/lib" "*.dll" true if { [UseWinCompiler $libName "vs"] || [NeedDll2Lib $libName] } { MultiFileCopy "$instDir/lib" "$devDir/lib" "*.lib" true } } else { MultiFileCopy "$buildDir/Build/Win[GetBits]/$msvc/[GetBuildType]" "$instDir/bin" "*" true MultiFileCopy "$buildDir/src/xercesc" "$instDir/include/xercesc" "*" true StripLibraries "$instDir" MultiFileCopy "$instDir/bin" "$distDir/lib" "*.dll" MultiFileCopy "$instDir/bin" "$devDir/lib" "*.dll" if { [UseWinCompiler $libName "vs"] || [NeedDll2Lib $libName] } { MultiFileCopy "$instDir/bin" "$devDir/lib" "*.lib" } } } else { StripLibraries "$instDir" LibFileCopy "$instDir" "$distDir" "*.dylib *.so*" LibFileCopy "$instDir" "$devDir" "*.dylib *.so* *.a" } MultiFileCopy "$instDir/include" "$devDir/include" "*" true if { [IsDebugBuild] && [UseWinCompiler $libName "vs"] } { if { $haveCMake } { MultiFileCopy "$buildDir/src/Debug" "$devDir/lib" "xerces*.pdb" } else { MultiFileCopy "$instDir/bin" "$devDir/lib" "xerces*.pdb" } } } return true }