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:
B. Scott Michel 2023-10-30 10:35:58 -07:00 committed by Paul Koning
parent cc76d9a70d
commit dfda031f23
3 changed files with 70 additions and 78 deletions

View file

@ -90,7 +90,7 @@ Before you begin building the simulators, you need the following:
`pacman`, `rpm`, ...) `pacman`, `rpm`, ...)
apt: `sudo apt install cmake cmake-data` apt: `sudo apt install cmake cmake-data`
pacman: `sudo pacman install cmake` pacman: `sudo pacman install cmake`
- macOS: Install `cmake` using your preferred external package management - macOS: Install `cmake` using your preferred external package management
@ -100,14 +100,14 @@ Before you begin building the simulators, you need the following:
MacPorts: `sudo port install cmake` MacPorts: `sudo port install cmake`
- Windows: - Windows:
- _Visual Studio IDE, Developer command or PowerShell console windows_: No - _Visual Studio IDE, Developer command or PowerShell console windows_: No
additional software installation needed. Microsoft provides `cmake` that additional software installation needed. Microsoft provides `cmake` that
can be invoked from the command prompt or from within the VS IDE. can be invoked from the command prompt or from within the VS IDE.
Microsoft has bundled various version of `cmake` into Visual Studio since Microsoft has bundled various version of `cmake` into Visual Studio since
VS 2015. VS 2015.
- Otherwise, install `cmake` using your preferred Windows software package - Otherwise, install `cmake` using your preferred Windows software package
manager, such as [Chocolatey][chocolatey] or [Scoop][scoop]. You can also manager, such as [Chocolatey][chocolatey] or [Scoop][scoop]. You can also
[download and install the `cmake` binary distribution][cmake_downloads] [download and install the `cmake` binary distribution][cmake_downloads]
@ -119,7 +119,7 @@ Before you begin building the simulators, you need the following:
`pacman`, `rpm`, ...) `pacman`, `rpm`, ...)
apt: `sudo apt install git` apt: `sudo apt install git`
pacman: `sudo pacman install git` pacman: `sudo pacman install git`
- macOS: Install `git` using your preferred external package management - macOS: Install `git` using your preferred external package management
@ -141,12 +141,12 @@ Before you begin building the simulators, you need the following:
- _Visual Studio Developer command or PowerShell console windows_: Unlike - _Visual Studio Developer command or PowerShell console windows_: Unlike
`cmake`, `git`'s location is not added to `PATH` or `$env:PATH`. Use the `cmake`, `git`'s location is not added to `PATH` or `$env:PATH`. Use the
VS IDE for `git`-related tasks (add, commit, branch, push, pull, etc.) VS IDE for `git`-related tasks (add, commit, branch, push, pull, etc.)
- Otherwise, install `git` using your preferred Windows software package - Otherwise, install `git` using your preferred Windows software package
manager, such as [Chocolatey][chocolatey] or [Scoop][scoop]. You can also manager, such as [Chocolatey][chocolatey] or [Scoop][scoop]. You can also
[download and install the `git` client][gitscm_downloads] directly. [download and install the `git` client][gitscm_downloads] directly.
- GNU Make: - GNU Make:
- Required for Linux and macOS. Consult your appropriate package manager to - Required for Linux and macOS. Consult your appropriate package manager to
install `make` if it is not already installed. install `make` if it is not already installed.
@ -238,10 +238,10 @@ the [command line](#cmake-command-line) or [via the IDE](#xp-compatible-build-vi
_VS2017_: There are two requirements that need to be satisfied: _VS2017_: There are two requirements that need to be satisfied:
- `CMake` version 3.14 or higher. The `CMake` distributed with VS 2017 is - `CMake` version 3.14 or higher. The `CMake` distributed with VS 2017 is
version 3.12. version 3.12.
- You will need to install a newer version of `CMake` (see above - You will need to install a newer version of `CMake` (see above
for download links.) for download links.)
- You will also need to ensure that the directory to the updated `cmake.exe` is on - You will also need to ensure that the directory to the updated `cmake.exe` is on
the front of your `PATH` (`cmd`) or `env:PATH` (`PowerShell`). If you are the front of your `PATH` (`cmd`) or `env:PATH` (`PowerShell`). If you are
unsure what this means, do not proceed further. unsure what this means, do not proceed further.
@ -274,19 +274,19 @@ feature libraries for and MinGW-64 Win64 native and Universal C Runtime (UCRT)
binaries. binaries.
- Linux apt-based distributions (e.g., Debian, Ubuntu): - Linux apt-based distributions (e.g., Debian, Ubuntu):
```bash ```bash
$ sudo sh .travis/deps.sh linux $ sudo sh .travis/deps.sh linux
``` ```
- macOS Homebrew: - macOS Homebrew:
```bash ```bash
$ sudo sh .travis/deps.sh osx $ sudo sh .travis/deps.sh osx
``` ```
- MinGW-w64 Win64 console: - MinGW-w64 Win64 console:
```bash ```bash
$ echo $MSYSTEM $ echo $MSYSTEM
MINGW64 MINGW64
@ -294,7 +294,7 @@ binaries.
``` ```
- MinGW-w64 UCRT console: - MinGW-w64 UCRT console:
```bash ```bash
$ echo $MSYSTEM $ echo $MSYSTEM
UCRT64 UCRT64
@ -320,7 +320,7 @@ between the two strategies are:
example, _"legacy"_ does not install `bzip2` as a `libpng` subdependency, example, _"legacy"_ does not install `bzip2` as a `libpng` subdependency,
which limits the compression methods available to `libpng` when capturing which limits the compression methods available to `libpng` when capturing
screenshots. screenshots.
5. `vcpkg` installs more subdependencies, potentially increasing 5. `vcpkg` installs more subdependencies, potentially increasing
functionality. Continuing `libpng` as the example, `vcpkg` will install functionality. Continuing `libpng` as the example, `vcpkg` will install
`bzip2` as a subdependency, which adds compression methods to `libpng` when `bzip2` as a subdependency, which adds compression methods to `libpng` when
@ -329,7 +329,7 @@ between the two strategies are:
6. _"legacy"_ compiles the dependency libraries as part of the overall 6. _"legacy"_ compiles the dependency libraries as part of the overall
compile/build process. compile/build process.
7. `vcpkg` compiles and installs dependencies during the CMake configuration 7. `vcpkg` compiles and installs dependencies during the CMake configuration
step, which makes the configuration process longer. step, which makes the configuration process longer.
@ -347,7 +347,7 @@ Setup and Usage:
reconfigure SIMH to use these newly installed dependencies. reconfigure SIMH to use these newly installed dependencies.
- [`vcpkg`](https://vcpkg.io) - [`vcpkg`](https://vcpkg.io)
Simply set the `VCPKG_ROOT` environment variable to use the `vcpkg` strategy. Simply set the `VCPKG_ROOT` environment variable to use the `vcpkg` strategy.
`vcpkg` operates in [Manifest mode][vcpkg_manifest]; refer to the `vcpkg.json` `vcpkg` operates in [Manifest mode][vcpkg_manifest]; refer to the `vcpkg.json`
manifest file. manifest file.
@ -355,7 +355,7 @@ Setup and Usage:
The default platform triplets for the Visual Studio compilers are The default platform triplets for the Visual Studio compilers are
`x86-windows-static` and `x64-windows-static`, depending on the architecture `x86-windows-static` and `x64-windows-static`, depending on the architecture
flag passed to CMake. flag passed to CMake.
The `x64-mingw-dynamic` triplet is known to work from within a MinGW-w64 The `x64-mingw-dynamic` triplet is known to work from within a MinGW-w64
console/terminal window using the GCC compiler. console/terminal window using the GCC compiler.
@ -371,10 +371,10 @@ Setup and Usage:
PS C:\...> cd vcpkg PS C:\...> cd vcpkg
PS C:\...\vcpkg> .\vcpkg\bootstrap-vcpkg.bat PS C:\...\vcpkg> .\vcpkg\bootstrap-vcpkg.bat
PS C:\...\vcpkg> cd ..\open-simh PS C:\...\vcpkg> cd ..\open-simh
PS C:\...\open-simh> PS C:\...\open-simh>
``` ```
Then set the `VCPKG_ROOT` environment variable to the `vcpkg` installaton directory. Then set the `VCPKG_ROOT` environment variable to the `vcpkg` installaton directory.
[^1]: `vcpkg` does not support the `v141_xp` toolkit required to compile Windows [^1]: `vcpkg` does not support the `v141_xp` toolkit required to compile Windows
XP binaries. Windows XP is a target platform that SIMH can hopefully deprecate XP binaries. Windows XP is a target platform that SIMH can hopefully deprecate
in the future. For the time being, Windows XP is a target platform that is part in the future. For the time being, Windows XP is a target platform that is part
@ -388,7 +388,7 @@ look for things, such as simulator executables.
``` ```
simh # Top-level SIMH source directory simh # Top-level SIMH source directory
+-- CMakeLists.txt # Top-level CMake configuration file +-- CMakeLists.txt # Top-level CMake configuration file
+-- BIN # Simulator executables (note 1) +-- BIN # Simulator executables (note 1)
| +-- Debug | +-- Debug
| +-- Release | +-- Release
@ -404,7 +404,7 @@ simh # Top-level SIMH source directory
| +-- build-unix # Build directory for Unix Makefiles (note 2) | +-- build-unix # Build directory for Unix Makefiles (note 2)
| +-- build-ninja # Build directory for Ninja builder (note 2) | +-- build-ninja # Build directory for Ninja builder (note 2)
| +-- dependencies # Install subdirectory for Windows dependency libraries | +-- dependencies # Install subdirectory for Windows dependency libraries
| | +-- Windows-10-MSVC-19.34 | | +-- Windows-10-MSVC-19.34
| | | |... # Feature library subdirectory for Windows legacy | | | |... # Feature library subdirectory for Windows legacy
| | | |... # dependency superbuilds (note 3) | | | |... # dependency superbuilds (note 3)
|... |...
@ -412,9 +412,9 @@ simh # Top-level SIMH source directory
| +-- build | +-- build
| +-- install | +-- install
+-- 3b2 +-- 3b2
| +-- CMakeLists.txt # 3b2 simulator CMake configuration file | +-- CMakeLists.txt # 3b2 simulator CMake configuration file
+-- alpha +-- alpha
| +-- CMakeLists.txt # alpha simulator CMake configuration file | +-- CMakeLists.txt # alpha simulator CMake configuration file
|... |...
+-- VAX +-- VAX
| +-- CMakeLists.txt # VAX simulators family CMake configuration file | +-- CMakeLists.txt # VAX simulators family CMake configuration file
@ -521,7 +521,6 @@ or video support.
-------- --------
--clean (-x) Remove the build subdirectory --clean (-x) Remove the build subdirectory
--generate (-g) Generate the build environment, don't compile/build --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) --parallel (-p) Enable build parallelism (parallel builds)
--nonetwork Build simulators without network support --nonetwork Build simulators without network support
--novideo Build simulators without video support --novideo Build simulators without video support
@ -541,7 +540,9 @@ or video support.
ucrt ucrt
--config (-c) Specifies the build configuration: 'Release' or 'Debug' --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 --lto Enable Link Time Optimization (LTO) in Release builds
--debugWall Enable maximal warnings in Debug builds --debugWall Enable maximal warnings in Debug builds
--cppcheck Enable cppcheck static code analysis rules --cppcheck Enable cppcheck static code analysis rules
@ -703,7 +704,7 @@ $ cmake --build .
$ ctest --build-config Release --output-on-failure --timeout 300 $ ctest --build-config Release --output-on-failure --timeout 300
``` ```
Examples of other things you can do from the command line: Examples of other things you can do from the command line:
```sh ```sh
# To build a specific simulator, such as b5500, specify the # To build a specific simulator, such as b5500, specify the
@ -888,7 +889,7 @@ $ cmake-builder.sh --flavor unix --lto ...
PS> cake-builder.ps1 -flavor mingw-unix -lto ... PS> cake-builder.ps1 -flavor mingw-unix -lto ...
``` ```
Setting `RELEASE_LTO` to `True` does two things: Setting `RELEASE_LTO` to `True` does two things:
1. It changes the optimization level to `-O3` and turns on link-time 1. It changes the optimization level to `-O3` and turns on link-time
optimization (`-flto`). optimization (`-flto`).
@ -967,7 +968,7 @@ within the IDE. The walkthrough provides directions for VS 2022 and VS 2019.
- Choose `Open>CMake...` from the `File` menu. Open the `CMakeLists.txt` file - Choose `Open>CMake...` from the `File` menu. Open the `CMakeLists.txt` file
in the source directory where `git` just checked out SIMH's source code. in the source directory where `git` just checked out SIMH's source code.
- The _Output_ pane should switch to "CMake" and display CMake's - The _Output_ pane should switch to "CMake" and display CMake's
configuration output. It should look similar to the following: configuration output. It should look similar to the following:
@ -993,8 +994,8 @@ within the IDE. The walkthrough provides directions for VS 2022 and VS 2019.
1> [CMake] -- Creating dependency library directory hierarchy 1> [CMake] -- Creating dependency library directory hierarchy
[... snipped for brevity ...] [... snipped for brevity ...]
1> [CMake] -- 1> [CMake] --
1> [CMake] -- Configuring done 1> [CMake] -- Configuring done
1> [CMake] -- Generating done 1> [CMake] -- Generating done
1> [CMake] -- Build files have been written to: C:/Users/bsm21317/play/open-simh-gitlab/out/build/x64-Debug 1> [CMake] -- Build files have been written to: C:/Users/bsm21317/play/open-simh-gitlab/out/build/x64-Debug
@ -1041,7 +1042,7 @@ within the IDE. The walkthrough provides directions for VS 2022 and VS 2019.
Choose `Delete Cache and Reconfigure` from the `Project` menu. This will Choose `Delete Cache and Reconfigure` from the `Project` menu. This will
cause CMake to reconfigure the project and detect the dependency feature cause CMake to reconfigure the project and detect the dependency feature
libraries. libraries.
When reconfiguration is complete, choose `Build All` from the `Build` menu, When reconfiguration is complete, choose `Build All` from the `Build` menu,
or equivalently chord `Ctrl-Shift-B` on the keyboard and restart building or equivalently chord `Ctrl-Shift-B` on the keyboard and restart building
the simulator suite. the simulator suite.
@ -1071,7 +1072,7 @@ within the IDE. The walkthrough provides directions for VS 2022 and VS 2019.
- Click on the "Show advanced settings" link. - Click on the "Show advanced settings" link.
- Change the "CMake generator" to "Visual Studio 16 2019" for VS 2019 or - Change the "CMake generator" to "Visual Studio 16 2019" for VS 2019 or
"Visual Studio 17 2022" for VS 2022 from the "CMake generator" dropdown. "Visual Studio 17 2022" for VS 2022 from the "CMake generator" dropdown.
- Save `CMakeSettings.json` (`File>Save` or `Ctrl-S`) - Save `CMakeSettings.json` (`File>Save` or `Ctrl-S`)
@ -1144,14 +1145,14 @@ add_simulator(3b2
- The first argument is the simulator's executable name: `3b2`. This generates - The first argument is the simulator's executable name: `3b2`. This generates
an executable named `3b2` on Unix platforms or `3b2.exe` on Windows. an executable named `3b2` on Unix platforms or `3b2.exe` on Windows.
- Argument list keywords: `SOURCES`, `INCLUDES`, `DEFINES`, `LABEL` and `TEST`. - Argument list keywords: `SOURCES`, `INCLUDES`, `DEFINES`, `LABEL` and `TEST`.
- `SOURCES`: The source files that comprise the simulator. The file names - `SOURCES`: The source files that comprise the simulator. The file names
are relative to the simulator's source directory. In the `3b2`'s case, are relative to the simulator's source directory. In the `3b2`'s case,
this is relative to the `3B2/` subdirectory where `3B2/CMakeLists.txt` is this is relative to the `3B2/` subdirectory where `3B2/CMakeLists.txt` is
located. located.
[CMake][cmake] sets the variable `CMAKE_CURRENT_SOURCE_DIR` to the same [CMake][cmake] sets the variable `CMAKE_CURRENT_SOURCE_DIR` to the same
directory from which `CMakeLists.txt` is being read. directory from which `CMakeLists.txt` is being read.
@ -1323,7 +1324,7 @@ endif()
2. Add your source to the `MySimulator` directory. 2. Add your source to the `MySimulator` directory.
3. Create the `CMakeLists.txt` file that invokes `add_simulator`. 3. Create the `CMakeLists.txt` file that invokes `add_simulator`.
4. Include your new simulator in the `cmake/simh-simulators.cmake` file. 4. Include your new simulator in the `cmake/simh-simulators.cmake` file.
```cmake ```cmake
@ -1357,7 +1358,7 @@ _Note:_ The `cmake/generate.py` script is not automatically run by `cmake` when
the `makefile` is newer than the top-level `CMakeLists.txt`. If you have done a the `makefile` is newer than the top-level `CMakeLists.txt`. If you have done a
`git pull` and you get undefined symbols when a simulator is linked, the `git pull` and you get undefined symbols when a simulator is linked, the
solution is `cmake/generate.py` to update the affected simulator solution is `cmake/generate.py` to update the affected simulator
`CMakeLists.txt` file. `CMakeLists.txt` file.
```sh ```sh
## You have to be in the cmake subdirectory to run the generate.py script ## You have to be in the cmake subdirectory to run the generate.py script

View file

@ -92,9 +92,10 @@ param (
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$false)]
[string] $cpack_suffix = "", [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)] [Parameter(Mandatory=$false)]
[string] $target = "", [string[]] $target = "",
## The rest are flag arguments ## The rest are flag arguments
@ -131,11 +132,6 @@ param (
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$false)]
[switch] $generate = $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. ## Only run the tests.
[Parameter(Mandatory=$false)] [Parameter(Mandatory=$false)]
[switch] $testonly = $false, [switch] $testonly = $false,
@ -348,11 +344,6 @@ if ($null -eq $genInfo)
Show-Help Show-Help
} }
if ($regenerate)
{
$generate = $true;
}
if ($testonly) if ($testonly)
{ {
$scriptPhases = @("test") $scriptPhases = @("test")
@ -397,12 +388,9 @@ if (($scriptPhases -contains "generate") -or ($scriptPhases -contains "build"))
Write-Host "** ${scriptName}: ${buildDir} exists." Write-Host "** ${scriptName}: ${buildDir} exists."
} }
## Need to regenerate? ## Unconditionally remove the CMake cache.
if ($regenerate) Remove-Item -Force -Path ${buildDir}/CMakeCache.txt -ErrorAction SilentlyContinue | Out-Null
{ Remove-Item -Recurse -Force -Path ${buildDir}/CMakeFiles -ErrorAction SilentlyContinue | Out-Null
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: ## Where we do the heaving lifting:
$generateArgs = @("-G", $genInfo.Generator) $generateArgs = @("-G", $genInfo.Generator)
@ -454,7 +442,9 @@ if (($scriptPhases -contains "generate") -or ($scriptPhases -contains "build"))
$buildArgs += "-DWINAPI_DEPRECATION:Bool=TRUE" $buildArgs += "-DWINAPI_DEPRECATION:Bool=TRUE"
} }
if (![String]::IsNullOrEmpty($target)) { if (![String]::IsNullOrEmpty($target)) {
$buildArgs += @("--target", "$target") foreach ($targ in $target) {
$buildArgs += @("--target", "$targ")
}
} }
$buildSpecificArgs = @() $buildSpecificArgs = @()
@ -511,7 +501,8 @@ foreach ($phase in $scriptPhases) {
} }
if (![String]::IsNullOrEmpty($target)) { if (![String]::IsNullOrEmpty($target)) {
$testArgs += @("-R", "simh-${target}`$") $tests = "simh-(" + ($target -join "|") + ")`$"
$testArgs += @("-R", $tests)
} }
$phaseCommand = ${ctestCmd} $phaseCommand = ${ctestCmd}

View file

@ -15,7 +15,6 @@ Options:
-------- --------
--clean (-x) Remove the build subdirectory --clean (-x) Remove the build subdirectory
--generate (-g) Generate the build environment, don't compile/build --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) --parallel (-p) Enable build parallelism (parallel builds)
--nonetwork Build simulators without network support --nonetwork Build simulators without network support
--novideo Build simulators without video support --novideo Build simulators without video support
@ -35,7 +34,8 @@ Options:
ucrt ucrt
--config (-c) Specifies the build configuration: 'Release' or 'Debug' --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 --lto Enable Link Time Optimization (LTO) in Release builds
--debugWall Enable maximal warnings in Debug builds --debugWall Enable maximal warnings in Debug builds
--cppcheck Enable cppcheck static code analysis rules --cppcheck Enable cppcheck static code analysis rules
@ -64,7 +64,6 @@ testArgs=
notest=no notest=no
buildParallel=no buildParallel=no
generateOnly= generateOnly=
regenerateFlag=
testOnly= testOnly=
noinstall= noinstall=
installOnly= installOnly=
@ -151,7 +150,7 @@ if [[ "x${MSYSTEM}" != x ]]; then
esac esac
fi 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: longopts=${longopts},noinstall,installonly,verbose,target:,lto,debugWall,cppcheck,cpack_suffix:
ARGS=$(${getopt_prog} --longoptions $longopts --options xhf:cpg -- "$@") ARGS=$(${getopt_prog} --longoptions $longopts --options xhf:cpg -- "$@")
@ -252,11 +251,6 @@ while true; do
generateOnly=yes generateOnly=yes
shift shift
;; ;;
-r | --regenerate)
generateOnly=yes
regenerateFlag=yes
shift
;;
--testonly) --testonly)
testOnly=yes testOnly=yes
shift shift
@ -271,7 +265,7 @@ while true; do
;; ;;
--target) --target)
noinstall=yes noinstall=yes
simTarget="$2" simTarget="${simTarget} $2"
shift 2 shift 2
;; ;;
--) --)
@ -317,18 +311,24 @@ if [[ x"$canParallel" = xyes ]] ; then
buildArgs="${buildArgs} --parallel" buildArgs="${buildArgs} --parallel"
buildPostArgs="${buildPostArgs} -j 8" buildPostArgs="${buildPostArgs} -j 8"
} }
# Don't execute ctest in parallel...
# [ x${canTestParallel} = xyes ] && { # Don't execute ctest in parallel...
# testArgs="${testArgs} --parallel 4" # [ x${canTestParallel} = xyes ] && {
# } # testArgs="${testArgs} --parallel 4"
# }
fi fi
else else
buildParallel= buildParallel=
fi fi
if [[ x"${simTarget}" != x ]]; then if [[ x"${simTarget}" != x ]]; then
buildArgs="${buildArgs} --target ${simTarget}" simTests=""
testArgs="${testArgs} -R simh-${simTarget}\$" 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 fi
buildArgs="${buildArgs} --config ${buildConfig}" buildArgs="${buildArgs} --config ${buildConfig}"
@ -349,10 +349,10 @@ fi
for ph in ${phases}; do for ph in ${phases}; do
case $ph in case $ph in
generate) generate)
[ x$regenerateFlag = xyes ] && { ## Uncondintionally remove the CMake cache.
echo "${scriptName}: Removing CMakeCache.txt and CMakeFiles" echo "${scriptName}: Removing CMakeCache.txt and CMakeFiles"
rm -rf ${buildSubdir}/CMakeCache.txt ${buildSubdir}/CMakefiles rm -rf ${buildSubdir}/CMakeCache.txt ${buildSubdir}/CMakefiles
}
if [[ "x${cmakeSFlag}" != x ]]; then if [[ "x${cmakeSFlag}" != x ]]; then
echo "${cmake} -G "\"${buildFlavor}\"" -DCMAKE_BUILD_TYPE="${buildConfig}" -S "${simhTopDir}" -B ${buildSubdir} ${generateArgs}" 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} || { \ ${cmake} -G "${buildFlavor}" -DCMAKE_BUILD_TYPE="${buildConfig}" -S "${simhTopDir}" -B "${buildSubdir}" ${generateArgs} || { \