Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HWinfo modular #94

Closed
lfreist opened this issue Jul 7, 2024 · 2 comments · Fixed by #98
Closed

Make HWinfo modular #94

lfreist opened this issue Jul 7, 2024 · 2 comments · Fixed by #98
Assignees
Labels
clean-code Something in the code structure/style should be changed enhancement New feature or request

Comments

@lfreist
Copy link
Owner

lfreist commented Jul 7, 2024

I would suggest removing GPU information from the library entirely. If people need information about the GPU, getting it from Vulkan, DirectX, OpenGL, or OpenCL is already really well documented. Those standards [and similar] are really the only places people would need it anyhow.

I would suggest removing GPU information from the library entirely. If people need information about the GPU, getting it from Vulkan, DirectX, OpenGL, or OpenCL is already really well documented. Those standards [and similar] are really the only places people would need it anyhow.

I'm not trying to be rude, but there really is zero reason to include it. For people who are already using one of these frameworks, adding OpenCL on top of it is unacceptable in most cases especially considering OpenCL is on its way out the door to be replaced with other alternative frameworks.

Edit: Had a quick think. It'd probably be better to make the entire library modular. You already have the library well divided as appropriate, making it modular seems like a very safe next step. In other words, I mean making the motherboard, battery, CPU, etc. dependent on user choice.

original post by @F35H in #54 (comment)

@lfreist lfreist added clean-code Something in the code structure/style should be changed enhancement New feature or request labels Jul 7, 2024
@lfreist lfreist self-assigned this Jul 7, 2024
@aminya
Copy link
Contributor

aminya commented Jul 8, 2024

There are still benefits to providing this information in an abstracted way. That's the point of giving a cross-platform way to know the hardware information.

However, we can provide separate CMake targets (libraries) and in the super-target, we can guard these features using CMake compile flags that set up the dependencies. This provides granular access for those interested as well as providing an easy way to access all the info in one target.

CMakeLists.txt

add_library(hwinfo_gpu)
add_library(hwinfo_cpu)
# etc.

add_library(hwinfo)

option(HWINFO_GPU "Provide GPU information" ON)
if (HWINFO_GPU)
	target_link_libraries(hwinfo PUBLIC hwinfo_gpu)
	target_compile_definitions(hwinfo PUBLIC "HWINFO_GPU")
endif()

# etc.

hwinfo.h

#pragma once

#ifdef HWINFO_GPU
#include <hwinfo/gpu.h> // IWYU pragma: export
#endif

// etc.

Those who only need hwinfo_cpu for example, can only link that target.
Those who use the hwinfo target directly, can use CMake flags to customize the features.

@lfreist
Copy link
Owner Author

lfreist commented Jul 9, 2024

Yes, the plan is to continue supporting GPU using OpenCL (and maybe also other backends...) but provide the information of the hardware components in modules (as CMake targets hwinfo_[gpu|cpu|ram|disk|mainboard|...])

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clean-code Something in the code structure/style should be changed enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants