Skip to content

Allow using CXX in extconf.rb #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/ruby_wasm/build/product/crossruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def feature_name(crossruby)
def make_args(crossruby)
make_args = []
make_args << "CC=#{@toolchain.cc}"
make_args << "CXX=#{@toolchain.cc}"
make_args << "LD=#{@toolchain.ld}"
make_args << "AR=#{@toolchain.ar}"
make_args << "RANLIB=#{@toolchain.ranlib}"
Expand Down
1 change: 1 addition & 0 deletions lib/ruby_wasm/build/product/product.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def system_triplet_args
def tools_args
args = []
args << "CC=#{@toolchain.cc}"
args << "CXX=#{@toolchain.cxx}"
args << "LD=#{@toolchain.ld}"
args << "AR=#{@toolchain.ar}"
args << "RANLIB=#{@toolchain.ranlib}"
Expand Down
3 changes: 2 additions & 1 deletion lib/ruby_wasm/build/toolchain.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def self.check_executable(command)
tool
end

%i[cc ranlib ld ar].each do |name|
%i[cc cxx ranlib ld ar].each do |name|
define_method(name) do
@tools_cache ||= {}
@tools_cache[name] ||= find_tool(name)
Expand Down Expand Up @@ -84,6 +84,7 @@ def initialize(

@tools = {
cc: "#{wasi_sdk_path}/bin/clang",
cxx: "#{wasi_sdk_path}/bin/clang++",
ld: "#{wasi_sdk_path}/bin/clang",
ar: "#{wasi_sdk_path}/bin/llvm-ar",
ranlib: "#{wasi_sdk_path}/bin/llvm-ranlib"
Expand Down
1 change: 1 addition & 0 deletions sig/ruby_wasm/build.rbs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ module RubyWasm
def self.find_path: (String command) -> String?
def self.check_executable: (String command) -> String
def cc: -> String
def cxx: -> String
def ranlib: -> String
def ld: -> String
def ar: -> String
Expand Down