CMake: Multiple targets, clean cache
Two updates suggested by Paul Koning: - Enable building multiple simulator targets using a comma-separated list, e.g.: pdp8,pdp11,3b2 - Unconditionally clean CMake's cache each time the script is invoked. This eliminates confusing CMake configuration messages when CMake changes or updates, and CMake policies change. The most recent policy change was IMPORT_LOCATION, which is now mandatory for interface libraries. An old CMake configuration cache doesn't reflect the import library IMPORT_LOCATION property, which caused confusing warning messages. The cure is removing the old cache and reconfiguring.
This commit is contained in:
parent
cc76d9a70d
commit
dfda031f23
3 changed files with 70 additions and 78 deletions
|
@ -521,7 +521,6 @@ or video support.
|
|||
--------
|
||||
--clean (-x) Remove the build subdirectory
|
||||
--generate (-g) Generate the build environment, don't compile/build
|
||||
--regenerate (-r) Regenerate the build environment from scratch.
|
||||
--parallel (-p) Enable build parallelism (parallel builds)
|
||||
--nonetwork Build simulators without network support
|
||||
--novideo Build simulators without video support
|
||||
|
@ -541,7 +540,9 @@ or video support.
|
|||
ucrt
|
||||
--config (-c) Specifies the build configuration: 'Release' or 'Debug'
|
||||
|
||||
--target Build a specific simulator (e.g., pdp11, vax, ...)
|
||||
--target Build a specific simulator or simulators. Separate multiple
|
||||
targets by separating with a comma,
|
||||
e.g. "--target pdp8,pdp11,vax750,altairz80,3b2"
|
||||
--lto Enable Link Time Optimization (LTO) in Release builds
|
||||
--debugWall Enable maximal warnings in Debug builds
|
||||
--cppcheck Enable cppcheck static code analysis rules
|
||||
|
|
|
@ -92,9 +92,10 @@ param (
|
|||
[Parameter(Mandatory=$false)]
|
||||
[string] $cpack_suffix = "",
|
||||
|
||||
## (optional) Simulator to build (e.g., 'vax', 'pdp11', 'pdp8', ...)
|
||||
## (optional) Build a specific simulator or simulators. Separate multiple
|
||||
## targets with a comma, ## e.g. "--target pdp8,pdp11,vax750,altairz80,3b2"
|
||||
[Parameter(Mandatory=$false)]
|
||||
[string] $target = "",
|
||||
[string[]] $target = "",
|
||||
|
||||
## The rest are flag arguments
|
||||
|
||||
|
@ -131,11 +132,6 @@ param (
|
|||
[Parameter(Mandatory=$false)]
|
||||
[switch] $generate = $false,
|
||||
|
||||
## Delete the CMake cache, configure and regenerate the build environment.
|
||||
## Don't compile, test or install.
|
||||
[Parameter(Mandatory=$false)]
|
||||
[switch] $regenerate = $false,
|
||||
|
||||
## Only run the tests.
|
||||
[Parameter(Mandatory=$false)]
|
||||
[switch] $testonly = $false,
|
||||
|
@ -348,11 +344,6 @@ if ($null -eq $genInfo)
|
|||
Show-Help
|
||||
}
|
||||
|
||||
if ($regenerate)
|
||||
{
|
||||
$generate = $true;
|
||||
}
|
||||
|
||||
if ($testonly)
|
||||
{
|
||||
$scriptPhases = @("test")
|
||||
|
@ -397,12 +388,9 @@ if (($scriptPhases -contains "generate") -or ($scriptPhases -contains "build"))
|
|||
Write-Host "** ${scriptName}: ${buildDir} exists."
|
||||
}
|
||||
|
||||
## Need to regenerate?
|
||||
if ($regenerate)
|
||||
{
|
||||
Remove-Item -Force -Path ${buildDir}/CMakeCache.txt -ErrorAction SilentlyContinue | Out-Null
|
||||
Remove-Item -Recurse -Force -Path ${buildDir}/CMakeFiles -ErrorAction SilentlyContinue | Out-Null
|
||||
}
|
||||
## Unconditionally remove the CMake cache.
|
||||
Remove-Item -Force -Path ${buildDir}/CMakeCache.txt -ErrorAction SilentlyContinue | Out-Null
|
||||
Remove-Item -Recurse -Force -Path ${buildDir}/CMakeFiles -ErrorAction SilentlyContinue | Out-Null
|
||||
|
||||
## Where we do the heaving lifting:
|
||||
$generateArgs = @("-G", $genInfo.Generator)
|
||||
|
@ -454,7 +442,9 @@ if (($scriptPhases -contains "generate") -or ($scriptPhases -contains "build"))
|
|||
$buildArgs += "-DWINAPI_DEPRECATION:Bool=TRUE"
|
||||
}
|
||||
if (![String]::IsNullOrEmpty($target)) {
|
||||
$buildArgs += @("--target", "$target")
|
||||
foreach ($targ in $target) {
|
||||
$buildArgs += @("--target", "$targ")
|
||||
}
|
||||
}
|
||||
|
||||
$buildSpecificArgs = @()
|
||||
|
@ -511,7 +501,8 @@ foreach ($phase in $scriptPhases) {
|
|||
}
|
||||
|
||||
if (![String]::IsNullOrEmpty($target)) {
|
||||
$testArgs += @("-R", "simh-${target}`$")
|
||||
$tests = "simh-(" + ($target -join "|") + ")`$"
|
||||
$testArgs += @("-R", $tests)
|
||||
}
|
||||
|
||||
$phaseCommand = ${ctestCmd}
|
||||
|
|
|
@ -15,7 +15,6 @@ Options:
|
|||
--------
|
||||
--clean (-x) Remove the build subdirectory
|
||||
--generate (-g) Generate the build environment, don't compile/build
|
||||
--regenerate (-r) Regenerate the build environment from scratch.
|
||||
--parallel (-p) Enable build parallelism (parallel builds)
|
||||
--nonetwork Build simulators without network support
|
||||
--novideo Build simulators without video support
|
||||
|
@ -35,7 +34,8 @@ Options:
|
|||
ucrt
|
||||
--config (-c) Specifies the build configuration: 'Release' or 'Debug'
|
||||
|
||||
--target Build a specific simulator (e.g., pdp11, vax, ...)
|
||||
--target Build a specific simulator or simulators. Separate multiple
|
||||
targets with a comma, e.g. "--target pdp8,pdp11,vax750,altairz80,3b2"
|
||||
--lto Enable Link Time Optimization (LTO) in Release builds
|
||||
--debugWall Enable maximal warnings in Debug builds
|
||||
--cppcheck Enable cppcheck static code analysis rules
|
||||
|
@ -64,7 +64,6 @@ testArgs=
|
|||
notest=no
|
||||
buildParallel=no
|
||||
generateOnly=
|
||||
regenerateFlag=
|
||||
testOnly=
|
||||
noinstall=
|
||||
installOnly=
|
||||
|
@ -151,7 +150,7 @@ if [[ "x${MSYSTEM}" != x ]]; then
|
|||
esac
|
||||
fi
|
||||
|
||||
longopts=clean,help,flavor:,config:,nonetwork,novideo,notest,parallel,generate,testonly,regenerate
|
||||
longopts=clean,help,flavor:,config:,nonetwork,novideo,notest,parallel,generate,testonly
|
||||
longopts=${longopts},noinstall,installonly,verbose,target:,lto,debugWall,cppcheck,cpack_suffix:
|
||||
|
||||
ARGS=$(${getopt_prog} --longoptions $longopts --options xhf:cpg -- "$@")
|
||||
|
@ -252,11 +251,6 @@ while true; do
|
|||
generateOnly=yes
|
||||
shift
|
||||
;;
|
||||
-r | --regenerate)
|
||||
generateOnly=yes
|
||||
regenerateFlag=yes
|
||||
shift
|
||||
;;
|
||||
--testonly)
|
||||
testOnly=yes
|
||||
shift
|
||||
|
@ -271,7 +265,7 @@ while true; do
|
|||
;;
|
||||
--target)
|
||||
noinstall=yes
|
||||
simTarget="$2"
|
||||
simTarget="${simTarget} $2"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
|
@ -317,18 +311,24 @@ if [[ x"$canParallel" = xyes ]] ; then
|
|||
buildArgs="${buildArgs} --parallel"
|
||||
buildPostArgs="${buildPostArgs} -j 8"
|
||||
}
|
||||
# Don't execute ctest in parallel...
|
||||
# [ x${canTestParallel} = xyes ] && {
|
||||
# testArgs="${testArgs} --parallel 4"
|
||||
# }
|
||||
|
||||
# Don't execute ctest in parallel...
|
||||
# [ x${canTestParallel} = xyes ] && {
|
||||
# testArgs="${testArgs} --parallel 4"
|
||||
# }
|
||||
fi
|
||||
else
|
||||
buildParallel=
|
||||
fi
|
||||
|
||||
if [[ x"${simTarget}" != x ]]; then
|
||||
buildArgs="${buildArgs} --target ${simTarget}"
|
||||
testArgs="${testArgs} -R simh-${simTarget}\$"
|
||||
simTests=""
|
||||
for tgt in $(echo ${simTarget} | sed 's/,/ /g'); do
|
||||
buildArgs="${buildArgs} --target ${tgt}"
|
||||
[[ x"${simTests}" != x ]] && simTests="${simTests}|"
|
||||
simTests="${simTests}${tgt}"
|
||||
done
|
||||
testArgs="${testArgs} -R simh-(${simTests})\$"
|
||||
fi
|
||||
|
||||
buildArgs="${buildArgs} --config ${buildConfig}"
|
||||
|
@ -349,10 +349,10 @@ fi
|
|||
for ph in ${phases}; do
|
||||
case $ph in
|
||||
generate)
|
||||
[ x$regenerateFlag = xyes ] && {
|
||||
echo "${scriptName}: Removing CMakeCache.txt and CMakeFiles"
|
||||
rm -rf ${buildSubdir}/CMakeCache.txt ${buildSubdir}/CMakefiles
|
||||
}
|
||||
## Uncondintionally remove the CMake cache.
|
||||
echo "${scriptName}: Removing CMakeCache.txt and CMakeFiles"
|
||||
rm -rf ${buildSubdir}/CMakeCache.txt ${buildSubdir}/CMakefiles
|
||||
|
||||
if [[ "x${cmakeSFlag}" != x ]]; then
|
||||
echo "${cmake} -G "\"${buildFlavor}\"" -DCMAKE_BUILD_TYPE="${buildConfig}" -S "${simhTopDir}" -B ${buildSubdir} ${generateArgs}"
|
||||
${cmake} -G "${buildFlavor}" -DCMAKE_BUILD_TYPE="${buildConfig}" -S "${simhTopDir}" -B "${buildSubdir}" ${generateArgs} || { \
|
||||
|
|
Loading…
Add table
Reference in a new issue