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

[Fix CMake for Clang users on Windows] #311

Merged
merged 2 commits into from
Sep 10, 2019

Conversation

Milerius
Copy link
Contributor

@Milerius Milerius commented Sep 10, 2019

Well, MSVC is not the only compiler on Windows, we use also Clang that use the same compiler flags as MSVC (clang-cl)

According to that, when you detect clang we also should detect platform.

Well, MSVC is not the only compiler on Windows, we use also `Clang` that use the same compiler flags as `MSVC` (clang-cl)
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 1ed0a9f on Milerius:patch-1 into be35975 on skypjack:master.

@Innokentiy-Alaytsev
Copy link
Contributor

Hello!

I'm not sure that $<PLATFORM_ID:MSVC> check will work. I used this pull-request as an example of using generator expressions and $<PLATFORM_ID:MSVC> did not work at all, because under MSVC PLATFORM_ID equals Windows.

@skypjack
Copy link
Owner

@Innokentiy-Alaytsev he updated it. Does it work as expected now?

@Milerius
Copy link
Contributor Author

Hello!

I'm not sure that $<PLATFORM_ID:MSVC> check will work. I used this pull-request as an example of using generator expressions and $<PLATFORM_ID:MSVC> did not work at all, because under MSVC PLATFORM_ID equals Windows.

Just a typo.

@Innokentiy-Alaytsev
Copy link
Contributor

Yes, it works fine. Sorry, if I looked into a wrong commit.

@skypjack
Copy link
Owner

Don't worry. Thank you for trying it. 👍

# it seems that -O3 ruins a bit the performance when using clang ...
INTERFACE $<$<AND:$<CONFIG:Release>,$<CXX_COMPILER_ID:Clang>>:-O2>
INTERFACE $<$<AND:$<CONFIG:Release>,$<CXX_COMPILER_ID:Clang>,$<PLATFORM_ID:Darwin>>:-O2>
Copy link
Owner

@skypjack skypjack Sep 10, 2019

Choose a reason for hiding this comment

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

We can merge this line and the one below as:

INTERFACE $<$<AND:$<CONFIG:Release>,$<CXX_COMPILER_ID:Clang>,$<OR:$<PLATFORM_ID:Darwin>,$<PLATFORM_ID:Linux>>>:-O2>

May I ask you to integrate the PR? Otherwise I can merge it on a separate branch and edit the file before to merge it on master.

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 can edit it on your side is great I used the GitHub web editor !

@skypjack skypjack self-assigned this Sep 10, 2019
@skypjack skypjack added the build system requests or issues related to the build system label Sep 10, 2019
@skypjack skypjack changed the base branch from master to build_system September 10, 2019 14:14
@skypjack skypjack dismissed their stale review September 10, 2019 14:15

I'm applying the changes on my side directly.

@skypjack skypjack merged commit f5db30b into skypjack:build_system Sep 10, 2019
@Milerius
Copy link
Contributor Author

Milerius commented Sep 10, 2019

maybe we can add a tests ta compile with clang on appveyor ?

cmake ../ -G "%GENERATOR%" -A %platform% -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -T "ClangCl" -DCMAKE_CXX_COMPILER="C:/Program Files/LLVM/bin/clang-cl.exe"

platform: x64
GENERATOR: Visual Studio 16 2019
BUILD_TYPE: Debug

@skypjack
Copy link
Owner

clang is tested already on two platforms. I don't think this will add much to the build system tbh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build system requests or issues related to the build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants