mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-04-22 06:02:04 +02:00
Build with Ruby 2.7
This commit is contained in:
parent
36e8c285c5
commit
1bb8ef48f4
2 changed files with 14 additions and 7 deletions
|
@ -73,9 +73,15 @@ void raiseRbExc(const Exception &exc);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef OLD_RUBY
|
#ifndef OLD_RUBY
|
||||||
|
#if RUBYCOMPAT < 270
|
||||||
#define DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, Free) \
|
#define DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, Free) \
|
||||||
rb_data_type_t Klass##Type = { \
|
rb_data_type_t Klass##Type = { \
|
||||||
Name, {0, Free, 0, {0, 0}}, 0, 0, DEF_TYPE_FLAGS}
|
Name, {0, Free, 0, {0, 0}}, 0, 0, DEF_TYPE_FLAGS}
|
||||||
|
#else
|
||||||
|
#define DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, Free) \
|
||||||
|
rb_data_type_t Klass##Type = { \
|
||||||
|
Name, {0, Free, 0, 0, 0}, 0, 0, DEF_TYPE_FLAGS}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define DEF_TYPE_CUSTOMFREE(Klass, Free) \
|
#define DEF_TYPE_CUSTOMFREE(Klass, Free) \
|
||||||
DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, #Klass, Free)
|
DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, #Klass, Free)
|
||||||
|
@ -172,14 +178,13 @@ getPrivateDataCheck(VALUE self, const rb_data_type_t &type)
|
||||||
getPrivateDataCheck(VALUE self, const char *type)
|
getPrivateDataCheck(VALUE self, const char *type)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifndef OLD_RUBY
|
#ifdef OLD_RUBY
|
||||||
void *obj = Check_TypedStruct(self, &type);
|
|
||||||
#else // RGSS1 works in a more permissive way than the above,
|
|
||||||
// See the function at ram:10012AB0 in RGSS104E for an example
|
|
||||||
// This isn't an exact replica, but should have pretty much the same
|
|
||||||
// result
|
|
||||||
rb_check_type(self, T_DATA);
|
rb_check_type(self, T_DATA);
|
||||||
VALUE otherObj = rb_const_get(rb_cObject, rb_intern(type));
|
VALUE otherObj = rb_const_get(rb_cObject, rb_intern(type));
|
||||||
|
#else
|
||||||
|
Check_TypedStruct(self, &type);
|
||||||
|
VALUE otherObj = rb_const_get(rb_cObject, rb_intern(type.wrap_struct_name));
|
||||||
|
#endif
|
||||||
const char *ownname, *othername;
|
const char *ownname, *othername;
|
||||||
if (!rb_obj_is_kind_of(self, otherObj)) {
|
if (!rb_obj_is_kind_of(self, otherObj)) {
|
||||||
ownname = rb_obj_classname(self);
|
ownname = rb_obj_classname(self);
|
||||||
|
@ -188,7 +193,6 @@ getPrivateDataCheck(VALUE self, const char *type)
|
||||||
}
|
}
|
||||||
void *obj = DATA_PTR(self);
|
void *obj = DATA_PTR(self);
|
||||||
|
|
||||||
#endif
|
|
||||||
return static_cast<C *>(obj);
|
return static_cast<C *>(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,9 @@ if get_option('mri_includes') == ''
|
||||||
if ver.version_compare('>1.8') == false
|
if ver.version_compare('>1.8') == false
|
||||||
add_project_arguments('-DOLD_RUBY', language: ['cpp','objc','objcpp'])
|
add_project_arguments('-DOLD_RUBY', language: ['cpp','objc','objcpp'])
|
||||||
endif
|
endif
|
||||||
|
if ver.version_compare('>=2.7') == true
|
||||||
|
add_project_arguments('-DRUBYCOMPAT=270', language: ['cpp', 'objc', 'objcpp'])
|
||||||
|
endif
|
||||||
global_dependencies += dependency('ruby-' + ver)
|
global_dependencies += dependency('ruby-' + ver)
|
||||||
else
|
else
|
||||||
global_args += ('-I' + get_option('mri_includes'))
|
global_args += ('-I' + get_option('mri_includes'))
|
||||||
|
|
Loading…
Add table
Reference in a new issue