Skip to content

Commit e42715d

Browse files
Add small ruby script to create compile_commands with absolute paths
1 parent c021362 commit e42715d

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

sample-project/compile_commands.json

Lines changed: 0 additions & 10 deletions
This file was deleted.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
require 'json'
2+
require 'shellwords'
3+
db = %w[some_file.cpp some_other_file.cpp].map do |sourcefile|
4+
fullpath = File.join(Dir.pwd, sourcefile).shellescape
5+
{ directory: Dir.pwd,
6+
file: fullpath,
7+
command: "clang++ #{fullpath}"
8+
}
9+
end
10+
File.open('./compile_commands.json', 'w') do |f|
11+
f.write JSON.pretty_generate(db)
12+
end

0 commit comments

Comments
 (0)