Skip to content
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

build.zig: Clean up my mess #4387

Merged
merged 1 commit into from
Oct 18, 2024
Merged

build.zig: Clean up my mess #4387

merged 1 commit into from
Oct 18, 2024

Conversation

sagehane
Copy link
Contributor

I am absolutely dumb and cannot make proper PRs. I'll make this a draft until someone can tell me it works.

Context:
#4380 (comment)

@raysan5
Copy link
Owner

raysan5 commented Oct 16, 2024

@Not-Nik Please, could you take a look at this build.zig improvement?

@Not-Nik
Copy link
Contributor

Not-Nik commented Oct 16, 2024

Both plain build (zig build) and raylib-zig build (as a .zon dependency) work on my MacBook 👍

@sagehane sagehane marked this pull request as ready for review October 17, 2024 02:57
@Yerdun
Copy link

Yerdun commented Oct 17, 2024

@sagehane Hi, I tried using your fix; while I am able to compile raylib by running zig build directly in the repository, it is not working for me as a dependency. For some reason, srcDir() seems to repeat the dependency's directory.

Here is a log showing what happens on my machine:

/tmp/raylib-zig-dep-bug % zig build
install
└─ install raylib-zig-dep-bug
   └─ zig build-exe raylib-zig-dep-bug Debug native
      └─ WriteFile raylib.h failure
error: FileNotFound: /tmp/raylib-zig-dep-bug/raylib/raylib/src/raylib.h

Unfortunately, I do not know enough about Zig to help with fixing this problem. I apologize that I cannot do more.

If you would like to test this yourself, I have provided a repo containing this sample project here. I am using Zig version 0.12.1; my build.zig is not configured to work with 0.13.

Please let me know if there is any additional information I could provide. Thanks.

@rstefanic
Copy link

@Yerdun I have a similar repo here configured for 0.13.0. I'm just sharing it here again for more testing.

https://github.com/rstefanic/raylib-zig-build-bug

@sagehane
Copy link
Contributor Author

I knew my incompetence would get me again. @Yerdun, thanks for the feedback. You're using b.dependency unlike us two, which explains why you're hitting an error I overlooked. This is very interesting but I also honestly don't know the appropriate fix here. I don't even know if this is intended behaviour by upstream.

Regardless, I'm starting to think that the use of @src logic is misguided in the first place... I was trying to fix compile errors without having to change the logic left by the people who previously edited the src/build.zig file but it clearly isn't working. If I can't think of a good way to overcome this issue (which I doubt I will), I'll probably consider a patch that removes src/build.zig and merges the content with build.zig. I honestly don't see why two are needed anyways.

The other solution is to keep src/build.zig and let it be "broken" when compiling from src/. (But why?)

@Not-Nik
Copy link
Contributor

Not-Nik commented Oct 17, 2024

I think Ray opposed that some time ago. IIRC we first had a single build.zig and then it was split into two.

Maybe we can rename src/build.zig to avoid people building in src, because I really don't see a reason why that should be possible.

@raysan5
Copy link
Owner

raysan5 commented Oct 17, 2024

@Not-Nik Why build.zig was split into two? Wasn't src/build.zig enough, same as src/Makefile?

@sagehane
Copy link
Contributor Author

After looking at this project some more, if I'm understanding this correctly, it looks like Raygui support is currently attempted by expecting the user to have cloned the Raylib and Raygui repo with a shared parent directory. With what the Zig build system is capable of, this looks like a terrible hack. I should look into that too.

@sagehane
Copy link
Contributor Author

The config option also looks broken at a glance as attempting zig build -Dconfig="-Werror" causes a compile error but something like zig build -Dconfig="-Werror -Wall" doesn't cause a compile error. My guess is that the logic is broken such that it will only work if only 1 cflag is supplied.

@sagehane
Copy link
Contributor Author

sagehane commented Oct 18, 2024

Another weird quirk:

raylib/src/build.zig

Lines 88 to 110 in 99ff770

if (options.config.len > 0) {
const file = b.pathJoin(&.{ srcDir(b), "config.h" });
const content = try std.fs.cwd().readFileAlloc(b.allocator, file, std.math.maxInt(usize));
defer b.allocator.free(content);
var lines = std.mem.splitScalar(u8, content, '\n');
while (lines.next()) |line| {
if (!std.mem.containsAtLeast(u8, line, 1, "SUPPORT")) continue;
if (std.mem.startsWith(u8, line, "//")) continue;
if (std.mem.startsWith(u8, line, "#if")) continue;
var flag = std.mem.trimLeft(u8, line, " \t"); // Trim whitespace
flag = flag["#define ".len - 1 ..]; // Remove #define
flag = std.mem.trimLeft(u8, flag, " \t"); // Trim whitespace
flag = flag[0 .. std.mem.indexOf(u8, flag, " ") orelse continue]; // Flag is only one word, so capture till space
flag = try std.fmt.allocPrint(b.allocator, "-D{s}", .{flag}); // Prepend with -D
// If user specifies the flag skip it
if (std.mem.containsAtLeast(u8, options.config, 1, flag)) continue;
// Append default value from config.h to compile flags
try raylib_flags_arr.append(b.allocator, flag);
}

This implies that the values of config.h would not be passed as cflags if users don't specify any custom build flags.

I'm not too familiar with C but is this intended behaviour? config.h should be sourced anyways, so if cflags aren't capable of overriding them, there's no point. If cflags can override them, I don't see the need for this code.


EDIT: I see, it has to do with how EXTERNAL_CONFIG_FLAGS affect where config.h should be sourced.

@sagehane
Copy link
Contributor Author

@Yerdun, I think I figured it out. It's the logic here:

raylib/src/build.zig

Lines 89 to 90 in 99ff770

const file = b.pathJoin(&.{ srcDir(b), "config.h" });
const content = try std.fs.cwd().readFileAlloc(b.allocator, file, std.math.maxInt(usize));

readFileAlloc is agnostic of the build system so, given a relative path, it will always try that literal path.

Something like const file = b.pathFromRoot("src/config.h"); worked on my branch where I moved src/build.zig to build.zig.

/// This is low-level implementation details of the build system, not meant to
/// be called by users' build scripts. Even in the build system itself it is a
/// code smell to call this function.
pub fn pathFromRoot(b: *Build, sub_path: []const u8) []u8 {
    return b.pathResolve(&.{ b.build_root.path orelse ".", sub_path });
}

This does suggest that pathFromRoot should be avoided so I'll try to see if there's a better way.

@Not-Nik
Copy link
Contributor

Not-Nik commented Oct 18, 2024

@Not-Nik Why build.zig was split into two? Wasn't src/build.zig enough, same as src/Makefile?

The build.zig is required to enable using raylib as a dependency with Zig's package manager

@sagehane
Copy link
Contributor Author

The convention in Zig projects is to have a build.zig in the root dir. All tooling depends on build.zig at root and would be much harder for the package manager to work otherwise.

In the case of big monorepos with multiple components, one reasonable way to handle that would probably be to have a build.zig in the root of each component and have them exposed as packages to the build.zig in the root dir.

$ tree
.
├── a
│   └── build.zig
├── b
│   └── build.zig
└── build.zig

Something like this is perfectly legal and fine, but it seems overkill for the state of raylib as it seems to just be one library.

@Not-Nik
Copy link
Contributor

Not-Nik commented Oct 18, 2024

Well we also have the examples, so it does make sense to split the build file.

@sagehane
Copy link
Contributor Author

Oh, I totally didn't realise that. Then I'll also try to get this PR to a properly working state in parallel with the other one so it's easier to decide. I think it might involve using newer Zig features and hence require bumping the minimum supported version of Zig to 0.13.0, depending on how things go.

@raysan5
Copy link
Owner

raysan5 commented Oct 18, 2024

@Not-Nik @sagehane Supporting Zig 0.13.0 as the minimum version sounds good to me, it has been out for some time. When is 0.14.0 released?

An unrelated question: can I use build.zig on Windows to cross-build raylin and a C project for Linux and macOS?

@sagehane
Copy link
Contributor Author

When is 0.14.0 released?

Zig's release schedule currently is meant to match that of LLVM (usually lagging by a few months), which releases twice a year.

An unrelated question: can I use build.zig on Windows to cross-build raylin and a C project for Linux and macOS?

Cross-compiling using Zig is usually very easy. One issue for cross-compiling is that, at least on Linux, Raylib depends on libraries that are normally dynamically linked like libX11, OpenGL, Wayland, etc. I'm not quite sure how this works and it's hard for me to test on NixOS as it's not FHS-compliant, meaning all the dynamic libraries Raylib might expect aren't where they normally would be in other Linux distros.

@sagehane
Copy link
Contributor Author

sagehane commented Oct 18, 2024

So, I came up with https://github.com/sagehane/raylib/tree/zig_patch_3 for another branch with a different way of fixing build.zig. It uses some comptime magic with a new function in src/build.zig called addRaylibType to circumvent a dumb compile error I've been having when trying to use raylib with b.dependency from other projects. There must be a better way but it'll do for now.

After thinking about it, I've concluded that:

  • I think it makes more sense to remove the src/build.zig file. The one in the examples dir should stay though.
  • The addRaylib function seems misguided to me. The idiomatic way to add dependencies using the package manager should be via b.dependency like from the example repo by @Yerdun. It only makes it slightly easier to depend on Raygui.
    • It's currently useful as a helper function internal to the project, but I don't think it needs to be exposed with pub.
    • As for Raygui support, I have no idea how to test it as I've only used a small subset of what Raylib offers so far.
  • There's also a logic bug in the current src/build.zig such that it can only accept 1 cflag via -Dconfig.
    • I think it would be better to delete all the logic dedicated to trying to apply the default config.h options. Handling this alone would solve the immediate problem. The rest can technically be handled later.
      • Edit: Okay, I tried not depending on config.h and it seems to require manually setting quite a lot of values. Probably infeasible for most users.

@Yerdun
Copy link

Yerdun commented Oct 18, 2024

@rstefanic

@Yerdun I have a similar repo here configured for 0.13.0. I'm just sharing it here again for more testing.

Thanks for sharing. Can confirm I get the same results when following the instructions in your readme.


@raysan5

An unrelated question: can I use build.zig on Windows to cross-build raylin and a C project for Linux and macOS?

You should be able to. I've been using Zig as my build system specifically to cross compile. That said, I have not tried from Windows -> Linux before, only the other way around.

From my experience, it works quite well, aside from some problems specific to my use cases. For example, I can't get custom cflags to be recognized when cross compiling. I plan on looking into this more and eventually open an issue about it.


@sagehane Thanks a lot for looking into all this. I was actually going to post an issue regarding the "can only use one cflag through build.zig" problem, but you noticed it before I could say anything, haha.

My sample project was also intended to demonstrate the single cflag problem. I actually haven't checked if the program actually works yet, but after I do that, I'll try out the changes proposed in zig_patch_3 and #4393, and see how they go. Will also test if cross compilation takes into account custom cflags passed through Options.config.

@wwderw
Copy link

wwderw commented Oct 18, 2024

@Not-Nik @sagehane Supporting Zig 0.13.0 as the minimum version sounds good to me, it has been out for some time. When is 0.14.0 released?

An unrelated question: can I use build.zig on Windows to cross-build raylin and a C project for Linux and macOS?

Zig is what I use for cross compiling, but I'm on Linux, so it will be cross compiling to Windows. That may be an easier path compared to the other way around. I have not tried it for Mac, so I have no experience there. Although, while the build.zig seems to be influx, I haven't had successful builds as of yet, but normally it does work well.

@raysan5 raysan5 merged commit dc5e6e0 into raysan5:master Oct 18, 2024
14 checks passed
@raysan5
Copy link
Owner

raysan5 commented Oct 18, 2024

@sagehane @Not-Nik thanks for the review, merged!

@sagehane
Copy link
Contributor Author

I hate GitHub. It doesn't let me set a PR back to draft mode without first deleting it and making a new PR. This PR wasn't truly ready to be merged because it still resulted in a small logic error when supplying -Dconfig (which I found out after undrafting it...), not to mention that there was some broken logic there before I started looking into it.

That said, I think this commit does solve the primary/immediate compile error that users would run into.

psxdev pushed a commit to raylib4Consoles/raylib that referenced this pull request Nov 18, 2024
Qoen1 added a commit to Qoen1/raylib-cpp-group-h that referenced this pull request Dec 26, 2024
* ADDED: `isGpuReady` flag, allow font loading with no GPU acceleration

* [RCORE] Update comments on fullscreen and boderless window to describe what they do (raysan5#4280)

* Update raylib_api.* by CI

* update fullscreen and borderless comments to better describe what they do.

* Update raylib_api.* by CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* [rcore][desktop_glfw] Keeping CORE.Window.position properly in sync with glfw window position (raysan5#4190)

* WindowPosCallback added.

CORE.Window.position is now properly kept in sync with the glfw window position.

* Update rcore_desktop_glfw.c

Comments updated.

* Setting CORE.Window.position correctly in InitPlatform() as well.

This also fixes not centering the window correctly when the high dpi flag was enabled.

* Fixes centering the window in the SetWindowMonitor() function.

Here the render size has to be used again in case the high dpi flag is enabled.

* Update Window Position

Update Window Position right away in ToggleFullscreen() & ToggleBorderlessWindowed() functions

* rlgl.h: glint64 did not exist before OpenGL 3.2 (raysan5#4284)

Compilation breaks on rlgl.h for early OpenGL versions.
Glint64 did not exist on those versions (< OpenGL 3.2)

* Examples makefiles: align /usr/local with /src Makefile (raysan5#4286)

* align /usr/local with src Makefile

Align /usr/local with the /src Makefile, where it can be overriden.

* /usr/local: allow override

align /usr/local with the /src Makefile, where it can be overriden

* Update raylib.h

* ADDED: more uniform data type options raysan5#4137

* Update rlgl.h

* Update rtext.c

* [rModels] Correctly split obj meshes by material (raysan5#4285)

* Correctly split meshes from tinyobj by material so they can be represented by raylib correctly

* PR Feedback

* fix(rcore/android): Allow main() to return it its caller on configuration changes. (raysan5#4288)

* Fix missing equal sign (raysan5#4294)

I just noticed there is a missing equal sign. This PR fixes this.

* Add uConsole mapping (raysan5#4297)

* fix: In certain cases the connector status is reported UNKNOWN, should be conisdered as CONNECTED (raysan5#4305)

Co-authored-by: Michal Jaskolski <[email protected]>

* Fix seg fault with long comment lines (raysan5#4306)

raysan5#4304

* Change implicit conversion to explicit conversion to remove warning (raysan5#4308)

* fix vld1q_f16 undeclared in arm on stb_image_resize2.h v2.10 (raysan5#4309)

* Update BINDINGS.md (raysan5#4311)

I've updated the bindings

* fix for hardcoded index values in vboID array (raysan5#4312)

changing any of the #defines in CONFIG.H would cause issues when rendering.

* chore: GetApplicationDirectory definition for FreeBSD (raysan5#4318)

* [rtextures] add MixColors. a function to mix 2 colors together (raysan5#4310)

* added MixColors function to mix 2 colors together (Line 1428 raylib.h and Line 4995 in rtextures.c)

* renamed MixColors to ColorLerp (raysan5#4310 (comment))

* changed ColorLerp to be more like other functions

---------

Co-authored-by: CI <[email protected]>

* Update raylib_api.* by CI

* REVIEWED: `ColorLerp()` formatting raysan5#4310

* Update raylib_api.* by CI

* Update rtextures.c

* [rcore] Add filtering folders to `LoadDirectoryFilesEx()`/`ScanDirectoryFiles()` (raysan5#4302)

* Add filtering folders in ScanDirectoryFiles and ScanDirectoryFilesRecursively

Add define FILTER_FOLDER for that purpose
Fix folder names matching filter being added to result

* Move FILTER_FOLDER define to internals of rcore and document option in comment

* Update raylib_api.* by CI

* REVIEWED: `DrawTexturePro()` to avoid negative dest rec raysan5#4316

* REVIEWED: Directory filter tag raysan5#4323

* Reviewed raysan5#4323

* Update raylib.h

* Update raylib_api.* by CI

* [BINDINGS.md] Added raylib-bqn, moved rayed-bqn (raysan5#4331)

* [BINDINGS.md] Added raylib-bqn, moved rayed-bqn

rayed-bqn has had a lot of progress and I've realized it has diverged too much from raylib, and so I made raylib-bqn to be a simple binding, while rayed-bqn will be a utility wrapper.

* removed accidental newline

* [rmodels] Optional GPU skinning (raysan5#4321)

* Added optional GPU skinning

* Added skinned bone matrices support for different file formats.

* Moved new shader locations to end of enum to avoid breaking existing examples. Added gpu skinning on drawing of instanced meshes.

* Added GPU skinning example.

* Removed variable declaration to avoid shadowing warning.

* Update raylib_api.* by CI

* Some minor tweaks

* Fix rlgl standalone defaults (raysan5#4334)

* Projects: Fix CMake example project  (raysan5#4332)

* Update CMakeLists.txt

Add missing link flags

* Update README.md

Remove unneeded flag because this flag is defined in the updated CMakeList file

* Update CMakeLists.txt

* Update parser's readme to mirror fixed help text (raysan5#4336)

* Update BINDINGS.md (raysan5#4337)

Updated Lean4 bindings

* `LoadFontDefault()`: Initialize glyphs and recs to zero raysan5#4319

* ADDED: `MakeDirectory()`

* Update raylib_api.* by CI

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Update rcore.c

* Fix isGpuReady flag on android (raysan5#4340)

* [SHAPES] Add more detail to comment for DrawPixel (raysan5#4344)

* Update raylib_api.* by CI

* Add comment that draw pixel uses geometry and may be slow

* Update raylib_api.* by CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Fix raysan5#4349

* [MODELS] Disable GPU skinning for MacOS platform (raysan5#4348)

* Update raylib_api.* by CI

* Disable GPU skinning on MacOS
Add GPU skinning example to MSVC Projects.

* Update raylib_api.* by CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Complements the raysan5#4348 GPU skinning fix (raysan5#4352)

* Fixes GetClipboardText() memory leak for PLATFORM_DESKTOP_SDL (raysan5#4354)

* [MODELS] Better fix for GPU skinning issues (raysan5#4353)

* Make the max VBO match the animation flag.

* re-enable GPU skinning for mac, and fix the max buffer to be correct based on the GPU skinning support flag.

* [rlgl] Fix rlgl standalone defaults (raysan5#4357)

* Fix rlgl standalone defaults

* Fix rmodels

* Typo fix (raysan5#4356)

Seemed to be a typo. Hope this helps.

* Allow Zig build script to change desktop backend (raysan5#4358)

* [build] CMake: Fix GRAPHICS check (raysan5#4359)

* updated camera speeds with GetFrameTime (raysan5#4362)

* taken from FluxFlus PR (raysan5#4363)

* Fix raysan5#4355

* [example] Input virtual controls example (raysan5#4342)

* Add files via upload

* Update core_input_gamepad_virtual.c

* Add files via upload

* Update and rename core_input_gamepad_virtual.c to core_virtual_Dpad.c

* Update and rename core_virtual_Dpad.c to core_input_virtual_controls.c

* Delete examples/core/core_input_gamepad_virtual.png

* Add files via upload

* Update Makefile

* Update Makefile.Web

* Update README.md

* Update README.md

* Create core_input_virtual_controls.vcxproj

* Delete projects/VS2022/examples/core_input_virtual_controls.vcxproj

* [zig] Fix build.zig bug (raysan5#4366)

* fixed zig config.h bug

* zig fmt

* removed old comment (raysan5#4370)

* Update CHANGELOG

* updated makefile to disable wayland by default (raysan5#4369)

* Update RGFW  (raysan5#4372)

* (rcore_desktop_rgfw.c) fix errors when compiling with mingw

* define WideCharToMultiByte

* update RGFW

* move stdcall def to windows only

* fix raw cursor input

* Removed tabs and triple line-breaks

* Some update to gltf loading (raysan5#4373)

Only warns when there are more animations than currently implemented
Allows mesh indices to be unsigned char

* Fix build.zig (raysan5#4374)

* build.zig: Improve logic (raysan5#4375)

* build.zig: Fix `@src` logic

* build.zig: Clarify build error

* build.zig: Add option for enabling `raygui`

* build.zig: Expose `Options` type

* `WARNING`: REMOVED: SVG files loading and drawing, moving it to raylib-extras

* REMOVED: `LoadImageSvg()`

* Update raylib_api.* by CI

* Update BINDINGS.md (raysan5#4378)

* build.zig: Fix `@src` logic and a few things (raysan5#4380)

* REVIEWED: `CodepointToUTF8()`, clean static buffer raysan5#4379

* build.zig: Very minor fixes (raysan5#4381)

* Fix the type mismatch caused due to unsupported `?[]const u8` (raysan5#4383)

Co-authored-by: Yuval Herman <[email protected]>

* qoi: Added support for image of channels 3 (raysan5#4384)

* Fix rectangle width and height check to account for squares (raysan5#4382)

* ADDED: Utility functions: `ComputeCRC32()` and `ComputeMD5()`

* Update raylib_api.* by CI

* WARNING: BREAKING: Renamed several functions for data validation raysan5#3930

* Update raylib_api.* by CI

* Fix raysan5#4388 (raysan5#4392)

* Fix VSCode Makefile to support multiple .c files (raysan5#4391)

Updated the VSCode Makefile to allow compilation of multiple .c files instead of just one (main.c).
- Replaced `SRC` and `OBJS` definitions to dynamically include all .c and .h files in the project.
- This change enables automatic handling of any number of source files specifically in the VSCode setup.

* [rcore] added sha1 implementation (raysan5#4390)

* added sha1 implementation

* added missing part

* fixed issue

* fix to match other implementations

* Update raylib_api.* by CI

* build.zig: Clean up my mess (raysan5#4387)

* [rl_gputex] Correctly load mipmaps from DDS files (raysan5#4399)

* correction of comments (raysan5#4400)

The indication of locations for bone ids and bone weights did not correspond to their default values ​​in config.h

* build.zig: Fix various issues around `-Dconfig` (raysan5#4398)

* build.zig: Fix various issues around `-Dconfig`

* build.zig: Parse all relevant flags from `src/config.h` at comptime

* Adds MaximizeWindow() and RestoreWindow() implementation for PLATFORM_WEB (raysan5#4397)

* [rtextures] ImageDraw(): Don't try to blend images without alpha (raysan5#4395)

* removed extra update command (raysan5#4401)

* [rcore] [web] Updates `SetWindowState()` and `ClearWindowState()` to handle `FLAG_WINDOW_MAXIMIZED` for `PLATFORM_WEB` (raysan5#4402)

* Updates SetWindowState() and ClearWindowState() to handle FLAG_WINDOW_MAXIMIZED for PLATFORM_WEB

* Update MaximizeWindow() and RestoreWindow() to set/unset the FLAG_WINDOW_MAXIMIZED

* Fix MaximizeWindow() for PLATFORM_WEB (raysan5#4404)

* Adds SetWindowOpacity() implementation for PLATFORM_WEB (raysan5#4403)

* build.zig: Merge `src/build.zig` to `build.zig` (raysan5#4393)

* build.zig: Move `src/build.zig` to `build.zig`

* build.zig: Remove uses of `@src`

* build.zig: Update entry point

* [Raymath] Add C++ operator overloads for common math function (raysan5#4385)

* Update raylib_api.* by CI

* Add math operators for C++ to raymath

* better #define for disabling C++ operators

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* REVIEWED: Formatting and raymath version raysan5#4385

* Updated instanced rendering support loading (raysan5#4408)

* Reviewed formatting raysan5#4408

* Removed trailing spaces

* Update raymath.h

* [Raymath] Add matrix operators to raymath for C++ (raysan5#4409)

* Add matrix operators to raymath for C++

* Fix spaces

* REVIEWED: `GetGestureHoldDuration()` comments

* Update raylib_api.* by CI

* [rcore] Adds implementation to `SetGamepadVibration()` on `PLATFORM_WEB` and updates it on `PLATFORM_DESKTOP_SDL` to handle duration (raysan5#4410)

* Updates SetGamepadVibration()

* Handle MAX_GAMEPAD_VIBRATION_TIME

* Revert low/high parameters back to left/rightMotor

* Fix missin semicolon

* Convert duration to seconds

* Add SetGamepadVibration() implementation to PLATFORM_WEB

* Update raylib_api.* by CI

* moved update out of draw area (raysan5#4413)

* REVIEWED: skinning shader for GLSL 100 raysan5#4412

* build.zig: Better specify Linux dependencies (raysan5#4406)

* Simplify EmscriptenResizeCallback() (raysan5#4415)

* build.zig: Re-add OpenGL to Linux deps (raysan5#4417)

* build.zig: Fix a minor issue with `-Dconfig` (raysan5#4418)

* Reviewed skinning shaders raysan5#4412

* Update config.h

* Update raylib.h

* Update raylib_api.* by CI

* Update core_input_gamepad example (raysan5#4416)

* [rcore] Fix raysan5#4405 (raysan5#4420)

* Fix raysan5#4405 at runtime

* Add parameter validation

* Remove default global deadzone

* [examples] Add deadzone handling to `core_input_gamepad` example (raysan5#4422)

* Add deadzone handling to core_input_gamepad example

* Rename variables

* Grammar fix in CONTRIBUTING.md (raysan5#4423)

"Can you write some tutorial/example?"
"Can you write some tutorials/examples?"

* Fix typo in rshapes.c (raysan5#4421)

* Add drawing for generic gamepad on core_input_gamepad example (raysan5#4424)

* Update skinning.fs

* Reviewed and reverted unneeded module check, `rtextures` should not depend on `rtext`

* ADDED: CHANGELOG for raylib 5.5 -WIP-

* Update CHANGELOG

* Update Makefile

* Update Makefile

* [RTEXTURES] Remove the panorama cubemap layout option (raysan5#4425)

* Remove the panorama cubemap layout, it was not implemented.
Left a todo in the code for some aspiring developer to finish.

* Update raylib_api.* by CI

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>

* Update HISTORY.md

* Update CHANGELOG

* Update raylib.h

* Update raylib_api.* by CI

* Update CHANGELOG

* Update raylib.h

* Update Makefile

* Update raylib_api.* by CI

* Update raylib.h

* Update raylib_api.* by CI

* REVIEWED: GPU skninning on Web, some gotchas! raysan5#4412

* Update rlgl.h

* REVIEWED: `UpdateModelAnimationBoneMatrices()` comments

* Update raylib_api.* by CI

* Update emsdk paths to latest versions

* [rshapes] Review `DrawRectangleLines()` pixel offset (raysan5#4261)

* [rshapes] Remove `DrawRectangleLines()`'s + 1 offset

* ... and replace it with a -/+ 0.5 offset divided by current cam's zoom.

* REVIEWED: `DrawRectangleLines()`, considering view matrix for lines "alignment"

* Use free camera in model shader example (raysan5#4428)

* Add shadow map example to MSVC projects (raysan5#4430)

* Use the vertex color as part of the base shader in GLSL330 (raysan5#4431)

* Add input_virtual_controls to MSVC projects (raysan5#4433)

Fix input_virtual_controls example to use correct default font sizes

* [build] CMake: Don't build for wayland by default (raysan5#4432)

This is to align with the behavior of raysan5#4369, see raysan5#4371 for rationale on
disabling Wayland by default.

* [build] [web] Fix examples `Makefile` for `PLATFORM_WEB` (raysan5#4434)

* Fix examples Makefile for PLATFORM_WEB

* Replace shell with assignment operator

* Replace tab with spaces

* Update Makefile.Web

* REVIEWED: WebGL2 (OpenGL ES 3.0) backend flags (PLATFORM_WEB) raysan5#4330

* Minor format tweaks

* Use mingw32-make for Windows (raysan5#4436)

* [rtextures/rlgl] Load mipmaps for cubemaps (raysan5#4429)

* [rlgl] Load cubemap mipmaps

* [rtextures] Only generate mipmaps that don't already exist

* [rtextures] ImageDraw(): Implement drawing to mipmaps

* [rtextures] Load cubemap mipmaps

* Reviewed formating to follow raylib conventions raysan5#4429

* Reviewed formatting, remove end-line points, for consistency with comments

* Update cgltf.h

* Update dr_mp3.h

* Update dr_wav.h

* Update qoa.h

* Update stb_image.h

* Update stb_image_resize2.h

* Update stb_truetype.h

* Fix examples Makefile for NetBSD (raysan5#4438)

* fix makefile

* moving to LDPATHS

* fix clean and ldlibs stuff

* Update Makefile

* REVIEWED: `LoadTextureCubemap()` to avoid crash raysan5#4429

* fix (raysan5#4440)

* [rtextures] LoadTextureCubemap(): Copy image before generating mipmaps, to avoid dangling re-allocated pointers (raysan5#4439)

* Fix MSVC errors for PLATFORM_DESKTOP_RGFW (raysan5#4441)

* (rcore_desktop_rgfw.c) fix errors when compiling with mingw

* define WideCharToMultiByte

* update RGFW

* move stdcall def to windows only

* fix raw cursor input

* Fix warnings, update RGFW, fix msvc errors (make sure windows macro _WIN32 is correct)

* Fix signed/unsigned mismatch in rlgl (raysan5#4443)

* Update README.md

* Fix empty input string for MeasureTextEx (raysan5#4448)

* Fix inconsistent dll linkage warning on windows (raysan5#4447)

* Update rcore_desktop_glfw.c

* Update rtext.c

* [shapes] Add `shapes_rectangle_advanced ` example implementing a `DrawRectangleRoundedGradientH` function (raysan5#4435)

* [rshapes] Add  function

* "[shapes] rectangle advanced: fix screen width and height to fit with other examples"

* fix the issue with GetScreenWidth/GetScreenHeight that was identified on other platforms (raysan5#4451)

* Fix SetWindowSize() for PLATFORM_WEB (raysan5#4452)

* Update HISTORY.md

* Update Makefile

* Update rmodels.c - 'fix' for GenMeshSphere artifact (raysan5#4460)

When creating a new sphere mesh with high number of slices/rings the top and bottom parts of the generated sphere are removed. This happens because the triangles in those parts, due to high resolution, end up being very small and are removed as part of the 'par_shapes' library's optimization. Adding par_shapes_set_epsilon_degenerate_sphere(0.0); before generating the sphere mesh sets the threshold for removal of small triangles is removed and the sphere is returned to raylib correctly.

* Added last week commits info

* RENAMED: `UpdateModelAnimationBoneMatrices()` to `UpdateModelAnimationBones()`

Still, not fully convinced of those functions naming, despite quite descriptive, sounds a bit confusing to me...

* Update raylib_api.* by CI

* Fix for issue 4454, MatrixDecompose() gave incorrect output for certain combinations of scale and rotation (raysan5#4461)

* Update CHANGELOG

* implemented new linear gradient generation function (raysan5#4462)

* Update Makefile.Web

* Update core_2d_camera_mouse_zoom.c

* fix float casting warnings (raysan5#4471)

* UpdateModelAnimation speedup (raysan5#4470)

If we borrow from the GPU skinned animation code, we can just multiply the vertex by the matrix * weight and shave a chunk of CPU time.

* Improve cross-compilation with zig builds (raysan5#4468)

- Add xcode_frameworks when cross compiling for mac (ref:
https://github.com/hexops/mach/blob/main/build.zig)
- Add emsdk when cross compiling for wasm (ref:
https://github.com/floooh/sokol-zig/blob/master/build.zig)

Signed-off-by: Tomas Slusny <[email protected]>

* [rcore]  Clipboard Image Support  (raysan5#4459)

* [rcore] add 'GetClipboardImage' for windows

* [rcore] GetClipboardImage removed some unneeded defines

* [rcore] PLATFORM_SDL: create a compatility layer for SDL3

* external: add win32_clipboard.h header only lib

* [rcore] using win32_clipboard on platforms rlfw and rgfw

* [rcore] fix warnings in SDL3 compatibility layer

* Makefile: Allow specifying SDL_LIBRARIES to link, this helps with SDL3

* Makefile: examples makefile now compile others/rlgl_standalone only when TARGET_PLATFORM is PLATFORM_DESKTOP_GFLW

* Makefile: examples makefile now compile others/rlgl_standalone only when TARGET_PLATFORM is PLATFORM_DESKTOP_GFLW

* [rcore]: PLATFORM_SDL: improve clipboard data retrieval

* external: remove unused function from win32_clipboard.h

* Makefile: allow for extra flags necessary when compiling for SDL3

* [rcore]: fix string typo

* [rcore]: Properly handle NULL dpi passing. As is allowed in SDL2

* external: fix arch finding on win32_clipboard.h to allow compilation on msvc cmake CI

* [rcore]: PLATFORM_SDL: Treat monitor as an ID in SDL3 as opposed to an index as in SDL2

* [rcore]: typo

* Update raylib_api.* by CI

* build.zig: Remove addRaylib and fix raygui builds when using raylib as dep (raysan5#4475)

- addRaylib just duplicates what adding raylib as dependency already does
  so it do not needs to exist
- move raygui build to standard build process when flag is enabled. this
  works correctly when using raylib as dependency and having raygui as
  dependency as well. problem with previous approach was that raygui was in
  options but it was doing nothing because you had to also use addRaygui for
  it to be effective

Signed-off-by: Tomas Slusny <[email protected]>

* Improved logos size

* Fix the X axis of the second vertex of the Y negative cap of a cylinders, triangle fan (raysan5#4478)

* Fix a typecast warning in glfw clipboard access (raysan5#4479)

* [rcore]: Issue an warning instead of an error when checking SUPPORT_CLIPBOARD_IMAGE necessary support detection (raysan5#4477)

* Fix the example lighting shaders to use both frag and diffuse colors so they work with shapes and meshes. (raysan5#4482)

* Update CHANGELOG

* build.zig: remove raygui from options and re add adding raygui as a (raysan5#4485)

function

* Fix Makefile.Web (raysan5#4487)

* Update CHANGELOG

* Update HISTORY.md

* Update CHANGELOG

* Fix touch count reset (raysan5#4488)

* Update raygui.h

* Updated Notepad++ autocomplete list for raylib 5.5

* Commented code issuing warnings on w64devkit (GCC)

Tested with w64devkit/MSVC and all seem to work as expected

* Updated raylib resource data

* Update raylib.ico

* Update emsdk path on Windows to match new raylib installer package

* Fix warnings in examples (raysan5#4492)

Move shapes/shapes_rectangle_advanced to the correct folder in MSVC project
Add core_input_virtual_controls.vcxproj back into sln file

* Fix typo in BINDINGS.md (raysan5#4493)

* Fixing an OBJ loader bug that fragmented the loaded meshes (raysan5#4494)

The nextShapeEnd integer is a pointer in the OBJ data structures.
The faceVertIndex is a vertex index counter for the mesh we are
about to create. Both integers are not compatible, which causes
the code to finish the meshes too early, thus writing the OBJ data
incompletely into the target meshes.

It wasn't noticed because for the last mesh, it process all remaining
data, causing the last mesh to contain all remaining triangles.

This would have been noticed if the OBJ meshes used different textures
for each mesh.

* Update CHANGELOG

* Update HISTORY.md

* Thanks @everyone for everything 😄

* Update HISTORY.md

* Update core_basic_window.c

* Update raylib.h

* Update raylib_api.* by CI

* Update webassembly.yml

* Update HISTORY.md

* removed workflows

* merge master

---------

Signed-off-by: Tomas Slusny <[email protected]>
Co-authored-by: Ray <[email protected]>
Co-authored-by: Jeffery Myers <[email protected]>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dave Green <[email protected]>
Co-authored-by: Tchan0 <[email protected]>
Co-authored-by: Hesham Abourgheba <[email protected]>
Co-authored-by: hanaxars <[email protected]>
Co-authored-by: carverdamien <[email protected]>
Co-authored-by: Michał Jaskólski <[email protected]>
Co-authored-by: Michal Jaskolski <[email protected]>
Co-authored-by: Chris Warren-Smith <[email protected]>
Co-authored-by: masnm <[email protected]>
Co-authored-by: Alex <[email protected]>
Co-authored-by: Jett <[email protected]>
Co-authored-by: base <[email protected]>
Co-authored-by: SusgUY446 <[email protected]>
Co-authored-by: CI <[email protected]>
Co-authored-by: foxblock <[email protected]>
Co-authored-by: Brian E <[email protected]>
Co-authored-by: Daniel Holden <[email protected]>
Co-authored-by: Asdqwe <[email protected]>
Co-authored-by: Ridge3Dproductions <[email protected]>
Co-authored-by: Daniil Kisel <[email protected]>
Co-authored-by: Menno van der Graaf <[email protected]>
Co-authored-by: Ashley Chekhov <[email protected]>
Co-authored-by: Nikolas <[email protected]>
Co-authored-by: Kacper Zybała <[email protected]>
Co-authored-by: Anthony Carbajal <[email protected]>
Co-authored-by: Magnus Oblerion <[email protected]>
Co-authored-by: Visen <[email protected]>
Co-authored-by: Colleague Riley <[email protected]>
Co-authored-by: Harald Scheirich <[email protected]>
Co-authored-by: William Culver <[email protected]>
Co-authored-by: Sage Hane <[email protected]>
Co-authored-by: Anand Swaroop <[email protected]>
Co-authored-by: yuval_dev <[email protected]>
Co-authored-by: Yuval Herman <[email protected]>
Co-authored-by: R-YaTian <[email protected]>
Co-authored-by: Jojaby <[email protected]>
Co-authored-by: Alan Arrecis <[email protected]>
Co-authored-by: Le Juez Victor <[email protected]>
Co-authored-by: Rapha <[email protected]>
Co-authored-by: Cypress <[email protected]>
Co-authored-by: Franz <[email protected]>
Co-authored-by: RadsammyT <[email protected]>
Co-authored-by: IcyLeave6109 <[email protected]>
Co-authored-by: Peter0x44 <[email protected]>
Co-authored-by: NishiOwO <[email protected]>
Co-authored-by: mpv-enjoyer <[email protected]>
Co-authored-by: Everton Jr. <[email protected]>
Co-authored-by: Arche Washi <[email protected]>
Co-authored-by: MikiZX1 <[email protected]>
Co-authored-by: waveydave <[email protected]>
Co-authored-by: decromo <[email protected]>
Co-authored-by: Tomas Slusny <[email protected]>
Co-authored-by: kimierik <[email protected]>
Co-authored-by: Oussama Teyib <[email protected]>
Co-authored-by: Eike Decker <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants