Merge pull request #23 from per-mathisen-arm/master
Workaround for Android build issue with JSON library used
diff --git a/hwcpipe.cpp b/hwcpipe.cpp
index bdd00a3..2d3ba19 100644
--- a/hwcpipe.cpp
+++ b/hwcpipe.cpp
@@ -25,18 +25,21 @@
#include "hwcpipe.h"
#include "hwcpipe_log.h"
-#ifdef linux
+#ifdef __linux__
# include "vendor/arm/pmu/pmu_profiler.h"
# include "vendor/arm/mali/mali_profiler.h"
#endif
+#ifndef HWCPIPE_NO_JSON
#include <json.hpp>
using json = nlohmann::json;
+#endif
#include <memory>
namespace hwcpipe
{
+#ifndef HWCPIPE_NO_JSON
HWCPipe::HWCPipe(const char *json_string)
{
auto json = json::parse(json_string);
@@ -79,6 +82,7 @@
create_profilers(std::move(enabled_cpu_counters), std::move(enabled_gpu_counters));
}
+#endif
HWCPipe::HWCPipe(CpuCounterSet enabled_cpu_counters, GpuCounterSet enabled_gpu_counters)
{
@@ -167,7 +171,7 @@
void HWCPipe::create_profilers(CpuCounterSet enabled_cpu_counters, GpuCounterSet enabled_gpu_counters)
{
// Automated platform detection
-#ifdef linux
+#ifdef __linux__
try
{
cpu_profiler_ = std::unique_ptr<PmuProfiler>(new PmuProfiler(enabled_cpu_counters));
diff --git a/hwcpipe.h b/hwcpipe.h
index 3ed73f2..81752d3 100644
--- a/hwcpipe.h
+++ b/hwcpipe.h
@@ -42,8 +42,10 @@
class HWCPipe
{
public:
+#ifndef HWCPIPE_NO_JSON
// Initializes HWCPipe via a JSON configuration string
explicit HWCPipe(const char *json_string);
+#endif
// Initializes HWCPipe with the specified counters
HWCPipe(CpuCounterSet enabled_cpu_counters, GpuCounterSet enabled_gpu_counters);