cppp-platform is a portable platform check library for C++ Plus.
- CMake (version >= 3.12)
mkdir build
cd build
cmake .. -DCMAKE_INSTALL_PREFIX=[[PREFIX]]
cmake --build .
cmake --install .
After install, you can use cppp-platform in C/C++
#include <cppp/cppp-platform.h>
#include <stdio.h>
int main()
{
if(__has_windows__)
{
printf("Compile in Windows!\n");
}
else
{
printf("Compile non-Windows!\n");
}
printf("Target arch:%s\n",__arch__);
printf("Target arch name:%s\n",__arch_name__);
printf("Pointer width:%d\n",__POINTER_WIDTH__);
}