You're a complete lifesaver. I haven't jumped into CMake until recently and it really feels like a black box. Makefiles were much simpler to use, but oh well. It takes time to learn all of this.
@KeaSigmaDelta11 ай бұрын
You're welcome
@dcdfm18bf18 Жыл бұрын
Amazing! you solved a week of struggling that no one else could fix! Thanks sooo much!!
@KeaSigmaDelta Жыл бұрын
Glad it was helpful.
@killacam297111 ай бұрын
Ugh thank you sir. Spent 2 days dealing with vcpkg issues and of course there's a much more simple way 😅. Much appreciated!
@KeaSigmaDelta11 ай бұрын
You're welcome.
@Mikey-gs1dx4 ай бұрын
Same
@Artistic_Nyungu6 ай бұрын
Huge thanks... A little something for the algorithm. I hope more people can find you. This was very helpful
@KeaSigmaDelta6 ай бұрын
Thanks. I'm glad that this helped you.
@stevenbroshar7948Ай бұрын
I'm struggling to learn CMake. I have questions about why you did certain things. Thanks in advance for your time. 1) Since you used ${PROJECT_NAME} for add_executable(), apparently CMake allows a target to have the same name as a project, but that confuses me since now two different things have the same name, and the target_link_libraries() looks like it's associating raylib with the project, but I guess it's associating it with the target that happens to have the same name as the project. Why do it that way? 2) The project fetches raylib which I assume includes compiled code (either a static or dynamic/shared lib) since you don't reference raylib source files. Where exactly will the lib file be such that the build will find it?
@KeaSigmaDeltaАй бұрын
1) It makes sense for the project and the main/only executable to have the same name. The project is there to build the app, so why try to be creative and give the project and app different names? Target_link_libraries() is linking raylib to the target executable. 2) CMake will download and build Raylib in a subdirectory of the build directory. You can take a peek inside the build directory to see all the files that it creates.
@kevinmarques93343 ай бұрын
life saver, thanks! Now the next problem is to fix the LSP of my editor hahaha
@KeaSigmaDelta3 ай бұрын
You're welcome.
@rodrigozaldivaralanis6985 ай бұрын
Thanks a lot, dude. This really helped me out
@KeaSigmaDelta5 ай бұрын
You're welcome. I'm glad it's helped you.
@adeolaibigbemi86122 ай бұрын
Thanks
@KeaSigmaDelta2 ай бұрын
You're welcome.
@Mikey-gs1dx4 ай бұрын
Excellent! TY!!
@KeaSigmaDelta4 ай бұрын
Glad it was helpful!
@N.G.Dreamer3 ай бұрын
Hi Sir, I want to set window icon. Would you share how to set an icon on game window?
@KeaSigmaDelta3 ай бұрын
For which OS/platform? If you're asking for Windows, then you need to add a resource file that sets IDI_ICON1 to your game's chosen icon. This will set the game exe's icon, which is used in multiple places, including the Window. I couldn't find a full tutorial, but here is an example in brief: www.aloneguid.uk/posts/2021/11/cmake-app-icon/
@N.G.Dreamer3 ай бұрын
@@KeaSigmaDelta Sir, Thank you for your reply. I am trying with the windows version for now. I followed your instructions. It sets an icon for the exe file and displayed icons on terminal window. But it doesn't show icons on the game window opened by InitWindow function from raylib.h. The raylib tutorial states SetWindowIcon function sets icon, but it doesn't work when I try with cmake while it's working correctly without cmake in visual studio 2022. If you would help me, I would really appreciate it. Thanks again.
@KeaSigmaDelta3 ай бұрын
Strange that Raylib won't use the icon you set in the resource. I didn't realize that. Anyway, for SetWindowIcon() you need to make sure that the icon is in the right format. I tried loading an icon file and got the following error: INFO: FILEIO: [Scarfy.ico] File loaded successfully WARNING: IMAGE: Data format not supported WARNING: IMAGE: Failed to load image data WARNING: GLFW: Window icon image must be in R8G8B8A8 pixel format Note the last warning. When I converted the icon to an RGBA32 PNG, then it worked.
@N.G.Dreamer3 ай бұрын
@@KeaSigmaDelta Thank you so much sir. It works for me. It shows icons on the game window and taskbar on windows 11. But I have another problem. It doesn't show icon on macOS. This is the last problem. Would you help me once more? Thanks a million.
@KeaSigmaDelta3 ай бұрын
@@N.G.Dreamer Looking at the source code, I think you're out of luck on MacOS X. Here's the relevant snippet from raylib/src/external/glfw/src /cocoa_window.m: void _glfwSetWindowIconCocoa(_GLFWwindow* window, int count, const GLFWimage* images) { _glfwInputError(GLFW_FEATURE_UNAVAILABLE, "Cocoa: Regular windows do not have icons on macOS"); }
@imxande69306 ай бұрын
thank you so much for the video, works perfectly, a question is how do you go about finding the correct URL for these libraries? I tried to do the same for ImGui and I get a 404 error code when fetching it.
@KeaSigmaDelta6 ай бұрын
I cover this in The CMake Tutorial (cmaketutorial.com/). For GitHub, visit the project you want in a web-browser, and choose the branch or tag that you want to fetch. Now click on the green "Code" button, and you'll see a "Download ZIP" menu item at the bottom of the drop-down. You can copy the URL from there.
@imxande69306 ай бұрын
@@KeaSigmaDelta thank you so much for such a fast a thoughtful replay, I will check it out thank you so much!
@bklan989910 күн бұрын
Shot in the dark: let’s say I’m using a static library as a wrapper for another 3rd party library. This static library will have a dependency on SDL. My application links against this static library, but Im finding that the application ends up having the same dependencies, making my separate wrapper library useless . Is there a way to get around that dependency, to where the application only needs to link against the library, and the dependencies of that static library are invisible to the application?
@KeaSigmaDelta7 күн бұрын
If you use CMake's FetchContent, then using the wrapper static library, should automatically pull in and build SDL2. An alternative approach is to include SDL2 in your static wrapper library's repository. This technique is used a fair bit, but can get messy if a project uses both your wrapper and another library that also depends on SDL2.
@bklan98996 күн бұрын
@ thanks so much for replying, my issue turned out to be improper encapsulation, and some the SDL headers were being exposed to the client of the wrapper library, which will (now obviously) cause linker issues. Everyone mentions fetch content though, seems like something I should get my head around.
@accountprincipale2293 Жыл бұрын
how can i do this with multiple files(i.e. having a main.cpp and a window.cpp etc) i tried everything but everytime it says "undefined reference to `InitWindow'" and other function names
@KeaSigmaDelta Жыл бұрын
I have a video on compiling multiple files: kzbin.info/www/bejne/fHe7dKSBgrqNbbs It sounds like you either: - Need to write a window.h header file with prototypes for InitWindow() and other functions (and then #include "window.h" in main.cpp) - Or, need to add #include "window.h" in main.cpp