sfml3-rb 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.md +14 -0
- data/README.md +110 -0
- data/ext/circle.c +198 -0
- data/ext/clock.c +65 -0
- data/ext/color.c +43 -0
- data/ext/drawable.c +39 -0
- data/ext/event.c +148 -0
- data/ext/event_name.c +45 -0
- data/ext/exceptions.c +44 -0
- data/ext/ext/exceptions.h +16 -0
- data/ext/ext/klass/clock.h +12 -0
- data/ext/ext/klass/color.h +26 -0
- data/ext/ext/klass/drawable/circle.h +12 -0
- data/ext/ext/klass/drawable/image.h +4 -0
- data/ext/ext/klass/drawable/polygon.h +4 -0
- data/ext/ext/klass/drawable/rectangle.h +4 -0
- data/ext/ext/klass/drawable/sprite.h +4 -0
- data/ext/ext/klass/drawable/texture.h +4 -0
- data/ext/ext/klass/event/event_name.h +8 -0
- data/ext/ext/klass/event.h +12 -0
- data/ext/ext/klass/keyboard.h +8 -0
- data/ext/ext/klass/render_state.h +16 -0
- data/ext/ext/klass/target.h +18 -0
- data/ext/ext/klass/transform.h +17 -0
- data/ext/ext/klass/transformable.h +13 -0
- data/ext/ext/klass/video_mode.h +12 -0
- data/ext/ext/klass/view.h +14 -0
- data/ext/ext/klass/window.h +12 -0
- data/ext/ext/module/drawable/drawable.h +10 -0
- data/ext/ext/module/transform.h +18 -0
- data/ext/ext/module.h +10 -0
- data/ext/ext/rect.h +16 -0
- data/ext/ext/sfml.h +16 -0
- data/ext/ext/style_name.h +11 -0
- data/ext/ext/vec2.h +38 -0
- data/ext/ext.c +47 -0
- data/ext/extconf.rb +84 -0
- data/ext/image.c +5 -0
- data/ext/keyboard.c +135 -0
- data/ext/polygon.c +5 -0
- data/ext/ports.rb +368 -0
- data/ext/rect.c +26 -0
- data/ext/rectangle.c +5 -0
- data/ext/render_state.c +109 -0
- data/ext/sprite.c +5 -0
- data/ext/style_name.c +15 -0
- data/ext/target.c +106 -0
- data/ext/texture.c +5 -0
- data/ext/transform.c +107 -0
- data/ext/transformable.c +145 -0
- data/ext/vec2.c +42 -0
- data/ext/video_mode.c +78 -0
- data/ext/view.c +170 -0
- data/ext/window.c +274 -0
- data/lib/sfml/version.rb +3 -0
- data/lib/sfml.rb +9 -0
- metadata +104 -0
data/ext/exceptions.c
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#include "ext/exceptions.h"
|
|
2
|
+
|
|
3
|
+
#define MSG_LENGTH 86
|
|
4
|
+
|
|
5
|
+
void raise_invalid_argument_type(const char *type) {
|
|
6
|
+
char msg[MSG_LENGTH];
|
|
7
|
+
|
|
8
|
+
sprintf(msg, "invalid argument, expected a %s object", type);
|
|
9
|
+
|
|
10
|
+
rb_raise(rb_eArgError, "%s", msg);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
void raise_invalid_argument_class(VALUE rb_cKlass) {
|
|
14
|
+
raise_invalid_argument_type(RSTRING_PTR(rb_funcall(rb_cKlass, rb_intern("name"), 0)));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
void raise_invalid_arguments_excepted(int expected, size_t given) {
|
|
18
|
+
char msg[MSG_LENGTH];
|
|
19
|
+
|
|
20
|
+
if (expected > 0) {
|
|
21
|
+
sprintf(msg, "wrong number of arguments (given %lu, expected %i)", given, expected);
|
|
22
|
+
} else {
|
|
23
|
+
sprintf(msg, "wrong number of arguments (given %lu)", given);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
rb_raise(rb_eArgError, "%s", msg);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void raise_invalid_array_length(size_t length) {
|
|
31
|
+
char msg[MSG_LENGTH];
|
|
32
|
+
|
|
33
|
+
sprintf(msg, "invalid array length, expected length of %lu", length);
|
|
34
|
+
|
|
35
|
+
rb_raise(rb_eArgError, "%s", msg);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
void raise_method_no_implemented(const char *method) {
|
|
39
|
+
if (strlen(method) == 0) {
|
|
40
|
+
rb_raise(rb_eArgError, "%s", "method no implemented");
|
|
41
|
+
} else {
|
|
42
|
+
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef SFML_RB_EXCEPTIONS_H
|
|
2
|
+
#define SFML_RB_EXCEPTIONS_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
void raise_invalid_argument_type(const char *type);
|
|
7
|
+
|
|
8
|
+
void raise_invalid_argument_class(VALUE rb_cKlass);
|
|
9
|
+
|
|
10
|
+
void raise_invalid_arguments_excepted(int expected, size_t given);
|
|
11
|
+
|
|
12
|
+
void raise_invalid_array_length(size_t length);
|
|
13
|
+
|
|
14
|
+
void raise_method_no_implemented(const char *method);
|
|
15
|
+
|
|
16
|
+
#endif //SFML_RB_EXCEPTIONS_H
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#ifndef SFML_RB_COLOR_H
|
|
2
|
+
#define SFML_RB_COLOR_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
#include "ext/sfml.h"
|
|
7
|
+
|
|
8
|
+
#define VALID_LENGTH_COLOR 4
|
|
9
|
+
|
|
10
|
+
#define UNPACK_COLOR(c_color) (unsigned char) c_color.r, (unsigned char) c_color.g, (unsigned char) c_color.b, (unsigned char) c_color.a
|
|
11
|
+
|
|
12
|
+
#define COLOR_C2RB(c_color) color_new(c_color.r, c_color.g, c_color.b, c_color.a)
|
|
13
|
+
|
|
14
|
+
#define COLOR_RB2C(rb_arr) { NUM2INT(rb_ary_entry(rb_arr, 0)), NUM2INT(rb_ary_entry(rb_arr, 1)), NUM2INT(rb_ary_entry(rb_arr, 2)), NUM2INT(rb_ary_entry(rb_arr, 3)) }
|
|
15
|
+
|
|
16
|
+
VALUE color_new(int r, int g, int b, int a);
|
|
17
|
+
|
|
18
|
+
void color_check(VALUE rb_arr);
|
|
19
|
+
|
|
20
|
+
void color_swap(sfColor *color_a, sfColor *color_b);
|
|
21
|
+
|
|
22
|
+
sfColor color_new_from_rb(VALUE rb_arr);
|
|
23
|
+
|
|
24
|
+
VALUE color_new_from_c(sfColor color);
|
|
25
|
+
|
|
26
|
+
#endif //SFML_RB_COLOR_H
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef SFML_RB_RENDER_STATE_H
|
|
2
|
+
#define SFML_RB_RENDER_STATE_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
#define DefaultMatrix3x3() {1, 0, 0, 0, 1, 0, 0, 0, 1}
|
|
7
|
+
|
|
8
|
+
void Init_RenderState(VALUE rb_module);
|
|
9
|
+
|
|
10
|
+
void *Get_RenderState_Struct(VALUE self);
|
|
11
|
+
|
|
12
|
+
VALUE Get_Klass_RenderState(void);
|
|
13
|
+
|
|
14
|
+
VALUE Get_New_RenderState(void);
|
|
15
|
+
|
|
16
|
+
#endif //SFML_RB_RENDER_STATE_H
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#ifndef SFML_RB_TARGET_H
|
|
2
|
+
#define SFML_RB_TARGET_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
typedef struct {
|
|
7
|
+
void *window;
|
|
8
|
+
} Target;
|
|
9
|
+
|
|
10
|
+
void Init_Target(VALUE rb_module);
|
|
11
|
+
|
|
12
|
+
VALUE Get_Klass_Target(void);
|
|
13
|
+
|
|
14
|
+
void *Get_Target_Struct(VALUE self);
|
|
15
|
+
|
|
16
|
+
VALUE Get_New_Target(VALUE rb_window);
|
|
17
|
+
|
|
18
|
+
#endif //SFML_RB_TARGET_H
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#ifndef SFML_RB_TRANSFORM_H
|
|
2
|
+
#define SFML_RB_TRANSFORM_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
#define MATRIX_LENGTH 9 // 3x3
|
|
7
|
+
#define MATRIX_GL_LENGTH 16 // 4x4
|
|
8
|
+
|
|
9
|
+
static VALUE rb_cTransform;
|
|
10
|
+
|
|
11
|
+
void Init_Transform(VALUE rb_module);
|
|
12
|
+
|
|
13
|
+
void *Get_Transform_Struct(VALUE self);
|
|
14
|
+
|
|
15
|
+
VALUE To_Transform_Struct(void *ptr);
|
|
16
|
+
|
|
17
|
+
#endif //SFML_RB_TRANSFORM_H
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#ifndef SFML_RB_TRANSFORMABLE_H
|
|
2
|
+
#define SFML_RB_TRANSFORMABLE_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
void Init_Transformable(VALUE rb_module);
|
|
7
|
+
|
|
8
|
+
void *Get_Transformable_Struct(VALUE self);
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
VALUE Get_Klass_Transformable();
|
|
12
|
+
|
|
13
|
+
#endif //SFML_RB_TRANSFORMABLE_H
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#ifndef CANDY2D_EXT_VIEW_H
|
|
2
|
+
#define CANDY2D_EXT_VIEW_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
void Init_View(VALUE rb_module);
|
|
7
|
+
|
|
8
|
+
void *Get_View_Struct(VALUE self);
|
|
9
|
+
|
|
10
|
+
VALUE Get_Klass_View();
|
|
11
|
+
|
|
12
|
+
VALUE Get_Casting_View(void *ptr);
|
|
13
|
+
|
|
14
|
+
#endif //CANDY2D_EXT_VIEW_H
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#ifndef CANDY2D_EXT_TRANSFORM_H
|
|
2
|
+
#define CANDY2D_EXT_TRANSFORM_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
#include "ext/sfml.h"
|
|
7
|
+
|
|
8
|
+
#define MATRIX_LENGTH 9 // 3x3
|
|
9
|
+
|
|
10
|
+
void Init_Transform(VALUE rb_module);
|
|
11
|
+
|
|
12
|
+
VALUE Transform_MatrixToArray(float *c_matrix);
|
|
13
|
+
|
|
14
|
+
void Transform_ArrayToMatrix(VALUE rb_matrix, float *c_matrix);
|
|
15
|
+
|
|
16
|
+
void Transform_SwapMatrix(const float *c_matrix_a, float *c_matrix_b);
|
|
17
|
+
|
|
18
|
+
#endif //CANDY2D_EXT_TRANSFORM_H
|
data/ext/ext/module.h
ADDED
data/ext/ext/rect.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef SFML_RB_EXT_RECT_H
|
|
2
|
+
#define SFML_RB_EXT_RECT_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
#define RECT_UNPACK(c_rect) c_rect.position.x, c_rect.position.y, c_rect.size.x, c_rect.size.y
|
|
7
|
+
|
|
8
|
+
#define RECT_C2RB(c_rect) Rect_new(RECT_UNPACK(c_rect))
|
|
9
|
+
|
|
10
|
+
#define RECT_RB2C(rb_arr) { {NUM2DBL(rb_ary_entry(rb_arr, 0)), NUM2DBL(rb_ary_entry(rb_arr, 1))}, {NUM2DBL(rb_ary_entry(rb_arr, 2)), NUM2DBL(rb_ary_entry(rb_arr, 3))} }
|
|
11
|
+
|
|
12
|
+
VALUE Rect_new(float x, float y, float width, float height);
|
|
13
|
+
|
|
14
|
+
void Rect_check(VALUE rb_arr);
|
|
15
|
+
|
|
16
|
+
#endif //SFML_RB_EXT_RECT_H
|
data/ext/ext/sfml.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#ifndef SFML_H
|
|
2
|
+
#define SFML_H
|
|
3
|
+
|
|
4
|
+
#include <CSFML/Config.h>
|
|
5
|
+
|
|
6
|
+
#if CSFML_VERSION_MAJOR < 3
|
|
7
|
+
#error "This extension requires CSFML 3. Run `rake ports` to build it, or upgrade your system CSFML."
|
|
8
|
+
#endif
|
|
9
|
+
|
|
10
|
+
#include <CSFML/Graphics.h>
|
|
11
|
+
#include <CSFML/Window.h>
|
|
12
|
+
#include <CSFML/System.h>
|
|
13
|
+
#include <CSFML/System/Vector2.h>
|
|
14
|
+
#include <CSFML/Graphics/RenderStates.h>
|
|
15
|
+
|
|
16
|
+
#endif //SFML_H
|
data/ext/ext/vec2.h
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#ifndef SFML_RB_VEC2_H
|
|
2
|
+
#define SFML_RB_VEC2_H
|
|
3
|
+
|
|
4
|
+
#include <ruby.h>
|
|
5
|
+
|
|
6
|
+
#include "ext/sfml.h"
|
|
7
|
+
|
|
8
|
+
#define UNPACK_VEC2(c_type, c_vec) (c_type) c_vec.x, (c_type) c_vec.y
|
|
9
|
+
|
|
10
|
+
#define VEC2_C2RB(c_vec) vec2_new((float) c_vec.x, (float) c_vec.y)
|
|
11
|
+
|
|
12
|
+
#define VEC2_C2RB_T(c_type, c_vec) vec2_new((c_type) c_vec.x, (c_type) c_vec.y)
|
|
13
|
+
|
|
14
|
+
#define VEC2_RB2C(rb_arr) { NUM2DBL(rb_ary_entry(rb_arr, 0)), NUM2DBL(rb_ary_entry(rb_arr, 1)) }
|
|
15
|
+
|
|
16
|
+
#define VEC2_RB2C_T(c_type, rb_arr) { (c_type) NUM2DBL(rb_ary_entry(rb_arr, 0)), (c_type) NUM2DBL(rb_ary_entry(rb_arr, 1)) }
|
|
17
|
+
|
|
18
|
+
#define VEC2_SET_X(rb_arr, x) rb_ary_store(rb_arr, 0, DBL2NUM(x))
|
|
19
|
+
|
|
20
|
+
#define VEC2_SET_Y(rb_arr, x) rb_ary_store(rb_arr, 1, DBL2NUM(y))
|
|
21
|
+
|
|
22
|
+
#define VEC2_GET_X(rb_arr) NUM2DBL(rb_ary_entry(rb_arr, 0))
|
|
23
|
+
|
|
24
|
+
#define VEC2_GET_Y(rb_arr) NUM2DBL(rb_ary_entry(rb_arr, 1))
|
|
25
|
+
|
|
26
|
+
VALUE vec2_new(float x, float y);
|
|
27
|
+
|
|
28
|
+
void vec2_check(VALUE rb_arr);
|
|
29
|
+
|
|
30
|
+
VALUE vec2f_new_from_c(sfVector2f c_vec);
|
|
31
|
+
|
|
32
|
+
sfVector2i vec2i_new_from_ruby(VALUE rb_arr);
|
|
33
|
+
|
|
34
|
+
sfVector2u vec2u_new_from_ruby(VALUE rb_arr);
|
|
35
|
+
|
|
36
|
+
sfVector2f vec2f_new_from_ruby(VALUE rb_arr);
|
|
37
|
+
|
|
38
|
+
#endif //SFML_RB_VEC2_H
|
data/ext/ext.c
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
#include <ruby.h>
|
|
2
|
+
#include <stdio.h>
|
|
3
|
+
|
|
4
|
+
#include "ext/module.h"
|
|
5
|
+
#include "ext/module/transform.h"
|
|
6
|
+
#include "ext/module/drawable/drawable.h"
|
|
7
|
+
#include "ext/klass/color.h"
|
|
8
|
+
#include "ext/klass/transformable.h"
|
|
9
|
+
#include <ext/klass/clock.h>
|
|
10
|
+
#include <ext/klass/target.h>
|
|
11
|
+
#include "ext/klass/render_state.h"
|
|
12
|
+
#include "ext/klass/event.h"
|
|
13
|
+
#include "ext/klass/window.h"
|
|
14
|
+
#include "ext/klass/view.h"
|
|
15
|
+
#include "ext/klass/video_mode.h"
|
|
16
|
+
#include "ext/klass/drawable/circle.h"
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
// C Naming Convention:
|
|
20
|
+
//
|
|
21
|
+
// Struct TitleCase
|
|
22
|
+
// Struct Members lower_case or lowerCase
|
|
23
|
+
//
|
|
24
|
+
// Enum ETitleCase
|
|
25
|
+
// Enum Members ALL_CAPS or lowerCase
|
|
26
|
+
//
|
|
27
|
+
// Public functions pfx_TitleCase (pfx = two or three letter module prefix)
|
|
28
|
+
// Private functions TitleCase
|
|
29
|
+
// Trivial variables i,x,n,f etc...
|
|
30
|
+
// Local variables lower_case or lowerCase
|
|
31
|
+
// Global variables g_lowerCase or g_lower_case (searchable by g_ prefix)
|
|
32
|
+
|
|
33
|
+
void Init_sfml_ext(void) {
|
|
34
|
+
rb_mExt = rb_define_module("SFML");
|
|
35
|
+
|
|
36
|
+
Init_Drawable(rb_mExt);
|
|
37
|
+
Init_Transform(rb_mExt);
|
|
38
|
+
Init_Transformable(rb_mExt);
|
|
39
|
+
Init_Clock(rb_mExt);
|
|
40
|
+
Init_Target(rb_mExt);
|
|
41
|
+
Init_RenderState(rb_mExt);
|
|
42
|
+
Init_Circle(rb_mExt);
|
|
43
|
+
Init_Event(rb_mExt);
|
|
44
|
+
Init_VideoMode(rb_mExt);
|
|
45
|
+
Init_View(rb_mExt);
|
|
46
|
+
Init_Window(rb_mExt);
|
|
47
|
+
}
|
data/ext/extconf.rb
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
require 'mkmf'
|
|
2
|
+
require_relative 'ports'
|
|
3
|
+
|
|
4
|
+
# Link order matters for static archives: CSFML depends on SFML, SFML depends
|
|
5
|
+
# on FreeType, and all of them depend on the target's OS libraries. This
|
|
6
|
+
# mirrors the INTERFACE_LINK_LIBRARIES that SFML's own CMake config exports.
|
|
7
|
+
VENDORED_LIBS = %w[
|
|
8
|
+
csfml-graphics-s csfml-window-s csfml-system-s
|
|
9
|
+
sfml-graphics-s sfml-window-s sfml-system-s
|
|
10
|
+
freetype
|
|
11
|
+
].freeze
|
|
12
|
+
|
|
13
|
+
SYSTEM_CSFML_LIBS = %w[csfml-graphics csfml-window csfml-system].freeze
|
|
14
|
+
|
|
15
|
+
def use_vendored_ports
|
|
16
|
+
$INCFLAGS = "-I#{Ports.prefix}/include #{$INCFLAGS}"
|
|
17
|
+
$LDFLAGS = "#{$LDFLAGS} -L#{Ports.prefix}/lib"
|
|
18
|
+
$defs.concat(Ports.defines)
|
|
19
|
+
|
|
20
|
+
# A precompiled gem is loaded on machines that never had this toolchain, so
|
|
21
|
+
# don't make it depend on the build host's libgcc.
|
|
22
|
+
$LDFLAGS = "#{$LDFLAGS} -static-libgcc" if Ports.cross? && Ports.os != :darwin
|
|
23
|
+
|
|
24
|
+
Ports.frameworks.each { |f| $LDFLAGS = "#{$LDFLAGS} -framework #{f}" }
|
|
25
|
+
|
|
26
|
+
# The C++ runtime goes last: it has to resolve symbols left over from the
|
|
27
|
+
# static SFML archives ahead of it.
|
|
28
|
+
$libs = [
|
|
29
|
+
$libs,
|
|
30
|
+
*(VENDORED_LIBS + Ports.libs).map { |l| "-l#{l}" },
|
|
31
|
+
*Ports.cxx_runtime
|
|
32
|
+
].join(' ')
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def use_system_csfml
|
|
36
|
+
missing = SYSTEM_CSFML_LIBS.reject { |l| have_library(l) }
|
|
37
|
+
return if missing.empty?
|
|
38
|
+
|
|
39
|
+
abort <<~MSG
|
|
40
|
+
Could not find a system CSFML 3: #{missing.join(', ')}
|
|
41
|
+
|
|
42
|
+
Install CSFML 3 development files, or drop --enable-system-libraries to let
|
|
43
|
+
the gem download and build SFML 3 and CSFML 3 itself.
|
|
44
|
+
|
|
45
|
+
Note that distro packages are often still CSFML 2.x, which this extension
|
|
46
|
+
no longer supports.
|
|
47
|
+
MSG
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
# Resolution order:
|
|
51
|
+
# 1. --enable-system-libraries -> link a system CSFML 3 (offline-capable)
|
|
52
|
+
# 2. an already-built ports prefix -> reuse it (fast path for development,
|
|
53
|
+
# and the path cross builds take, since rake-compiler-dock builds the
|
|
54
|
+
# ports before invoking the extension build)
|
|
55
|
+
# 3. otherwise -> download and build FreeType, SFML 3 and CSFML 3, then link
|
|
56
|
+
if enable_config('system-libraries', ENV.fetch('SFML_USE_SYSTEM_LIBRARIES', nil))
|
|
57
|
+
use_system_csfml
|
|
58
|
+
else
|
|
59
|
+
Ports.build! unless Ports.built?
|
|
60
|
+
use_vendored_ports
|
|
61
|
+
end
|
|
62
|
+
|
|
63
|
+
# Fails at configure time with a readable message rather than letting a CSFML 2.x
|
|
64
|
+
# header produce a wall of compile errors later.
|
|
65
|
+
unless try_compile(<<~C)
|
|
66
|
+
#include <CSFML/Config.h>
|
|
67
|
+
#if CSFML_VERSION_MAJOR < 3
|
|
68
|
+
#error "CSFML 3 required"
|
|
69
|
+
#endif
|
|
70
|
+
int main(void) { return 0; }
|
|
71
|
+
C
|
|
72
|
+
abort <<~MSG
|
|
73
|
+
Could not compile against CSFML 3 headers (<CSFML/Config.h>).
|
|
74
|
+
|
|
75
|
+
Either no CSFML is installed, or the one found is CSFML 2.x. Note that CSFML
|
|
76
|
+
2.x installs its headers under SFML/ rather than CSFML/, and distro packages
|
|
77
|
+
are frequently still 2.x -- so a successful library check above does not mean
|
|
78
|
+
the version is right.
|
|
79
|
+
|
|
80
|
+
Drop --enable-system-libraries to let the gem download and build CSFML 3 itself.
|
|
81
|
+
MSG
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
create_makefile 'sfml/sfml_ext'
|