aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Balsini <balsini@google.com>2024-03-04 14:43:00 +0000
committerAlessio Balsini <balsini@google.com>2024-03-05 10:20:00 +0000
commit040233a7d45d2f60f361042b01f7f8f1b4c57550 (patch)
tree66f401df161b184ca978742c1d0f98c2e2561916
parent147963359aea13e21fa45e2425cf8a31f1f130bd (diff)
downloaddittosuite-040233a7d45d2f60f361042b01f7f8f1b4c57550.tar.gz
Update protobuf header include path
When building the project with Kleaf, the root path is different from the Dittosuite root, causing the protobuffer-generated headers to not be found in the expected folder. After several attemps, the simplest solution that unifies Android.bp, CMake and Bazel is to explicitly include the PB directory "schema". This works for both CMake and Bazel, and is also what was is done by Android by default. The `#ifdef __ANDROID__` condition to choose if including `<benchmark.pb.h>` or `"schema/benchmark.pb.h"` is not needed anymore, as `<benchmark.pb.h>` now works in both cases. Bug: 322744630 Test: bazel build --enable_bzlmod --config=internet \ //test/dittosuite:dittobench # From common-android-mainline Change-Id: Ibb90679689178169add35c866c4935f30686ccc0 Signed-off-by: Alessio Balsini <balsini@google.com>
-rw-r--r--BUILD.bazel5
-rw-r--r--CMakeLists.txt1
-rw-r--r--dittotrace.cpp4
-rw-r--r--include/ditto/instruction_factory.h4
-rw-r--r--include/ditto/multithreading_utils.h4
-rw-r--r--include/ditto/parser.h4
-rw-r--r--include/ditto/result.h4
-rw-r--r--include/ditto/tracer.h4
8 files changed, 5 insertions, 25 deletions
diff --git a/BUILD.bazel b/BUILD.bazel
index 016091a..cc96d1d 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -41,7 +41,10 @@ cc_library(
hdrs = glob([
"include/ditto/*.h",
]),
- includes = ["include"],
+ includes = [
+ "include",
+ "schema",
+ ],
deps = [
":dittosuite_cc_proto",
],
diff --git a/CMakeLists.txt b/CMakeLists.txt
index a1196d9..12ed4ff 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,6 +10,7 @@ add_subdirectory(schema)
include_directories(include)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
+include_directories(${CMAKE_BINARY_DIR}/schema)
file(GLOB libditto_src
src/*.cpp
diff --git a/dittotrace.cpp b/dittotrace.cpp
index 47a1bc2..39281f5 100644
--- a/dittotrace.cpp
+++ b/dittotrace.cpp
@@ -18,11 +18,7 @@
#include <string>
#include <vector>
-#ifdef __ANDROID__
#include <benchmark.pb.h>
-#else
-#include "schema/benchmark.pb.h"
-#endif
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/text_format.h>
diff --git a/include/ditto/instruction_factory.h b/include/ditto/instruction_factory.h
index 33fa75a..213eaa3 100644
--- a/include/ditto/instruction_factory.h
+++ b/include/ditto/instruction_factory.h
@@ -21,11 +21,7 @@
#include <ditto/instruction_set.h>
#include <ditto/read_write_file.h>
-#ifdef __ANDROID__
#include <benchmark.pb.h>
-#else
-#include "schema/benchmark.pb.h"
-#endif
namespace dittosuite {
diff --git a/include/ditto/multithreading_utils.h b/include/ditto/multithreading_utils.h
index 9c17a6d..0efce35 100644
--- a/include/ditto/multithreading_utils.h
+++ b/include/ditto/multithreading_utils.h
@@ -14,11 +14,7 @@
#pragma once
-#ifdef __ANDROID__
#include <benchmark.pb.h>
-#else
-#include "schema/benchmark.pb.h"
-#endif
#include <ditto/logger.h>
#include <ditto/syscall.h>
diff --git a/include/ditto/parser.h b/include/ditto/parser.h
index 8c7a767..5d7c9b3 100644
--- a/include/ditto/parser.h
+++ b/include/ditto/parser.h
@@ -17,11 +17,7 @@
#include <string>
#include <ditto/instruction_set.h>
-#ifdef __ANDROID__
#include <benchmark.pb.h>
-#else
-#include "schema/benchmark.pb.h"
-#endif
namespace dittosuite {
diff --git a/include/ditto/result.h b/include/ditto/result.h
index 7f6f3d9..fbacab7 100644
--- a/include/ditto/result.h
+++ b/include/ditto/result.h
@@ -14,11 +14,7 @@
#pragma once
-#ifdef __ANDROID__
#include <result.pb.h>
-#else
-#include "schema/result.pb.h"
-#endif
#include <time.h>
diff --git a/include/ditto/tracer.h b/include/ditto/tracer.h
index 0832950..c46b619 100644
--- a/include/ditto/tracer.h
+++ b/include/ditto/tracer.h
@@ -17,11 +17,7 @@
#include <memory>
#include <fstream>
-#ifdef __ANDROID__
#include <benchmark.pb.h>
-#else
-#include "schema/benchmark.pb.h"
-#endif
namespace dittosuite {