Skip to content

Commit

Permalink
Refine build_config
Browse files Browse the repository at this point in the history
  • Loading branch information
hadashiA committed Sep 9, 2024
1 parent 0189c13 commit 97d1074
Show file tree
Hide file tree
Showing 17 changed files with 66 additions and 101 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/build-mruby.windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,28 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
ruby-version: mswin
- uses: microsoft/setup-msbuild@v2

- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64

- name: Build mruby (windows x86)
working-directory: ${{ env.MRUBY_DIR }}
shell: bash
run: |
MRUBY_CONFIG=${GITHUB_WORKSPACE}/src/vitalrouter-mruby/build_config.windows-x64.rb rake
ls -R ./build/
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: amd64_arm64

- name: Build mruby (windows x86)
working-directory: ${{ env.MRUBY_DIR }}
shell: bash
run: |
MRUBY_CONFIG=${GITHUB_WORKSPACE}/src/vitalrouter-mruby/build_config.rb rake -v
ls ./build/minimal/lib
MRUBY_CONFIG=${GITHUB_WORKSPACE}/src/vitalrouter-mruby/build_config.windows-arm64.rb rake
ls -R ./build/
Expand Down
5 changes: 0 additions & 5 deletions src/vitalrouter-mruby/build_config.android-arm64.rb

This file was deleted.

11 changes: 0 additions & 11 deletions src/vitalrouter-mruby/build_config.android-arm64.rb.lock

This file was deleted.

4 changes: 0 additions & 4 deletions src/vitalrouter-mruby/build_config.android-x64.rb

This file was deleted.

11 changes: 0 additions & 11 deletions src/vitalrouter-mruby/build_config.android-x64.rb.lock

This file was deleted.

9 changes: 9 additions & 0 deletions src/vitalrouter-mruby/build_config.android.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
MRuby::CrossBuild.new('android-arm64') do |conf|
toolchain :android, arch: 'arm64-v8a'
conf.gembox '../../../vitalrouter'
end

MRuby::CrossBuild.new('android-x64') do |conf|
toolchain :android, arch: 'x86_64'
conf.gembox '../../../vitalrouter'
end
17 changes: 0 additions & 17 deletions src/vitalrouter-mruby/build_config.ios-arm64.rb

This file was deleted.

11 changes: 0 additions & 11 deletions src/vitalrouter-mruby/build_config.ios-arm64.rb.lock

This file was deleted.

11 changes: 0 additions & 11 deletions src/vitalrouter-mruby/build_config.ios-x64.rb.lock

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
MRuby::CrossBuild.new('ios-arm64') do |conf|
conf.gembox '../../../vitalrouter'

sdk = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/'

conf.cc do |cc|
cc.command = 'xcrun'
cc.flags = %W(-sdk iphoneos clang -arch arm64 -isysroot "#{sdk}" -g -O3 -Wall -Werror-implicit-function-declaration)
end

conf.linker do |linker|
linker.command = 'xcrun'
linker.flags = %W(-sdk iphoneos clang -arch arm64 -isysroot "#{sdk}")
end
end

MRuby::CrossBuild.new('ios-x64') do |conf|
sdk = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/'

Expand Down
13 changes: 13 additions & 0 deletions src/vitalrouter-mruby/build_config.macOS.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
MRuby::CrossBuild.new("macOS-arm64") do |conf|
conf.toolchain
conf.gembox '../../../vitalrouter'

conf.cc.flags << '-target aarch64-apple-darwin'
end

MRuby::CrossBuild.new("macOS-x64") do |conf|
conf.toolchain
conf.gembox '../../../vitalrouter'

conf.cc.flags << '-target x86_64-apple-darwin'
end
11 changes: 0 additions & 11 deletions src/vitalrouter-mruby/build_config.rb.lock

This file was deleted.

4 changes: 2 additions & 2 deletions src/vitalrouter-mruby/build_config.wasm.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
MRuby::CrossBuild.new('wasm') do |conf|
conf.toolchain
conf.gembox '../../../vitalrouter'

conf.cc.command = 'emcc'
conf.linker.command = 'emcc'
conf.archiver.command = 'emar'

conf.gembox '../../../vitalrouter'
end

11 changes: 0 additions & 11 deletions src/vitalrouter-mruby/build_config.wasm.rb.lock

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MRuby::CrossBuild.new("minimal") do |conf|
MRuby::CrossBuild.new("windows") do |conf|
conf.toolchain
conf.gembox '../../../vitalrouter'
end
4 changes: 4 additions & 0 deletions src/vitalrouter-mruby/build_config.windows-x64.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
MRuby::CrossBuild.new('windows-x64') do |conf|
conf.toolchain
conf.gembox '../../../vitalrouter'
end
6 changes: 3 additions & 3 deletions src/vitalrouter-mruby/mrbgem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ MRuby::Gem::Specification.new('vitalrouter-mruby') do |spec|
end

MRuby.each_target do
next unless name.match(/^(minimal|android)/i)
next unless name.match(/^(windows|macOS|android)/i)

sharedlib_ext =
if `uname`.match(/darwin/i)
if RUBY_PLATFORM.match(/darwin/i)
'dylib'
elsif ENV['OS'] == 'Windows_NT'
'dll'
else
'so'
end

mruby_sharedlib = "#{build_dir}/lib/libmruby.#{sharedlib_ext}"
mruby_sharedlib = "#{build_dir}/lib/VitalRouter.MRuby.Native.#{sharedlib_ext}"

products << mruby_sharedlib

Expand Down

0 comments on commit 97d1074

Please sign in to comment.