Sha256: a972cd3baae48f76215eb6a8b381ade7a559034df4f7ff1cdc366cfc5fafe040

Contents?: true

Size: 1.93 KB

Versions: 17

Compression:

Stored size: 1.93 KB

Contents

require 'fileutils'


def build_extension(name, arch, src_files)
  objects = []
  mkdir_p $tempdir unless File.exists? $tempdir

  src_files.each do |f|
    objname = File.join( $tempdir, File.basename( f.gsub(/\.c$/, '.o') ) )
    objects << ('"'+objname+'"')

    args = []
    args << "-I."
    args << "-I\"#{$rootdir}/platform/android/Rhodes/jni/include\""
    args << "-I\"#{$rootdir}/platform/shared/ruby/include\""
    args << "-I\"#{$rootdir}/platform/shared\""
    args << "-I\"#{$rootdir}/platform/shared/common\""
    args << "-I\"#{$rootdir}/platform/shared/ruby/android\""
    args << "-I\"#{$rootdir}/platform/shared/ruby/generated\""

    cc_compile f, $tempdir, args or exit 1
  end

  mkdir_p $targetdir unless File.exist? $targetdir

   cc_ar ('"'+File.join( $targetdir, 'lib' + name + '.a' )+'"'), Dir.glob($tempdir + "/**/*.o").collect{|x| '"'+x+'"'} or exit 1

end

namespace "build" do
  task :config do
    curdir = pwd
    $rawsensorsdir = curdir.gsub('/ext/rawsensors/platform/android','');
    $targetdir = ENV['TARGET_TEMP_DIR']
    raise "TARGET_TEMP_DIR is not set" if $targetdir.nil?
    $tempdir = ENV['TEMP_FILES_DIR']
    raise "TEMP_FILES_DIR is not set" if $tempdir.nil?
    $rootdir = ENV['RHO_ROOT']
    raise "RHO_ROOT is not set" if $rootdir.nil?

    require File.join($rootdir, 'platform/android/build/androidcommon.rb')

    setup_ndk(ENV['ANDROID_NDK'],ENV['ANDROID_API_LEVEL'])

  end

  task :all => :config do

    src_files = []

    src_files << $rawsensorsdir + '/ext/rawsensors/platform/android/jni/src/rawsensors.cpp'
    src_files << $rawsensorsdir + '/ext/rawsensors/shared/ruby/rawsensors_wrap.c'
    src_files << $rawsensorsdir + '/ext/rawsensors/shared/src/rawsensors.c'

    # build native part
    build_extension('RawSensors', $arch, src_files)

    # java part will be builded automatically (java files should be listed in ext_build.files ans ext. yml should be configured)

  end
end

task :default => "build:all"

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
rhodes-7.6.0 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-7.5.1 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-7.4.1 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-7.1.17 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-6.2.0 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-6.0.11 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.18 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.17 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.15 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.0.22 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.2 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.0.7 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.0.3 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
rhodes-5.5.0 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
tauplatform-1.0.3 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
tauplatform-1.0.2 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile
tauplatform-1.0.1 lib/extensions/rawsensors/ext/rawsensors/platform/android/Rakefile