Skip to content

Commit e385e69

Browse files
authored
Merge pull request #274 from rpavlik/android-include-guard
Android file ifdef guard in loader
2 parents fcdd449 + f9289e1 commit e385e69

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Loader: Add `ifdef` guards around contents of Android-specific files so all platforms may still glob all source files in OpenXR-SDK to build the loader with a custom build system.

src/loader/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ else() # build static lib
4646
endif()
4747

4848
add_library(openxr_loader ${LIBRARY_TYPE}
49+
android_utilities.cpp
50+
android_utilities.h
4951
api_layer_interface.cpp
5052
api_layer_interface.hpp
5153
loader_core.cpp
@@ -231,8 +233,6 @@ elseif(ANDROID)
231233
CXX_STANDARD_REQUIRED TRUE)
232234
target_sources(openxr_loader
233235
PRIVATE
234-
${CMAKE_CURRENT_SOURCE_DIR}/android_utilities.cpp
235-
${CMAKE_CURRENT_SOURCE_DIR}/android_utilities.h
236236
${ANDROID_WRAP_SOURCES}
237237
${JNIPP_ROOT}/jnipp.cpp
238238
)

src/loader/android_utilities.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "android_utilities.h"
99

10+
#ifdef __ANDROID__
1011
#include <wrap/android.net.h>
1112
#include <wrap/android.content.h>
1213
#include <wrap/android.database.h>
@@ -314,3 +315,5 @@ int getActiveRuntimeVirtualManifest(wrap::android::content::Context const &conte
314315
return 0;
315316
}
316317
} // namespace openxr_android
318+
319+
#endif // __ANDROID__

src/loader/android_utilities.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// Initial Author: Ryan Pavlik <[email protected]>
77

88
#pragma once
9+
#ifdef __ANDROID__
910

1011
#include "wrap/android.content.h"
1112

@@ -27,3 +28,5 @@ using wrap::android::content::Context;
2728
*/
2829
int getActiveRuntimeVirtualManifest(wrap::android::content::Context const &context, Json::Value &virtualManifest);
2930
} // namespace openxr_android
31+
32+
#endif // __ANDROID__

0 commit comments

Comments
 (0)