|
| 1 | +using BinaryBuilder, Pkg |
| 2 | + |
| 3 | +name = "Enzyme" |
| 4 | +repo = "https://github.com/wsmoses/Enzyme.git" |
| 5 | + |
| 6 | +auto_version = "%ENZYME_VERSION%" |
| 7 | +version = VersionNumber(split(auto_version, "/")[end]) |
| 8 | + |
| 9 | +# Collection of sources required to build attr |
| 10 | +sources = [GitSource(repo, "%ENZYME_HASH%")] |
| 11 | + |
| 12 | +# These are the platforms we will build for by default, unless further |
| 13 | +# platforms are passed in on the command line |
| 14 | +platforms = expand_cxxstring_abis(supported_platforms()) |
| 15 | + |
| 16 | +# Bash recipe for building across all platforms |
| 17 | +script = raw""" |
| 18 | +cd Enzyme |
| 19 | +# install_license LICENSE.TXT |
| 20 | +CMAKE_FLAGS=() |
| 21 | +# Release build for best performance |
| 22 | +CMAKE_FLAGS+=(-DENZYME_EXTERNAL_SHARED_LIB=ON) |
| 23 | +CMAKE_FLAGS+=(-DCMAKE_BUILD_TYPE=RelWithDebInfo) |
| 24 | +# Install things into $prefix |
| 25 | +CMAKE_FLAGS+=(-DCMAKE_INSTALL_PREFIX=${prefix}) |
| 26 | +# Explicitly use our cmake toolchain file and tell CMake we're cross-compiling |
| 27 | +CMAKE_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TARGET_TOOLCHAIN}) |
| 28 | +CMAKE_FLAGS+=(-DCMAKE_CROSSCOMPILING:BOOL=ON) |
| 29 | +# Tell CMake where LLVM is |
| 30 | +CMAKE_FLAGS+=(-DLLVM_DIR="${prefix}/lib/cmake/llvm") |
| 31 | +# Force linking against shared lib |
| 32 | +CMAKE_FLAGS+=(-DLLVM_LINK_LLVM_DYLIB=ON) |
| 33 | +# Build the library |
| 34 | +CMAKE_FLAGS+=(-DBUILD_SHARED_LIBS=ON) |
| 35 | +cmake -B build -S enzyme -GNinja ${CMAKE_FLAGS[@]} |
| 36 | +ninja -C build -j ${nproc} install |
| 37 | +""" |
| 38 | + |
| 39 | +# The products that we will ensure are always built |
| 40 | +products = Product[ |
| 41 | + LibraryProduct(["libEnzyme-9", "libEnzyme"], :libEnzyme), |
| 42 | +] |
| 43 | + |
| 44 | +dependencies = [ |
| 45 | + BuildDependency(PackageSpec(name="LLVM_full_jll", version=v"9.0.1")), |
| 46 | +# Dependency(PackageSpec(name="libLLVM_jll", version=v"9.0.1")) |
| 47 | +] |
| 48 | + |
| 49 | + |
| 50 | +# Build the tarballs. |
| 51 | +build_tarballs(ARGS, name, version, sources, script, platforms, products, dependencies; |
| 52 | + preferred_gcc_version=v"8", julia_compat="1.5") |
0 commit comments