Skip to content

[lit] Use CMAKE_C_FLAGS and CMAKE_EXE_LINKER_FLAGS when compiling test plugin #70136

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
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
4 changes: 3 additions & 1 deletion test/Macros/lit.local.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ else:
0,
(
'%swift-build-cxx-plugin',
Copy link
Contributor

Choose a reason for hiding this comment

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

Makes me think swift-build-cxx-plugin is the wrong name, since it's not C++ 😅.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you want that change, I would prefer doing it in a different PR. It involves changing a lot of "callsites".

Copy link
Contributor

@bnbarham bnbarham Dec 1, 2023

Choose a reason for hiding this comment

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

Yeah that's fine, I just noticed because you added C_FLAGS and I was about to comment with "CXX_FLAGS?".

'%clang -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
'%clang %c-flags %exe-linker-flags -isysroot %host_sdk -I %swift_src_root/include -L %swift-lib-dir -l_swiftMockPlugin -Xlinker -rpath -Xlinker %swift-lib-dir'
)
)
config.substitutions.append(('%c-flags', config.c_flags))
config.substitutions.append(('%exe-linker-flags', config.exe_linker_flags))
3 changes: 3 additions & 0 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ config.swift_driver_test_options = "@SWIFT_DRIVER_TEST_OPTIONS@"
config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
config.swift_ide_test_test_options = "@SWIFT_IDE_TEST_TEST_OPTIONS@"

config.c_flags = r'''@CMAKE_C_FLAGS@'''
config.exe_linker_flags = r'''@CMAKE_EXE_LINKER_FLAGS@'''

# --- Darwin ---
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"

Expand Down