diff --git a/CMakeLists.txt b/CMakeLists.txt index 5cd7c132e..a871e5f5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -94,6 +94,10 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMESA_EGL_NO_X11_HEADERS") +if(Protobuf_VERSION GREATER_EQUAL "3.7") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_PROTOBUF_CALLBACK_HEADER") +endif() + ##################################################################### # Enable code coverage calculation with gcov/gcovr/lcov # Usage: diff --git a/android/opengl/system/gralloc/gralloc.cpp b/android/opengl/system/gralloc/gralloc.cpp index f8f929228..e89fa0f03 100644 --- a/android/opengl/system/gralloc/gralloc.cpp +++ b/android/opengl/system/gralloc/gralloc.cpp @@ -688,7 +688,7 @@ static int gralloc_lock(gralloc_module_t const* module, if (sw_read) { D("gralloc_lock read back color buffer %d %d\n", cb->width, cb->height); rcEnc->rcReadColorBuffer(rcEnc, cb->hostHandle, - 0, 0, cb->width, cb->height, GL_RGBA, GL_UNSIGNED_BYTE, cpu_addr); + 0, 0, cb->width, cb->height, cb->glFormat, cb->glType, cpu_addr); } } diff --git a/external/android-emugl/host/libs/CMakeLists.txt b/external/android-emugl/host/libs/CMakeLists.txt index f3141bf2a..25c813c1e 100644 --- a/external/android-emugl/host/libs/CMakeLists.txt +++ b/external/android-emugl/host/libs/CMakeLists.txt @@ -1,4 +1,23 @@ -set(GENERATED_SOURCES +FUNCTION(PREPEND var prefix) + SET(listVar "") + FOREACH(f ${ARGN}) + LIST(APPEND listVar "${prefix}/${f}") + ENDFOREACH(f) + SET(${var} "${listVar}" PARENT_SCOPE) +ENDFUNCTION(PREPEND) + +PREPEND(GLHEADERS_SOURCES libOpenGLESDispatch/ + render_egl_extensions.entries + render_egl.entries + gles_common.entries + gles_extensions.entries + gles1_only.entries + gles1_extensions.entries + gles2_only.entries + gles2_extensions.entries + gles3_only.entries) + +PREPEND(GLHEADERS_GENERATED_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/../include/OpenGLESDispatch/ gles1_extensions_functions.h gles1_only_functions.h gles2_extensions_functions.h @@ -6,18 +25,16 @@ set(GENERATED_SOURCES gles3_only_functions.h gles_common_functions.h gles_extensions_functions.h - gles_functions.h RenderEGL_extensions_functions.h RenderEGL_functions.h) -add_custom_target(GLHeaders) add_custom_command( - TARGET GLHeaders - POST_BUILD + OUTPUT ${GLHEADERS_GENERATED_SOURCES} COMMAND ${CMAKE_SOURCE_DIR}/scripts/gen-emugl-headers.sh ${CMAKE_BINARY_DIR} + DEPENDS ${GLHEADERS_SOURCES} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) -add_subdirectory(GLESv1_dec) -add_subdirectory(GLESv2_dec) -add_subdirectory(libOpenGLESDispatch) -add_subdirectory(renderControl_dec) +include(GLESv1_dec/CMakeLists.txt) +include(GLESv2_dec/CMakeLists.txt) +include(libOpenGLESDispatch/CMakeLists.txt) +include(renderControl_dec/CMakeLists.txt) diff --git a/external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt b/external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt index c057c59ef..d748250f1 100644 --- a/external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt +++ b/external/android-emugl/host/libs/GLESv1_dec/CMakeLists.txt @@ -1,4 +1,6 @@ -set(GENERATED_SOURCES +set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/GLESv1_dec) + +PREPEND(GENERATED_SOURCES ${CURRENT_BINARY_DIR}/ gles1_dec.cpp gles1_opcodes.h gles1_server_context.cpp) @@ -6,12 +8,12 @@ set(GENERATED_SOURCES add_custom_command( OUTPUT ${GENERATED_SOURCES} POST_BUILD - COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen - -D ${CMAKE_CURRENT_BINARY_DIR} gles1 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND mkdir -p ${CURRENT_BINARY_DIR} && ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen + -D ${CURRENT_BINARY_DIR} gles1 + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DEPENDS emugen) -set(SOURCES +PREPEND(SOURCES ${CMAKE_CURRENT_LIST_DIR}/ GLESv1Decoder.cpp) if ("${cmake_build_type_lower}" STREQUAL "trace") @@ -20,6 +22,5 @@ if ("${cmake_build_type_lower}" STREQUAL "trace") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENGL_DEBUG}") endif() -add_library(GLESv1_dec STATIC ${SOURCES} ${GENERATED_SOURCES}) -add_dependencies(GLESv1_dec GLHeaders) +add_library(GLESv1_dec STATIC ${SOURCES} ${GENERATED_SOURCES} ${GLHEADERS_GENERATED_SOURCES}) target_link_libraries(GLESv1_dec OpenglCodecCommon) diff --git a/external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt b/external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt index 0e4ad0d2b..b61ef75fd 100644 --- a/external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt +++ b/external/android-emugl/host/libs/GLESv2_dec/CMakeLists.txt @@ -1,4 +1,6 @@ -set(GENERATED_SOURCES +set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/GLESv2_dec) + +PREPEND(GENERATED_SOURCES ${CURRENT_BINARY_DIR}/ gles2_dec.cpp gles2_opcodes.h gles2_server_context.cpp) @@ -6,12 +8,12 @@ set(GENERATED_SOURCES add_custom_command( OUTPUT ${GENERATED_SOURCES} POST_BUILD - COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen - -D ${CMAKE_CURRENT_BINARY_DIR} gles2 - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND mkdir -p ${CURRENT_BINARY_DIR} && ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen + -D ${CURRENT_BINARY_DIR} gles2 + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DEPENDS emugen) -set(SOURCES +PREPEND(SOURCES ${CMAKE_CURRENT_LIST_DIR}/ GLESv2Decoder.cpp) if ("${cmake_build_type_lower}" STREQUAL "trace") @@ -20,6 +22,5 @@ if ("${cmake_build_type_lower}" STREQUAL "trace") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OPENGL_DEBUG}") endif() -add_library(GLESv2_dec STATIC ${SOURCES} ${GENERATED_SOURCES}) -add_dependencies(GLESv2_dec GLHeaders) +add_library(GLESv2_dec STATIC ${SOURCES} ${GENERATED_SOURCES} ${GLHEADERS_GENERATED_SOURCES}) target_link_libraries(GLESv2_dec OpenglCodecCommon) diff --git a/external/android-emugl/host/libs/libOpenGLESDispatch/CMakeLists.txt b/external/android-emugl/host/libs/libOpenGLESDispatch/CMakeLists.txt index 46c4847ff..0ed343271 100644 --- a/external/android-emugl/host/libs/libOpenGLESDispatch/CMakeLists.txt +++ b/external/android-emugl/host/libs/libOpenGLESDispatch/CMakeLists.txt @@ -1,10 +1,9 @@ -set(SOURCES +PREPEND(SOURCES ${CMAKE_CURRENT_LIST_DIR}/ EGLDispatch.cpp GLESv2Dispatch.cpp GLESv1Dispatch.cpp) -add_library(OpenGLESDispatch STATIC ${SOURCES}) -add_dependencies(OpenGLESDispatch GLHeaders) +add_library(OpenGLESDispatch STATIC ${SOURCES} ${GLHEADERS_GENERATED_SOURCES}) target_link_libraries(OpenGLESDispatch emugl_common GLESv2_dec diff --git a/external/android-emugl/host/libs/renderControl_dec/CMakeLists.txt b/external/android-emugl/host/libs/renderControl_dec/CMakeLists.txt index 4b0786f7d..3b2f89029 100644 --- a/external/android-emugl/host/libs/renderControl_dec/CMakeLists.txt +++ b/external/android-emugl/host/libs/renderControl_dec/CMakeLists.txt @@ -1,13 +1,15 @@ -set(GENERATED_SOURCES +set(CURRENT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/GLESv1_dec) + +PREPEND(GENERATED_SOURCES ${CURRENT_BINARY_DIR}/ renderControl_dec.cpp renderControl_server_context.cpp) add_custom_command( OUTPUT ${GENERATED_SOURCES} POST_BUILD - COMMAND ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen - -D ${CMAKE_CURRENT_BINARY_DIR} renderControl - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} + COMMAND mkdir -p ${CURRENT_BINARY_DIR} && ${CMAKE_BINARY_DIR}/external/android-emugl/host/tools/emugen/emugen + -D ${CURRENT_BINARY_DIR} renderControl + WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR} DEPENDS emugen) if ("${cmake_build_type_lower}" STREQUAL "trace") diff --git a/src/anbox/bridge/android_api_stub.cpp b/src/anbox/bridge/android_api_stub.cpp index 45325d593..b81ebe5e4 100644 --- a/src/anbox/bridge/android_api_stub.cpp +++ b/src/anbox/bridge/android_api_stub.cpp @@ -26,6 +26,10 @@ #include "anbox_rpc.pb.h" #include +#ifdef USE_PROTOBUF_CALLBACK_HEADER +#include +#endif + namespace fs = boost::filesystem; diff --git a/src/anbox/bridge/platform_api_skeleton.cpp b/src/anbox/bridge/platform_api_skeleton.cpp index b4457481e..1274754eb 100644 --- a/src/anbox/bridge/platform_api_skeleton.cpp +++ b/src/anbox/bridge/platform_api_skeleton.cpp @@ -28,6 +28,10 @@ #include "anbox_bridge.pb.h" +#ifdef USE_PROTOBUF_CALLBACK_HEADER +#include +#endif + namespace anbox { namespace bridge { PlatformApiSkeleton::PlatformApiSkeleton( diff --git a/src/anbox/container/management_api_skeleton.cpp b/src/anbox/container/management_api_skeleton.cpp index 9beff477a..93a43bbb7 100644 --- a/src/anbox/container/management_api_skeleton.cpp +++ b/src/anbox/container/management_api_skeleton.cpp @@ -25,6 +25,10 @@ #include "anbox_container.pb.h" #include "anbox_rpc.pb.h" +#ifdef USE_PROTOBUF_CALLBACK_HEADER +#include +#endif + namespace anbox { namespace container { ManagementApiSkeleton::ManagementApiSkeleton( diff --git a/src/anbox/container/management_api_stub.cpp b/src/anbox/container/management_api_stub.cpp index ef2d103a9..e2a0584ed 100644 --- a/src/anbox/container/management_api_stub.cpp +++ b/src/anbox/container/management_api_stub.cpp @@ -22,6 +22,10 @@ #include "anbox_container.pb.h" #include "anbox_rpc.pb.h" +#ifdef USE_PROTOBUF_CALLBACK_HEADER +#include +#endif + namespace anbox { namespace container { diff --git a/src/anbox/rpc/pending_call_cache.cpp b/src/anbox/rpc/pending_call_cache.cpp index 1e0ff789f..15094f816 100644 --- a/src/anbox/rpc/pending_call_cache.cpp +++ b/src/anbox/rpc/pending_call_cache.cpp @@ -20,6 +20,10 @@ #include "anbox_rpc.pb.h" +#ifdef USE_PROTOBUF_CALLBACK_HEADER +#include +#endif + namespace anbox { namespace rpc { PendingCallCache::PendingCallCache() {} diff --git a/src/anbox/rpc/template_message_processor.h b/src/anbox/rpc/template_message_processor.h index 3032840ec..328a6216e 100644 --- a/src/anbox/rpc/template_message_processor.h +++ b/src/anbox/rpc/template_message_processor.h @@ -20,6 +20,9 @@ #define ANBOX_RPC_TEMPLATE_MESSAGE_PROCESSOR_H_ #include +#ifdef USE_PROTOBUF_CALLBACK_HEADER +#include +#endif #include "anbox/rpc/message_processor.h"