-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
build: remove custom variables for cmark handling #29438
base: main
Are you sure you want to change the base?
Conversation
@swift-ci please clean test |
Hi @compnerd -- Thanks for the CC. I've verified that this does not break my unified build setup. |
Build failed |
Build failed |
8b351de
to
507892d
Compare
@swift-ci please clean test |
Build failed |
Build failed |
Left a comment in commonmark/cmark#327 of why I think it is not working as intended. |
Ugh, yeah, that would work too. I ended up with just extracting the variable for the export file and then substituting that in. But you’re spot on with the analysis. |
Please test with following PRs: @swift-ci please clean test |
Build failed |
Build failed |
507892d
to
10f4558
Compare
@swift-ci please clean test |
Build failed |
Build failed |
10f4558
to
29d9ccc
Compare
@swift-ci please clean test |
@swift-ci please test Windows platform |
Build failed |
Build failed |
Use the imported target to handle the include path and link libraries. This allows CMake to properly handle dependencies and removes the custom handling logic that we have relied on now that CMark properly supports export targets.
29d9ccc
to
f53ae41
Compare
@swift-ci please test |
Build failed |
Build failed |
@compnerd I've checked out this branch locally, but it fails with this build error:
It seems like the change from include_directories(
"${CLANG_BUILD_INCLUDE_DIR}"
"${CLANG_MAIN_INCLUDE_DIR}"
"${CMARK_MAIN_INCLUDE_DIR}"
"${CMARK_BUILD_INCLUDE_DIR}") to include_directories(${CLANG_BUILD_INCLUDE_DIR}
${CLANG_MAIN_INCLUDE_DIR}) in this branch breaks that, as no replacement include directory is specified for the I assumed that something like target_include_directories(swiftMarkup PRIVATE
${cmark_INCLUDE_DIR}) in |
I think that we may need to sync with upstream again? |
Nothing has changed upstream in their CMake files though, at least when comparing their |
I'm seeing this both upstream and in the install(FILES
cmark.h
${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
${CMAKE_CURRENT_BINARY_DIR}/cmark_version.h
DESTINATION include
)
Sorry for such a trivial question, I'm just trying to wrap my head around how these dependencies are built, how their include paths are set up, and how target dependencies are structured in the toolchain CMake files. So I decided to start with something small such as cmark. |
@compnerd another thing I wanted to try was to migrate the cmark dependency from |
The current CMake usage is not something we should be aiming to emulate. What you’re thinking about (using cmake properly) is a good thing. Making it built in build-script and passed in via CMark_DIR is the right approach. However, be aware that some of us build with it unified (all of the toolchain in a single cmake invocation). Migrating from build-script-impl to build script would be a good learning experience though, it would be welcome and good to see others get involved in the build cleanup efforts. |
The unified/standalone builds is something that I saw references to in CMake files, but I still don't understand pros/cons and use cases of those. Would you elaborate please why some use unified builds then and how exactly that differs? I'd be happy to add that to |
Well, different people have different reasons to use unified builds. If you have enough CPU cores, then it's dramatically faster than the build-script. |
How do you even run it? I'm not able to find any documentation whatsoever about unified builds 🤔 |
BTW, how many CPU cores is enough? 🙂 |
I don’t know how many cores are enough to appreciate the advantage of unified builds. I have 48 cores and (from memory), it’s about 50% faster than using the build script. I also don’t know how others setup their unified builds, but for me, I just build LLVM and add swift, etc as external projects (as opposed to internal projects like clang, lld, lldb, etc) |
IMO the pros is that its a faster build (with my 4 core machine, it ends up being ~10-15% faster). It also reduces the complexity of the build IMO, because the single build directory contains nearly everything (llvm, clang, lld, lldb, swiftc, and the swift runtime/standard library). The last pro IMO is that when you update the repositories, it ensures that the dependencies fully percolate through the entire system. As to the cons - largely that you get a single configuration type (release vs debug for the entire toolchain). The other cons include things like not being able to do a partial incremental build (e.g. if you update and LLVM has changed, you will need to rebuild LLVM, you cannot go behind its back and do just the incremental swift build).
@davezarzycki I dislike the setup I have currently in that I have swift checked out not where I would like. In theory, you should be able to use |
Use the imported target to handle the include path and link libraries.
This allows CMake to properly handle dependencies and removes the
custom handling logic that we have relied on now that CMark properly
supports export targets.
Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.
Resolves SR-NNNN.