Skip to content

Conversation

@vzakhari
Copy link
Contributor

@vzakhari vzakhari commented Mar 8, 2025

It allows specifying path to quadmath.h directory,
which is needed when building flang-rt with
FLANG_RUNTIME_F128_MATH_LIB=libquadmath using clang.

It allows specifying path to `quadmath.h` directory,
which is needed when building flang-rt with
FLANG_RUNTIME_F128_MATH_LIB=libquadmath using clang.
Copy link
Member

@Meinersbur Meinersbur left a comment

Choose a reason for hiding this comment

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

Why not just -DCMAKE_CXX_FLAGS=-I/usr//lib/gcc/x86_64-linux-gnu/13/include? No additional configuration complexity needed.

Clang is already searching for gcc installations, just doesn't add its include dir to the default header search path.

@vzakhari
Copy link
Contributor Author

vzakhari commented Mar 8, 2025

Why not just -DCMAKE_CXX_FLAGS=-I/usr//lib/gcc/x86_64-linux-gnu/13/include? No additional configuration complexity needed.

Clang is already searching for gcc installations, just doesn't add its include dir to the default header search path.

check_include_file does not rely on CMAKE_C/CXX_FLAGS for compiling the sample code.

@vzakhari
Copy link
Contributor Author

vzakhari commented Mar 8, 2025

Clang is already searching for gcc installations, just doesn't add its include dir to the default header search path.

I do not think it is possible to use both clang's and gcc's include paths in the same clang compilation. If you try you would get lots of errors due to conflicting header files.

@Meinersbur
Copy link
Member

Meinersbur commented Mar 8, 2025

check_include_file does not rely on CMAKE_C/CXX_FLAGS for compiling the sample code.

From the documention:

CMAKE_REQUIRED_FLAGS
String of additional flags to pass to the compiler. The string must be space-delimited--a ;-list will not work. The contents of CMAKE_<LANG>_FLAGS and its associated configuration-specific variable are automatically added to the compiler command before the contents of CMAKE_REQUIRED_FLAGS.

If the issue is that the parameter is not forwarded to the runtimes build, that's what -DRUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLANGS=..." is for.

@Meinersbur
Copy link
Member

Meinersbur commented Mar 8, 2025

I do not think it is possible to use both clang's and gcc's include paths in the same clang compilation. If you try you would get lots of errors due to conflicting header files.

Isn't this exactly what include_directories(${FLANG_RT_QUADMATH_INCLUDE_DIR}) does? Or do you expect users to copy GCC's quadmath.h into another directory?

Better solution here: #130411. No additional configuration input from the user required.

@vzakhari
Copy link
Contributor Author

If the issue is that the parameter is not forwarded to the runtimes build, that's what -DRUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLANGS=..." is for.

I tried exactly -DRUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLANGS=..." method, but it did not work for some reason. Let me try it again.

@Meinersbur
Copy link
Member

Sorry, there was a typo: -DRUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLAGS=-I/usr/lib/gcc/x86_64-linux-gnu/13/include" (FLAGS instead of FLANGS)

@vzakhari
Copy link
Contributor Author

Sorry, there was a typo: -DRUNTIMES_CMAKE_ARGS="-DCMAKE_CXX_FLAGS=-I/usr/lib/gcc/x86_64-linux-gnu/13/include" (FLAGS instead of FLANGS)

No problem :) I did try it (without the typo) before I posted this PR, that is why I went with the extra var. I could have made a different typo though.

@vzakhari
Copy link
Contributor Author

Isn't this exactly what include_directories(${FLANG_RT_QUADMATH_INCLUDE_DIR}) does? Or do you expect users to copy GCC's quadmath.h into another directory?

Better solution here: #130411. No additional configuration input from the user required.

I like your solution better. Thanks! Let me try it.

@vzakhari
Copy link
Contributor Author

Closing this in favor of #130411.

@vzakhari vzakhari closed this Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants