Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,16 @@ if (NOT WITHOUT_QEMU)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}>
)

# Glib shim path (BUILD_INTERFACE only): shadows system glib for any
# in-tree TU that transitively includes qemu-plugin.h via libqemu's
# generated typedefs.h (which sits inside an extern "C" block in
# libqemu.h). Forward-decls of GArray/GByteArray are sufficient
# because qbox C++ never accesses glib internals.
target_include_directories(
${PROJECT_NAME} BEFORE PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/qemu-components/common/include/glib_shim>
)

target_link_libraries(${PROJECT_NAME} PUBLIC libqemu)

set(LIBQEMU_CXX_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/qemu-components/common/include/libqemu-cxx)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CPMDeclarePackage(SCP
CPMDeclarePackage(qemu
NAME libqemu
GIT_REPOSITORY ${LIBQEMU_GIT}
GIT_TAG libqemu-v11.0-v0.6
GIT_TAG libqemu-v11.0-v0.8
Comment thread
jeromehaxhiaj-qti marked this conversation as resolved.
GIT_SUBMODULES CMakeLists.txt
GIT_SHALLOW ON
)
24 changes: 24 additions & 0 deletions qemu-components/common/include/glib_shim/glib.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/*
* Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries. All Rights Reserved.
*
* SPDX-License-Identifier: BSD-3-Clause-Clear
*
* Forward-decl-only glib.h shim, on libqemu-cxx's PRIVATE include path
* BEFORE the system glib path.
*
* Why: libqemu's generated typedefs.h is wrapped in extern "C" by
* libqemu/libqemu.h, and qemu-plugin.h does `#include <glib.h>`. Modern
* glib.h has C++ template inline functions (g_steal_pointer, ...) that
* fail with "template with C linkage" inside extern "C". qbox's plugin
* API surface only references @c GArray and @c GByteArray as opaque
* pointers, so opaque forward-decls are sufficient — and shadowing real
* glib for the libqemu-cxx target only is safe because nothing in qbox
* C++ uses real glib internals.
*/
#ifndef GLIB_QBOX_SHIM_H
#define GLIB_QBOX_SHIM_H

typedef struct _GArray GArray;
typedef struct _GByteArray GByteArray;

#endif
Loading