]> granicus.if.org Git - graphviz/commitdiff
CI: call CPack via CMake smattr/a6d69c3e-65f6-499d-9bf0-0d3a484aa3d0
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 30 Sep 2022 04:36:07 +0000 (21:36 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Fri, 30 Sep 2022 04:36:07 +0000 (21:36 -0700)
CPack is CMake’s “packaging driver,” exposed as `cpack.exe`. Yet if you
call `cpack.exe` in some CI environments, you will find the binary in your
`$PATH` is _not_ CMake’s packaging driver. This is what the logic in the Windows
setup script that is being removed in this commit was attempting to detect and
workaround or diagnose: a `cpack.exe` in your `$PATH` that is some unrelated and
unhelpful platform management executable.

But there is a simpler way. CMake’s docs¹ tell us:

  Instead of `cpack`, one may call `cmake --build . --target package` or
  `make package` or `ninja package`.

In this change, we drop the `cpack` and `$PATH` workarounds and just call
`cmake`, relying on it to know where its own packaging driver is.

¹ https://cmake.org/cmake/help/latest/module/CPack.html

ci/build.sh
ci/windows_build.py
windows/bin/setup-build-utilities.ps1

index c4e3272d8c1511ab0665f726d9334cd8c63efb81..6e9e7a6c4e291d30211f5c8c2c3c50de0db0a291 100755 (executable)
@@ -38,7 +38,7 @@ if [ "${build_system}" = "cmake" ]; then
     pushd build
     cmake --log-level=VERBOSE ${CMAKE_OPTIONS:-} ..
     cmake --build .
-    cpack
+    cmake --build . --target package
     popd
     if [ "${OSTYPE}" = "linux-gnu" ]; then
         GV_VERSION=$(python3 gen_version.py)
index 1db270ad0730a4a86fb1d4b4b4e2ffc9d2259c90..e84afab5ead6388b6172ffd7109bc59acf6f7947 100644 (file)
@@ -39,7 +39,9 @@ def main(args: List[str]) -> int: #pylint: disable=C0116
          options.platform, "-D", "with_cxx_api=ON", ".."],
         build)
     run(["cmake", "--build", ".", "--config", options.configuration], build)
-    run(["cpack", "-C", options.configuration], build)
+    run(["cmake", "--build", ".", "--config", options.configuration, "--target",
+         "package"],
+        build)
 
   else:
     run(["msbuild.exe", f"-p:Configuration={options.configuration}",
index f05c68bb946b389ba5d69fe3e1f848dd08c07ead..74e488cfd79c82f3ee445d39b6969279ca9e521e 100644 (file)
@@ -52,14 +52,9 @@ $build_utilities_path = "$GRAPHVIZ_ROOT\windows\dependencies\graphviz-build-util
 find_or_fallback "swig" "$build_utilities_path"
 find_or_fallback "win_bison win_flex" "$build_utilities_path\winflexbison"
 find_or_fallback "makensis" "$build_utilities_path\NSIS\Bin"
-find_or_fallback "cmake cpack" "$CMAKE_BIN"
+find_or_fallback "cmake" "$CMAKE_BIN"
 find_or_fallback "msbuild" "$MSBUILD_BIN"
 
-if (-NOT (cpack.exe --help | Select-String 'CPACK_GENERATOR')) {
-    echo "Moving $CMAKE_BIN to front of PATH in order to find CMake's cpack"
-    $Env:Path="$CMAKE_BIN;$path"
-}
-
 echo "Final check where all utilites are found:"
 
 $script:all_programs.Trim().Split(" ") | ForEach {
@@ -72,14 +67,6 @@ $script:all_programs.Trim().Split(" ") | ForEach {
     }
 }
 
-# Special checks
-
-if (-NOT (cpack.exe --help | Select-String 'CPACK_GENERATOR')) {
-    $exe = (Get-Command cpack.exe 2>$null).Source
-    Write-Error -EA Continue "Found an unknown cpack at $exe"
-    $exit_status = 1
-}
-
 if ($exit_status -eq 0) {
     echo "All utilities have been found. Happy building!"
 } else {