aboutsummaryrefslogtreecommitdiff
path: root/libclc/cmake
AgeCommit message (Collapse)AuthorFilesLines
2024-07-18[libclc] Revise IDE folder structure (#89746)Michael Kruse1-1/+4
Reviewers of #89153 suggested to break up the patch into per-subproject patches. This is the libclc part. See #89153 for the entire series and motivation. Update the folder titles for targets in the monorepository that have not seen taken care of for some time. These are the folders that targets are organized in Visual Studio and XCode (`set_property(TARGET <target> PROPERTY FOLDER "<title>")`) when using the respective CMake's IDE generator. * Ensure that every target is in a folder * Use a folder hierarchy with each LLVM subproject as a top-level folder * Use consistent folder names between subprojects * When using target-creating functions from AddLLVM.cmake, automatically deduce the folder. This reduces the number of `set_property`/`set_target_property`, but are still necessary when `add_custom_target`, `add_executable`, `add_library`, etc. are used. A LLVM_SUBPROJECT_TITLE definition is used for that in each subproject's root CMakeLists.txt.
2024-07-02[libclc] Fix cross in-tree builds (#97392)Harald van Dijk1-8/+8
When performing cross in-tree builds, we need native versions of various tools, we cannot assume the cross builds that are part of the current build are executable. LLVM provides the setup_host_tool function to handle this, either picking up versions of tools from LLVM_NATIVE_TOOL_DIR, or implicitly building native versions as needed. Use it for libclc too. LLVM's setup_host_tool function assumes the project is LLVM, so this also needs libclc's project() to be conditional on it being built standalone. Luckily, the only change this needs is using CMAKE_CURRENT_SOURCE_DIR instead of PROJECT_SOURCE_DIR.
2024-06-24[CMake][libclc] Improve dependencies to avoid build errors (#95018)Tim Creech1-2/+4
With the Makefile generator and particularly high build parallelism some intermediate dependencies may be generated redundantly and concurrently, leading to build failures. To fix this, arrange for libclc's add_custom_commands to depend on targets in addition to files. This follows CMake documentation's[^1] guidance on add_custom_command: > Do not list the output in more than one independent target that may > build in parallel or the instances of the rule may conflict. Instead, > use the add_custom_target() command to drive the command and make the > other targets depend on that one. Eliminating the redundant commands also improves build times. [^1]: https://cmake.org/cmake/help/v3.29/command/add_custom_command.html
2024-04-24[libclc] Use a response file when building on Windows (#89756)Fraser Cormack1-2/+17
We've recently seen the libclc llvm-link invocations become so long that they exceed the character limits on certain platforms. Using a 'response file' should solve this by offloading the list of inputs into a separate file, and using special syntax to pass it to llvm-link. Note that neither the response file nor syntax aren't specific to Windows but we restrict it to that platform regardless. We have the option of expanding it to other platforms in the future.
2024-04-22[libclc] Fix build with Unix Makefiles (#89147)Fraser Cormack1-0/+4
Commit #87622 broke the build. Ninja was happy with creating the output directories as necessary, but Unix Makefiles isn't. Ensure they are always created. Fixes #88626.
2024-04-11[libclc] Refactor build system to allow in-tree builds (#87622)Fraser Cormack9-197/+156
The previous build system was adding custom "OpenCL" and "LLVM IR" languages in CMake to build the builtin libraries. This was making it harder to build in-tree because the tool binaries needed to be present at configure time. This commit refactors the build system to use custom commands to build the bytecode files one by one, and link them all together into the final bytecode library. It also enables in-tree builds by aliasing the clang/llvm-link/etc. tool targets to internal targets, which are imported from the LLVM installation directory when building out of tree. Diffing (with llvm-diff) all of the final bytecode libraries in an out-of-tree configuration against those built using the current tip system shows no changes. Note that there are textual changes to metadata IDs which confuse regular diff, and that llvm-diff 14 and below may show false-positives. This commit also removes a file listed in one of the SOURCEs which didn't exist and which was preventing the use of ENABLE_RUNTIME_SUBNORMAL when configuring CMake.
2024-03-28[libclc] Track dependencies through dependency files (#86965)Fraser Cormack1-0/+1
This commit fixes the problem of missing build dependencies between libclc source files and their various includes (namely headers and .inc files). We would like to do this with compiler-generated dependency files because then the dependencies are accurate and there are no false positives, leading to unnecessary rebuilds. This is how regular C/C++ dependencies are usually tracked by CMake. Note that this variable is an internal API so is not guaranteed to work, but then again *all* of CMake's support for new languages (which we use for CLC/LL languages) is an internal API. On balance this change is probably worth it due to how minimally invasive it is. It should work with all supported compilers and CMake generators.
2024-03-18[libclc] Convert tabs to spaces in CMake (#85634)Fraser Cormack1-2/+2
Having a mix of tabs and spaces makes the diff of any changes to the build system noisier than necessary. This commit unifies them to two spaces. This includes some minor cosmetic changes such as with joining things on one line where appropriate. There are other files in libclc which have tabs but those haven't been touched at this time. Those could come at another time if desired, though they might be more contentious as the project isn't clang-formatted at all and so that might invite larger discussions around formatting.
2020-04-14libclc: Use temporary files rather than a pipeDaniel Stone1-1/+2
This is required for using the Ninja backend on Windows, as it passes commands directly to CreateProcess, and does not allow the shell to interpret them: https://ninja-build.org/manual.html#ref_rule_command Using the Visual Studio backend is not possible as attempting to create a static library target comprised entirely of novel languages not known to the Visual Studio backend built in to CMake's C++ source will generate nothing at all. reviewer: jvesely Differential Revision: https://reviews.llvm.org/D77165
2020-04-14libclc: Don't pass linker flags to CLC/LLAsmDaniel Stone2-2/+2
We don't want the regular linker flags for these invocations, since we're not compiling to the target machine anyway. This fixes things like '/machine:x64' being unknown when invoked under Windows. reviewer: jvesely Differential Revision: https://reviews.llvm.org/D77164
2020-04-14libclc: Use echo rather than true for try_compileDaniel Stone2-2/+2
When providing a fake compiler, libclc currently uses 'true' which does not exist on Windows. Use echo instead as the no-op. reviewer: jvesely Differential Revision: https://reviews.llvm.org/D77163
2018-11-27Add cmake build systemJan Vesely8-0/+195
Add cmake support for CLC and ll asm language, the latter includes clang preprocessing stage. Add ctests to check for external function calls. v2: fix typos, style Signed-off-by: Jan Vesely <jan.vesely@rutgers.edu> Acked-by: Aaron Watry <awatry@gmail.com> Tested-by: Aaron Watry <awatry@gmail.com> Acked-by: Vedran Miletić <vedran@miletic.net> llvm-svn: 347667