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

Building with Clang under a MinGW environment fails #1784

Closed
vittorioromeo opened this issue Apr 12, 2021 · 1 comment · Fixed by #1795
Closed

Building with Clang under a MinGW environment fails #1784

vittorioromeo opened this issue Apr 12, 2021 · 1 comment · Fixed by #1795
Projects
Milestone

Comments

@vittorioromeo
Copy link
Member

Subject of the issue

Building using -DCMAKE_CXX_COMPILER=clang++ in a MinGW environment (e.g. installed via MSYS2) results in a compilation failure, because SFML's CMake files assume that when SFML_COMPILER_CLANG is TRUE then clang-cl is being used.

Your environment

  • Windows 10, using a MinGW x64 environment obtained via MSYS2
  • master branch of SFML
  • clang version 11
  • no special compiler flags

Steps to reproduce

  1. Obtain MSYS2

  2. Open a MSYS shell and install mingw-w64-x86_64-clang via pacman

  3. Open a MinGW 64-bit shell and

    git clone https://github.com/SFML/SFML
    cd SFML
    mkdir build
    cd build
    cmake .. -G"MinGW Makefiles" -DCMAKE_CXX_COMPILER=clang++
  4. Observe the compilation failure -- SFML tries to get libraries from libs-msvc-universal

@eXpl0it3r
Copy link
Member

Looks like this is because of this rule

elseif(SFML_COMPILER_MSVC OR SFML_COMPILER_CLANG)
if(SFML_MSVC_VERSION LESS 14)
if(ARCH_32BITS)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x86")
elseif(ARCH_64BITS)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc/x64")
endif()
else()
if(ARCH_32BITS)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x86")
elseif(ARCH_64BITS)
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "${PROJECT_SOURCE_DIR}/extlibs/libs-msvc-universal/x64")
endif()
endif()

If you can figure out a way to support clang-cl and clang msys/mingw I'd appreciate a PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
SFML 2.6.0
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants