Cmake improvements#98
Open
Marco Liebel (quic-mliebel) wants to merge 14 commits into
Open
Conversation
Extract elf_loader into its own header/.cc so all libelf types and includes live in the .cc only; loader.h delegates elf_load() to gs::elf_loader. Move the libelf include dir to PRIVATE. This lets libelf become a PRIVATE dependency, needed for find_package(qbox). Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Extract zip_extract/zip_extract_nested plus a zip_open_from_memory
helper into zip_loader.{h,cc}; public headers see only an opaque
zip_t* forward decl. Move json_zip_archive into reg_model_maker.cc
and route smmuv3/smmu500 through zip_open_from_memory. loader.h keeps
a zip_t* handle so in-memory (INCBIN) archives are read from the live
handle. Lets libzip become PRIVATE, needed for find_package(qbox).
Add gs_memory/router/reg_router BUILD_INTERFACE include dirs to
compile reg_model_maker.cc in-tree.
Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
With zip.h and libelf.h no longer in public headers, move zip, libelf, Threads, pybind11, and dl to PRIVATE on qbox. rpc and Crow stay PUBLIC for now (pass, monitor, char_backend_socket inherit them transitively); they move to PRIVATE in the next commit. The pass and monitor plugins link rpc and Crow explicitly since they use them directly. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Drop the PackageProject.cmake dependency. Use CMake's built-in configure_package_config_file, write_basic_package_version_file, and install(EXPORT) to generate a qbox:: namespaced package config. qboxConfig.cmake.in calls find_dependency for all public deps; Lua is exported in the same export set. Move rpc and Crow to PRIVATE on qbox. Targets that need them link explicitly: pass->rpc, monitor->Crow, char_backend_socket gets an asio::asio guard, and test targets link gtest/gmock directly. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Convert hello-qbox to a standalone project demonstrating external consumption of qbox via find_package(qbox) + qbox::qbox. Remove it from the main build tree and fix INSTALL_INTERFACE paths to match the install layout. A CI job builds and runs it against an installed Qbox. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
char_backend_socket includes <asio.hpp> but had no explicit asio dep; it worked via Crow's transitive PUBLIC linkage. Moving Crow to PRIVATE broke this on macOS. Link asio::asio if present, else find_path (with Homebrew hints) and apply the include dir, ASIO_STANDALONE, and Threads. Linkage is PUBLIC since the header includes <asio.hpp>. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Remove the duplicate gs_addexpackage for rpclib introduced when PackageProject.cmake was deleted; rpclib is already fetched below. Drop the dead EXPORT qqvpTargets from the dynmod install (no matching install(EXPORT) exists; dynmods are runtime-loaded plugins) and the COMPONENT names referencing the undefined LIBRARY_NAME. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
The qemu-components install interface used an absolute
${CMAKE_INSTALL_PREFIX} path, leaking a non-relocatable path into
qboxTargets.cmake and pointing consumers at the install root instead
of the qemu include dir. Use a relative path so it resolves to
${_IMPORT_PREFIX}/qemu-components/common/include.
Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Installed qbox headers transitively include <glib.h>, but neither qbox's exported interface nor libqemu carried glib's include dir; in-tree builds only worked via a BUILD_INTERFACE glib shim. External find_package(qbox) consumers failed with 'glib.h: No such file'. Discover glib-2.0 via pkg-config, link PkgConfig::GLIB PUBLIC, and recreate the imported target in qboxConfig.cmake. The shim is retained for in-tree builds. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Platform configs locate sibling files (firmware images, nested configs) relative to their own Lua chunk source, but a config passed to --gs_luafile as a bare filename had no directory in that source, so those lookups broke and the run crashed. Normalize the path to absolute before luaL_loadfile so a config works the same however its path is spelled. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
The project declared CMAKE_CXX_STANDARD 14, but SystemC propagates cxx_std_17 via PUBLIC linkage, so Qbox silently built as C++17 regardless. The declared standard was misleading and a consumer could not rely on it. Declare 17 to match reality, and update the README accordingly. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
The example became a standalone find_package(qbox) consumer, but the README still described the old in-tree build, so anyone following it would use paths that no longer exist and fail to build or run. Document the install-then-configure workflow, and correct the manual-firmware note that implied firmware could be built on its own. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Contributor
|
looks amazing, but - some of it is quite involved, do we need to do an online session on it? |
The standalone hello-qbox consumer path was left untested when the GitLab CI was removed, so a broken find_package(qbox) or install layout would go unnoticed. Install and archive the existing Ubuntu GCC matrix build, then consume that artifact in a dependent job that builds the example and checks its guest output, without rebuilding qbox. The installed package resolves its libraries and runtime-loaded plugins via relocatable RPATH, so no library path override is needed. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
Keystone 0.9.2 vendors an old LLVM that still derives from std::unary_function and std::binary_function. The project-wide C++17 requirement removes those declarations under libc++, breaking the macOS and Windows clang builds while libstdc++ continues to provide them. Enable libc++'s narrow compatibility escape hatch only while adding the keystone CPM subproject. This keeps qbox and keystone in C++17 mode and prevents the workaround from reaching later test targets. Remove the stopgap with the in-flight keystone removal. Signed-off-by: Marco Liebel <marco.liebel@oss.qualcomm.com>
|
|
||
| - name: Upload qbox install tree | ||
| if: matrix.os == 'ubuntu-24.04' && matrix.preset == 'gcc' | ||
| uses: actions/upload-artifact@v4 |
| runs-on: ubuntu-24.04 | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 |
| sudo apt-get install -y gcc-aarch64-linux-gnu | ||
|
|
||
| - name: Download qbox install tree | ||
| uses: actions/download-artifact@v4 |
| # C++17 mode. Enable libc++'s compatibility hatch for keystone only. | ||
| # Remove together with keystone (in-flight removal). | ||
| add_compile_definitions(_LIBCPP_ENABLE_CXX17_REMOVED_UNARY_BINARY_FUNCTION) | ||
| cpmfindpackage( |
| find_package(PkgConfig REQUIRED) | ||
| pkg_check_modules(LIBELF REQUIRED IMPORTED_TARGET libelf) | ||
| pkg_check_modules(LIBZIP REQUIRED IMPORTED_TARGET libzip) | ||
| pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) |
Contributor
There was a problem hiding this comment.
Is glib required for headers?
Maybe Alwalid Salama (@alwalidsalama) can provide more info.
| ################################################################################ | ||
|
|
||
| # ----- configure include paths and EXPORT PROJECT | ||
| macro(gs_export) |
Contributor
There was a problem hiding this comment.
gs_export is also used by QQVP.
We should also update QQVP to cope with this change.
Jerome Haxhiaj (jeromehaxhiaj-qti)
approved these changes
Jul 22, 2026
tmarcero
approved these changes
Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The main goal of this MR is to enable the use of Qbox with
find_package(qbox). The hello-qbox example demonstrates how to do it.