Skip to content
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

Findthrust.cmake parse error #407

Closed
HWZen opened this issue Mar 12, 2024 · 1 comment · Fixed by #408
Closed

Findthrust.cmake parse error #407

HWZen opened this issue Mar 12, 2024 · 1 comment · Fixed by #408
Labels

Comments

@HWZen
Copy link
Contributor

HWZen commented Mar 12, 2024

Describe the bug
Cannot config project because Findthrust.cmake@15 cannot find the thrust properly.

Look at this code:

string(REGEX REPLACE "#define THRUST_VERSION[ \t]+" "" THRUST_VERSION_STRING ${THRUST_VERSION_STRING})

It does not take into account that #define THRUST_VERSION may be followed by comments.

Unfortunately, cuda 12.4's thrust/version.h has a comment after THRUST_VERSION

/*! \def THRUST_VERSION
 *  \brief The preprocessor macro \p THRUST_VERSION encodes the version
 *         number of the Thrust library as MMMmmmpp.
 *
 *  \note THRUST_VERSION is formatted as `MMMmmmpp`, which differs from `CCCL_VERSION` that uses `MMMmmmppp`.
 *
 *         <tt>THRUST_VERSION % 100</tt> is the sub-minor version.
 *         <tt>THRUST_VERSION / 100 % 1000</tt> is the minor version.
 *         <tt>THRUST_VERSION / 100000</tt> is the major version.
 */
#define THRUST_VERSION 200301 // macro expansion with ## requires this to be a single value

So ${THRUST_VERSION_STRING} in cmake was parsed to 200301 // macro expansion with ## requires this to be a single value and led to subsequent errors in judgment.

If you think what I'm saying makes sense, I'll be happy to fix it.

System (please complete the following information):

  • OS: Windows 11
  • Compiler: Visual Studio 2022
  • Backend: CUDA 12.4
  • Library version: main branch
@HWZen HWZen added the bug label Mar 12, 2024
@stotko
Copy link
Owner

stotko commented Mar 12, 2024

Thanks for the report. This indeed looks like a bug in Findthrust.cmake and your explanation makes perfect sense. A PR to fix this issue would be very welcome.

HWZen added a commit to HWZen/stdgpu that referenced this issue Mar 13, 2024
Fix bug stotko#407: The original regular replacement does not consider the possibility that THRUST_VERSION may be followed by comments.
HWZen added a commit to HWZen/stdgpu that referenced this issue Mar 13, 2024
Fix bug stotko#407: The original regular replacement does not consider the possibility that THRUST_VERSION may be followed by comments.
@stotko stotko linked a pull request Mar 13, 2024 that will close this issue
stotko pushed a commit that referenced this issue Mar 13, 2024
Fix bug #407: The original regular replacement does not consider the possibility that THRUST_VERSION may be followed by comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants