From 650a668a9de31ef66b3a944ef8630277052a71cd Mon Sep 17 00:00:00 2001 From: "John W. Parent" <45471568+johnwparent@users.noreply.github.com> Date: Wed, 28 Sep 2022 11:54:00 -0400 Subject: 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. --- lib/spack/spack/bootstrap.py | 4 ++++ lib/spack/spack/build_environment.py | 9 ++++++++- lib/spack/spack/build_systems/cmake.py | 3 +-- lib/spack/spack/test/conftest.py | 3 +-- 4 files changed, 14 insertions(+), 5 deletions(-) (limited to 'lib') diff --git a/lib/spack/spack/bootstrap.py b/lib/spack/spack/bootstrap.py index 6951ad4946..cfcaac2a31 100644 --- a/lib/spack/spack/bootstrap.py +++ b/lib/spack/spack/bootstrap.py @@ -46,6 +46,8 @@ import spack.version #: 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") diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index c1aee2c749..93ff1512a7 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -109,7 +109,14 @@ SPACK_SYSTEM_DIRS = "SPACK_SYSTEM_DIRS" # 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): diff --git a/lib/spack/spack/build_systems/cmake.py b/lib/spack/spack/build_systems/cmake.py index de54bcd0e3..6fb75b6747 100644 --- a/lib/spack/spack/build_systems/cmake.py +++ b/lib/spack/spack/build_systems/cmake.py @@ -19,7 +19,6 @@ from llnl.util.filesystem import working_dir 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 @@ class CMakePackage(PackageBase): 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), ] diff --git a/lib/spack/spack/test/conftest.py b/lib/spack/spack/test/conftest.py index 97a6b9de7b..80a5ee49de 100644 --- a/lib/spack/spack/test/conftest.py +++ b/lib/spack/spack/test/conftest.py @@ -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) -- cgit v1.2.3-70-g09d2