Compare commits
2 Commits
packages/v
...
hs/compile
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c2dae308a | ||
|
|
bb735478fe |
@@ -216,16 +216,13 @@ def check_args_contents(cc, args, must_contain, must_not_contain):
|
|||||||
assert a not in cc_modified_args
|
assert a not in cc_modified_args
|
||||||
|
|
||||||
|
|
||||||
def check_env_var(executable, var, expected):
|
def check_wrapper_var(exe, *args, var, expected):
|
||||||
"""Check environment variables updated by the passed compiler wrapper
|
"""Check variables set by the compiler wrapper. This works by setting SPACK_TEST_COMMAND to
|
||||||
|
dump-var-<variable-to-debug>, which will print the variable and exit."""
|
||||||
This assumes that cc will print debug output when it's environment
|
executable = Executable(str(exe))
|
||||||
contains SPACK_TEST_COMMAND=dump-env-<variable-to-debug>
|
with set_env(SPACK_TEST_COMMAND=f"dump-var-{var}"):
|
||||||
"""
|
output = executable(*args, output=str).strip()
|
||||||
executable = Executable(str(executable))
|
assert f"{executable.path}: {var}: {expected}" == output
|
||||||
with set_env(SPACK_TEST_COMMAND="dump-env-" + var):
|
|
||||||
output = executable(*test_args, output=str).strip()
|
|
||||||
assert executable.path + ": " + var + ": " + expected == output
|
|
||||||
|
|
||||||
|
|
||||||
def dump_mode(cc, args):
|
def dump_mode(cc, args):
|
||||||
@@ -749,11 +746,22 @@ def test_system_path_cleanup(wrapper_environment, wrapper_dir):
|
|||||||
"""
|
"""
|
||||||
cc = wrapper_dir / "cc"
|
cc = wrapper_dir / "cc"
|
||||||
system_path = "/bin:/usr/bin:/usr/local/bin"
|
system_path = "/bin:/usr/bin:/usr/local/bin"
|
||||||
with set_env(SPACK_COMPILER_WRAPPER_PATH=str(wrapper_dir), SPACK_CC="true"):
|
with set_env(SPACK_COMPILER_WRAPPER_PATH=str(wrapper_dir)):
|
||||||
with set_env(PATH=str(wrapper_dir) + ":" + system_path):
|
with set_env(PATH=str(wrapper_dir) + ":" + system_path):
|
||||||
check_env_var(cc, "PATH", system_path)
|
check_wrapper_var(cc, *test_args, var="PATH", expected=system_path)
|
||||||
with set_env(PATH=str(wrapper_dir) + "/:" + system_path):
|
with set_env(PATH=str(wrapper_dir) + "/:" + system_path):
|
||||||
check_env_var(cc, "PATH", system_path)
|
check_wrapper_var(cc, *test_args, var="PATH", expected=system_path)
|
||||||
|
|
||||||
|
|
||||||
|
def test_language_from_flags(wrapper_environment, wrapper_dir):
|
||||||
|
"""Test that the compiler language mode is determined by -x/--language flags if present"""
|
||||||
|
cc = wrapper_dir / "cc"
|
||||||
|
|
||||||
|
for flag_value, lang in [("c", "CC"), ("c++", "CXX"), ("f77", "F77"), ("f95", "FC")]:
|
||||||
|
check_wrapper_var(cc, "-c", "file", "-x", flag_value, var="comp", expected=lang)
|
||||||
|
check_wrapper_var(cc, "-c", "file", f"-x{flag_value}", var="comp", expected=lang)
|
||||||
|
check_wrapper_var(cc, "-c", "file", f"--language={flag_value}", var="comp", expected=lang)
|
||||||
|
check_wrapper_var(cc, "-c", "file", "--language", flag_value, var="comp", expected=lang)
|
||||||
|
|
||||||
|
|
||||||
def test_ld_deps_partial(wrapper_environment, wrapper_dir):
|
def test_ld_deps_partial(wrapper_environment, wrapper_dir):
|
||||||
|
|||||||
@@ -178,9 +178,10 @@ execute() {
|
|||||||
unset IFS
|
unset IFS
|
||||||
exit
|
exit
|
||||||
;;
|
;;
|
||||||
dump-env-*)
|
dump-var-*)
|
||||||
var=${SPACK_TEST_COMMAND#dump-env-}
|
var=${SPACK_TEST_COMMAND#dump-var-}
|
||||||
eval "printf '%s\n' \"\$0: \$var: \$$var\""
|
eval "printf '%s\n' \"\$0: \$var: \$$var\""
|
||||||
|
exit
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
die "Unknown test command: '$SPACK_TEST_COMMAND'"
|
die "Unknown test command: '$SPACK_TEST_COMMAND'"
|
||||||
@@ -296,9 +297,36 @@ fi
|
|||||||
# Note. SPACK_ALWAYS_XFLAGS are applied for all compiler invocations,
|
# Note. SPACK_ALWAYS_XFLAGS are applied for all compiler invocations,
|
||||||
# including version checks (SPACK_XFLAGS variants are not applied
|
# including version checks (SPACK_XFLAGS variants are not applied
|
||||||
# for version checks).
|
# for version checks).
|
||||||
command="${0##*/}"
|
command_from_argv0="${0##*/}"
|
||||||
|
command="$command_from_argv0"
|
||||||
comp="CC"
|
comp="CC"
|
||||||
vcheck_flags=""
|
vcheck_flags=""
|
||||||
|
|
||||||
|
_command_from_flags() {
|
||||||
|
while [ $# -ne 0 ]; do
|
||||||
|
arg="$1"
|
||||||
|
shift
|
||||||
|
case "$arg" in
|
||||||
|
-x|--language)
|
||||||
|
_lang="$1"
|
||||||
|
shift ;;
|
||||||
|
-x*)
|
||||||
|
_lang="${arg#-x}" ;;
|
||||||
|
--language=*)
|
||||||
|
_lang="${arg#--language=}" ;;
|
||||||
|
*) continue ;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
case "$_lang" in
|
||||||
|
c) command=cc ;;
|
||||||
|
c++|f77|f95) command="$_lang" ;;
|
||||||
|
*) command="$command_from_argv0" ;; # drop unknown languages
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
_command_from_flags "$@"
|
||||||
|
|
||||||
case "$command" in
|
case "$command" in
|
||||||
cpp)
|
cpp)
|
||||||
mode=cpp
|
mode=cpp
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ class CompilerWrapper(Package):
|
|||||||
if sys.platform != "win32":
|
if sys.platform != "win32":
|
||||||
version(
|
version(
|
||||||
"1.0",
|
"1.0",
|
||||||
sha256="c65a9d2b2d4eef67ab5cb0684d706bb9f005bb2be94f53d82683d7055bdb837c",
|
sha256="db44e5898aa9b8605e3cfe53a51649b4df504066f0f13562432f584fc88a5038",
|
||||||
expand=False,
|
expand=False,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -156,13 +156,7 @@ class Vtk(CMakePackage):
|
|||||||
depends_on("libxt", when="^[virtuals=gl] glx platform=linux")
|
depends_on("libxt", when="^[virtuals=gl] glx platform=linux")
|
||||||
|
|
||||||
# VTK will need Qt5OpenGL, and qt needs '-opengl' for that
|
# VTK will need Qt5OpenGL, and qt needs '-opengl' for that
|
||||||
depends_on("qmake", when="@9.1: +qt")
|
depends_on("qt+opengl", when="+qt")
|
||||||
with when("^[virtuals=qmake] qt-base"):
|
|
||||||
depends_on("qt-base+opengl+widgets")
|
|
||||||
depends_on("qt-quick3d")
|
|
||||||
with when("^[virtuals=qmake] qt"):
|
|
||||||
depends_on("qt+opengl")
|
|
||||||
depends_on("qt+opengl", when="@:9.0 +qt")
|
|
||||||
|
|
||||||
depends_on("boost", when="+xdmf")
|
depends_on("boost", when="+xdmf")
|
||||||
depends_on("boost+mpi", when="+xdmf +mpi")
|
depends_on("boost+mpi", when="+xdmf +mpi")
|
||||||
@@ -386,8 +380,8 @@ def cmake_args(self):
|
|||||||
cmake_args.extend(["-DCMAKE_MACOSX_RPATH=ON"])
|
cmake_args.extend(["-DCMAKE_MACOSX_RPATH=ON"])
|
||||||
|
|
||||||
if "+qt" in spec:
|
if "+qt" in spec:
|
||||||
qt_ver = spec["qmake"].version.up_to(1)
|
qt_ver = spec["qt"].version.up_to(1)
|
||||||
qt_bin = spec["qmake"].prefix.bin
|
qt_bin = spec["qt"].prefix.bin
|
||||||
qmake_exe = os.path.join(qt_bin, "qmake")
|
qmake_exe = os.path.join(qt_bin, "qmake")
|
||||||
|
|
||||||
# https://github.com/martijnkoopman/Qt-VTK-viewer/blob/master/doc/Build-VTK.md
|
# https://github.com/martijnkoopman/Qt-VTK-viewer/blob/master/doc/Build-VTK.md
|
||||||
@@ -412,7 +406,7 @@ def cmake_args(self):
|
|||||||
# NOTE: The following definitions are required in order to allow
|
# NOTE: The following definitions are required in order to allow
|
||||||
# VTK to build with qt~webkit versions (see the documentation for
|
# VTK to build with qt~webkit versions (see the documentation for
|
||||||
# more info: http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup).
|
# more info: http://www.vtk.org/Wiki/VTK/Tutorials/QtSetup).
|
||||||
if "~webkit" in spec["qmake"]:
|
if "~webkit" in spec["qt"]:
|
||||||
if spec.satisfies("@:8"):
|
if spec.satisfies("@:8"):
|
||||||
cmake_args.extend(
|
cmake_args.extend(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user