diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Rakefile | 33 | ||||
-rw-r--r-- | ruby_build_config.rb | 8 | ||||
-rw-r--r-- | ruby_build_config.rb.lock | 4 | ||||
-rw-r--r-- | src/rotation_3d.cpp | 2 |
5 files changed, 45 insertions, 3 deletions
@@ -1,4 +1,5 @@ candy_gear +candy_gear.exe doc pkg @@ -15,6 +15,12 @@ require 'rake/clean' require 'rake/loaders/makefile' +OS = if RUBY_PLATFORM == "x64-mingw32" + :windows +else + :linux +end + OBJ = 'candy_gear' VERSION = '0.1.0' @@ -48,9 +54,20 @@ LIBRARIES = [ 'SDL2_image', 'SDL2_mixer', 'm', - 'vulkan', 'yaml-cpp' ] +case OS +when :windows + LIBRARIES.concat([ + 'SDL2main', + 'mingw32', + 'vulkan-1.dll' + ]) +when :linux + LIBRARIES.concat([ + 'vulkan' + ]) +end CLEAN.include( FileList[ @@ -72,7 +89,10 @@ end # inside the engine to ensure all versions of the engine have precisely the # same features. file MRUBY_STATIC_LIB => ["mruby-#{MRUBY_VERSION}"] do - Dir.chdir("mruby-#{MRUBY_VERSION}") { `rake` } + Dir.chdir("mruby-#{MRUBY_VERSION}") do + ENV['MRUBY_CONFIG'] = '../ruby_build_config.rb' + `rake` + end end task :doc do @@ -109,7 +129,14 @@ end task build: CPP_OBJS + SPV_FILES + [MRUBY_STATIC_LIB] do libs = LIBRARIES.inject('') {_1 + "-l#{_2} "} - system("g++ -o #{OBJ} #{CPP_OBJS} #{MRUBY_STATIC_LIB} #{libs}") + flags = '' + case OS + when :windows + flags = '-w -Wl,-subsystem,windows' + when :linux + end + + system("g++ -o #{OBJ} #{CPP_OBJS} #{MRUBY_STATIC_LIB} #{flags} #{libs}") end task install: :build do diff --git a/ruby_build_config.rb b/ruby_build_config.rb new file mode 100644 index 0000000..3818f6e --- /dev/null +++ b/ruby_build_config.rb @@ -0,0 +1,8 @@ +MRuby::Build.new do |conf| + conf.toolchain + + conf.gembox 'default-no-stdio' + + conf.enable_bintest + conf.enable_test +end diff --git a/ruby_build_config.rb.lock b/ruby_build_config.rb.lock new file mode 100644 index 0000000..0b289fd --- /dev/null +++ b/ruby_build_config.rb.lock @@ -0,0 +1,4 @@ +--- +mruby: + version: 3.1.0 + release_no: 30100 diff --git a/src/rotation_3d.cpp b/src/rotation_3d.cpp index db0ce5a..0795859 100644 --- a/src/rotation_3d.cpp +++ b/src/rotation_3d.cpp @@ -14,6 +14,8 @@ * limitations under the License. */ +#define _USE_MATH_DEFINES + #include "rotation_3d.hpp" #include "vector_3d.hpp" |