Skip to content

Commit

Permalink
Generate compile_flags.txt for clangd for development
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Mar 8, 2024
1 parent 543b1ff commit 4621a56
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
/ext/ilios/*.o
/ext/ilios/mkmf.log
/ext/ilios/Makefile
/ext/ilios/compile_flags.txt
/ext/ilios/cpp-driver
/ext/ilios/libuv
/ext/ilios/ports
Expand Down
17 changes: 17 additions & 0 deletions ext/ilios/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,22 @@ def num_cpu_cores
cores >= 7 ? MAX_CORES : cores
end

def create_compile_flags_txt
cppflags = $CPPFLAGS.split(' ')

Check failure on line 31 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Style/RedundantArgument: Argument ' ' is redundant because it is implied by default.
include_flags = cppflags.select { |flag| flag.start_with?('-I') }
define_flags = cppflags.select { |flag| flag.start_with?('-D') } + $defs

File.open('compile_flags.txt', 'w') do |f|
include_flags.each { |flag| f.puts(flag) }
f.puts "-I#{Dir.pwd}"

Check failure on line 37 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Style/MethodCallWithArgsParentheses: Use parentheses for method calls with arguments.
f.puts "-I#{RbConfig::CONFIG['rubyhdrdir']}"

Check failure on line 38 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Style/MethodCallWithArgsParentheses: Use parentheses for method calls with arguments.
f.puts "-I#{RbConfig::CONFIG['rubyhdrdir']}/ruby/backward"

Check failure on line 39 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Style/MethodCallWithArgsParentheses: Use parentheses for method calls with arguments.
f.puts "-I#{RbConfig::CONFIG['rubyarchhdrdir']}"

Check failure on line 40 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Style/MethodCallWithArgsParentheses: Use parentheses for method calls with arguments.
define_flags.each { |flag| f.puts(flag) }
end
end


Check failure on line 45 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Layout/EmptyLines: Extra blank line detected.
module LibuvInstaller

Check failure on line 46 in ext/ilios/extconf.rb

View workflow job for this annotation

GitHub Actions / RuboCop

[Correctable] Layout/EmptyLineBetweenDefs: Expected 1 empty line between module definitions; found 2.
LIBUV_INSTALL_PATH = File.expand_path('libuv')
private_constant :LIBUV_INSTALL_PATH
Expand Down Expand Up @@ -146,3 +162,4 @@ def self.install_from_source
$LDFLAGS += " #{ENV['LDFLAGS']}"

create_makefile('ilios')
create_compile_flags_txt

0 comments on commit 4621a56

Please sign in to comment.