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
58
namespace
ph::os
59
{
60
61
enum class
EWindowsVersion
62
{
63
Unknown
= 0,
64
65
// Later version must have larger value
66
67
Windows_2000
,
68
Windows_XP
,
69
Windows_Vista
,
70
Windows_7
,
71
Windows_8
,
72
Windows_8_1
,
73
Windows_10
74
};
75
78
EWindowsVersion
get_windows_version
();
79
83
std::size_t
get_L1_cache_line_size_in_bytes
();
84
89
std::filesystem::path
get_executable_path
();
90
91
}
// end namespace ph::os
ph::os
Definition
os.h:59
ph::os::EWindowsVersion
EWindowsVersion
Definition
os.h:62
ph::os::EWindowsVersion::Windows_8_1
@ Windows_8_1
ph::os::EWindowsVersion::Windows_XP
@ Windows_XP
ph::os::EWindowsVersion::Windows_2000
@ Windows_2000
ph::os::EWindowsVersion::Unknown
@ Unknown
ph::os::EWindowsVersion::Windows_10
@ Windows_10
ph::os::EWindowsVersion::Windows_7
@ Windows_7
ph::os::EWindowsVersion::Windows_Vista
@ Windows_Vista
ph::os::EWindowsVersion::Windows_8
@ Windows_8
ph::os::get_windows_version
EWindowsVersion get_windows_version()
Get current Windows version at runtime.
Definition
os.cpp:189
ph::os::get_executable_path
std::filesystem::path get_executable_path()
Get the path to the currently running executable. Answering the question, "Where am I?...
Definition
os.cpp:201
ph::os::get_L1_cache_line_size_in_bytes
std::size_t get_L1_cache_line_size_in_bytes()
Get size of L1 cache at runtime.
Definition
os.cpp:195
Include
Common
os.h
Generated by
1.11.0