xref: /isa-l/doc/build.md (revision 0f7bf1c04d91d846b8f1dff13e0fc2ea5a1ae8e5)
1# ISA-L Build Details
2
3## Build tools
4
5NASM: For x86-64 builds it is highly recommended to get an up-to-date version of
6[nasm] that can understand the latest instruction sets. Building with an older
7assembler version is often possible but the library may lack some function
8versions for the best performance. For example, as a minimum, nasm v2.11.01 or
9yasm 1.2.0 can be used to build a limited functionality library but it will not
10include any function versions with AVX2, AVX512, or optimizations for many
11processors before the assembler's build. The configure or make tools can run
12tests to check the assembler's knowledge of new instructions and change build
13defines. For autoconf builds, check the output of configure for full nasm
14support as it includes the following lines.
15
16    checking for nasm... yes
17    checking for modern nasm... yes
18    checking for optional nasm AVX512 support... yes
19    checking for additional nasm AVX512 support... yes
20
21If an appropriate nasm is not available from your distro, it is simple to build
22from source or download an executable from [nasm].
23
24    git clone --depth=10 https://github.com/netwide-assembler/nasm
25    cd nasm
26    ./autogen.sh
27    ./configure
28    make
29    sudo make install
30
31## Windows Build Environment Details
32
33The windows dynamic and static libraries can be built with the nmake tool on the
34windows command line when appropriate paths and tools are setup as follows.
35
36### Download nasm and put into path
37
38Download and install [nasm] and add location to path.
39
40    set PATH=%PATH%;C:\Program Files\NASM
41
42### Setup compiler environment
43
44Install compiler and run environment setup script.
45
46Compilers for windows usually have a batch file to setup environment variables
47for the command line called `vcvarsall.bat` or `compilervars.bat` or a link to
48run these. For Visual Studio this may be as follows for Community edition.
49
50    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat x64
51
52For the Intel compiler the path is typically as follows where yyyy, x, zzz
53represent the version.
54
55    C:\Program Files (x86)\IntelSWTools\system_studio_for_windows_yyyy.x.zzz\compilers_and_libraries_yyyy\bin\compilervars.bat intel64
56
57### Build ISA-L libs and copy to appropriate place
58
59Run `nmake /f Makefile.nmake`
60
61This should build isa-l.dll, isa-l.lib and isa-l_static.lib. You may want to
62copy the libs to a system directory in the dynamic linking path such as
63`C:\windows\system32` or to a project directory.
64
65To build a simple program with a static library.
66
67    cl /Fe: test.exe test.c isa-l_static.lib
68
69[nasm]: https://www.nasm.us
70