
AsmJit
Low-Latency Machine Code Generation
Build instructions, supported environments, and feature selection.
AsmJit is designed to be easy embeddable in any project. However, it depends on some compile-time definitions that can be used to enable or disable features to decrease the resulting binary size. A typical way of building AsmJit is to use cmake, but it's also possible to just include AsmJit source code in your project and to just build it. The easiest way to include AsmJit in your project is to just include src directory in your project and to define ASMJIT_STATIC. AsmJit can be just updated from time to time without any changes to this integration process. Do not embed AsmJit's test
files in such case as these are used exclusively for testing.
These definitions can be used to enable static library build. Embed is used when AsmJit's source code is embedded directly in another project, implies static build as well.
AsmJit has a first-class CMake support. When consuming AsmJit as a cmake dependency, just use asmjit::asmjit
as a link dependency, which would instrument cmake to setup everything else, including include paths, and build flags (either defining ASMJIT_STATIC
or not, and possibly defining other AsmJit feature macros). For example considering that AsmJit was fetched to 3rdparty/asmjit
directory in your project as an external dependency, you can just use the following CMake snippet that integrates AsmJit with your own CMake project:
These definitions control whether asserts are active or not. By default AsmJit would autodetect build configuration from existing pre-processor definitions, but this behavior can be overridden, for example to enable debug asserts in release configuration.
NDEBUG
is defined and automatically defines ASMJIT_BUILD_RELEASE if configuration overrides were not used. We only recommend using build configuration overrides in special situations, like using AsmJit in release configuration with asserts enabled for whatever reason.All backends AsmJit supports are included by default. To exclude a backend use the following build-type macros:
ASMJIT_NO_FOREIGN
would disable every backend but X86.shm_open()
.asmjit
namespace. This is only provided for users that control all the dependencies (even transitive ones) and that make sure that no two AsmJit versions are used at the same time. This option can be debugging a little simpler as there would not be ABI tag after asmjit::
namespace. Otherwise asmjit would look like asmjit::_abi_1_13::
, for example.AsmJit builds by default all supported features, which includes all emitters, logging, instruction validation and introspection, and JIT memory allocation. Features can be disabled at compile time by using ASMJIT_NO_...
definitions.
Asmjit is embedded, implies ASMJIT_STATIC.
Enables static-library build.
Defined when AsmJit's build configuration is 'Debug'.
Defined when AsmJit's build configuration is 'Debug'.
Defined when AsmJit's build configuration is 'Release'.
Disables X86/X64 backends.
Disables AArch64 backend.
Disables non-host backends entirely (useful for JIT compilers to minimize the library size).
Disables deprecated API at compile time (deprecated API won't be available).
Disables JIT memory management and asmjit::JitRuntime.
Disables asmjit::Logger and asmjit::Formatter.
Disables everything that contains text.
Disables instruction validation API.
Disables instruction introspection API.