@@ -68,6 +68,11 @@ function Invoke-CMakeConfigure {
6868 $configureArgs += " -DCMAKE_MSVC_RUNTIME_LIBRARY=$env: CMAKE_MSVC_RUNTIME_LIBRARY "
6969 }
7070 }
71+ if ($env: CMAKE_CXX_FLAGS ) {
72+ if (-not ($configureArgs | Where-Object { $_ -like " -DCMAKE_CXX_FLAGS=*" })) {
73+ $configureArgs += " -DCMAKE_CXX_FLAGS=$env: CMAKE_CXX_FLAGS "
74+ }
75+ }
7176 if (Get-Command ccache - ErrorAction SilentlyContinue) {
7277 if (-not ($configureArgs | Where-Object { $_ -like " -DCMAKE_C_COMPILER_LAUNCHER=*" })) {
7378 $configureArgs += " -DCMAKE_C_COMPILER_LAUNCHER=ccache"
@@ -93,6 +98,27 @@ function Invoke-CMakeInstall {
9398 cmake -- install .
9499}
95100
101+ function Add-ImportedTargetCompileDefinitions {
102+ param (
103+ [Parameter (Mandatory )] [string ]$TargetsFile ,
104+ [Parameter (Mandatory )] [string ]$TargetName ,
105+ [Parameter (Mandatory )] [string []]$Definitions
106+ )
107+
108+ if (-not (Test-Path $TargetsFile )) {
109+ throw " Could not find imported targets file: $TargetsFile "
110+ }
111+
112+ $targetsContents = Get-Content - Path $TargetsFile - Raw
113+ if ($targetsContents -like " *set_property(TARGET $TargetName APPEND PROPERTY*" ) {
114+ return
115+ }
116+
117+ $definitionList = ($Definitions | ForEach-Object { ' "{0}"' -f $_ }) -join " "
118+ $patch = " `n set_property(TARGET $TargetName APPEND PROPERTY`n INTERFACE_COMPILE_DEFINITIONS $definitionList )`n "
119+ Add-Content - Path $TargetsFile - Value $patch
120+ }
121+
96122function Resolve-LibraryPath {
97123 param (
98124 [Parameter (Mandatory )] [string []]$Patterns ,
@@ -237,6 +263,7 @@ Write-Host "TARGET_TRIPLE = $env:TARGET_TRIPLE"
237263Write-Host " HOST_TRIPLE = $env: HOST_TRIPLE "
238264Write-Host " MSVC_PLATFORM = $msvcPlatform "
239265Write-Host " CMAKE_MSVC_RUNTIME_LIBRARY = $env: CMAKE_MSVC_RUNTIME_LIBRARY "
266+ Write-Host " CMAKE_CXX_FLAGS = $env: CMAKE_CXX_FLAGS "
240267Write-Host " PYTHON_EXE = $pythonExe "
241268Write-Host " LLVM_VERSION = $env: LLVM_VERSION "
242269Write-Host " QT_VERSION = $env: QT_VERSION "
@@ -400,7 +427,7 @@ $boostB2Args = @(
400427if ($env: BOOST_B2_OPTIONS ) {
401428 $boostB2Args += $env: BOOST_B2_OPTIONS -split " "
402429}
403- $boostB2Args += @ (" link=static" , " install" )
430+ $boostB2Args += @ (" link=static" , " runtime-link=static " , " install" )
404431& .\b2 @boostB2Args
405432Pop-Location
406433
@@ -437,6 +464,8 @@ $catch2Args = @(
437464 " -DBUILD_SHARED_LIBS=OFF" ,
438465 " -DCMAKE_INSTALL_PREFIX=$env: INSTALL_PREFIX " ,
439466 " -DCMAKE_PREFIX_PATH=$env: INSTALL_PREFIX " ,
467+ " -DCMAKE_CXX_STANDARD=20" ,
468+ " -DCMAKE_CXX_STANDARD_REQUIRED=ON" ,
440469 " -DCATCH_INSTALL_DOCS=OFF" ,
441470 " -DCATCH_CONFIG_NO_POSIX_SIGNALS=1" ,
442471 " -DCATCH_INSTALL_EXTRAS=ON"
@@ -695,6 +724,7 @@ $libsbmlArgs = @(
695724Invoke-CMakeConfigure $libsbmlArgs
696725Invoke-CMakeBuild
697726Invoke-CMakeInstall
727+ Add-ImportedTargetCompileDefinitions - TargetsFile (Join-Path $env: INSTALL_PREFIX " lib\cmake\libsbml-static-targets.cmake" ) - TargetName " libsbml-static" - Definitions @ (" LIBSBML_STATIC=1" , " LIBLAX_STATIC=1" )
698728Pop-Location
699729Pop-Location
700730
@@ -723,6 +753,7 @@ $libCombineArgs = @(
723753Invoke-CMakeConfigure $libCombineArgs
724754Invoke-CMakeBuild
725755Invoke-CMakeInstall
756+ Add-ImportedTargetCompileDefinitions - TargetsFile (Join-Path $env: BOOST_INSTALL_PREFIX " lib\cmake\libCombine-static-targets.cmake" ) - TargetName " libCombine-static" - Definitions @ (" LIBCOMBINE_STATIC=1" )
726757Pop-Location
727758Pop-Location
728759
0 commit comments