Skip to content
Cross compile source code easily for Windows with clang on Linux/Unix
C++ CMake Shell
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
cmake
debian
src
CMakeLists.txt Update CMakeLists.txt Feb 13, 2019
LICENSE speed up command parsing Mar 15, 2014
README
cleanup.sh simplify cleanup.sh Dec 6, 2014
config.h.cmake.in
package.sh add -wc-static-runtime option Oct 13, 2013

README

Wclang is a tool which helps you to cross compile source code easily with clang on Linux/Unix for Windows.
Wclang is basically a wrapper for clang, which allows you to directly target Windows.
Wclang detects the target and headers automatically and adds them to the clang invocation command.

After the installation you will have "<mingw-triplet>-clang", "<mingw-triplet>-clang++" available as "compiler".

PREREQUISITES:

 A C++11 compiler for compiling the wrapper (g++ 4.6+, clang)
 clang
 mingw-w64 with its headers and libs
 cmake

INSTALLATION:

 cmake -DCMAKE_INSTALL_PREFIX=_prefix_ .
 make
 make install

EXAMPLES:

 i686-w64-mingw32-clang++ hello-world.cpp -o hello-world.exe && wine hello-world
 CC=i686-w64-mingw32-clang ./configure --host=i686-w64-mingw32

 x86_64-w64-mingw32-clang++ hello-world.cpp -o hello-world.exe && wine hello-world
 CC=x86_64-w64-mingw32-clang ./configure --host=x86_64-w64-mingw32

LISTING AVAILABLE PARAMETERS:
 i686-w64-clang -wc-help

LIMITATIONS:
 C++ exceptions do not work with clang<3.7, and in 3.7 just for 64-bit, clang>=6.0 added support for 32-bit.

KNOWN TO WORK ON:

 Linux:   Ubuntu, Debian (Wheezy*), Mint, Arch, Fedora and openSUSE.
          Other distributions may work as well, but have not been tested.
 Windows: Cygwin.

* Wheezy: important: clang-3.0 coming with wheezy is too old
  to compile the wrapper, so use g++ or get a newer clang
  from e.g.: http://llvm.org/apt.
You can’t perform that action at this time.