Walnut icon indicating copy to clipboard operation
Walnut copied to clipboard

Add basic Linux+CMake support!

Open valerioformato opened this issue 2 years ago • 11 comments

This PR adds support for building Walnut under Linux using CMake. The build configuration follows very closely the premake one.

On the Walnut side the only thing missing was an entrypoint. The remaining 90% of the work was just writing the CMake build files, basically translating the premake build :)

Tested under Arch Linux, with Vulkan SDK version 1.3.224, CMake 3.24.2 Screenshot_20221029_171658

NOTE: this patch also requires a fix in the GLFW submodule, see corresponding PR in the GLFW repo

valerioformato avatar Oct 29 '22 15:10 valerioformato

Looks good -- I didn't test it. I'd take it you are using CMake because you are using CLion. That goes against Cherno conventions though as this community is using the latest Premake.

DaveAxiom avatar Nov 12 '22 07:11 DaveAxiom

hello can you please tell me how I can compile and run on a MacOS? I successfully used make to create the executable , but I these errors Glfw Error 65542: Cocoa: Vulkan instance missing VK_EXT_metal_surface extension Glfw Error 65542: Vulkan: Window surface creation extensions not found [vulkan] Error: VkResult = -7

SYBIOTE avatar Nov 12 '22 16:11 SYBIOTE

Looks good -- I didn't test it. I'd take it you are using CMake because you are using CLion. That goes against Cherno conventions though as this community is using the latest Premake.

I know premake is the standard here. I was thinking that maybe the two don't have to be mutually exclusive. I've seen projects that support multiple build systems. Of course, this comes with the additional hurdle of keeping the two build systems aligned and I woud understand if this is considered too big to be handled right now.

valerioformato avatar Nov 17 '22 15:11 valerioformato

hello can you please tell me how I can compile and run on a MacOS? I successfully used make to create the executable , but I these errors Glfw Error 65542: Cocoa: Vulkan instance missing VK_EXT_metal_surface extension Glfw Error 65542: Vulkan: Window surface creation extensions not found [vulkan] Error: VkResult = -7

Not sure what could be the problem but while working on this I found out that the GLFW fork used for Walnut is only tested on Windows so I had to patch it for Linux. My guess is that it should be appropriately patched for OSX as well so I suggest you start looking there. The GLFW repo comes with example/test executables that you could try to run after compiling it on your machine. If those work then I'd say that the problem is elsewhere :)

valerioformato avatar Nov 17 '22 15:11 valerioformato

got that , I had no idea this could have been the problem , thanks ill look into it and try to get it to work

SYBIOTE avatar Nov 18 '22 19:11 SYBIOTE

@valerioformato Thank you for this PR! This is exactly what I was looking for: CMake and Linux support. I'm hoping this project will become more cross-platform focused in the near future rather than just Windows.

Radagan avatar Mar 09 '23 22:03 Radagan

The CMake configuration worked giving me a successful build. Running the program gave me a window flashing on the screen and a core dump crash. I tried it.

The Premake file is unmodified and doesn't produce results on my Linux system. It'd probably be best to remove that file from this CMake Linux project branch to avoid confusion.

DaveAxiom avatar Mar 23 '23 05:03 DaveAxiom

The CMake configuration worked giving me a successful build. Running the program gave me a window flashing on the screen and a core dump crash. I tried it.

The Premake file is unmodified and doesn't produce results on my Linux system. It'd probably be best to remove that file from this CMake Linux project branch to avoid confusion.

Did you also use the patched version of GLFW as stated in the PR description? If so it would be useful to run the main app in gdb and get a stack trace.

I am not sure about removing the premake files, the hope for this PR is to be merged in, lots of people on the windows side rely on those :)

valerioformato avatar Mar 24 '23 14:03 valerioformato

Pulled this in on Windows using CLion and it worked beautifully, thank you :)

glenpierce avatar Mar 01 '24 05:03 glenpierce

This PR adds support for building Walnut under Linux using CMake.

Why not also use premake for the linux side?

learn-more avatar Mar 05 '24 08:03 learn-more

This PR adds support for building Walnut under Linux using CMake.

Why not also use premake for the linux side?

Because I have a CMake project that uses Walnut as a dependency. This way I can integrate it seamlessly.

valerioformato avatar May 14 '24 08:05 valerioformato