Closed gamecubate closed 1 year ago
Builds fine on my linux box with latest master version of Janet and jpm.
Building / installation worked for me for a x86_64 Linux environment as well as for Windows 10.
I used janet 4b7b285a and jpm bdf5999a.
I don't have a macos environment to test with unfortunately.
On a side note, because jaylib is currently listed in pkgs.janet
, I think one can use the following more convenient invocation:
jpm install jaylib
The problem here is the use of a label (case SHADER_UNIFORM_FLOAT
) immediately before a declaration (float valueFloat = (float) janet_getnumber(argv, 2);
). This is not valid C99 or Objective-C apparently (see this comment on Stack Overflow). I'm not sure why this is an error on macOS but not the other platforms (although maybe related to -ObjC
C flag in project.janet
?).
In any case, you can solve the problem like so:
switch (uniformType) {
case SHADER_UNIFORM_FLOAT:
{
float valueFloat = (float) janet_getnumber(argv, 2);
SetShaderValue(*shader, locIndex, (const void*) &valueFloat, uniformType);
break;
}
case SHADER_UNIFORM_INT:
{
int valueInt = janet_getinteger(argv, 2);
SetShaderValue(*shader, locIndex, (const void*) &valueInt, uniformType);
break;
}
case SHADER_UNIFORM_VEC2:
{
Vector2 valueVec2 = jaylib_getvec2(argv, 2);
SetShaderValue(*shader, locIndex, (const void*) &valueVec2, uniformType);
break;
}
case SHADER_UNIFORM_VEC3:
{
Vector3 valueVec3 = jaylib_getvec3(argv, 2);
SetShaderValue(*shader, locIndex, (const void*) &valueVec3, uniformType);
break;
}
case SHADER_UNIFORM_VEC4:
{
Vector4 valueVec4 = jaylib_getvec4(argv, 2);
SetShaderValue(*shader, locIndex, (const void*) &valueVec4, uniformType);
break;
}
default:
janet_panicf("unknown uniform type %d", uniformType);
break;
}
@pyrmont Thanks ! Build succeeds albeit with a few warnings and 4 failed tests. I will look into the jaylib-specific warnings and submit a PR shortly.
[jaylib (master *)]$ jpm clean ; jpm build
Deleted build directory build/
compiling src/main.c to build/src___main.o...
compiling raylib/src/rcore.c to build/raylib___src___rcore.o...
compiling raylib/src/rmodels.c to build/raylib___src___rmodels.o...
compiling raylib/src/raudio.c to build/raylib___src___raudio.o...
compiling raylib/src/rglfw.c to build/raylib___src___rglfw.o...
compiling raylib/src/rshapes.c to build/raylib___src___rshapes.o...
compiling raylib/src/rtext.c to build/raylib___src___rtext.o...
compiling raylib/src/rtextures.c to build/raylib___src___rtextures.o...
compiling raylib/src/utils.c to build/raylib___src___utils.o...
generating meta file build/jaylib.meta.janet...
In file included from src/main.c:13:
src/3d.h:453:59: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
ModelAnimation *anims = LoadModelAnimations(fileName, &animCount);
^~~~~~~~~~
raylib/src/raylib.h:1488:79: note: passing argument to parameter 'animCount' here
RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, unsigned int *animCount); // Load model animations from file
^
compiling raylib/src/utils.c to build/raylib___src___utils.static.o...
compiling raylib/src/rshapes.c to build/raylib___src___rshapes.static.o...
1 warning generated.
compiling src/main.c to build/src___main.static.o...
In file included from raylib/src/raudio.c:256:
raylib/src/external/jar_xm.h:521:9: warning: 'ALIGN' macro redefined [-Wmacro-redefined]
#define ALIGN(x, b) (((x) + ((b) - 1)) & ~((b) - 1))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/param.h:85:9: note: previous definition is here
#define ALIGN(p) __DARWIN_ALIGN(p)
^
raylib/src/raudio.c:1290:45: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
qoaplay_desc *ctxQoa = qoaplay_open(fileName);
^~~~~~~~
raylib/src/external/qoaplay.c:86:34: note: passing argument to parameter 'path' here
qoaplay_desc *qoaplay_open(char *path)
^
In file included from src/main.c:13:
src/3d.h:453:59: warning: passing 'int *' to parameter of type 'unsigned int *' converts between pointers to integer types with different sign [-Wpointer-sign]
ModelAnimation *anims = LoadModelAnimations(fileName, &animCount);
^~~~~~~~~~
raylib/src/raylib.h:1488:79: note: passing argument to parameter 'animCount' here
RLAPI ModelAnimation *LoadModelAnimations(const char *fileName, unsigned int *animCount); // Load model animations from file
^
compiling raylib/src/rtext.c to build/raylib___src___rtext.static.o...
1 warning generated.
compiling raylib/src/rcore.c to build/raylib___src___rcore.static.o...
compiling raylib/src/rglfw.c to build/raylib___src___rglfw.static.o...
compiling raylib/src/rtextures.c to build/raylib___src___rtextures.static.o...
compiling raylib/src/rmodels.c to build/raylib___src___rmodels.static.o...
2 warnings generated.
creating native module build/jaylib.so...
compiling raylib/src/raudio.c to build/raylib___src___raudio.static.o...
ld: warning: -undefined dynamic_lookup may not work with chained fixups
In file included from raylib/src/raudio.c:256:
raylib/src/external/jar_xm.h:521:9: warning: 'ALIGN' macro redefined [-Wmacro-redefined]
#define ALIGN(x, b) (((x) + ((b) - 1)) & ~((b) - 1))
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/i386/param.h:85:9: note: previous definition is here
#define ALIGN(p) __DARWIN_ALIGN(p)
^
raylib/src/raudio.c:1290:45: warning: passing 'const char *' to parameter of type 'char *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
qoaplay_desc *ctxQoa = qoaplay_open(fileName);
^~~~~~~~
raylib/src/external/qoaplay.c:86:34: note: passing argument to parameter 'path' here
qoaplay_desc *qoaplay_open(char *path)
^
2 warnings generated.
creating static library build/jaylib.a...
PR submitted.
This can be closed.
What version of janet was jaylib last successfully built for?
Build attempts for janet 1.29.1-meson and raylib 4.5.0 (installed with brew) fail (macos 13.0.1).