|
1 | 1 | # Base library - fundamental utilities and platform abstractions |
2 | 2 | cmake_minimum_required(VERSION 3.16) |
3 | 3 |
|
4 | | -# Create interface library for headers-only components |
5 | | -add_library(cfbase_interface INTERFACE) |
| 4 | +# Include subdirectory CMakeLists |
| 5 | +add_subdirectory(system/cpu) |
| 6 | +add_subdirectory(system/memory) |
6 | 7 |
|
7 | | -# Target for CPU info module |
8 | | -add_library(cfbase_cpu STATIC |
9 | | - system/cpu/cfcpu.cpp |
10 | | - system/cpu/cfcpu_profile.cpp |
11 | | - system/cpu/cfcpu_bonus.cpp |
12 | | -) |
| 8 | +# ============================================================ |
| 9 | +# Unified Base Library |
| 10 | +# ============================================================ |
13 | 11 |
|
14 | | -target_include_directories(cfbase_cpu |
15 | | - PUBLIC |
16 | | - ${CMAKE_CURRENT_SOURCE_DIR}/include |
17 | | - PRIVATE |
18 | | - ${CMAKE_CURRENT_SOURCE_DIR}/system |
19 | | -) |
| 12 | +# Create interface library that merges all sub-libraries |
| 13 | +add_library(cfbase INTERFACE) |
20 | 14 |
|
21 | | -target_link_libraries(cfbase_cpu |
22 | | - PUBLIC |
23 | | - Qt6::Core |
| 15 | +# Link all CPU and memory modules |
| 16 | +target_link_libraries(cfbase INTERFACE |
| 17 | + cfbase_cpu_info |
| 18 | + cfbase_cpu_profile |
| 19 | + cfbase_cpu_bonus |
| 20 | + cfbase_cpu_features |
| 21 | + cfbase_memory_info |
| 22 | + Qt6::Core |
24 | 23 | ) |
25 | 24 |
|
26 | | -# Platform-specific sources |
| 25 | +# Platform-specific link for unified library |
27 | 26 | if(WIN32) |
28 | | - # Windows specific implementations |
29 | | - target_sources(cfbase_cpu PRIVATE |
30 | | - system/cpu/private/win_impl/cpu_profile.cpp |
31 | | - system/cpu/private/win_impl/cpu_bonus.cpp |
32 | | - system/cpu/private/win_impl/cpu_features.cpp |
33 | | - system/cpu/private/win_impl/cpu_info.cpp |
34 | | - ) |
35 | | - target_include_directories(cfbase_cpu PRIVATE |
36 | | - ${CMAKE_CURRENT_SOURCE_DIR}/base/windows |
37 | | - ) |
38 | | - # Link Windows WMI libraries for CPU info |
39 | | - target_link_libraries(cfbase_cpu PUBLIC wbemuuid PowrProf pdh) |
40 | | -elseif(UNIX) |
41 | | - # Linux/Unix specific implementations |
42 | | - target_sources(cfbase_cpu PRIVATE |
43 | | - system/cpu/private/linux_impl/cpu_profile.cpp |
44 | | - system/cpu/private/linux_impl/cpu_bonus.cpp |
45 | | - system/cpu/private/linux_impl/cpu_features.cpp |
46 | | - system/cpu/private/linux_impl/cpu_info.cpp |
47 | | - utils/linux/proc_parser.cpp |
| 27 | + target_link_libraries(cfbase INTERFACE |
| 28 | + wbemuuid |
| 29 | + PowrProf |
| 30 | + pdh |
| 31 | + psapi |
48 | 32 | ) |
49 | 33 | endif() |
50 | 34 |
|
51 | | -# Alias for convenience |
52 | | -add_library(CFDesktop::base_cpu ALIAS cfbase_cpu) |
53 | | -add_library(CFDesktop::base_interface ALIAS cfbase_interface) |
54 | | - |
55 | | -# Group sources for IDEs |
56 | | -source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} PREFIX "base" FILES |
57 | | - system/cpu/cfcpu.cpp |
58 | | - system/cpu/private/win_impl/cpu.cpp |
59 | | - base/windows/co_helper.cpp |
60 | | -) |
| 35 | +# ============================================================ |
| 36 | +# Aliases |
| 37 | +# ============================================================ |
| 38 | +add_library(CFDesktop::base ALIAS cfbase) |
0 commit comments