#pragma once

namespace td {
namespace utils {

enum class Os {
	Windows = 0,
	Linux,
	Android,
	Unknown,
};

enum class Architecture {
	x86_64 = 0,
	x86,
	Arm64,
	Armhf,
	Unknown,
};

inline Os GetSystemOs() {
#if defined(_WIN32) || defined(_WIN64)
	return Os::Windows;
#elif defined(__ANDROID__)
	return Os::Android;
#elif defined(__unix__)
	return Os::Linux;
#else
#pragma message ("Target OS unknown or unsupported !")
	return Os::Unknown;
#endif
}

inline Architecture GetSystemArchitecture() {
#if defined(_WIN64)
	return Architecture::x86_64;
#elif defined(_WIN32)
	return Architecture::x86;
#elif defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64)
	return Architecture::x86_64;
#elif defined(_M_IX86) || defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)
	return Architecture::x86;
#elif defined(__aarch64__)
	return Architecture::Arm64;
#elif defined(__arm__) || defined(_M_ARM)
	return Architecture::Armhf;
#else
#pragma message ("Target CPU architecture unknown or unsupported !")
	return Architecture::Unknown;
#endif
}

} // namespace utils 
} // namespace td
