Photon Common Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
os.h
Go to the documentation of this file.
1#pragma once
2
15#include <cstddef>
16#include <filesystem>
17
18// Defined on Windows x64 & x86
19#if defined(_WIN32)
20
21 #define PH_OPERATING_SYSTEM_IS_WINDOWS 1
22
23// Defined on Linux
24#elif defined(__linux__)
25
26 #define PH_OPERATING_SYSTEM_IS_LINUX 1
27
28// Defined on Apple platforms
29// Reference: https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets
30#elif defined(__APPLE__) || defined(__MACH__)
31
32 #include <TargetConditionals.h>
33
34 #if TARGET_OS_MAC == 1 && TARGET_OS_OSX == 1
35 #define PH_OPERATING_SYSTEM_IS_OSX 1
36 #else
37 #error "Unsupported Apple operating system."
38 #endif
39
40#else
41
42 #error "Unsupported operating system."
43
44#endif
45
46#ifndef PH_OPERATING_SYSTEM_IS_WINDOWS
47 #define PH_OPERATING_SYSTEM_IS_WINDOWS 0
48#endif
49
50#ifndef PH_OPERATING_SYSTEM_IS_LINUX
51 #define PH_OPERATING_SYSTEM_IS_LINUX 0
52#endif
53
54#ifndef PH_OPERATING_SYSTEM_IS_OSX
55 #define PH_OPERATING_SYSTEM_IS_OSX 0
56#endif
57
58namespace ph::os
59{
60
62{
63 Unknown = 0,
64
65 // Later version must have larger value
66
74};
75
79
84
89std::filesystem::path get_executable_path();
90
91}// end namespace ph::os
Definition os.h:59
EWindowsVersion
Definition os.h:62
EWindowsVersion get_windows_version()
Get current Windows version at runtime.
Definition os.cpp:189
std::filesystem::path get_executable_path()
Get the path to the currently running executable. Answering the question, "Where am I?...
Definition os.cpp:201
std::size_t get_L1_cache_line_size_in_bytes()
Get size of L1 cache at runtime.
Definition os.cpp:195