-
Notifications
You must be signed in to change notification settings - Fork 134
cmake
The Tumultuous Unicorn Of Darkness edited this page Aug 26, 2024
·
2 revisions
CPU-X uses CMake to generate files for build system.
There is one CMakeLists.txt
per directory, like this:
.
├── CMakeLists.txt
├── data
│ ├── CMakeLists.txt
│ ├── completions
│ │ └── CMakeLists.txt
│ ├── icons
│ │ └── CMakeLists.txt
│ └── logos
│ └── CMakeLists.txt
├── po
│ └── CMakeLists.txt
├── scripts
├── src
│ ├── bandwidth
│ │ └── CMakeLists.txt
│ ├── CMakeLists.txt
│ └── dmidecode
│ └── CMakeLists.txt
├── tests
│ ├── awk
│ ├── CMakeLists.txt
│ └── grep
│ ├── results
│ └── samples
└── vagrant
Options and common variables are defined in the main CMakeLists.txt
file.
Example to check if msr_serialize_raw_data
exists in libcpuid:
check_symbol_exists(msr_serialize_raw_data "libcpuid/libcpuid.h" HAVE_MSR_SERIALIZE_RAW_DATA)
if(HAVE_MSR_SERIALIZE_RAW_DATA)
add_definitions(-DHAVE_MSR_SERIALIZE_RAW_DATA)
endif(HAVE_MSR_SERIALIZE_RAW_DATA)
Example to check if l1_instruction_asso
member exists in struct cpu_id_
in libcpuid:
check_struct_has_member("struct cpu_id_t" l1_instruction_assoc libcpuid/libcpuid.h HAVE_CPU_ID_L1I_INFO LANGUAGE C)
if(HAVE_CPU_ID_L1I_INFO)
add_definitions(-DHAVE_CPU_ID_L1I_INFO)
endif(HAVE_CPU_ID_L1I_INFO)
Example to check if PURPOSE_LP_EFFICIENCY
enum value exists in cpu_purpose_t
in libcpuid:
check_c_source_compiles(
"
#include <stdio.h>
#include <libcpuid/libcpuid.h>
int main()
{
printf(\"%i\", PURPOSE_LP_EFFICIENCY);
return 0;
}
"
HAS_LIBCPUID_PURPOSE_LP_EFFICIENCY
)
if(HAS_LIBCPUID_PURPOSE_LP_EFFICIENCY)
add_definitions(-DHAS_LIBCPUID_PURPOSE_LP_EFFICIENCY)
endif(HAS_LIBCPUID_PURPOSE_LP_EFFICIENCY)
- Gallery
- Get and install CPU-X
- Useful pages
- Developers zone
- Other pages