- Only 64-bit systems are supported
- C++ compilers with C++20 support (e.g., Clang-15, GCC-11, MSVC-17)
- On Linux,
uuid-dev
is required to build the core libraries and the following libraries are required for the GUI module:libopencv-dev
libglfw3-dev
libxinerama-dev
libxcursor-dev
libxi-dev
- XMake 2.7.8+
- The LLVM toolchain is recommended and well-tested
- Building with XMake on Linux and macOS is experimental. You may encounter with RPATH issues. Please use CMake instead.
- Rust 1.64+ (latest stable version is recommended)
- To use the Rust frontend, please see luisa-compute-rs
-
CPU
clang++
must be inPATH
-
CUDA
- CUDA 11.7 or higher
- Nvidia graphics cards with appropriate drivers (R535+ for OptiX 8).
- To use hardware ray tracing, RTX-compatible graphics cards are needed.
- To build with GPU compression/decompression support, you may specify
-D LUISA_COMPUTE_DOWNLOAD_NVCOMP=ON
to let CMake automatically download the nvCOMP library for you - To build with GPU BC texture compression support, you may download NVTT 3
- On Linux (or when the library is installed to a custom location on Windows), also specify
-D NVTT_DIR=<path-to-nvtt>
to the directory containing the NVTT DLLs so CMake could find it.
- On Linux (or when the library is installed to a custom location on Windows), also specify
-
DirectX
- DirectX 12 with ray tracing support
- DirectX-12.1 & Shader Model 6.5 compatible graphics cards with appropriate drivers
-
Metal
- macOS 13 or higher with Metal 3 support
- Apple M1 chips are recommended (older GPUs are probably supported but not tested)
xmake f -c
xmake
All xmake options declared in ./xmake.lua clearly, you can create ./scripts/options.lua to save a default config for your local environment. An example of options.lua is:
-- for xmake internal arguments
lc_toolchain = {
toolchain = "llvm",
}
-- for LC's custom options
function get_options()
return {
enable_dsl = true,
enable_gui = true,
}
end
Options in options.lua can be covered by command-line config, for example:
xmake f --enable_dsl=false --enable_gui=false -c
xmake
Now both "enable_dsl" and "enable_gui" are false values so the DSL and GUI modules will not be built.
You can use ./scripts/write_options.lua to generate a default options.lua:
xmake lua scripts/write_options.lua
When LuisaCompute is required by other xmake projects, include config/xmake_config.lua
and call methods to add includedirs
, linkdirs
and defines
to other projects.
cmake -S . -B <build-dir> -D CMAKE_BUILD_TYPE=Release # if you want a debug build, change to `-D CMAKE_BUILD_TYPE=Debug`; optionally followed by other flags as listed above
cmake --build <build-dir> # when building on Windows using Visual Studio Generators, add `--config=Release` in a release build
All backends are enabled by default if the corresponding required
APIs/frameworks are detected available. You can override the default
settings by specifying CMake flags manually, in form of -D FLAG=value
behind the first cmake command.
Note: On Windows, please remember to replace the backslashes
\\
in the paths with/
when passing arguments to CMake.
LUISA_COMPUTE_ENABLE_CUDA
: Enable CUDA backend (Default:ON
)LUISA_COMPUTE_ENABLE_DX
: Enable DirectX backend (Default:ON
)LUISA_COMPUTE_ENABLE_METAL
: Enable Metal backend (Default:ON
)LUISA_COMPUTE_ENABLE_CPU
: Enable CPU backend (Default:ON
)LUISA_COMPUTE_ENABLE_GUI
: Enable GUI display in C++ tests (Default:ON
)
Note: You may also edit the
scripts/options.cmake
file (generated bybootstrap.py
or copied by yourself fromscripts/options.cmake.template
) to set the default values of these flags. You can still override the default values by specifying the above CMake flags manually.
- LuisaCompute C++ tests are output to the
<build-dir>/bin
folder. - All tests accept a command-line argument specifying the backend, which can be chosen from
cuda
,dx
,metal
, andcpu
(all in the lower case).