File: Building.md

package info (click to toggle)
astc-encoder 2.1%2Bds-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 36,948 kB
  • sloc: cpp: 20,204; python: 2,598; makefile: 156; sh: 15
file content (88 lines) | stat: -rw-r--r-- 2,638 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# Building ASTC Encoder

This page provides instructions for building `astcenc` from the sources in
this repository. The current `master` branch is configured to statically build
binaries which each use a specific level of SIMD support (SSE2, SSE4.2,
or AVX2) selected at compile time. Binaries are produced with a name postfix
indicating the SIMD type in use; e.g. `astcenc-avx2` for the AVX2 binary.

## Windows

Builds for Windows use Visual Studio 2019, using the solution and/or project
files located in the `Source/VS2019/` directory.

### Single variants

To compile a single SIMD variant from the command line, it is possible to use
the `msbuild` utility from the Visual Studio installation, targeting the
specific project for the variant desired.

```
msbuild astcenc-<variant>.vcxproj /p:Configuration=Release /p:Platform=x64
```

### Multiple variants

To compile all supported SIMD variants from the command line, it is possible
to use the `msbuild` utility from the Visual Studio installation, targeting the
solution.

```
msbuild astcenc.sln /p:Configuration=Release /p:Platform=x64
```

## macOS and Linux

Builds for macOS and Linux use GCC or Clang and Make. They are tested using
Clang 9.0, GCC 7.4, and Make 3.82. Using Clang 9.0 is recommended, as it
out-performs GCC by 15-20% in benchmarked test runs.

### Single variants

To compile a single SIMD variant compile with:

```
make -C Source CXX=clang++ VEC=[sse2|sse4.2|avx2] -j8
```

... and use:

```
make -C Source CXX=clang++ VEC=[sse2|sse4.2|avx2] clean
```

... to clean the build.

### All variants

To compile all supported SIMD variants compile with:

```
make -sC Source CXX=clang++ batchbuild -j8
```

... and use:

```
make -sC Source batchclean -j8
```

... to clean the build.

### Developer build options

The default build, `BUILD=release`, is heavily optimized using link-time
optimization (`-O3 -flto`) and does not include symbols.

For debugging, add `BUILD=debug` to the Make command line. This will build a
non-optimized build (`-O0`) with symbols included (`-g`).

For easier profiling, add `BUILD=profile` to the Make command line. This will
build a moderately optimized build (`-O2`) with symbols include (`-g`), but
without link-time optimization (no `-flto`).

Normal builds are not ISA invariant, builds for different instruction sets on
the same CPU hardware can produce subtly different outputs. To build an ISA
invariant build set `-DASTCENC_ISA_INVARIANCE=1`. For make builds this can be
achieved by setting `ISA_INV=1` on the command line. This will reduce
performance, as optimizations will be disabled to keep alignment with SSE2.