-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Modernize CMake #4644
Modernize CMake #4644
Conversation
(Note: normally I know we don't bother rebasing commits before landing, but in this case, I suspect it will make tracking down issues after the fact simpler; once this gets close(r) to landing, definitely consider collapsing this all into a single commit) |
Ok! |
I opened a bug with LLVM that inquires about their lack of a ClangConfigVersion.cmake |
Can you expand a bit on why these are preferred? |
I just tried this on mine, with my usual cmake invocation: and it fails quickly (for recent-trunk LLVM) with
|
@steven-johnson for now add:
to the cmake command line. That's what the bug I opened with LLVM is about. |
Yes, it's because they can be installed for end-users as-is. An example where this is necessary is with the Halide::ImageIO target that only links to PNG if it is available and only defines HALIDE_NO_PNG if it isn't. If you were to wrap it in a conditional at configure time, then the fact that we built with PNG would propagate to our users as a requirement. OTOH if we didn't build with PNG, then the resulting library wouldn't have PNG support either. This way, it does the right thing depending on our client's build environment, not ours. Another issue is with multi-config generators, like Visual Studio. If you want to do something based on the build configuration (ie. Debug or Release) only generator expressions are correct. Ultimately, I have found fewer "gotchas" with generator expressions and since they're terser anyway, I think they're all around better to use when you can. |
Now I get about halfway thru the build, then fail with
|
7e11d4c
to
769b611
Compare
769b611
to
4d2dc2f
Compare
In anticipation of halide/Halide#4644 landing, we need better CMake coverage on our buildbots. This refactors to: - Pull all the CMake support for building Halide into a non-windows-specific chunk - Smarten up the use of CTest to more fully test everything we want to test - Hopefully streamline the code some - Use Ninja everywhere possible I'm sure this will take a few tries to get right (we'll have to take down the buildbots to try it out, so scheduling suggestions welcomed) -- offering this up for initial review and comments. (Note that I wrote this with an eye toward the code in the branch above; it's possible that it may have glitches with our current CMake code in addition to general errors...)
7aa66c5
to
8e3f665
Compare
f384708
to
0d541ad
Compare
I think this is finally ready to land, pending green |
It just occurred to me that for cuda, opencl, and d3d12, we don't need to mention them in the build files at all (with the exception of cuda_mat_mul). The runtime dlopens those if it needs them. You don't need to link the generated code against them. So it should be possible to just delete a large chunk of the generator cmake file and avoid any problems with people having libcuda installed somewhere cmake can't find it. Edit: two of the generator tests also use the cuda or opencl API directly: acquire_release and define_extern_opencl |
Handled. |
d6dae45
to
6a3bfdd
Compare
The only outstanding failure is with Halide's dgemm transB on size 64 when compiling with (say) |
6a3bfdd
to
d7034c8
Compare
In anticipation of halide/Halide#4644 landing, we need better CMake coverage on our buildbots. This refactors to: - Pull all the CMake support for building Halide into a non-windows-specific chunk - Smarten up the use of CTest to more fully test everything we want to test - Hopefully streamline the code some - Use Ninja everywhere possible
This PR overhauls the CMake build to use modern features and improve our ability to be used/included by other projects. Note that a recent version of CMake (3.16+) is now required.
New features:
find_package(Halide)
to use Halide.add_subdirectory
our root. This also works with FetchContent, which automates cloning a git repo and downloading it to the build dir.Changes outside CMake:
doc/CMakeLists.txt
. There is no more Doxyfile.tests/
folder must now obey the following rules:a. Print "Success!" upon success unless it is an error or warning test.
b. Print a message beginning with "[SKIP]" if the test will not run for some reason (e.g. no GPU).
Breaking changes:
halide.cmake
and its associated functions are gone.Fixes #870
Fixes #2400
Fixes #2643
Fixes #2821
Fixes #2852
Fixes #2942
Fixes #3658
Fixes #4009
Fixes #4284
Fixes #4476
Fixes #4581
Fixes #4890
Fixes #4893
Fixes #4895
Fixes #4943
Fixes #4948