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

Make library work on clang on windows #57

Merged
merged 1 commit into from
Feb 6, 2024

Conversation

grandseiken
Copy link
Contributor

@grandseiken grandseiken commented Feb 6, 2024

This fixes #56.

As described in that issue, the function_name() obtained from std::source_location on clang on windows does not include template parameters, which means the tricks used by the library to determine names automatically just don't work. However, __PRETTY_FUNCTION__ does contain the template parameters and gives the exact string we wanted.

This works whether running clang directly on Windows or whether via clang-cl, since both __clang__ and _MSC_VER are defined in either case.

I did a few tests of some basic functionality of the library and everything seemed to work as expected now.

@grandseiken
Copy link
Contributor Author

I managed to run the tests successfully as well after installing cmake and the ClangCl build tools for Visual Studio:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DREFLECTCPP_BUILD_TESTS=ON -G"Visual Studio 17 2022" -T ClangCl
cmake --build build --config Release -j 4
./build/tests/json/Release/reflect-cpp-json-tests.exe

@liuzicheng1987
Copy link
Contributor

@grandseiken , thank you so much for this PR.

@liuzicheng1987 liuzicheng1987 merged commit 70b8c0b into getml:main Feb 6, 2024
3 checks passed
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.

get_field_name_str_view() doesn't work with clang on windows
2 participants