diff options
-rw-r--r-- | lib/spack/spack/compilers/msvc.py | 24 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/icu4c/package.py | 64 |
2 files changed, 78 insertions, 10 deletions
diff --git a/lib/spack/spack/compilers/msvc.py b/lib/spack/spack/compilers/msvc.py index f6e86f831a..e74bb4e307 100644 --- a/lib/spack/spack/compilers/msvc.py +++ b/lib/spack/spack/compilers/msvc.py @@ -224,6 +224,30 @@ class Msvc(Compiler): self.msvc_compiler_environment = CmdCall(*env_cmds) @property + def cxx11_flag(self): + return "/std:c++11" + + @property + def cxx14_flag(self): + return "/std:c++14" + + @property + def cxx17_flag(self): + return "/std:c++17" + + @property + def cxx20_flag(self): + return "/std:c++20" + + @property + def c11_flag(self): + return "/std:c11" + + @property + def c17_flag(self): + return "/std:c17" + + @property def msvc_version(self): """This is the VCToolset version *NOT* the actual version of the cl compiler For CL version, query `Msvc.cl_version`""" diff --git a/var/spack/repos/builtin/packages/icu4c/package.py b/var/spack/repos/builtin/packages/icu4c/package.py index 3dddb27010..3cb4eb1d98 100644 --- a/var/spack/repos/builtin/packages/icu4c/package.py +++ b/var/spack/repos/builtin/packages/icu4c/package.py @@ -3,10 +3,12 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import pathlib + from spack.package import * -class Icu4c(AutotoolsPackage): +class Icu4c(AutotoolsPackage, MSBuildPackage): """ICU is a mature, widely used set of C/C++ and Java libraries providing Unicode and Globalization support for software applications. ICU4C is the C/C++ interface.""" @@ -31,15 +33,22 @@ class Icu4c(AutotoolsPackage): depends_on("c", type="build") # generated depends_on("cxx", type="build") # generated - variant( - "cxxstd", - default="11", - values=("11", "14", "17"), - multi=False, - description="Use the specified C++ standard when building", - ) + build_system("autotools", "msbuild", default="autotools") + for plat in ["linux", "darwin", "freebsd"]: + with when(f"platform={plat}"): + variant( + "cxxstd", + default="11", + values=("11", "14", "17"), + multi=False, + description="Use the specified C++ standard when building", + ) depends_on("python", type="build", when="@64.1:") + with when("build_system=autotools"): + depends_on("autoconf", type="build") + depends_on("automake", type="build") + depends_on("libtool", type="build") conflicts( "%intel@:16", @@ -55,8 +64,6 @@ class Icu4c(AutotoolsPackage): when="@58.0:59", ) - configure_directory = "source" - def url_for_version(self, version): url = "https://github.com/unicode-org/icu/releases/download/release-{0}/icu4c-{1}-src.tgz" return url.format(version.dashed, version.underscored) @@ -68,12 +75,19 @@ class Icu4c(AutotoolsPackage): flags.append(getattr(self.compiler, f"cxx{self.spec.variants['cxxstd'].value}_flag")) return (None, flags, None) + +class BuildEnvironment: # Need to make sure that locale is UTF-8 in order to process source # files in UTF-8. @when("@59:") def setup_build_environment(self, env): env.set("LC_ALL", "en_US.UTF-8") + +class AutotoolsBuilder(spack.build_systems.autotools.AutotoolsBuilder, BuildEnvironment): + + configure_directory = "source" + def configure_args(self): args = [] @@ -88,3 +102,33 @@ class Icu4c(AutotoolsPackage): args.append("--enable-rpath") return args + + +class MSBuildBuilder(spack.build_systems.msbuild.MSBuildBuilder, BuildEnvironment): + def msbuild_args(self): + return [ + "allinone.sln", + self.define("OutputPath", self.spec.prefix), + self.define("Configuration", "Release"), + self.define("SkipUWP", "true"), + ] + + @property + def build_directory(self): + solution_path = pathlib.Path(self.pkg.stage.source_path) + if self.spec.satsifies("@:67"): + solution_path = solution_path / "icu" + solution_path = solution_path / "source" / "allinone" + return str(solution_path) + + def install(self, pkg, spec, prefix): + mkdirp(prefix.lib) + mkdirp(prefix.bin) + mkdirp(prefix.include) + with working_dir(self.pkg.stage.source_path): + # install bin + install_tree("bin64", prefix.bin) + # install lib + install_tree("lib64", prefix.lib) + # intstall headers + install_tree("include", prefix.include) |