Skip to content

Commit

Permalink
Reworking includes to avoid pragma once in cpp files
Browse files Browse the repository at this point in the history
  • Loading branch information
zite committed Jul 16, 2024
1 parent aa29f04 commit 1fc6b1f
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 47 deletions.
13 changes: 3 additions & 10 deletions Providers/Display/Display.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
#pragma once
#ifdef __linux__
#include <cstring>
#endif

#include "Display.h"
#include "Input/Input.h"
#include "UnityInterfaces.h"
#include "OpenVRProviderContext.h"
#include "CommonTypes.h"
#include "ProviderInterface/UnityXRDisplayStats.h"
#include "ProviderInterface/XRMath.h"
#include "UserProjectSettings.h"

#ifdef __linux__
#include <cstring>
#endif

// Interfaces
static IUnityXRDisplayInterface *s_pXRDisplay = nullptr;
Expand Down
9 changes: 7 additions & 2 deletions Providers/Display/Display.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,18 @@

#include <vector>
#include <limits>
#include <CommonTypes.h>

#include "ProviderInterface/IUnityXRDisplay.h"
#include "OpenVRSystem.h"
#include "OpenVRProviderContext.h"

#include "UnityInterfaces.h"

#include "ProviderInterface/IUnityXRDisplay.h"
#include "ProviderInterface/IUnityGraphics.h"
#include "ProviderInterface/IUnityGraphicsVulkan.h"
#include "ProviderInterface/UnityXRDisplayStats.h"
#include "ProviderInterface/XRMath.h"

#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(_WIN64) || defined(WINAPI_FAMILY)
#include "d3d11.h"
Expand All @@ -16,7 +22,6 @@
#else
#define XR_WIN 0
#endif
#include <CommonTypes.h>


#define kPI 3.14159265358979323846264338327950288419716939937510F
Expand Down
10 changes: 2 additions & 8 deletions Providers/Input/Input.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
#pragma once

#include "Input.h"
#include "UnityInterfaces.h"
#include "ProviderInterface/XRMath.h"

#include "UserProjectSettings.h"

#include <cassert>
#include <array>
#include <algorithm>
#include <sstream>
#include <chrono>

#include "Input.h"

static OpenVRProviderContext *s_pProviderContext;
static IUnityXRInputInterface *s_Input = nullptr;
int OpenVRInputProvider::hmdFeatureIndices[static_cast< int >( HMDFeature::Total )] = {};
Expand Down
14 changes: 9 additions & 5 deletions Providers/Input/Input.h
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
#pragma once

#include "ProviderInterface/IUnityXRInput.h"
#include <string>
#include <optional>
#include <variant>
#include <vector>

#include "OpenVRSystem.h"
#include "OpenVRProviderContext.h"

#include "Singleton.h"
#include "CommonTypes.h"
#include "UnityInterfaces.h"

#include <string>
#include <optional>
#include <variant>
#include <vector>
#include "ProviderInterface/XRMath.h"
#include "ProviderInterface/IUnityXRInput.h"


bool RegisterInputLifecycleProvider( OpenVRProviderContext *pOpenProviderContext );
Expand Down
1 change: 1 addition & 0 deletions Providers/OpenVRProviderContext.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <cassert>

#include "ProviderInterface/IUnityXRDisplay.h"

struct IUnityXRTrace;
Expand Down
9 changes: 1 addition & 8 deletions Providers/OpenVRSystem.cpp
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#pragma once
#include <cassert>

#include "OpenVRSystem.h"
#include "UnityInterfaces.h"
#include "CommonTypes.h"
#include "ProviderInterface/IUnityGraphics.h"
#include "ProviderInterface/IUnityInterface.h"
#include "UserProjectSettings.h"

#include <cassert>


OpenVRSystem::OpenVRSystem() :
Expand Down
9 changes: 8 additions & 1 deletion Providers/OpenVRSystem.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
#pragma once

#include "OpenVR/openvr.h"
#include "UserProjectSettings.h"

#include "CommonTypes.h"
#include "Singleton.h"

#include "UnityInterfaces.h"
#include "ProviderInterface/IUnityGraphics.h"
#include "ProviderInterface/IUnityInterface.h"
#include "ProviderInterface/IUnityXRPreInit.h"


extern "C" typedef void( *TickCallback )( int );

class OpenVRSystem : public Singleton<OpenVRSystem>
Expand Down
6 changes: 1 addition & 5 deletions Providers/UserProjectSettings.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#pragma once
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS TRUE
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS TRUE

#include "UserProjectSettings.h"
#include "CommonTypes.h"
#include "UnityInterfaces.h"
#include "Display/Display.h"

using namespace std;
using namespace std::string_view_literals;
Expand Down
3 changes: 3 additions & 0 deletions Providers/UserProjectSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
#include <string>

#include "OpenVR/openvr.h"
#include "UnityInterfaces.h"
#include "CommonTypes.h"
#include "ProviderInterface/IUnityXRDisplay.h"

enum EVRMirrorViewMode
{
Expand Down
13 changes: 5 additions & 8 deletions Providers/dllmain.cpp
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
#pragma once

#include "ProviderInterface/IUnityInterface.h"
#include "UnityInterfaces.h"
#include "CommonTypes.h"
#include "ProviderInterface/IUnityXRPreInit.h"
#include "ProviderInterface/IUnityXRTrace.h"
#include "ProviderInterface/UnitySubsystemTypes.h"

#include "OpenVRSystem.h"
#include "OpenVRProviderContext.h"
#include "Display/Display.h"
#include "Input/Input.h"
#include "UserProjectSettings.h"

#include "ProviderInterface/IUnityXRPreInit.h"
#include "ProviderInterface/IUnityXRTrace.h"
#include "ProviderInterface/UnitySubsystemTypes.h"
#include "ProviderInterface/IUnityInterface.h"

static OpenVRProviderContext *s_pOpenVRProviderContext {};

Expand Down

0 comments on commit 1fc6b1f

Please sign in to comment.