wclang
wclang copied to clipboard
Cross compile source code easily for Windows with clang on Linux/Unix
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 "
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.