]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add support for cuda including the -optf option
authorClemens Rabe <clemens.rabe@gmail.com>
Fri, 7 Nov 2014 20:10:51 +0000 (21:10 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Fri, 7 Aug 2015 15:20:46 +0000 (17:20 +0200)
ccache.c
language.c

index 7bd7788e82bb656be41a51f415a3bd49a165d74b..2bb2179e219307efcd65e8cb2e031e938adc0977 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1884,6 +1884,47 @@ cc_process_args(struct args *args, struct args **preprocessor_args,
                        continue;
                }
 
+               /* Handle cuda "-optf" and "--options-file" argument. */
+               if (str_eq(argv[i], "-optf") || str_eq(argv[i], "--options-file")) {
+                       if (++i >= argc) {
+                               cc_log("Expected argument after the '-optf' resp. '--options-file' option!");
+                               stats_update(STATS_UNSUPPORTED);
+                               result = false;
+                               goto out;
+                       }
+
+                       /* Argument is a comma separated list of files. */
+                       char *strStart = argv[i];
+                       char *strEnd   = strchr(strStart,',');
+                       int   index    = i+1;
+
+                       if (!strEnd) {
+                               strEnd = strStart + strlen(strStart);
+                       }
+
+                       while (strEnd) {
+                               *strEnd = (char) 0;
+                               struct args *file_args;
+                               file_args = args_init_from_gcc_atfile(strStart);
+                               if (!file_args) {
+                                       cc_log("Couldn't read cuda options file %s", strStart);
+                                       stats_update(STATS_ARGS);
+                                       result = false;
+                                       goto out;
+                               }
+
+                               int newIndex = file_args->argc + index;
+                               args_insert(expanded_args, index, file_args, false);
+                               index    = newIndex;
+                               strStart = strEnd;
+                               strEnd   = strchr(strStart,',');
+                       }
+
+                       argc = expanded_args->argc;
+                       argv = expanded_args->argv;
+                       continue;
+               }
+
                /* These are always too hard. */
                if (compopt_too_hard(argv[i])
                    || str_startswith(argv[i], "-fdump-")) {
index 78c4a7d0262d8ee38693c55832905918c5d59eb2..bea4bf9d2849a5520998066df56eefd1dda99984 100644 (file)
@@ -61,6 +61,8 @@ static const struct {
        {".HXX", "c++-header"},
        {".tcc", "c++-header"},
        {".TCC", "c++-header"},
+       {".cu",  "cuda"},
+       {".ic",  "cuda-output"},
        {NULL,  NULL}
 };
 
@@ -85,6 +87,7 @@ static const struct {
        {"objc++-cpp-output",        "objective-c++-cpp-output"},
        {"objective-c++-header",     "objective-c++-cpp-output"},
        {"objective-c++-cpp-output", "objective-c++-cpp-output"},
+       {"cuda",                     "cuda-output"},
        {NULL,  NULL}
 };