Skip to content

Basic build instructions

Bevin Hansson edited this page Sep 28, 2018 · 1 revision

These instructions focus on how to build this on Linux. It's possible to build on Windows as well, either with some kind of emulation layer like MINGW, MSYS or Cygwin, or building with Visual Studio/msbuild directly, but you'll have to check the LLVM documentation for details on this.

The LLVM documentation for building is located here.

Prerequisites

  • At least CMake 3.4.3
  • A reasonably new version of gcc or clang. gcc 8.0.0 or newer is probably good.

How to build

  1. Make yourself a workspace.

     mkdir llvm
     cd llvm
    
  2. Check out the llvm-gbz80 repository.

     git clone https://github.com/Bevinsky/llvm-gbz80.git
    
  3. Check out the clang-gbz80 repository and ake a symlink at tools/clang in the LLVM repository to the Clang repository.

     git clone https://github.com/Bevinsky/clang-gbz80.git
     cd llvm-gbz80/tools
     ln -s ../../clang-gbz80 clang
    

    Or, just clone Clang there directly.

     cd llvm-gbz80/tools
     git clone https://github.com/Bevinsky/clang-gbz80.git clang
    
  4. Make a build directory in the workspace root.

     cd ../..
     mkdir build
     cd build
    
  5. Configure the build with CMake.

     cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug -DLLVM_TARGETS_TO_BUILD="GBZ80" ../llvm-gbz80
    

    If you are short on memory (8 GB or less) you can either configure a release build (-DCMAKE_BUILD_TYPE=Release) or install the gold linker and enable it (-DLLVM_USE_LINKER=gold). Building a debug build is recommended if you're going to experiment, though.

  6. Build clang and llc.

     make llc clang
    
Clone this wiki locally