this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "Pass CMake flags to MRuby cross target"

This reverts commit 1a8bf8330ecfcfe83082476282156a867796d8a8.

It turns out that wrapping CMake's poor cross build support
was not a good idea after all.

+116 -72
+12 -19
CMakeLists.txt
··· 9 9 if(CMAKE_BUILD_TYPE STREQUAL "Debug") 10 10 set(VERSION_BUILD ".dbg" ) 11 11 endif() 12 - if(CMAKE_BUILD_TYPE) 13 - string(TOUPPER ${CMAKE_BUILD_TYPE} BUILD_TYPE_UC) 14 - endif() 15 12 16 13 find_package(Git) 17 14 if(Git_FOUND) ··· 239 236 endif() 240 237 241 238 set(MRUBY_DIR ${THIRDPARTY_DIR}/mruby) 242 - set(MRUBY_CONFIG ${CMAKE_SOURCE_DIR}/mruby/tic_default.rb) 243 - set(MRUBY_LIB ${MRUBY_DIR}/build/target/lib/libmruby.a) 239 + if(EMSCRIPTEN) 240 + set(MRUBY_TARGET wasm) 241 + set(MRUBY_CONFIG ${CMAKE_SOURCE_DIR}/tic_mruby_wasm_build_config.rb) 242 + else() 243 + set(MRUBY_TARGET host) 244 + set(MRUBY_CONFIG ${CMAKE_SOURCE_DIR}/tic_mruby_build_config.rb) 245 + endif() 246 + set(MRUBY_LIBRARIES ${MRUBY_DIR}/build/${MRUBY_TARGET}/lib/libmruby.a) 244 247 245 248 ExternalProject_Add(mruby_vendor 246 249 SOURCE_DIR ${MRUBY_DIR} 247 250 CONFIGURE_COMMAND "" 248 251 BUILD_IN_SOURCE TRUE 249 - BUILD_COMMAND 250 - ${CMAKE_COMMAND} -E env 251 - "TARGET_CC=${CMAKE_C_COMPILER}" 252 - "TARGET_CXX=${CMAKE_CXX_COMPILER}" 253 - "TARGET_LD=${CMAKE_C_LINK_EXECUTABLE}" 254 - "TARGET_AR=${CMAKE_AR}" 255 - "TARGET_CFLAGS=${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${BUILD_TYPE_UC}}" 256 - "TARGET_CXXFLAGS=${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${BUILD_TYPE_UC}}" 257 - "TARGET_LDFLAGS=${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_LINKER_FLAGS_${BUILD_TYPE_UC}}" 258 - "BUILD_TYPE=${BUILD_TYPE_UC}" 259 - ${RAKE} "MRUBY_CONFIG=${MRUBY_CONFIG}" 252 + BUILD_COMMAND ${RAKE} MRUBY_CONFIG=${MRUBY_CONFIG} 260 253 INSTALL_COMMAND "" 261 - BUILD_BYPRODUCTS ${MRUBY_LIB} 254 + BUILD_BYPRODUCTS ${MRUBY_LIBRARIES} 262 255 ) 263 256 264 257 add_library(mruby STATIC IMPORTED GLOBAL) 265 258 set_property(TARGET mruby APPEND 266 - PROPERTY IMPORTED_LOCATION ${MRUBY_LIB} 259 + PROPERTY IMPORTED_LOCATION ${MRUBY_LIBRARIES} 267 260 ) 268 261 set_property(TARGET mruby APPEND 269 262 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${MRUBY_DIR}/include ··· 544 537 set_target_properties(tic80_libretro PROPERTIES SUFFIX "_partial.a") 545 538 add_custom_command(TARGET tic80_libretro 546 539 POST_BUILD 547 - COMMAND ${CMAKE_SOURCE_DIR}/build/libretro/merge_static.sh $(AR) ${CMAKE_BINARY_DIR}/lib/tic80_libretro${LIBRETRO_SUFFIX}.a ${CMAKE_BINARY_DIR}/lib/tic80_libretro_partial.a ${CMAKE_BINARY_DIR}/lib/libtic80core.a ${CMAKE_BINARY_DIR}/lib/liblua.a ${CMAKE_BINARY_DIR}/lib/libblipbuf.a ${CMAKE_BINARY_DIR}/lib/libduktape.a ${CMAKE_BINARY_DIR}/lib/libwren.a ${CMAKE_BINARY_DIR}/lib/libsquirrel.a ${CMAKE_BINARY_DIR}/lib/libgiflib.a ${CMAKE_BINARY_DIR}/lib/liblpeg.a ${MRUBY_LIB}) 540 + COMMAND ${CMAKE_SOURCE_DIR}/build/libretro/merge_static.sh $(AR) ${CMAKE_BINARY_DIR}/lib/tic80_libretro${LIBRETRO_SUFFIX}.a ${CMAKE_BINARY_DIR}/lib/tic80_libretro_partial.a ${CMAKE_BINARY_DIR}/lib/libtic80core.a ${CMAKE_BINARY_DIR}/lib/liblua.a ${CMAKE_BINARY_DIR}/lib/libblipbuf.a ${CMAKE_BINARY_DIR}/lib/libduktape.a ${CMAKE_BINARY_DIR}/lib/libwren.a ${CMAKE_BINARY_DIR}/lib/libsquirrel.a ${CMAKE_BINARY_DIR}/lib/libgiflib.a ${CMAKE_BINARY_DIR}/lib/liblpeg.a ${MRUBY_LIBRARIES}) 548 541 else() 549 542 add_library(tic80_libretro SHARED 550 543 ${LIBRETRO_SRC}
-1
mruby/.gitignore
··· 1 - *.lock
mruby/tic.gembox tic.gembox
-52
mruby/tic_default.rb
··· 1 - MRuby::Build.new do |conf| 2 - # load specific toolchain settings 3 - conf.toolchain 4 - 5 - # include the GEM box 6 - conf.gembox 'default' 7 - 8 - conf.enable_bintest 9 - conf.enable_test 10 - end 11 - 12 - MRuby::Toolchain.new('target') do |conf| 13 - toolchain :clang 14 - 15 - conf.cc.command = ENV['TARGET_CC'] || 'cc' 16 - conf.cxx.command = ENV['TARGET_CXX'] || 'cxx' 17 - conf.linker.command = ENV['TARGET_LD'] || 'ld' 18 - conf.archiver.command = ENV['TARGET_AR'] || 'ar' 19 - end 20 - 21 - MRuby::CrossBuild.new('target') do |conf| 22 - # load specific toolchain settings 23 - toolchain :target 24 - 25 - # include the GEM box 26 - conf.gembox File.expand_path('tic', File.dirname(__FILE__)) 27 - 28 - # C compiler settings 29 - conf.cc do |cc| 30 - cc.flags = [ENV["TARGET_CFLAGS"] || %w()] 31 - unless ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] 32 - cc.flags << '-fPIC' 33 - end 34 - end 35 - 36 - # Linker settings 37 - conf.linker do |linker| 38 - linker.flags = [ENV['TARGET_LDFLAGS'] || []] 39 - end 40 - 41 - # file extensions 42 - conf.exts do |exts| 43 - exts.object = '.o' 44 - exts.library = '.a' 45 - # exts.executable = '' # '.exe' if Windows 46 - end 47 - 48 - # Turn on `enable_debug` for better debugging 49 - conf.enable_debug if /DEBUG/ =~ ENV["BUILD_TYPE"] 50 - conf.enable_bintest 51 - conf.enable_test 52 - end
+82
tic_mruby_build_config.rb
··· 1 + MRuby::Build.new do |conf| 2 + # load specific toolchain settings 3 + conf.toolchain 4 + 5 + # Use mrbgems 6 + # conf.gem 'examples/mrbgems/ruby_extension_example' 7 + # conf.gem 'examples/mrbgems/c_extension_example' do |g| 8 + # g.cc.flags << '-g' # append cflags in this gem 9 + # end 10 + # conf.gem 'examples/mrbgems/c_and_ruby_extension_example' 11 + # conf.gem :core => 'mruby-eval' 12 + # conf.gem :mgem => 'mruby-onig-regexp' 13 + # conf.gem :github => 'mattn/mruby-onig-regexp' 14 + # conf.gem :git => 'git@github.com:mattn/mruby-onig-regexp.git', :branch => 'master', :options => '-v' 15 + 16 + # include the GEM box 17 + conf.gembox File.expand_path('tic', File.dirname(__FILE__)) 18 + 19 + # C compiler settings 20 + conf.cc do |cc| 21 + # cc.command = ENV['CC'] || 'gcc' 22 + cc.flags = [ENV['CFLAGS'] || %w()] 23 + cc.flags << '-fPIC' unless ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR'] 24 + # cc.include_paths = ["#{root}/include"] 25 + # cc.defines = %w() 26 + # cc.option_include_path = %q[-I"%s"] 27 + # cc.option_define = '-D%s' 28 + # cc.compile_options = %Q[%{flags} -MMD -o "%{outfile}" -c "%{infile}"] 29 + end 30 + 31 + # mrbc settings 32 + # conf.mrbc do |mrbc| 33 + # mrbc.compile_options = "-g -B%{funcname} -o-" # The -g option is required for line numbers 34 + # end 35 + 36 + # Linker settings 37 + # conf.linker do |linker| 38 + # linker.command = ENV['LD'] || 'gcc' 39 + # linker.flags = [ENV['LDFLAGS'] || []] 40 + # linker.flags_before_libraries = [] 41 + # linker.libraries = %w() 42 + # linker.flags_after_libraries = [] 43 + # linker.library_paths = [] 44 + # linker.option_library = '-l%s' 45 + # linker.option_library_path = '-L%s' 46 + # linker.link_options = "%{flags} -o "%{outfile}" %{objs} %{libs}" 47 + # end 48 + 49 + # Archiver settings 50 + # conf.archiver do |archiver| 51 + # archiver.command = ENV['AR'] || 'ar' 52 + # archiver.archive_options = 'rs "%{outfile}" %{objs}' 53 + # end 54 + 55 + # Parser generator settings 56 + # conf.yacc do |yacc| 57 + # yacc.command = ENV['YACC'] || 'bison' 58 + # yacc.compile_options = %q[-o "%{outfile}" "%{infile}"] 59 + # end 60 + 61 + # gperf settings 62 + # conf.gperf do |gperf| 63 + # gperf.command = 'gperf' 64 + # gperf.compile_options = %q[-L ANSI-C -C -p -j1 -i 1 -g -o -t -N mrb_reserved_word -k"1,3,$" "%{infile}" > "%{outfile}"] 65 + # end 66 + 67 + # file extensions 68 + # conf.exts do |exts| 69 + # exts.object = '.o' 70 + # exts.executable = '' # '.exe' if Windows 71 + # exts.library = '.a' 72 + # end 73 + conf.exts.library = '.a' 74 + 75 + # file separator 76 + # conf.file_separator = '/' 77 + 78 + # Turn on `enable_debug` for better debugging 79 + # conf.enable_debug 80 + conf.enable_bintest 81 + conf.enable_test 82 + end
+22
tic_mruby_wasm_build_config.rb
··· 1 + MRuby::Toolchain.new('emscripten') do |conf| 2 + toolchain :clang 3 + 4 + conf.cc.command = 'emcc' 5 + conf.cxx.command = 'emcc' 6 + conf.linker.command = 'emcc' 7 + conf.archiver.command = 'emar' 8 + end 9 + 10 + MRuby::CrossBuild.new('wasm') do |conf| 11 + toolchain :emscripten 12 + 13 + # include the GEM box 14 + conf.gembox File.expand_path('tic', File.dirname(__FILE__)) 15 + 16 + conf.cc do |cc| 17 + cc.flags = [ENV['CFLAGS'] || %w()] 18 + end 19 + 20 + conf.enable_bintest 21 + conf.enable_test 22 + end