From abeb0882d4278c637721690a71246110f611f769 Mon Sep 17 00:00:00 2001 From: Thomas Frosio Date: Sat, 28 Oct 2023 01:46:10 +0200 Subject: [PATCH 1/2] Use the loaded headers from the previous file --- jitify2_preprocess.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jitify2_preprocess.cpp b/jitify2_preprocess.cpp index fc19c90..122497d 100644 --- a/jitify2_preprocess.cpp +++ b/jitify2_preprocess.cpp @@ -250,7 +250,7 @@ int main(int argc, char* argv[]) { } PreprocessedProgram preprocessed = - Program(source_filename, source)->preprocess(options); + Program(source_filename, source, all_header_sources)->preprocess(options); if (!preprocessed) { std::cerr << "Error processing source file " << source_filename << "\n" << preprocessed.error() << std::endl; From e579dc090b346e44fb4592b9a8468f03cdb2d4f4 Mon Sep 17 00:00:00 2001 From: Thomas Frosio Date: Sat, 28 Oct 2023 02:27:14 +0200 Subject: [PATCH 2/2] Only when `share_headers=true` --- jitify2_preprocess.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/jitify2_preprocess.cpp b/jitify2_preprocess.cpp index 122497d..2901705 100644 --- a/jitify2_preprocess.cpp +++ b/jitify2_preprocess.cpp @@ -250,7 +250,9 @@ int main(int argc, char* argv[]) { } PreprocessedProgram preprocessed = - Program(source_filename, source, all_header_sources)->preprocess(options); + Program(source_filename, source, + share_headers ? all_header_sources : StringMap{}) + ->preprocess(options); if (!preprocessed) { std::cerr << "Error processing source file " << source_filename << "\n" << preprocessed.error() << std::endl;