Skip to content

Latest commit

 

History

History
74 lines (62 loc) · 2.67 KB

Build-Instructions.md

File metadata and controls

74 lines (62 loc) · 2.67 KB
title parent weight
Building Instructions
index.md
1

Quick Build

~$ git clone https://github.com/AnyDSL/anydsl.git
~$ cd anydsl
~/anydsl$ cp config.sh.template config.sh
~/anydsl$ ./setup.sh

You may also want to fine-tune config.sh.

On Windows you may prefer the setup completely based on CMake

...> git clone https://github.com/AnyDSL/anydsl.git -b cmake-based-setup
...> cd anydsl
...\anydsl> mkdir build_msvc-x64 && cd build_msvc-x64
...\anydsl\build_msvc-x64> cmake -G "Visual Studio 15 2017" -A x64 -Thost=x64 ..

With an pre-existing build of LLVM that matches AnyDSL's requirements, you can insert -DLLVM_DIR=<path to LLVMConfig.cmake> as first argument to cmake. This will skip the download/configure of LLVM. Otherwise LLVM is build on-demand as dependency of thorin.

You can fine-tune dependencies and options using cmake-gui

...\anydsl> cmake-gui build_msvc-x64

You'll find the generated AnyDSL.sln inside the build folder or use CMake to build AnyDSL.

...\anydsl> cmake --build build_msvc-x64 --config Release

Verify your Installation

As pointed out by the build script, ensure that impala and your build of clang is in your path:

~/anydsl$ which impala
~/anydsl$ which clang

Try out hello world

Invoking impala --help shows available options. As impala currently does not ship with a standard library, impala emits LLVM files. We link via clang small C-wrappers to communicate with the outside world and to build the final executable. So let's compile hello_world.impala:

~/anydsl$ cd impala/test
~/anydsl/impala/test$ clang rtmock.cpp -O2 -c                           # compile wrappers
~/anydsl/impala/test$ impala --emit-llvm -O2 codegen/hello_world.impala # produce hello_world.ll
# link wrapper and hello_world.ll to executable
~/anydsl/impala/test$ clang hello_world.ll rtmock.o
~/anydsl/impala/test$ ./a.out

Troubleshooting

  • Double-check that your fresh build of llvm & clang is in your path.
  • Please make sure that LLVM and clang is properly built. If you used too many threads (see your config.sh), you may run out of memory during linking.
  • If you are debugging thorin/impala you may be annoyed that gdb is so slow. This is because thorin/impala links to LLVM. Use
    : ${LLVM:=false}
    in your config.sh to disable LLVM support.
  • To disable a particular runtime component, disable it using CMake's CMAKE_DISABLE_FIND_PACKAGE_<PackageName> variable. For example, pass -DCMAKE_DISABLE_FIND_PACKAGE_OpenCL=TRUE to cmake to disable the OpenCL runtime component.