Skip to content

subatomicglue/cross-compile-macosx-clang-windows-msvc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-Compile C/C++ Windows and RaspberryPI binaries from MacOSX bash terminal

(Update: RaspberryPI cross compile for cmake has also been added, see source code)

Here is an example Makefile, as well as example cmake platform & toolchains, to cross-compile C/C++ Windows binaries from MacOSX bash terminal, using llvm's clang/lld.

Included are both 32 and 64bit examples for:

  • .exe
  • .lib (static linked)
  • .dll (dynamic linked)
  • .dll (dynamic loaded - plugin)

Prerequisites:

  • MacOSX High Sierra (or similar)
  • MacOSX terminal
  • Windows10 installed under Parallels
    • Windows C:\ mounted under MacOSX /Volumes/[C] Windows 10/. This is how clang will find the MSVC compiler lib/ & include/ directories.
  • Microsoft Visual Studio 2015 w/ windows sdk (for includes and libs)
  • brew install llvm (clang compiler version 6.0.0, or similar)
    • clang/clang++
    • lld
  • brew install cmake (cmake version 3.10.3, or similar)
  • Optional: Parallels 13 (or similar) - virtualization host running Windows 10

Makefile example:

A simple example illustrating how to cross-compile C/C++ Windows binaries from a system such as MacOSX, using the LLVM clang compiler.

CMake example:

A more advanced example, with reusable cmake toolchain for cross-compiling C/C++ Windows (and RaspberryPI) binaries under MacOSX, using the LLVM clang compiler.

About

Here is an example HOWTO to cross compile C/C++ from MacOSX terminal to Windows compatible binaries, using Clang.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published