Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic Linux+CMake support! #31

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

valerioformato
Copy link

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

@DaveAxiom
Copy link

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.

@SYBIOTE
Copy link

SYBIOTE commented Nov 12, 2022

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

@valerioformato
Copy link
Author

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
Copy link
Author

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 :)

@SYBIOTE
Copy link

SYBIOTE commented Nov 18, 2022

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

@Radagan
Copy link

Radagan commented Mar 9, 2023

@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.

@DaveAxiom
Copy link

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.

@valerioformato
Copy link
Author

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 :)

@glenpierce
Copy link

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

@learn-more
Copy link

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

Why not also use premake for the linux side?

@valerioformato
Copy link
Author

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.

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.

6 participants