Changeset 331 for EcnlProtoTool/trunk/mruby-1.3.0/tasks
- Timestamp:
- Jan 21, 2018, 12:10:09 AM (6 years ago)
- Location:
- EcnlProtoTool/trunk/mruby-1.3.0
- Files:
-
- 2 added
- 10 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
EcnlProtoTool/trunk/mruby-1.3.0/tasks/libmruby.rake
r321 r331 6 6 file "#{build_dir}/lib/libmruby.flags.mak" => [__FILE__, libfile("#{build_dir}/lib/libmruby")] do |t| 7 7 open(t.name, 'w') do |f| 8 f.puts "MRUBY_CFLAGS = #{cc.all_flags .gsub('"', '\\"')}"8 f.puts "MRUBY_CFLAGS = #{cc.all_flags}" 9 9 10 10 gem_flags = gems.map { |g| g.linker.flags } 11 11 gem_library_paths = gems.map { |g| g.linker.library_paths } 12 f.puts "MRUBY_LDFLAGS = #{linker.all_flags(gem_library_paths, gem_flags) .gsub('"', '\\"')} #{linker.option_library_path % "#{build_dir}/lib"}"12 f.puts "MRUBY_LDFLAGS = #{linker.all_flags(gem_library_paths, gem_flags)} #{linker.option_library_path % "#{build_dir}/lib"}" 13 13 14 14 gem_flags_before_libraries = gems.map { |g| g.linker.flags_before_libraries } 15 f.puts "MRUBY_LDFLAGS_BEFORE_LIBS = #{[linker.flags_before_libraries, gem_flags_before_libraries].flatten.join(' ') .gsub('"', '\\"')}"15 f.puts "MRUBY_LDFLAGS_BEFORE_LIBS = #{[linker.flags_before_libraries, gem_flags_before_libraries].flatten.join(' ')}" 16 16 17 17 gem_libraries = gems.map { |g| g.linker.libraries } 18 f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries).gsub('"', '\\"')}" 18 f.puts "MRUBY_LIBS = #{linker.option_library % 'mruby'} #{linker.library_flags(gem_libraries)}" 19 20 f.puts "MRUBY_LIBMRUBY_PATH = #{libfile("#{build_dir}/lib/libmruby")}" 19 21 end 20 22 end -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/mrbgem_spec.rake
r321 r331 2 2 require 'forwardable' 3 3 require 'tsort' 4 require 'shellwords' 4 5 5 6 module MRuby … … 18 19 alias mruby build 19 20 attr_accessor :build_config_initializer 21 attr_accessor :mrblib_dir, :objs_dir 20 22 21 23 attr_accessor :version … … 45 47 @initializer = block 46 48 @version = "0.0.0" 49 @mrblib_dir = "mrblib" 50 @objs_dir = "src" 47 51 MRuby::Gem.current = self 48 52 end … … 55 59 @linker = LinkerConfig.new([], [], [], [], []) 56 60 57 @rbfiles = Dir.glob("#{ dir}/mrblib/**/*.rb").sort58 @objs = Dir.glob("#{ dir}/src/*.{c,cpp,cxx,cc,m,asm,s,S}").map do |f|61 @rbfiles = Dir.glob("#{@dir}/#{@mrblib_dir}/**/*.rb").sort 62 @objs = Dir.glob("#{@dir}/#{@objs_dir}/*.{c,cpp,cxx,cc,m,asm,s,S}").map do |f| 59 63 objfile(f.relative_path_from(@dir).to_s.pathmap("#{build_dir}/%X")) 60 64 end … … 87 91 88 92 instance_eval(&@build_config_initializer) if @build_config_initializer 89 93 end 94 95 def setup_compilers 90 96 compilers.each do |compiler| 91 97 compiler.define_rules build_dir, "#{dir}" … … 122 128 def test_rbireps 123 129 "#{build_dir}/gem_test.c" 130 end 131 132 def search_package(name, version_query=nil) 133 package_query = name 134 package_query += " #{version_query}" if version_query 135 _pp "PKG-CONFIG", package_query 136 escaped_package_query = Shellwords.escape(package_query) 137 if system("pkg-config --exists #{escaped_package_query}") 138 cc.flags += [`pkg-config --cflags #{escaped_package_query}`.strip] 139 cxx.flags += [`pkg-config --cflags #{escaped_package_query}`.strip] 140 linker.flags_before_libraries += [`pkg-config --libs #{escaped_package_query}`.strip] 141 true 142 else 143 false 144 end 124 145 end 125 146 … … 182 203 print_gem_comment(f) 183 204 f.puts %Q[#include <stdlib.h>] unless rbfiles.empty? 184 f.puts %Q[#include "mruby.h"]185 f.puts %Q[#include "mruby/irep.h"] unless rbfiles.empty?205 f.puts %Q[#include <mruby.h>] 206 f.puts %Q[#include <mruby/irep.h>] unless rbfiles.empty? 186 207 end 187 208 … … 190 211 f.puts %Q[#include <stdio.h>] 191 212 f.puts %Q[#include <stdlib.h>] 192 f.puts %Q[#include "mruby.h"]193 f.puts %Q[#include "mruby/irep.h"]194 f.puts %Q[#include "mruby/variable.h"]195 f.puts %Q[#include "mruby/hash.h"] unless test_args.empty?213 f.puts %Q[#include <mruby.h>] 214 f.puts %Q[#include <mruby/irep.h>] 215 f.puts %Q[#include <mruby/variable.h>] 216 f.puts %Q[#include <mruby/hash.h>] unless test_args.empty? 196 217 end 197 218 … … 401 422 @ary = tsort_dependencies gem_table.keys, gem_table, true 402 423 424 each(&:setup_compilers) 425 403 426 each do |g| 404 427 import_include_paths(g) … … 414 437 import_include_paths(dep_g) 415 438 439 dep_g.export_include_paths.uniq! 416 440 g.compilers.each do |compiler| 417 441 compiler.include_paths += dep_g.export_include_paths 418 442 g.export_include_paths += dep_g.export_include_paths 443 compiler.include_paths.uniq! 444 g.export_include_paths.uniq! 419 445 end 420 446 end -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/mrbgems.rake
r321 r331 32 32 f.puts %Q[ */] 33 33 f.puts %Q[] 34 f.puts %Q[#include "mruby.h"]34 f.puts %Q[#include <mruby.h>] 35 35 f.puts %Q[] 36 36 f.write gem_func_decls -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/mruby_build.rake
r321 r331 84 84 @gems, @libmruby = MRuby::Gem::List.new, [] 85 85 @build_mrbtest_lib_only = false 86 @cxx_exception_enabled = false 87 @cxx_exception_disabled = false 86 88 @cxx_abi_enabled = false 87 @cxx_exception_disabled = false88 89 @enable_bintest = false 89 90 @enable_test = false … … 111 112 112 113 def disable_cxx_exception 114 if @cxx_exception_enabled or @cxx_abi_enabled 115 raise "cxx_exception already enabled" 116 end 113 117 @cxx_exception_disabled = true 118 end 119 120 def enable_cxx_exception 121 return if @cxx_exception_enabled 122 return if @cxx_abi_enabled 123 if @cxx_exception_disabled 124 raise "cxx_exception disabled" 125 end 126 @cxx_exception_enabled = true 127 compilers.each { |c| 128 c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) 129 c.flags << c.cxx_exception_flag 130 } 131 linker.command = cxx.command if toolchains.find { |v| v == 'gcc' } 132 end 133 134 def cxx_exception_enabled? 135 @cxx_exception_enabled 114 136 end 115 137 … … 119 141 120 142 def enable_cxx_abi 121 return if @cxx_exception_disabled or @cxx_abi_enabled 122 compilers.each { |c| c.defines += %w(MRB_ENABLE_CXX_EXCEPTION) } 143 return if @cxx_abi_enabled 144 if @cxx_exception_enabled 145 raise "cxx_exception already enabled" 146 end 147 compilers.each { |c| 148 c.defines += %w(MRB_ENABLE_CXX_EXCEPTION MRB_ENABLE_CXX_ABI) 149 c.flags << c.cxx_compile_flag 150 } 151 compilers.each { |c| c.flags << c.cxx_compile_flag } 123 152 linker.command = cxx.command if toolchains.find { |v| v == 'gcc' } 124 153 @cxx_abi_enabled = true … … 136 165 #define __STDC_LIMIT_MACROS 137 166 167 #ifndef MRB_ENABLE_CXX_ABI 138 168 extern "C" { 169 #endif 139 170 #include "#{src}" 171 #ifndef MRB_ENABLE_CXX_ABI 140 172 } 141 142 #{src == "#{MRUBY_ROOT}/src/error.c"? 'mrb_int mrb_jmpbuf::jmpbuf_id = 0;' : ''} 173 #endif 143 174 EOS 144 175 end -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/mruby_build_commands.rake
r321 r331 43 43 attr_accessor :flags, :include_paths, :defines, :source_exts 44 44 attr_accessor :compile_options, :option_define, :option_include_path, :out_ext 45 attr_accessor :cxx_compile_flag, :cxx_exception_flag 45 46 46 47 def initialize(build, source_exts=[]) -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/mruby_build_gem.rake
r321 r331 39 39 Dir.glob("#{Gem.current.dir}/#{subdir}/*.{cpp,cxx,cc}") 40 40 end.flatten 41 enable_cxx_ abiunless cxx_srcs.empty?41 enable_cxx_exception unless cxx_srcs.empty? 42 42 43 43 Gem.current -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/android.rake
r321 r331 1 1 class MRuby::Toolchain::Android 2 DEFAULT_ARCH = 'armeabi' 3 DEFAULT_PLATFORM = 'android-14' 4 DEFAULT_TOOLCHAIN = :gcc 2 3 DEFAULT_ARCH = 'armeabi' # TODO : Revise if arch should have a default 4 5 DEFAULT_TOOLCHAIN = :clang 6 5 7 DEFAULT_NDK_HOMES = %w{ 8 /usr/local/opt/android-sdk/ndk-bundle 6 9 /usr/local/opt/android-ndk 10 %LOCALAPPDATA%/Android/android-sdk/ndk-bundle 11 %LOCALAPPDATA%/Android/android-ndk 12 ~/Library/Android/sdk/ndk-bundle 13 ~/Library/Android/ndk 7 14 } 8 TOOLCHAINS = [:gcc, :clang] 15 16 TOOLCHAINS = [:clang, :gcc] 17 9 18 ARCHITECTURES = %w{ 10 19 armeabi armeabi-v7a arm64-v8a 20 x86 x86_64 11 21 mips mips64 12 x86 x86_6413 22 } 14 23 … … 22 31 end 23 32 33 class PlatformDirNotFound < StandardError 34 def message 35 <<-EOM 36 Couldn't find Android NDK platform directories. 37 Set ANDROID_PLATFORM environment variable or set :platform parameter 38 EOM 39 end 40 end 41 24 42 attr_reader :params 25 43 26 44 def initialize(params) 27 45 @params = params 46 end 47 48 def bin_gcc(command) 49 command = command.to_s 50 51 command = case arch 52 when /armeabi/ then 'arm-linux-androideabi-' 53 when /arm64-v8a/ then 'aarch64-linux-android-' 54 when /x86_64/ then 'x86_64-linux-android-' 55 when /x86/ then 'i686-linux-android-' 56 when /mips64/ then 'mips64el-linux-android-' 57 when /mips/ then 'mipsel-linux-android-' 58 end + command 59 60 gcc_toolchain_path.join('bin', command).to_s 61 end 62 63 def bin(command) 64 command = command.to_s 65 toolchain_path.join('bin', command).to_s 28 66 end 29 67 … … 31 69 @home_path ||= Pathname( 32 70 params[:ndk_home] || 33 ENV['ANDROID_NDK_HOME'] || 34 DEFAULT_NDK_HOMES.find{ |path| File.directory?(path) } || 35 raise(AndroidNDKHomeNotFound) 71 ENV['ANDROID_NDK_HOME'] || 72 DEFAULT_NDK_HOMES.find { |path| 73 path.gsub! '%LOCALAPPDATA%', ENV['LOCALAPPDATA'] || '%LOCALAPPDATA%' 74 path.gsub! '\\', '/' 75 path.gsub! '~', Dir.home || '~' 76 File.directory?(path) 77 } || raise(AndroidNDKHomeNotFound) 36 78 ) 37 79 end 38 80 81 def toolchain 82 @toolchain ||= params.fetch(:toolchain){ DEFAULT_TOOLCHAIN } 83 end 84 85 def toolchain_path 86 @toolchain_path ||= case toolchain 87 when :gcc 88 gcc_toolchain_path 89 when :clang 90 home_path.join('toolchains', 'llvm' , 'prebuilt', host_platform) 91 end 92 end 93 94 def gcc_toolchain_path 95 if @gcc_toolchain_path === nil then 96 prefix = case arch 97 when /armeabi/ then 'arm-linux-androideabi-' 98 when /arm64-v8a/ then 'aarch64-linux-android-' 99 when /x86_64/ then 'x86_64-' 100 when /x86/ then 'x86-' 101 when /mips64/ then 'mips64el-linux-android-' 102 when /mips/ then 'mipsel-linux-android-' 103 end 104 105 test = case arch 106 when /armeabi/ then 'arm-linux-androideabi-*' 107 when /arm64-v8a/ then 'aarch64-linux-android-*' 108 when /x86_64/ then 'x86_64-*' 109 when /x86/ then 'x86-*' 110 when /mips64/ then 'mips64el-linux-android-*' 111 when /mips/ then 'mipsel-linux-android-*' 112 end 113 114 gcc_toolchain_version = Dir[home_path.join('toolchains', test)].map{|t| t.match(/-(\d+\.\d+)$/); $1.to_f }.max 115 @gcc_toolchain_path = home_path.join('toolchains', prefix + gcc_toolchain_version.to_s, 'prebuilt', host_platform) 116 end 117 @gcc_toolchain_path 118 end 119 120 def host_platform 121 @host_platform ||= case RUBY_PLATFORM 122 when /cygwin|mswin|mingw|bccwin|wince|emx/i 123 path = home_path.join('toolchains', 'llvm' , 'prebuilt', 'windows*') 124 Dir.glob(path.to_s){ |item| 125 next if File.file?(item) 126 path = Pathname(item) 127 break 128 } 129 path.basename 130 when /x86_64-darwin/i 131 'darwin-x86_64' 132 when /darwin/i 133 'darwin-x86' 134 when /x86_64-linux/i 135 'linux-x86_64' 136 when /linux/i 137 'linux-x86' 138 else 139 raise NotImplementedError, "Unknown host platform (#{RUBY_PLATFORM})" 140 end 141 end 142 39 143 def arch 40 params.fetch(:arch){ DEFAULT_ARCH } 144 @arch ||= (params[:arch] || ENV['ANDROID_ARCH'] || DEFAULT_ARCH).to_s 145 end 146 147 def sysroot 148 @sysroot ||= home_path.join('platforms', platform, 149 case arch 150 when /armeabi/ then 'arch-arm' 151 when /arm64-v8a/ then 'arch-arm64' 152 when /x86_64/ then 'arch-x86_64' 153 when /x86/ then 'arch-x86' 154 when /mips64/ then 'arch-mips64' 155 when /mips/ then 'arch-mips' 156 end 157 ).to_s 41 158 end 42 159 43 160 def platform 44 params.fetch(:platform){ DEFAULT_PLATFORM } 45 end 46 47 def toolchain 48 params.fetch(:toolchain){ DEFAULT_TOOLCHAIN } 49 end 50 51 def toolchain_version 52 params.fetch(:toolchain_version) do 53 test = case toolchain 54 when :gcc 55 case arch 56 when /armeabi/ 57 'arm-linux-androideabi-*' 58 when /arm64/ 59 'aarch64-linux-android-*' 60 when /mips64/ 61 'mips64el-linux-android-*' 62 when /mips/ 63 'mipsel-linux-android-*' 64 when /x86_64/ 65 'x86_64-*' 66 when /x86/ 67 'x86-*' 161 if @platform === nil then 162 @platform = params[:platform] || ENV['ANDROID_PLATFORM'] || nil 163 if @platform === nil 164 Dir.glob(home_path.join('platforms/android-*').to_s){ |item| 165 next if File.file?(item) 166 if @platform === nil 167 @platform = Integer(item.rpartition('-')[2]) 168 else 169 platform = Integer(item.rpartition('-')[2]) 170 @platform = platform > @platform ? platform : @platform 171 end 172 } 173 if @platform === nil 174 raise(PlatformDirNotFound) 175 else 176 @platform = "android-#{@platform}" 68 177 end 69 when :clang 70 'llvm-*' 71 end 72 73 Dir[home_path.join('toolchains',test)].map{|t| t.match(/-(\d+\.\d+)$/); $1.to_f }.max 74 end 75 end 76 77 def toolchain_path 78 prefix = case toolchain 79 when :clang then 'llvm-' 80 when :gcc 81 case arch 82 when /armeabi/ then 'arm-linux-androideabi-' 83 when /arm64/ then 'aarch64-linux-android-' 84 when /x86_64/ then 'x86_64-' 85 when /x86/ then 'x86-' 86 when /mips64/ then 'mips64el-linux-android-' 87 when /mips/ then 'mipsel-linux-android-' 88 end 89 end 90 home_path.join('toolchains', prefix + toolchain_version.to_s, 'prebuilt', host_platform) 91 end 92 93 def sysroot 94 path = case arch 95 when /armeabi/ then 'arch-arm' 96 when /arm64/ then 'arch-arm64' 97 when /x86_64/ then 'arch-x86_64' 98 when /x86/ then 'arch-x86' 99 when /mips64/ then 'arch-mips64' 100 when /mips/ then 'arch-mips' 101 end 102 103 home_path.join('platforms', platform, path).to_s 104 end 105 106 def bin(command) 107 command = command.to_s 108 109 if toolchain == :gcc 110 command = case arch 111 when /armeabi/ then 'arm-linux-androideabi-' 112 when /arm64/ then 'aarch64-linux-android-' 113 when /x86_64/ then 'x86_64-linux-android-' 114 when /x86/ then 'i686-linux-android-' 115 when /mips64/ then 'mips64el-linux-android-' 116 when /mips/ then 'mipsel-linux-android-' 117 end + command 118 end 119 120 toolchain_path.join('bin',command).to_s 178 end 179 end 180 if Integer(@platform.rpartition('-')[2]) < 21 181 case arch 182 when /arm64-v8a/, /x86_64/, /mips64/ 183 raise NotImplementedError, "Platform (#{@platform}) has no implementation for architecture (#{arch})" 184 end 185 end 186 @platform 187 end 188 189 def armeabi_v7a_mfpu 190 @armeabi_v7a_mfpu ||= (params[:mfpu] || 'vfpv3-d16').to_s 191 end 192 193 def armeabi_v7a_mfloat_abi 194 @armeabi_v7a_mfloat_abi ||= (params[:mfloat_abi] || 'softfp').to_s 195 end 196 197 def no_warn_mismatch 198 if %W(soft softfp).include? armeabi_v7a_mfloat_abi 199 '' 200 else 201 ',--no-warn-mismatch' 202 end 121 203 end 122 204 123 205 def cc 124 206 case toolchain 125 when :gcc then bin(:gcc) 126 when :clang then bin(:clang) 127 end 207 when :gcc then bin_gcc('gcc') 208 when :clang then bin('clang') 209 end 210 end 211 212 def ar 213 case toolchain 214 when :gcc then bin_gcc('ar') 215 when :clang then bin_gcc('ar') 216 end 217 end 218 219 def ctarget 220 flags = [] 221 222 case toolchain 223 when :gcc 224 case arch 225 when /armeabi-v7a/ then flags += %W(-march=armv7-a) 226 when /armeabi/ then flags += %W(-march=armv5te) 227 when /arm64-v8a/ then flags += %W(-march=armv8-a) 228 when /x86_64/ then flags += %W(-march=x86-64) 229 when /x86/ then flags += %W(-march=i686) 230 when /mips64/ then flags += %W(-march=mips64r6) 231 when /mips/ then flags += %W(-march=mips32) 232 end 233 when :clang 234 case arch 235 when /armeabi-v7a/ then flags += %W(-target armv7-none-linux-androideabi) 236 when /armeabi/ then flags += %W(-target armv5te-none-linux-androideabi) 237 when /arm64-v8a/ then flags += %W(-target aarch64-none-linux-android) 238 when /x86_64/ then flags += %W(-target x86_64-none-linux-android) 239 when /x86/ then flags += %W(-target i686-none-linux-android) 240 when /mips64/ then flags += %W(-target mips64el-none-linux-android) 241 when /mips/ then flags += %W(-target mipsel-none-linux-android) 242 end 243 end 244 245 case arch 246 when /armeabi-v7a/ then flags += %W(-mfpu=#{armeabi_v7a_mfpu} -mfloat-abi=#{armeabi_v7a_mfloat_abi}) 247 when /armeabi/ then flags += %W(-mtune=xscale -msoft-float) 248 when /arm64-v8a/ then flags += %W() 249 when /x86_64/ then flags += %W() 250 when /x86/ then flags += %W() 251 when /mips64/ then flags += %W(-fmessage-length=0) 252 when /mips/ then flags += %W(-fmessage-length=0) 253 end 254 255 flags 128 256 end 129 257 … … 131 259 flags = [] 132 260 261 flags += %W(-MMD -MP -D__android__ -DANDROID --sysroot="#{sysroot}") 262 flags += ctarget 133 263 case toolchain 134 264 when :gcc 135 flags += %W(-ffunction-sections -funwind-tables -no-canonical-prefixes)136 flags += %W(-D__android__ -mandroid --sysroot="#{sysroot}")137 case arch138 when /arm64/139 flags += %W(-fpic -fstack-protector-strong)140 when 'armeabi-v7a-hard'141 flags += %W(-fpic -fstack-protector-strong -march=armv7-a -mhard-float -D_NDK_MATH_NO_SOFTFP=1 -mfpu=vfpv3-d16)142 when 'armeabi-v7a'143 flags += %W(-fpic -fstack-protector-strong -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16)144 when /arm/145 flags += %W(-fpic -fstack-protector-strong -march=armv5te -mtune=xscale -msoft-float)146 when /mips/147 flags += %W(-fpic -fno-strict-aliasing -finline-functions -fmessage-length=0 -fno-inline-functions-called-once -fgcse-after-reload -frerun-cse-after-loop -frename-registers)148 when /x86/149 flags += %W(-fstack-protector-strong)150 end151 265 when :clang 152 end 266 flags += %W(-gcc-toolchain "#{gcc_toolchain_path.to_s}" -Wno-invalid-command-line-argument -Wno-unused-command-line-argument) 267 end 268 flags += %W(-fpic -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes) 153 269 154 270 flags 155 end156 157 def ld158 cc159 271 end 160 272 161 273 def ldflags 162 274 flags = [] 275 276 flags += %W(--sysroot="#{sysroot}") 277 278 flags 279 end 280 281 def ldflags_before_libraries 282 flags = [] 283 163 284 case toolchain 164 285 when :gcc 165 flags += %W(-no-canonical-prefixes) 166 flags += %W(-D__android__ -mandroid --sysroot="#{sysroot}") 167 case arch 168 when 'armeabi-v7a-hard' 169 flags += %W(-march=armv7-a -Wl,--fix-cortex-a8 -Wl,--no-warn-mismatch -lm_hard) 170 when 'armeabi-v7a' 171 flags += %W(-march=armv7-a -Wl,--fix-cortex-a8) 172 end 173 end 174 286 case arch 287 when /armeabi-v7a/ then flags += %W(-Wl#{no_warn_mismatch}) 288 end 289 when :clang 290 flags += %W(-gcc-toolchain "#{gcc_toolchain_path.to_s}") 291 case arch 292 when /armeabi-v7a/ then flags += %W(-target armv7-none-linux-androideabi -Wl,--fix-cortex-a8#{no_warn_mismatch}) 293 when /armeabi/ then flags += %W(-target armv5te-none-linux-androideabi) 294 when /arm64-v8a/ then flags += %W(-target aarch64-none-linux-android) 295 when /x86_64/ then flags += %W(-target x86_64-none-linux-android) 296 when /x86/ then flags += %W(-target i686-none-linux-android) 297 when /mips64/ then flags += %W(-target mips64el-none-linux-android) 298 when /mips/ then flags += %W(-target mipsel-none-linux-android) 299 end 300 end 301 flags += %W(-no-canonical-prefixes) 302 175 303 flags 176 304 end 177 178 def ar179 case toolchain180 when :gcc then bin(:ar)181 when :clang then bin('llvm-ar')182 end183 end184 185 def host_platform186 case RUBY_PLATFORM187 when /cygwin|mswin|mingw|bccwin|wince|emx/i188 'windows'189 when /x86_64-darwin/i190 'darwin-x86_64'191 when /darwin/i192 'darwin-x86'193 when /x86_64-linux/i194 'linux-x86_64'195 when /linux/i196 'linux-x86'197 else198 raise NotImplementedError, "Unknown host platform (#{RUBY_PLATFORM})"199 end200 end201 305 end 202 306 203 307 MRuby::Toolchain.new(:android) do |conf, params| 204 ndk= MRuby::Toolchain::Android.new(params)205 206 toolchain ndk.toolchain308 android = MRuby::Toolchain::Android.new(params) 309 310 toolchain android.toolchain 207 311 208 312 [conf.cc, conf.cxx, conf.objc, conf.asm].each do |cc| 209 cc.command = ndk.cc 210 cc.flags = ndk.cflags 211 end 212 conf.linker.command = ndk.ld 213 conf.linker.flags = ndk.ldflags 214 conf.archiver.command = ndk.ar 313 cc.command = android.cc 314 cc.flags = android.cflags 315 end 316 317 conf.archiver.command = android.ar 318 conf.linker.command = android.cc 319 conf.linker.flags = android.ldflags 320 conf.linker.flags_before_libraries = android.ldflags_before_libraries 215 321 end 216 -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/clang.rake
r321 r331 1 MRuby::Toolchain.new(:clang) do |conf |1 MRuby::Toolchain.new(:clang) do |conf, _params| 2 2 toolchain :gcc 3 3 -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/gcc.rake
r321 r331 1 MRuby::Toolchain.new(:gcc) do |conf |1 MRuby::Toolchain.new(:gcc) do |conf, _params| 2 2 [conf.cc, conf.objc, conf.asm].each do |cc| 3 3 cc.command = ENV['CC'] || 'gcc' … … 7 7 cc.option_define = '-D%s' 8 8 cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}' 9 cc.cxx_compile_flag = '-x c++ -std=c++03' 10 cc.cxx_exception_flag = '-fexceptions' 9 11 end 10 12 … … 16 18 cxx.option_define = '-D%s' 17 19 cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}' 20 cxx.cxx_compile_flag = '-x c++ -std=c++03' 21 cxx.cxx_exception_flag = '-fexceptions' 18 22 end 19 23 -
EcnlProtoTool/trunk/mruby-1.3.0/tasks/toolchains/visualcpp.rake
r321 r331 1 MRuby::Toolchain.new(:visualcpp) do |conf |1 MRuby::Toolchain.new(:visualcpp) do |conf, _params| 2 2 conf.cc do |cc| 3 3 cc.command = ENV['CC'] || 'cl.exe' 4 cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /utf-8 /W4 /GS /analyze- /Zc:wchar_t /ZI /Gm /Od /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /EHsc /DWIN32 /D_DEBUG /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS)] 5 cc.flags << %w(/we4002 /we4003 /we4005 /we4007 /we4010 /we4013 /we4015 /we4020 /we4022 /we4024 /we4028 /we4029 /we4031 /we4033 /we4034 /we4042 /we4047 /we4048 /we4049 /we4056 /we4067 /we4074 /we4079 /we4083 /we4088 /we4089 /we4090 /we4091 /we4094 /we4096 /we4098 /we4099 /we4113 /we4133 /we4715 /we4716) 6 cc.flags << %w(/wd4214 /wd4100 /wd4996) 7 cc.flags << "/Fd\"#{conf.build_dir}\\vc140.pdb\"" 8 cc.flags << "/Fp\"%{outdir}\\%{outfilebase}.pch\"" 4 # C4013: implicit function declaration 5 cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /we4013 /Zi /MD /O2 /utf-8 /D_CRT_SECURE_NO_WARNINGS)] 9 6 cc.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING) 10 7 cc.option_include_path = '/I%s' 11 8 cc.option_define = '/D%s' 12 9 cc.compile_options = "%{flags} /Fo%{outfile} %{infile}" 10 cc.cxx_compile_flag = '/TP' 11 cc.cxx_exception_flag = '/EHs' 13 12 end 14 13 15 14 conf.cxx do |cxx| 16 15 cxx.command = ENV['CXX'] || 'cl.exe' 17 cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /utf-8 /nologo /W4 /GS /analyze- /Zc:wchar_t /ZI /Gm /Od /Zc:inline /fp:precise /errorReport:prompt /WX- /Zc:forScope /RTC1 /Gd /Oy- /MDd /EHsc /DWIN32 /D_DEBUG /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS)] 18 cxx.flags << %w(/we4002 /we4003 /we4005 /we4007 /we4010 /we4013 /we4015 /we4020 /we4022 /we4024 /we4028 /we4029 /we4031 /we4033 /we4034 /we4042 /we4047 /we4048 /we4049 /we4056 /we4067 /we4074 /we4079 /we4083 /we4088 /we4089 /we4090 /we4091 /we4094 /we4096 /we4098 /we4099 /we4113 /we4133 /we4715 /we4716) 19 cxx.flags << %w(/wd4214 /wd4100 /wd4996) 20 cxx.flags << "/Fd\"#{conf.build_dir}\\vc140.pdb\"" 21 cxx.flags << "/Fp\"%{outdir}\\%{outfilebase}.pch\"" 16 cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(/c /nologo /W3 /Zi /MD /O2 /EHs /utf-8 /D_CRT_SECURE_NO_WARNINGS)] 22 17 cxx.defines = %w(DISABLE_GEMS MRB_STACK_EXTEND_DOUBLING) 23 18 cxx.option_include_path = '/I%s' 24 19 cxx.option_define = '/D%s' 25 20 cxx.compile_options = "%{flags} /Fo%{outfile} %{infile}" 21 cxx.cxx_compile_flag = '/TP' 22 cxx.cxx_exception_flag = '/EHs' 26 23 end 27 24 … … 61 58 62 59 conf.file_separator = '\\' 60 61 if require 'open3' 62 Open3.popen3 conf.cc.command do |_, _, e, _| 63 if /Version (\d{2})\.\d{2}\.\d{5}/ =~ e.gets && $1.to_i <= 17 64 m = "# VS2010/2012 support will be dropped after the next release! #" 65 h = "#" * m.length 66 puts h, m, h 67 end 68 end 69 end 70 63 71 end
Note:
See TracChangeset
for help on using the changeset viewer.