Skip to content

Add raylib.umi building#21

Open
RobLoach wants to merge 2 commits intomasterfrom
umi
Open

Add raylib.umi building#21
RobLoach wants to merge 2 commits intomasterfrom
umi

Conversation

@RobLoach
Copy link
Owner

Fixes #11

    set(CMAKE_POSITION_INDEPENDENT_CODE ON)
@RobLoach
Copy link
Owner Author

@marekmaskarinec I'm unsure of this approach. Since we're exporting the raylib functions as the same name, we end up with conflicts on the exported names. Hopefully having the export name changed with a pragma call fixes this.

I tried testing, and am getting....

  umka-test ./umka core_basic_window.um
INFO: Initializing raylib 4.2
INFO: Supported raylib modules:
INFO:     > rcore:..... loaded (mandatory)
INFO:     > rlgl:...... loaded (mandatory)
INFO:     > rshapes:... loaded (optional)
INFO:     > rtextures:. loaded (optional)
INFO:     > rtext:..... loaded (optional)
INFO:     > rmodels:... loaded (optional)
INFO:     > raudio:.... loaded (optional)
umka: raylib-src/src/external/glfw/src/window.c:163: glfwCreateWindow: Assertion `width >= 0' failed.
fish: Job 1, './umka -warn core_basic_window.…' terminated by signal SIGABRT (Abort)

So there's definitely something wrong with it.

@marekmaskarinec
Copy link

From experience, I advice against using raw bindings to functions without umka wrappers. It can save you lot of work and make the API easier to use. You can look at tophat as an example (although src/bindings.c is currently bit of a mess).

@RobLoach
Copy link
Owner Author

RobLoach commented Oct 24, 2022

Thanks! I have the Umka wrapper functions in there. umkaInitWindow wraps InitWindow, for instance. The problem is that building the .umi file, in the Umka script, if you have...

import "raylib.um"

fn main() {
  raylib.InitWindow(640, 480, "Hello")
  raylib.CloseWindow()
}

Umka will call InitWindow() instead of umkaInitWindow(). My hope is to use the compiler to rename the symbols in the .umi file.

As a side-note, I really like what you did with Tophat! Definitely going a really neat direction with it 👍

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.

Distribute as an UMI module.

2 participants