openglonmetal / MGL

OpenGL 4.6 on Metal
Apache License 2.0
769 stars 30 forks source link

being able to compile - almost out of the box.. feedback about my troubles with Xcode #54

Open designerfuzzi opened 2 years ago

designerfuzzi commented 2 years ago

it might be of use for someone also doing a first compile attempt following the steps in Build.md

When doing so with Xcode.. step by step as written

in Build.md is something written to compile glm first. That left me confused, i was searching for a folder according to the text to compile before i start. Turns out glm seems to be MGL which is the project target.. so i assumed glm==MGL and hmm i was right, i hope. But first the other 3 issues found..

#include "spirv.h" was missing. so i dropped that file into the workspace MGL>SPIRV>SPIRV-Cross> folder making a reference for Xcode. Same for ... #include "spirv_cross_c.h"

and short before the compilation would succeed it failed with missing symbols .. following the error message the symbol for spvtools::val::RayTracingPass(... was missing.. which can only happen when the cpp file is not compiled at that stage. turns out the function spv_result_t RayTracingPass(...) resides in validate_ray_tracing.cpp that had to be dropped manually to workspace MGL>SPIRV>SPIRV-Tools> and of course checkmarked for being part of the MGL target.

from there it compiled like a charm. Now sipping coffee and testing.. cheers

designerfuzzi commented 2 years ago

testing. tiny trouble shoot.. after fixing all developer ID issues via setting all libraries (MGL & GLFW) to Sign to run locally in Build Settings (in other words erasing/replacing the ID of the repository creator) they properly compile.

doing all this on a Xcode with 10.14.6 i had to switch all related library projects to compile for 10.14 first (both MGL & GLFW) to be able to run test_mgl_glfw (same for this test application) which then runs obviously as intended pretty well. Searching for some OpenGL framework linked - kidding! Of course i did not find such link.. exciting..

i thought i will be showerd with error messages, but nooo - amazing work. Really good!

r58Playz commented 2 years ago

it might be of use for someone also doing a first compile attempt following the steps in Build.md

When doing so with Xcode.. step by step as written

in Build.md is something written to compile glm first. That left me confused, i was searching for a folder according to the text to compile before i start. Turns out glm seems to be MGL which is the project target.. so i assumed glm==MGL and hmm i was right, i hope. But first the other 3 issues found..

#include "spirv.h" was missing. so i dropped that file into the workspace MGL>SPIRV>SPIRV-Cross> folder making a reference for Xcode. Same for ... #include "spirv_cross_c.h"

and short before the compilation would succeed it failed with missing symbols .. following the error message the symbol for spvtools::val::RayTracingPass(... was missing.. which can only happen when the cpp file is not compiled at that stage. turns out the function spv_result_t RayTracingPass(...) resides in validate_ray_tracing.cpp that had to be dropped manually to workspace MGL>SPIRV>SPIRV-Tools> and of course checkmarked for being part of the MGL target.

from there it compiled like a charm. Now sipping coffee and testing.. cheers

Ah the build instructions in the README are outdated. BUILD.md does not mention glm.

Updated instructions from BUILD.md:

Open the xcodeproj and build any of:

  • MGL: produces libMGL.dylib
  • GLFW: produces libMGL.dylib and a patched GLFW that uses MGL.
  • test_mgl_glfw: runs the tests

If you get errors such as No account for team "..." open the affected target and in the Signing and Capabilities tab select the correct team. If there is no Signing and Capabilities tab open Build Settings, search for "signing", and select the correct team in Development Team.