Skip to content
Snippets Groups Projects
Commit e047e11e authored by Virgile Prevosto's avatar Virgile Prevosto Committed by Andre Maroneze
Browse files

[machdep] Support passing several arch flags to the compiler

parent 419dd697
No related branches found
No related tags found
No related merge requests found
...@@ -67,27 +67,33 @@ parser.add_argument("--compiler", default="cc", help="which compiler to use; def ...@@ -67,27 +67,33 @@ parser.add_argument("--compiler", default="cc", help="which compiler to use; def
parser.add_argument( parser.add_argument(
"--compiler-version", "--compiler-version",
default="--version", default="--version",
help="option to pass to the compiler to obtain its version; default is --version" help="option to pass to the compiler to obtain its version; default is --version",
) )
parser.add_argument( parser.add_argument(
"--cpp-arch-flags", "--cpp-arch-flags",
nargs="+", nargs="+",
default=[], action="extend",
help="architecture-specific flags needed for preprocessing, e.g. '-m32'", help="architecture-specific flags needed for preprocessing, e.g. '-m32'",
) )
parser.add_argument( parser.add_argument(
"--compiler-flags", "--compiler-flags",
nargs="+", nargs="+",
default=["-c"], action="extend",
type=str,
help="flags to be given to the compiler (other than those set by --cpp-arch-flags); default is '-c'", help="flags to be given to the compiler (other than those set by --cpp-arch-flags); default is '-c'",
) )
parser.add_argument("--check", action="store_true") parser.add_argument("--check", action="store_true")
args, other_args = parser.parse_known_args() args, other_args = parser.parse_known_args()
if not args.compiler_flags:
args.compiler_flags = ["-c"]
def print_machdep(machdep): def print_machdep(machdep):
json.dump(machdep, args.dest_file, indent=4, sort_keys=True) json.dump(machdep, args.dest_file, indent=4, sort_keys=True)
def check_machdep(machdep): def check_machdep(machdep):
try: try:
from jsonschema import validate, ValidationError from jsonschema import validate, ValidationError
...@@ -232,7 +238,7 @@ version_output = subprocess.run( ...@@ -232,7 +238,7 @@ version_output = subprocess.run(
version = version_output.stdout.splitlines()[0] version = version_output.stdout.splitlines()[0]
machdep["compiler"] = args.compiler machdep["compiler"] = args.compiler
machdep["cpp_arch_flags"] = ' '.join(args.cpp_arch_flags) machdep["cpp_arch_flags"] = " ".join(args.cpp_arch_flags)
machdep["version"] = version machdep["version"] = version
missing_fields = [f for [f, v] in machdep.items() if v is None] missing_fields = [f for [f, v] in machdep.items() if v is None]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment