Skip to content

[CMake] Fix issues when running build-tooling-libs #61683

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

Merged
merged 1 commit into from
Oct 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions SwiftCompilerSources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ function(add_swift_compiler_modules_library name)
${SWIFT_HOST_VARIANT_ARCH} "${deployment_version}")

# Let Swift discover SwiftShims headers which are included by some headers
# under `include/swift`.
# under `include/swift`. These are either located next to the compiler (in case of open source toolchains) or
# in the SDK (in case a Swift compiler from Xcode)
get_filename_component(swift_exec_bin_dir ${ALS_SWIFT_EXEC} DIRECTORY)
set(sdk_option ${sdk_option} "-I" "${swift_exec_bin_dir}/../lib")
set(sdk_option ${sdk_option} "-I" "${swift_exec_bin_dir}/../lib" "-I" "${sdk_path}/usr/lib")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, does this mean we'll include two copies of SwiftShims when using an open source toolchain with an SDK from Xcode? If that's true, can we instead add only one of these two directories if both exist?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done that locally and it worked just fine. I assume that it just chooses the first include path that it finds.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, thanks.


set(all_obj_files)
set(all_module_targets)
Expand Down
4 changes: 4 additions & 0 deletions cmake/modules/SwiftSharedCMakeConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,10 @@ macro(swift_common_unified_build_config product)
set(${product}_NATIVE_CLANG_TOOLS_PATH "${CMAKE_BINARY_DIR}/bin")
set(LLVM_PACKAGE_VERSION ${PACKAGE_VERSION})
set(LLVM_CMAKE_DIR "${CMAKE_SOURCE_DIR}/cmake/modules")
set(CLANG_INCLUDE_DIRS
"${CLANG_MAIN_INCLUDE_DIR}"
"${CLANG_BUILD_INCLUDE_DIR}"
)

# If cmark was checked out into tools/cmark, expect to build it as
# part of the unified build.
Expand Down
2 changes: 1 addition & 1 deletion lib/AST/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ endif()
# where intrinsics and attributes are declared. swiftAST depends on these
# headers.
# For more information see the comment at the top of lib/CMakeLists.txt.
add_dependencies(swiftAST intrinsics_gen clang-tablegen-targets)
add_dependencies(swift-ast-generated-headers intrinsics_gen clang-tablegen-targets)
add_dependencies(swiftAST swift-ast-generated-headers)

set_swift_llvm_is_available(swiftAST)