BUILDING.md (2490B)
1 # Compilation 2 3 For more details and other workflows see the "Advanced guide" below. 4 5 ## Checking out the code 6 7 ```bash 8 git clone https://github.com/libjxl/libjxl.git --recursive --shallow-submodules 9 ``` 10 11 This repository uses git submodules to handle some third party dependencies 12 under `third_party`, that's why it is important to pass `--recursive`. If you 13 didn't check out with `--recursive`, or any submodule has changed, run: 14 15 ```bash 16 git submodule update --init --recursive --depth 1 --recommend-shallow 17 ``` 18 19 The `--shallow-submodules` and `--depth 1 --recommend-shallow` options create 20 shallow clones which only downloads the commits requested, and is all that is 21 needed to build `libjxl`. Should full clones be necessary, you could always run: 22 23 ```bash 24 git submodule foreach git fetch --unshallow 25 git submodule update --init --recursive 26 ``` 27 28 which pulls the rest of the commits in the submodules. 29 30 Important: If you downloaded a zip file or tarball from the web interface you 31 won't get the needed submodules and the code will not compile. You can download 32 these external dependencies from source running `./deps.sh`. The git workflow 33 described above is recommended instead. 34 35 ## Installing dependencies 36 37 Required dependencies for compiling the code, in a Debian/Ubuntu based 38 distribution run: 39 40 ```bash 41 sudo apt install cmake pkg-config libbrotli-dev 42 ``` 43 44 Optional dependencies for supporting other formats in the `cjxl`/`djxl` tools, 45 in a Debian/Ubuntu based distribution run: 46 47 ```bash 48 sudo apt install libgif-dev libjpeg-dev libopenexr-dev libpng-dev libwebp-dev 49 ``` 50 51 We recommend using a recent Clang compiler (version 7 or newer), for that 52 install clang and set `CC` and `CXX` variables. 53 54 ```bash 55 sudo apt install clang 56 export CC=clang CXX=clang++ 57 ``` 58 59 ## Building 60 61 ```bash 62 cd libjxl 63 mkdir build 64 cd build 65 cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF .. 66 cmake --build . -- -j$(nproc) 67 ``` 68 69 The encoder/decoder tools will be available in the `build/tools` directory. 70 71 ## <a name="installing"></a> Installing 72 73 ```bash 74 sudo cmake --install . 75 ``` 76 77 78 ## Building JPEG XL for developers 79 80 For experienced developers, we provide build instructions for several other environments: 81 82 * [Building on Debian](doc/developing_in_debian.md) 83 * Building on Windows with [vcpkg](doc/developing_in_windows_vcpkg.md) (Visual Studio 2019) 84 * Building on Windows with [MSYS2](doc/developing_in_windows_msys.md) 85 * [Cross Compiling for Windows with Crossroad](doc/developing_with_crossroad.md)