-
Notifications
You must be signed in to change notification settings - Fork 81
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
Allow building macOS client with Makefiles/Ninja #1611
Conversation
ec7390f
to
72e3295
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It makes sense and looks good to me, just some formatting nitpicks.
if(CMAKE_Metal_FLAGS_ENV_INIT) | ||
set(CMAKE_Metal_COMPILER_ARG1 "${CMAKE_Metal_FLAGS_ENV_INIT}" CACHE STRING "Arguments to the Metal compiler") | ||
endif() | ||
if(NOT EXISTS ${CMAKE_Metal_COMPILER_INIT}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if ${CMAKE_Metal_COMPILER_INIT}
should be quoted?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
None of the other language support files built-in to CMake seem to quote the CMAKE_whatever_COMPILER_INIT
stuff when they test it 🤷🏼♂️
It should be a filepath to a compiler executable, as I understand it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason it should probably be quoted is without the quotes, CMake generally just inserts the contents of the variable directly into the if command. This means if you have a semicolon, CMake starts thinking about lists, and if you have a space, you've begun a new argument to the if command. If the variable is quoted, then none of that applies, and CMake will just test if the path exists.
Welcome to the world of CMake's idiosyncrasies.
@Hoikas The 5 new CMake files are from my https://github.com/dpogue/CMake-MetalShaderSupport project, and are based on files used internally by CMake for language detection/support (and the inconsistent formatting that CMake uses internally). If we feel strongly about the code style here, I can update them, but I'd like to also make those changes in my "upstream" repo to keep things consistent for updating/diffing. I didn't see a good way to bring these over without just copying them, and I don't think it's worth the hassle of another git submodule for them. |
0324899
to
7ce9730
Compare
I pulled this down, checked the Xcode output, and built. Looks good to me. |
This removes the strict requirement to use the Xcode project generator, but still requires the Xcode build tools (and specifically the Metal compiler) to be installed. I expect that our official stance will always be that the Xcode project generator is the recommended and supported way to do macOS builds, but any day I don't have to launch Xcode is a good day.
I believe I've resolved all the formatting concerns in the CMake scripts now |
This removes the strict requirement to use the Xcode project generator, but still requires the Xcode build tools (and specifically the Metal compiler) to be installed. With these changes, I was able to build and launch plClient.app locally with a Makefile build, and it rendered as expected (so I'm assuming the Metal shaders are working).
I expect that our official stance will always be that the Xcode project generator is the recommended and supported way to do macOS builds, but any day I don't have to launch Xcode is a good day.
Note: the new CMake files came from https://github.com/dpogue/CMake-MetalShaderSupport