Skip to content

Commit

Permalink
fix: Require native extension through Thermite::Fiddle
Browse files Browse the repository at this point in the history
Second attempt to fix #12.

Thermite builds native extension as .so file while
Rutie loads the module as .dylib on MacOS.
  • Loading branch information
baygeldin committed Apr 29, 2022
1 parent 52c6560 commit da4cb44
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
9 changes: 7 additions & 2 deletions ext/Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
require "thermite/tasks"

project_dir = File.dirname(File.dirname(__FILE__)) # rubocop:disable Style/NestedFileDirname
Thermite::Tasks.new(cargo_project_path: project_dir, ruby_project_path: project_dir)
project_dir = File.expand_path("../..", __FILE__)

Thermite::Tasks.new(
cargo_project_path: project_dir,
ruby_project_path: project_dir
)

task default: %w[thermite:build]
9 changes: 8 additions & 1 deletion lib/tantiny.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
RubyNext::Language.setup_gem_load_path

require "rutie"
require "thermite/fiddle"
require "concurrent"
require "fileutils"

Expand All @@ -16,5 +17,11 @@
require "tantiny/index"

module Tantiny
Rutie.new(:tantiny, lib_path: __dir__, lib_prefix: "").init("Init_tantiny", __dir__)
project_dir = File.expand_path("../..", __FILE__)

Thermite::Fiddle.load_module(
"Init_tantiny",
cargo_project_path: project_dir,
ruby_project_path: project_dir
)
end

0 comments on commit da4cb44

Please sign in to comment.