Skip to content

The Thrush Compiler main dependency constructor builds LLVM and GCC infrastructure for the compiler. (Operating system agnostic)

License

Notifications You must be signed in to change notification settings

thrushlang/compiler-builder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

Compiler Builder

This small tool builds the necessary dependencies for the compiler and places them where they are needed for the compiler to be built.

Dependencies that it builds

Commands & Flags

A list of the commands supported by the compiler builder command line.

Warning

This might be a bit outdated, it could be information that's somewhat distant from the changes.

The Compiler Builder

Usage: compiler-builder [-flag|--flags]

Commands:

• -h, --help, help Show help message.
• -v, --version, version Show the version.

LLVM build flags:

• -llvm-enable-pipeline Enable a custom build pipeline for LLVM.
• -llvm-pipeline ["-DLLVM_ENABLE_PROJECTS="clang;lldb";;-DLLVM_TARGETS_TO_BUILD=X86"] Set the custom build pipeline for LLVM. Separators in the string are ';;'.

• --llvm-major Set LLVM major version (default: 17).
• --llvm-minor Set LLVM minor version (default: 0).
• --llvm-patch Set LLVM patch version (default: 6).
• --llvm-c-compiler [clang] Set C compiler for LLVM build (default: clang).
• --llvm-cpp-compiler [clang++] Set C++ compiler for LLVM build (default: clang++).
• --llvm-c-flags [-O3] Set C compiler flags for LLVM build.
• --llvm-cpp-flags [-Oz] Set C++ compiler flags for LLVM build.
• --llvm-release-type [Debug|Release|MinSizeRel] Set LLVM release type (Debug, Release, MinSizeRel) (default: Release).
• --llvm-build-share-libs [true|false] Flag indicating if each LLVM component (e.g. Support) is built as a shared library (ON) or as a static library (OFF). Its default value is OFF. On Windows, shared libraries may be used when building with MinGW, including mingw-w64, but not when building with the Microsoft toolchain. s(default: false).
• --llvm-build-x86-libs [true|false] Build 32-bit executables and libraries on 64-bit systems. This option is available only on some 64-bit Unix systems. (default: false).
• --llvm-build-dylib [true|false] If enabled, the target for building the libLLVM shared library is added. This library contains all of LLVM’s components in a single shared library. Defaults to OFF. This cannot be used in conjunction with BUILD_SHARED_LIBS. Tools will only be linked to the libLLVM shared library if LLVM_LINK_LLVM_DYLIB is also ON. The components in the library can be customised by setting LLVM_DYLIB_COMPONENTS to a list of the desired components. This option is not available on Windows. (default: false).
• --llvm-link-statically-libcpp [true|false] Statically link to the C++ standard library if possible. This uses the flag -static-libstdc++, but a Clang host compiler will statically link to libc++ if used in conjunction with the LLVM_ENABLE_LIBCXX flag. Defaults to OFF. (default: false).
• --llvm-use-linker [lld] Override the system’s default linker. For instance, use lld with -DLLVM_USE_LINKER=lld.
• --llvm-use-llvm-libc [true|false] If the LLVM libc overlay is installed in a location where the host linker can access it, all built executables will be linked against the LLVM libc overlay before linking against the system libc. (default: false).
• --llvm-pic [true|false] Add the -fPIC flag to the compiler command-line, if the compiler supports this flag. Some systems, like Windows, do not need this flag (default: true).
• --llvm-libcpp [true|false] If the host compiler and linker support the stdlib flag, -stdlib=libc++ is passed to invocations of both so that the project is built using libc++ instead of stdlibc++ (default: false).
• --llvm-clang-modules [true|false] Compile with Clang Header Modules. (default: false).
• --llvm-pdb [true|false] For Windows builds using MSVC or clang-cl, generate PDB files when CMAKE_BUILD_TYPE is set to Release. (default: false).
• --llvm-temporarily-old-toolchain [true|false] If enabled, the compiler version check will only warn when using a toolchain which is about to be deprecated, instead of emitting an error. (default: false).
• --llvm-optimize-tblgen [true|false] If enabled and building a debug or assert build, the CMake build system will generate a Release build tree to build a fully optimized tablegen for use during the build. Enabling this option can significantly speed up build times, especially when building LLVM in Debug configurations. (default: false).
• --llvm-link-libffi [true|false] Indicates whether the LLVM Interpreter will be linked with the Foreign Function Interface library (libffi) in order to enable calling external functions. (default: true).

For more information: https://llvm.org/docs/CMake.html

Libclang build flags:

• --libclang Enable to build the libclang for the compiler.
• --libclang-major Set libclang major version (default: 17).
• --libclang-minor Set libclang minor version (default: 0).
• --libclang-patch Set libclang patch version (default: 0).
• --libclang-c-compiler [clang] Set C compiler for libclang build (default: clang).
• --libclang-cpp-compiler [clang++] Set C++ compiler for libclang build (default: clang++).
• --libclang-c-flags [-O3] Set C compiler flags for libclang build.
• --libclang-cpp-flags [-Oz] Set C++ compiler flags for libclang build.
• --libclang-release-type [Debug|Release|MinSizeRel] Set libclang release type (Debug, Release, MinSizeRel) (default: Release).
• --libclang-build-share-libs [true|false] Flag indicating if each libclang component is built as a shared library (ON) or as a static library (OFF) (default: true).
• --libclang-build-x86-libs [true|false] Build 32-bit executables and libraries on 64-bit systems for libclang (default: true).
• --libclang-build-dylib [true|false] If enabled, build libclang as a dynamic library (default: true).
• --libclang-link-statically-libcpp [true|false] Statically link to the C++ standard library if possible for libclang (default: true).
• --libclang-use-linker [lld] Override the system's default linker for libclang build.
• --libclang-use-llvm-libc [true|false] Use LLVM libc overlay for libclang build (default: false).
• --libclang-pic [true|false] Add the -fPIC flag to the compiler command-line for libclang (default: true).
• --libclang-libcpp [true|false] Use libc++ instead of stdlibc++ for libclang build (default: false).
• --libclang-clang-modules [true|false] Compile with Clang Header Modules for libclang (default: false).
• --libclang-pdb [true|false] Generate PDB files for Windows builds using MSVC or clang-cl for libclang (default: false).
• --libclang-temporarily-old-toolchain [true|false] Allow temporarily old toolchain for libclang build (default: false).
• --libclang-optimize-tblgen [true|false] Optimize tablegen for libclang build (default: false).

For more information: https://clang.llvm.org/docs/LibClang.html

GCC build flags:

• -gcc Enable to build GCC backend for the compiler.
• --gcc-major Set GCC major version (default: 15).
• --gcc-minor Set GCC minor version (default: 2).
• --gcc-patch Set GCC patch version (default: 0).
• --gcc-host-shared [true|false] Enable host shared for GCC (default: true).
• --gcc-c-compiler-flags [-O2 -g] Set C compiler flags for GCC build.
• --gcc-cpp-compiler-flags [-O2 -g] Set C++ compiler flags for GCC build.
• --gcc-c-compiler-command [gcc] Set C compiler command for GCC build.
• --gcc-cpp-compiler-command [g++] Set C++ compiler command for GCC build.

For more information: https://gcc.gnu.org/onlinedocs/jit/internals/index.html#working-on-the-jit-library

Debug flags:

• --debug-llvm Debug LLVM build commands.
• --debug-libclang Debug libclang build commands.
• --debug-gcc Debug GCC build commands.

About

The Thrush Compiler main dependency constructor builds LLVM and GCC infrastructure for the compiler. (Operating system agnostic)

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Languages