To Build AOCL Cryptography for different platforms please refer to the document related to your platform - Linux - Windows
$ mkdir build
$ cd build
$ cmake ../
To generate a single .a file from all the .a files
ar crsT libnew.a libalcp.a libarch_zen3.a libarch_avx2.a
mv libnew.a libalcp.a
- Enable Examples - To compile example/demo code.
- Enable AOCL-UTILS - To dispatch correct kernel with CPU identification.
- Enable DEBUG Build - To compile code in Debug Mode.
- Enable Address Sanitizer Support
- Enable Bench - To compile bench code.
- Enable Tests - To compile test code
To enable examples, append -DALCP_ENABLE_EXAMPLES=ON
to the cmake configuration command.
$ cmake -DALCP_ENABLE_EXAMPLES=ON ../
To enable aocl utils support, append -DAOCL_UTILS_INSTALL_DIR=path/to/aocl/utils/source
and -DENABLE_AOCL_UTILS=ON
to the cmake configuration command.
$ cmake -DENABLE_AOCL_UTILS=ON -DAOCL_UTILS_INSTALL_DIR=path/to/aocl/utils/source ../
To build in debug mode, append -DCMAKE_BUILD_TYPE=DEBUG
to the cmake configuration command.
$ cmake -DCMAKE_BUILD_TYPE=DEBUG ../
To enable sanitizers (asan, tsan etc), append -DALCP_SANITIZE=ON
to the cmake configuration command.
$ cmake -DALCP_SANITIZE=ON ../
To build benchmarking support with alcp library, append -DALCP_ENABLE_BENCH=ON
to the cmake configuration command.
$ cmake -DALCP_ENABLE_BENCH=ON ../
Benchmarks will be built into bench/{algorithm_type}/
Please look into README.md from bench.
$ ./bench/{algorithm_type}/bench_{algorithm_type}
$ ./bench/digest/bench_digest --benchmark_filter=SHA2_<SHA SCHEME>_<Block Size>
$ ./bench/digest/bench_digest --benchmark_filter=SHA2_512_16 (runs SHA256 schemes for 16 block size)
$ ./bench/digest/bench_digest --benchmark_filter=SHA2 (runs for all SHA2 schemes and block sizes)
To build tests, append -DALCP_ENABLE_TESTS=ON
to the cmake configuration command.
$ cmake -DALCP_ENABLE_TESTS=ON ../
Test executables can be found inside tests/{algorithm_type}
directory
For more details see README.md from tests.
$ ./tests/{algorithm_type}/test_{algorithm_type}
- MS Visual Studio (2019 or greater)
- Clang 15.0 or above
- Python 3.7 or greater
- Cmake 3.21 or greater
- Git
- Install visual Studio with workload: Desktop development with c++
- Enable Clang/cl tools(required) & Address Santizer(if require)
- If using LLVM/Clang as external toolset:
- Install LLVM
- Install plugin: llvm2019.vsix :https://marketplace.visualstudio.com/items?itemName=MarekAniola.mangh-llvm2019
- Install VS19 version 16.10
Using Powershell:
- Checkout the latest code.
- Open the powershell.exe (as administrator)
- Set path to current working directory/cmake_source_directory
Run from source directory
PS > cmake -A [platform: x86/x64] -B [build_directory] [Enable features] -DCMAKE_BUILD_TYPE=[RELEASE] -G "[generator: Visual Studio 17 2022]" -T [toolset:ClangCl/LLVM]
Default set values:
- Generator:'Visual Studio Generator'
- platform: 'x64' if external LLVM toolset use: -T LLVM (otherwise,ClangCl)
- Available features: EXAMPLES, ADDRESS SANITIZER, TESTS, BENCH
Powershell
* 1. cmake -A x64 -DCMAKE_BUILD_TYPE=RELEASE -B build -T ClangCl
`-Build binaries will be written to cmake_source_directory/build`
* 2. cmake --build .\build --config=release
- Enable Examples - To compile example/demo code.
- Enable AOCL-UTILS - To dispatch correct kernel with CPU identification.
- Enable DEBUG Build - To compile code in Debug Mode.
- Enable Address Sanitizer Support
- Enable Bench - To compile bench code.
- Enable Tests - To compile test code
After build, alcp & gtests dll's are not found by feature's *.exe. Run the batch file(Set_Env_Path.bat) to set the environment path required by examples, tests & bench.
PS> scripts\Set_Env_Path.bat
-Restart the powershell & run any feature .exe from build directory or directly.
PS> cmake -DALCP_ENABLE_EXAMPLES=ON -B build
PS> cmake --build .\build --config=release
Run from build directory after setting an environment path.
$ .\examples\{algorithm_type}\release\{algorithm_type}\*.exe
PS> cmake -DENABLE_AOCL_UTILS=ON -DAOCL_UTILS_INSTALL_DIR=path/to/aocl/utils/source -B build
PS> cmake --build .\build --config=release
PS> cmake -DCMAKE_BUILD_TYPE=DEBUG -B build
PS> cmake --build .\build --config=debug
PS> cmake -DALCP_SANITIZE=ON -B build
PS> cmake --build .\build --config=release
`Running from build directory PS>cd build
$ Append the argument '-DALCP_ENABLE_TESTS=ON'
PS> cmake -DALCP_ENABLE_TESTS=ON ./
PS> cmake --build . --config=release
This will create test executable:
.\build\tests\{algorithm_type}\release\*.exe
$ .\tests\{algorithm_type}\release\test_{algorithm_type}
PS> ctest -C release
$ Append the argument -DALCP_ENABLE_BENCH=ON
PS> cmake -DALCP_ENABLE_BENCH=ON ./
PS> cmake --build . --config=release
This will create bench executable into:
.\build\bench\{algorithm_type}\{build_type}\*.exe
$ .\bench\{algorithm_type}\release\bench_{algorithm_type}
$ .\bench\{algorithm_type}\release\bench_{algorithm_type} --benchmark_filter=SHA2_<SHA SCHEME>_<Block Size>
$ .\bench\{algorithm_type}\release\bench_{algorithm_type} --benchmark_filter=SHA2_512 (runs SHA512 schemes for all block size)
$ .\bench\{algorithm_type}\release\bench_{algorithm_type} --benchmark_filter=SHA2 (runs for all SHA2 schemes and block sizes)
Enabling openSSL
PS> cmake -DENABLE_TESTS_OPENSSL_API=ON -DOPENSSL_INSTALL_DIR=path/to/openssl ./
PS> cmake --build build/ --config=release
Enabling IPP-Crypto
PS> cmake -DENABLE_TESTS_IPP_API=ON -DIPP_INSTALL_DIR=path/to/ipp_crypto ./
PS> cmake --build build/ --config=release
1. Use '-o' for OpenSSL & '-i' for IPPCP to run tests & bench for them. And also set bin path of compat libs in PATH variable.
2. Run *scripts\Set_Env_Path.bat* to set the path of binaries in environment variable.
3. To Enable examples, tests & bench:
>cmake -A x64 -DALCP_ENABLE_EXAMPLES=ON -DALCP_ENABLE_TESTS=ON -DALCP_ENABLE_BENCH=ON -DCMAKE_BUILD_TYPE=RELEASE -B build -T ClangCl
4. Few non-critical warnings are expected in Windows build with Clang while integrating other libs.