LIEF: Library to Instrument Executable Formats Version 0.15.0
Loading...
Searching...
No Matches
platforms.hpp
1/* Copyright 2017 - 2024 R. Thomas
2 * Copyright 2017 - 2024 Quarkslab
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16#ifndef LIEF_PLATFORMS_H
17#define LIEF_PLATFORMS_H
18#include "LIEF/platforms/android.hpp"
19
20#if defined(__APPLE__)
21 #include "TargetConditionals.h"
22#endif
23
24namespace LIEF {
25
26enum class PLATFORMS {
27 UNKNOWN = 0,
28 LINUX,
29 ANDROID_PLAT,
30 WINDOWS,
31 IOS,
32 OSX,
33};
34
35constexpr PLATFORMS current_platform() {
36#if defined(__ANDROID__)
37 return PLATFORMS::ANDROID_PLAT;
38#elif defined(__linux__)
39 return PLATFORMS::LINUX;
40#elif defined(_WIN64) || defined(_WIN32)
41 return PLATFORMS::WINDOWS;
42#elif defined(__APPLE__)
43 #if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
44 return PLATFORMS::IOS;
45 #else
46 return PLATFORMS::OSX;
47 #endif
48#else
49 return PLATFORMS::UNKNOWN;
50#endif
51
52}
53
54
55}
56
57#endif
LIEF namespace.
Definition Abstract/Binary.hpp:32