Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
H

hwinfo

> 数据库
Open source

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)

723 stars0 likes5 views
WebsiteGitHub

About

cross platform C++ library for hardware information (CPU, RAM, GPU, ...)

Warning hwinfo.io is not affiliated with this repository. Any claim that this is the official product repository of hwinfo.io is false.

hwinfo

hwinfo provides an easy-to-use and modern C++ API for retrieving hardware information of your systems components such as CPU, RAM, GPU, Disks, Mainboard, ...

Note

If you face any issues, find bugs or if your platform is not supported yet, do not hesitate to create an issue.

Content

  • hwinfo
    • Content
    • Supported Components
    • Build hwinfo
    • Example
    • include hwinfo to cmake project
      • Include installed version
      • As git submodule

Supported Components

Note

The listed components that are not yet implemented (indicated with ❌) are in development and will be supported in future releases. You are welcome to start contributing and help improving this library!

Component Info Linux Apple Windows
CPU Vendor ✔️ ✔️ ✔️
Model ✔️ ✔️ ✔️
Frequency ✔️ ❌️ ✔️
Physical Cores ✔️ ✔️ ✔️
Logical Cores ✔️ ✔️ ✔️
Cache Size ✔️ ✔️️ ✔️
GPU Vendor ✔️ ❌️ ✔️
Model ✔️ ❌️ ✔️
Memory Size ❌ ❌ ✔️
Memory (RAM) Vendor ❌ ❌ ✔️
Model ❌ ❌ ✔️
Name ❌ ❌ ✔️
Serial Number ❌ ❌ ✔️
Total Memory Size ✔️ ✔️ ✔️
Free Memory Size ✔️ ✔️ ✔️
Mainboard Vendor ✔️ ✔️ ✔️
Model ✔️ ❌ ✔️
Version ✔️ ❌ ✔️
Serial-Number ❌ ✔️ ✔️
Bios ❌ ❌ ❌
Disk Vendor ✔️ ✔️ ✔️
Model ✔️ ✔️ ✔️
Serial-Number ✔️ ✔️ ✔️
Size ✔️ ✔️ ✔️
Free Size ✔️ ✔️ ✔️
Volumes ✔️ ✔️ ✔️
Operating System Name ✔️ ✔️ ✔️
Short Name ✔️ ✔️ ✔️
Version ✔️ ✔️ ❌
Kernel ✔️ ✔️ ❌
Architecture (Bit) ✔️ ✔️ ✔️
Endianess ✔️ ✔️ ✔️
Battery Vendor ✔️ ❌️ ❌
Model ✔️ ❌ ❌
Serial Number ✔️ ✔️ ❌
Technology ✔️ ❌ ❌
Capacity ✔️ ✔️ ️❌
Charging ✔️ ✔️ ❌

All components are available via the hwinfo::hwinfo target, or via individual CMake targets, which you can choose and link against depending on your needs.

cmake
target_link_libraries(your_target PRIVATE hwinfo::hwinfo)

or

cmake
target_link_libraries(
  your_target
  PRIVATE hwinfo::cpu
          hwinfo::gpu
          hwinfo::ram
          hwinfo::mainboard
          hwinfo::disk
          hwinfo::os
          hwinfo::battery)

The CMake options control which components will be built and available in the library:

  • HWINFO_OS "Enable OS detection" (default to ON)
  • HWINFO_MAINBOARD "Enable mainboard detection" (default to ON)
  • HWINFO_CPU "Enable CPU detection" (default to ON)
  • HWINFO_DISK "Enable disk detection" (default to ON)
  • HWINFO_RAM "Enable RAM detection" (default to ON)
  • HWINFO_GPU "Enable GPU detection" (default to ON)
  • HWINFO_GPU_OPENCL "Enable usage of OpenCL in GPU information" (default to OFF)
  • HWINFO_BATTERY "Enable battery detection" (default to ON)

Build hwinfo

Requirements: git, cmake, c++ compiler (gcc, clang, MSVC)

  1. Download repository:
    bash
    git clone https://github.com/lfreist/hwinfo
  2. Build using cmake:
    bash
    mkdir build
    cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CONFIGURATION_TYPES=Release
    cmake --build build --config Release
    This builds static and dynamic libraries. Static library cmake targets are named _static (e.g. hwinfo_static)

Example

See system_infoMain.cpp

The output should look similar to this one:

…

include hwinfo to cmake project

Include installed version

  1. Install hwinfo
    bash
    git clone https://github.com/lfreist/hwinfo && cd hwinfo
    mkdir build
    cmake -B build && cmake --build build
    cmake --install build
  2. Simply add the following to your CMakeLists.txt file:
    cmake
    # file: CMakeLists.txt
    
    find_package(hwinfo REQUIRED)
  3. Include hwinfo into your .cpp/.h files:
    cpp
    // file: your_executable.cpp
    
    #include 
    
    int main(int argc, char** argv) {
     // Your code
    }
  4. Link it in cmake
    cmake
    add_executable(your_executable your_executable.cpp)
    target_link_libraries(your_executable PUBLIC lfreist-hwinfo::hwinfo)

As git submodule

  1. Download hwinfo into your project (e.g. in /third_party/hwinfo)
    bash
    mkdir third_party
    cd third_party
    git clone https://github.com/lfreist/hwinfo
  2. Simply add the following to your /CMakeLists.txt file:
    cmake
    # file: /CMakeLists.txt
    
    # define the HWINFO_* options if you want to change the default values
    
    add_subdirectory(third_party/hwinfo)
  3. Include hwinfo into your .cpp/.h files:
    cpp
    // file: your_executable.cpp
    
    #include "hwinfo/hwinfo.h"
    
    int main(int argc, char** argv) {
     // Your code
    }
  4. Link it in cmake
    cmake
    add_executable(your_executable your_executable.cpp)
    target_link_libraries(your_executable PUBLIC lfreist-hwinfo::hwinfo)

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

C++apiapplec-plus-pluscpp

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category数据库
PricingOpen source

> Related tools

P
PostgreSQL
功能强大的开源关系型数据库
R
Redis
内存数据结构存储,常用作缓存与队列
M
MySQL
广泛使用的开源关系型数据库