Windows: Support for Clingo and dependencies (#30690)

Make it possible to install the Clingo package on Windows; this
also provides a means to use Clingo with Spack on Windows.

This includes

* A new "winbison" package: Windows has a port of bison and flex where
  the two packages are grouped together. Clingo dependencies have been
  updated to use winbison on Windows and bison elsewhere (this avoids
  complicating the existin bison/flex packages until we can add support
  for implied virtuals).
* The CMake build system was incorrectly converting CMAKE_INSTALL_PREFIX
  to POSIX format.
* The re2c package has been modified to use CMake on Windows; for now
  this is done by overloading the configure/build/install methods to
  perform CMake-appropriate operations; the package should be refactored
  once support for multiple build systems in one Package is available.
This commit is contained in:
John W. Parent
2022-09-28 11:54:00 -04:00
committed by GitHub
parent db2565cb53
commit 650a668a9d
9 changed files with 130 additions and 16 deletions

View File

@@ -46,6 +46,8 @@
#: Name of the file containing metadata about the bootstrapping source
METADATA_YAML_FILENAME = "metadata.yaml"
is_windows = sys.platform == "win32"
#: Map a bootstrapper type to the corresponding class
_bootstrap_methods = {}
@@ -655,6 +657,8 @@ def _add_externals_if_missing():
# GnuPG
spack.repo.path.get_pkg_class("gawk"),
]
if is_windows:
search_list.extend(spack.repo.path.get_pkg_class("winbison"))
detected_packages = spack.detection.by_executable(search_list)
spack.detection.update_configuration(detected_packages, scope="bootstrap")

View File

@@ -109,7 +109,14 @@
# Platform-specific library suffix.
dso_suffix = "dylib" if sys.platform == "darwin" else "so"
if sys.platform == "darwin":
dso_suffix = "dylib"
elif sys.platform == "win32":
dso_suffix = "dll"
else:
dso_suffix = "so"
stat_suffix = "lib" if sys.platform == "win32" else "a"
def should_set_parallel_jobs(jobserver_support=False):

View File

@@ -19,7 +19,6 @@
import spack.build_environment
from spack.directives import conflicts, depends_on, variant
from spack.package_base import InstallError, PackageBase, run_after
from spack.util.path import convert_to_posix_path
# Regex to extract the primary generator from the CMake generator
# string.
@@ -176,7 +175,7 @@ def _std_args(pkg):
args = [
"-G",
generator,
define("CMAKE_INSTALL_PREFIX", convert_to_posix_path(pkg.prefix)),
define("CMAKE_INSTALL_PREFIX", pkg.prefix),
define("CMAKE_BUILD_TYPE", build_type),
define("BUILD_TESTING", pkg.run_tests),
]

View File

@@ -634,12 +634,11 @@ def configuration_dir(tmpdir_factory, linux_os):
# Slightly modify config.yaml and compilers.yaml
if is_windows:
solver = "original"
locks = False
else:
solver = os.environ.get("SPACK_TEST_SOLVER", "clingo")
locks = True
solver = os.environ.get("SPACK_TEST_SOLVER", "clingo")
config_yaml = test_config.join("config.yaml")
modules_root = tmpdir_factory.mktemp("share")
tcl_root = modules_root.ensure("modules", dir=True)