1
0
Fork 0
mirror of https://github.com/anrieff/libcpuid synced 2024-12-26 16:55:45 +00:00
a small C library for x86 CPU detection and feature extraction
Find a file
Xorg 3a2db00f04
Set CMAKE_C_FLAGS_DEBUG to display warnings during build
CI workflows are reporting warnings. Adding more C flags here help to avoid that.
2022-09-04 19:19:12 +02:00
.github/workflows Fix failing CI builds introduced by cb5fdd1 2021-07-16 02:04:08 +03:00
cmake Add CMake 2020-02-06 10:32:25 +02:00
contrib/MSR Driver Remove all trailling spaces 2020-05-09 17:34:07 +02:00
cpuid_tool fix installation of BUNDLE if iOS (#154) 2021-07-16 01:47:17 +03:00
libcpuid DB: add Warhol 2022-08-28 11:41:28 +02:00
tests Tests: add AMD A10 Pro-7350B (Kaveri) from InstLatx64 2022-08-28 11:42:25 +02:00
.gitignore Update .gitignore 2020-05-21 18:44:12 +02:00
AUTHORS Moving the repository one level deeper 2008-11-06 18:17:20 +00:00
bump_version.sh Remove Debian package (#165) 2022-09-03 21:48:12 +03:00
ChangeLog Release version 0.5.1 (#151) 2021-03-21 12:41:56 +02:00
cmake-format.py Add config file for cmake-format 2020-05-21 18:42:42 +02:00
CMakeLists.txt Set CMAKE_C_FLAGS_DEBUG to display warnings during build 2022-09-04 19:19:12 +02:00
configure.ac Don't link with msrdriver.c on non-Windows platform. (#159) 2022-01-14 10:35:10 +02:00
COPYING Moving the repository one level deeper 2008-11-06 18:17:20 +00:00
libcpuid.dsw Remove all trailling spaces 2020-05-09 17:34:07 +02:00
libcpuid.pc.in Incorrect path in .pc file - fixed; Clarified documentation a bit 2008-11-28 16:17:29 +00:00
libcpuid_vc10.sln Remove all trailling spaces 2020-05-09 17:34:07 +02:00
libcpuid_vc71.sln Remove all trailling spaces 2020-05-09 17:34:07 +02:00
Makefile.am Fixes issue #148: CMake build script not in 0.5.0 tarball release 2020-10-19 02:12:03 +03:00
NEWS Moving the repository one level deeper 2008-11-06 18:17:20 +00:00
README Convert README to markdown. 2015-11-04 01:31:23 +02:00
Readme.md Simplifies binary package names 2022-08-28 10:40:42 +02:00

libcpuid

libcpuid provides CPU identification for the x86 (and x86_64). For details about the programming API, you might want to take a look at the project's website on sourceforge (http://libcpuid.sourceforge.net/). There you'd find a short tutorial, as well as the full API reference.

Configuring after checkout

Under Linux, where you download the sources, there's no configure script to run. This is because it isn't a good practice to keep such scripts in a source control system. To create it, you need to run the following commands once, after you checkout the libcpuid sources from github:

    1. run "libtoolize"
    2. run "autoreconf --install"

You need to have autoconf, automake and libtool installed.

After that you can run ./configure and make - this will build the library.

make dist will create a tarball (with "configure" inside) with the sources.

Prerequisites

Using libcpuid requires no dependencies on any of the supported OSes. Building it requires the aforementioned libtool and autotools commands to be available, which is a matter of installing a few common packages with related names (e.g. automake, autoconf, libtool). It also requires a POSIX-compatible shell. On NetBSD, you may need to install one (credits to @brucelilly):

  1. Install a POSIX-compatible shell such as ksh93 (pkg_add ast-ksh || pkgin in ast-ksh)
  2. export CONFIG_SHELL=/usr/pkg/bin/ksh93 (substitute the correct path if required)
  3. Follow the regular Linux instructions

Testing

After any change to the detection routines or match tables, it's always a good idea to run make test. If some test fails, and you're confident that the test is wrong and needs fixing, run make fix-tests.

You can also add a new test (which is basically a file containing the raw CPUID data and the expected decoded items) by using tests/create_test.py. The workflow there is as follows:

  1. Run "cpuid_tool" with no arguments. It will tell you that it has written a pair of files, raw.txt and report.txt. Ensure that report.txt contains meaningful data.
  2. Run "tests/create_test.py raw.txt report.txt > «my-cpu».test"
  3. Use a proper descriptive name for the test (look into tests/amd and tests/intel to get an idea) and copy your test file to an appropriate place within the tests directory hierarchy.

For non-developers, who still want to contribute tests for the project, use this page to report misdetections or new CPUs that libcpuid doesn't handle well yet.

Users

So far, I'm aware of the following projects which utilize libcpuid (listed alphabetically):

We'd love to hear from you if you are also using libcpuid and want your project listed above.

Downloads

You can find latest versioned archives here, with binaries for macOS and Windows.

Binary packages

Also, libcpuid is available for following systems in official repositories:

Build tool

  • Vcpkg: vcpkg install cpuid