From 8818e6ac6ebbc4cf6c504bb07e6472eea5d193c5 Mon Sep 17 00:00:00 2001 From: Guillaume Chatelet Date: Fri, 9 Feb 2018 17:04:20 +0100 Subject: [PATCH] Updating documentation part 1. --- README.md | 22 ++++++++++++++++++++++ cmake/README.md | 28 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 cmake/README.md diff --git a/README.md b/README.md index 0cf03da..33d60c4 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,15 @@ A cross-platform C library to retrieve CPU features (such as available instructions) at runtime. +## Table of Contents + +- [Design Rationale](#rationale) +- [Code samples](#codesample) +- [What's supported](#support) +- [License](#license) +- [Build with cmake](#cmake) + + ## Design Rationale - **Simple to use.** See the snippets below for examples. @@ -18,6 +27,7 @@ instructions) at runtime. `malloc`, `memcpy`, and `memcmp`. - **Unit tested.** + ### Checking features at runtime Here's a simple example that executes a codepath if the CPU supports both the @@ -94,6 +104,7 @@ static const bool has_fast_avx = info.features.avx && uarch != INTEL_SNB; This feature is currently available only for x86 microarchitectures. + ## What's supported | | x86 | ARM | AArch64 | MIPS | POWER | @@ -116,3 +127,14 @@ This feature is currently available only for x86 microarchitectures. implemented efficiently in hardware (e.g. AVX on Sandybridge). Exposing the microarchitecture allows the client to reject particular microarchitectures. + + +## License + +The cpu_features library is licensed under the terms of the Apache license. +See [LICENSE](LICENSE) for more information. + + +## Build with CMake + +Please check the [CMake build instructions](cmake/README.md) diff --git a/cmake/README.md b/cmake/README.md new file mode 100644 index 0000000..b6baeaa --- /dev/null +++ b/cmake/README.md @@ -0,0 +1,28 @@ +# CMake build instructions + +## Recommended usage : Incorporating cpu_features into a CMake project + + For API / ABI compatibility reasons, it is recommended to build and use + cpu_features in a subdirectory of your project or as an embedded dependency. + + This is similar to the recommended usage of the googletest framework + ( https://github.com/google/googletest/blob/master/googletest/README.md ) + + Build and use step-by-step + + + 1- Download cpu_features and copy it in a sub-directory in your project. + or add cpu_features as a git-submodule in your project + + 2- You can then use the cmake command `add_subdirectory()` to include + cpu_features directly and use the `cpu_features` target in your project. + + 3- Add the `cpu_features` target to the `target_link_libraries()` section of + your executable or of your library. + +## Enabling tests + + CMake default options for cpu_features is Release built type with tests + disabled. To enable testing set cmake `BUILD_TESTING` variable to `ON`, + [.travis.yml](../.travis.yml) and [appveyor.yml](../appveyor.yml) have up to + date examples.