Skip to content

add raylib wrap #2016

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
20 changes: 20 additions & 0 deletions ci_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -1118,6 +1118,26 @@
"quickjs-ng:examples=enabled"
]
},
"raylib": {
"alpine_packages": [
"libxi-dev",
"libxkbcommon-dev",
"mesa-dev",
"wayland-dev"
],
"debian_packages": [
"libxi-dev",
"libxkbcommon-dev",
"libxrandr-dev",
"libwayland-dev",
"libwayland-bin",
"libegl-dev",
"libgl-dev"
],
"build_options": [
"raylib:examples=true"
]
},
"rdkafka": {
"_comment": "- broken CI finds bad version of OpenSSL on Windows",
"build_options": [
Expand Down
8 changes: 8 additions & 0 deletions releases.json
Original file line number Diff line number Diff line change
Expand Up @@ -3275,6 +3275,14 @@
"1.1.0-1"
]
},
"raylib": {
"dependency_names": [
"raylib"
],
"versions": [
"5.5-1"
]
},
"rdkafka": {
"dependency_names": [
"rdkafka",
Expand Down
261 changes: 261 additions & 0 deletions subprojects/packagefiles/raylib/examples/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,261 @@
examples_list = {
'core': [
'core/core_2d_camera',
'core/core_2d_camera_mouse_zoom',
'core/core_2d_camera_platformer',
'core/core_2d_camera_split_screen',
'core/core_3d_camera_first_person',
'core/core_3d_camera_free',
'core/core_3d_camera_mode',
'core/core_3d_camera_split_screen',
'core/core_3d_picking',
'core/core_automation_events',
'core/core_basic_screen_manager',
'core/core_basic_window',
'core/core_basic_window_web',
'core/core_custom_frame_control',
'core/core_custom_logging',
'core/core_drop_files',
'core/core_input_gamepad',
'core/core_input_gamepad_info',
'core/core_input_gestures',
'core/core_input_gestures_web',
'core/core_input_keys',
'core/core_input_mouse',
'core/core_input_mouse_wheel',
'core/core_input_multitouch',
'core/core_input_virtual_controls',
'core/core_loading_thread',
'core/core_random_sequence',
'core/core_random_values',
'core/core_scissor_test',
'core/core_smooth_pixelperfect',
'core/core_storage_values',
'core/core_vr_simulator',
'core/core_window_flags',
'core/core_window_letterbox',
'core/core_window_should_close',
'core/core_world_screen',
],
'shapes': [
'shapes/shapes_basic_shapes',
'shapes/shapes_bouncing_ball',
'shapes/shapes_collision_area',
'shapes/shapes_colors_palette',
'shapes/shapes_draw_circle_sector',
'shapes/shapes_draw_rectangle_rounded',
'shapes/shapes_draw_ring',
'shapes/shapes_easings_ball_anim',
'shapes/shapes_easings_box_anim',
'shapes/shapes_easings_rectangle_array',
'shapes/shapes_following_eyes',
'shapes/shapes_lines_bezier',
'shapes/shapes_logo_raylib',
'shapes/shapes_logo_raylib_anim',
'shapes/shapes_rectangle_scaling',
'shapes/shapes_splines_drawing',
'shapes/shapes_top_down_lights',
'shapes/shapes_rectangle_advanced',
],
'textures': [
'textures/textures_background_scrolling',
'textures/textures_blend_modes',
'textures/textures_bunnymark',
'textures/textures_draw_tiled',
'textures/textures_fog_of_war',
'textures/textures_gif_player',
'textures/textures_image_channel',
'textures/textures_image_drawing',
'textures/textures_image_generation',
'textures/textures_image_kernel',
'textures/textures_image_loading',
'textures/textures_image_processing',
'textures/textures_image_rotate',
'textures/textures_image_text',
'textures/textures_logo_raylib',
'textures/textures_mouse_painting',
'textures/textures_npatch_drawing',
'textures/textures_particles_blending',
'textures/textures_polygon',
'textures/textures_raw_data',
'textures/textures_sprite_anim',
'textures/textures_sprite_button',
'textures/textures_sprite_explosion',
'textures/textures_srcrec_dstrec',
'textures/textures_textured_curve',
'textures/textures_to_image',
],
'text': [
'text/text_codepoints_loading',
'text/text_draw_3d',
'text/text_font_filters',
'text/text_font_loading',
'text/text_font_sdf',
'text/text_font_spritefont',
'text/text_format_text',
'text/text_input_box',
'text/text_raylib_fonts',
'text/text_rectangle_bounds',
'text/text_unicode',
'text/text_writing_anim',
],
'models': [
'models/models_animation',
'models/models_billboard',
'models/models_bone_socket',
'models/models_box_collisions',
'models/models_cubicmap',
'models/models_draw_cube_texture',
'models/models_first_person_maze',
'models/models_geometric_shapes',
'models/models_heightmap',
'models/models_loading',
'models/models_loading_gltf',
'models/models_loading_m3d',
'models/models_loading_vox',
'models/models_mesh_generation',
'models/models_mesh_picking',
'models/models_orthographic_projection',
'models/models_point_rendering',
'models/models_rlgl_solar_system',
'models/models_skybox',
'models/models_waving_cubes',
'models/models_yaw_pitch_roll',
'models/models_gpu_skinning',
],
'shaders': [
'shaders/shaders_basic_lighting',
'shaders/shaders_basic_pbr',
'shaders/shaders_custom_uniform',
'shaders/shaders_deferred_render',
'shaders/shaders_eratosthenes',
'shaders/shaders_fog',
'shaders/shaders_hot_reloading',
'shaders/shaders_hybrid_render',
'shaders/shaders_julia_set',
'shaders/shaders_lightmap',
'shaders/shaders_mesh_instancing',
'shaders/shaders_model_shader',
'shaders/shaders_multi_sample2d',
'shaders/shaders_palette_switch',
'shaders/shaders_postprocessing',
'shaders/shaders_raymarching',
'shaders/shaders_shadowmap',
'shaders/shaders_shapes_textures',
'shaders/shaders_simple_mask',
'shaders/shaders_spotlight',
'shaders/shaders_texture_drawing',
'shaders/shaders_texture_outline',
'shaders/shaders_texture_tiling',
'shaders/shaders_texture_waves',
'shaders/shaders_write_depth',
'shaders/shaders_vertex_displacement',
],
'audio': [
'audio/audio_mixed_processor',
'audio/audio_module_playing',
'audio/audio_music_stream',
'audio/audio_raw_stream',
'audio/audio_sound_loading',
'audio/audio_sound_multi',
'audio/audio_stream_effects',
],
'others': [
'others/easings_testbed',
'others/embedded_files_loading',
'others/raylib_opengl_interop',
'others/raymath_vector_angle',
'others/rlgl_compute_shader',
],
}

uses_raygui_incorrectly = [
'shapes/shapes_draw_circle_sector',
'shapes/shapes_draw_rectangle_rounded',
'shapes/shapes_draw_ring',
'shapes/shapes_splines_drawing',
]

example_compile_args = []

if target_platform == 'GLFW' or target_platform == 'SDL' or target_platform == 'RGFW'
example_compile_args += '-DPLATFORM_DESKTOP'
endif

fs = import('fs')

# Detect if compiling in an MSYS2-based MinGW/Clang environment
host_is_msys2 = host_machine.system() == 'windows' and cc.get_argument_syntax() == 'gcc'

foreach category, files : examples_list

example_inc_dirs = []

if category == 'others'
example_inc_dirs += include_directories('others/external/include')
endif


foreach file : files
basename = fs.name(file)

specific_compile_args = []

if host_machine.system() == 'windows' and not host_is_msys2
# detect wrong dllimport / dllexport declarations and therefore wrong build or public compile arguments
if file in uses_raygui_incorrectly
#some files use ragui, and that also uses the same defines (USE_LIBTYPE_SHARED and BUILD_LIBTYPE_SHARED) as raylib, so it clashes here, this needs to be removed, after upstream fixes this!
specific_compile_args += '/wd4273'
else
specific_compile_args += '/we4273'
endif
endif


# this example is not supported on windows
if file == 'core/core_loading_thread' and host_machine.system() == 'windows'
continue
endif

if file == 'others/raylib_opengl_interop'
#this is needed, as this example doesn't include glad correctly
specific_compile_args += '-DGLAD_GLAPI_EXPORT'
#this is needed, as the hard copy of glad.h inside the examples/external folderincorrectly uses 'WIN32' instead of '_WIN32' as detection for windows
if host_machine.system() == 'windows'
specific_compile_args += '-DWIN32'
endif
endif


executable(
f'@category@ @basename@',
files(f'@file@.c'),
include_directories: example_inc_dirs,
dependencies: [raylib_dep],
c_args: example_compile_args + specific_compile_args,
)
endforeach
endforeach



# this example is special, therefore it is outside of the loop

#only avaibale if target_platform == GLFW
if target_platform == 'GLFW'
special_compile_args = example_compile_args

if host_machine.system() == 'windows' and not host_is_msys2
# detect wrong dllimport / dllexport declarations and therefore wrong build or public compile arguments
special_compile_args += '/we4273'
endif

executable(
'others rlgl_standalone',
files('others/rlgl_standalone.c'),
include_directories: include_directories('others/external/include'),
dependencies: _do_not_use_internal_glfw_dep,
c_args: special_compile_args,
)

endif
94 changes: 94 additions & 0 deletions subprojects/packagefiles/raylib/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
project(
'raylib',
'c',
version: '5.5',
license: 'zlib',
default_options: ['c_std=none'],
meson_version: '>=1.1.0',
)

# get all available options
platform = get_option('platform')

glfw_build_wayland = get_option('glfw_build_wayland')
glfw_build_x11 = get_option('glfw_build_x11')

forced_opengl_version = get_option('opengl_version')
use_external_glfw = get_option('use_external_glfw')

# resolve target platform
target_platform = platform

if platform == 'Desktop'
target_platform = 'GLFW'
endif

# Define raylib graphics api depending on selected platform
if target_platform == 'GLFW' or target_platform == 'RGFW' or target_platform == 'SDL'
graphics = 'OpenGL 3.3'
if forced_opengl_version != 'off'
graphics = f'OpenGL @forced_opengl_version@'
endif
elif target_platform == 'DRM' or target_platform == 'Web' or target_platform == 'Android'
graphics = 'OpenGL ES 2.0'
endif


graphics_define = 'GRAPHICS_API_' + graphics.replace('.', '').underscorify().to_upper()

target_platform_define = 'PLATFORM_' + target_platform.underscorify().to_upper()

if target_platform == 'GLFW' or target_platform == 'SDL' or target_platform == 'RGFW'
target_platform_define = 'PLATFORM_DESKTOP_' + target_platform.underscorify().to_upper()
endif

compile_args = [f'-D@target_platform_define@', f'-D@graphics_define@']
private_compile_args = []

cc = meson.get_compiler('c')

compile_args += cc.get_supported_arguments('-fno-strict-aliasing')

is_shared_lib = get_option('default_library') == 'shared'

if is_shared_lib
private_compile_args += '-DBUILD_LIBTYPE_SHARED'
compile_args += '-DUSE_LIBTYPE_SHARED'
endif


if target_platform == 'DRM'
# without EGL_NO_X11 eglplatform.h tears Xlib.h in which tears X.h in
# which contains a conflicting type Font
compile_args += '-DEGL_NO_X11'
endif

deps = []
src_files = []
inc_dirs = []

subdir('src')

raylib = library(
'raylib',
src_files,
include_directories: inc_dirs,
c_args: private_compile_args + compile_args,
dependencies: deps,
install: true,
version: meson.project_version(),
gnu_symbol_visibility: 'hidden',
)

raylib_dep = declare_dependency(
link_with: raylib,
dependencies: deps,
include_directories: inc_dirs,
compile_args: compile_args,
)

meson.override_dependency('raylib', raylib_dep)

if get_option('examples')
subdir('examples')
endif
Loading
Loading