File tree 3 files changed +22
-4
lines changed
3 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ foreach(input ${prelude_headers})
11
11
set (output "${CMAKE_CURRENT_BINARY_DIR} /${input_name} .cpp" )
12
12
add_custom_command (
13
13
OUTPUT ${output}
14
- COMMAND slang-embed "${input} " ${output}
14
+ COMMAND
15
+ slang-embed "${input} " "${CMAKE_CURRENT_LIST_DIR} /../include"
16
+ ${output}
15
17
DEPENDS ${input} slang-embed
16
18
VERBATIM
17
19
)
Original file line number Diff line number Diff line change 1
1
// Prelude for PyTorch cpp binding.
2
2
3
+ // clang-format off
4
+ #include < torch/extension.h>
5
+ // clang-format on
6
+
3
7
#include < ATen/cuda/CUDAContext.h>
4
8
#include < ATen/cuda/CUDAUtils.h>
5
9
#include < stdexcept>
6
10
#include < string>
7
- #include < torch/extension.h>
8
11
#include < vector>
9
12
10
13
#ifdef SLANG_LLVM
Original file line number Diff line number Diff line change @@ -63,6 +63,7 @@ struct App
63
63
{
64
64
char const * appName = " slang-embed" ;
65
65
char const * inputPath = nullptr ;
66
+ char const * includeDir = nullptr ;
66
67
char const * outputPath = nullptr ;
67
68
Slang::HashSet<Slang::String> includedFiles;
68
69
@@ -83,6 +84,12 @@ struct App
83
84
argc--;
84
85
}
85
86
87
+ if (argc > 0 )
88
+ {
89
+ includeDir = *argv++;
90
+ argc--;
91
+ }
92
+
86
93
if (argc > 0 )
87
94
{
88
95
outputPath = *argv++;
@@ -91,7 +98,7 @@ struct App
91
98
92
99
if (!inputPath || (argc != 0 ))
93
100
{
94
- fprintf (stderr, " usage: %s inputPath [outputPath]\n " , appName);
101
+ fprintf (stderr, " usage: %s inputPath includeDir [outputPath]\n " , appName);
95
102
exit (1 );
96
103
}
97
104
}
@@ -137,7 +144,13 @@ struct App
137
144
auto path =
138
145
Slang::Path::combine (Slang::Path::getParentDirectory (inputPath), fileName);
139
146
if (!Slang::File::exists (path))
140
- goto normalProcess;
147
+ {
148
+ // Try looking in the include directory.
149
+ path = Slang::Path::combine (includeDir, fileName);
150
+
151
+ if (!Slang::File::exists (path))
152
+ goto normalProcess;
153
+ }
141
154
processInputFile (outputFile, path.getUnownedSlice ());
142
155
continue ;
143
156
}
You can’t perform that action at this time.
0 commit comments