### Basic CMake Project Setup Source: https://github.com/jingmatrix/vector/blob/master/zygisk/src/main/cpp/CMakeLists.txt Sets the minimum CMake version and project name. Configures the C++ standard to C++23. ```cmake cmake_minimum_required(VERSION 3.10) project(zygisk) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) ``` -------------------------------- ### Basic Project and Executable/Library Setup Source: https://github.com/jingmatrix/vector/blob/master/dex2oat/src/main/cpp/CMakeLists.txt Defines the minimum CMake version, project name, and adds an executable target 'dex2oat' and a shared library target 'oat_hook'. ```cmake cmake_minimum_required(VERSION 3.10) project(dex2oat) add_executable(dex2oat dex2oat.cpp) add_library(oat_hook SHARED oat_hook.cpp) ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/jingmatrix/vector/blob/master/daemon/src/main/jni/CMakeLists.txt Sets the minimum required CMake version and project name. Also sets the C++ standard to C++23. ```cmake cmake_minimum_required(VERSION 3.10) project(daemon) set(CMAKE_CXX_STANDARD 23) ``` -------------------------------- ### Creating a Shared Library Source: https://github.com/jingmatrix/vector/blob/master/daemon/src/main/jni/CMakeLists.txt Builds a shared library named 'daemon' using the defined source files. This library can be loaded at runtime. ```cmake add_library(${PROJECT_NAME} SHARED ${SOURCES}) ``` -------------------------------- ### Defining Project Sources Source: https://github.com/jingmatrix/vector/blob/master/daemon/src/main/jni/CMakeLists.txt Lists the source files that will be compiled into the daemon library. Ensure these files exist in the project. ```cmake set(SOURCES dex2oat.cpp logcat.cpp obfuscation.cpp ) ``` -------------------------------- ### Vector Daemon Directory Structure Source: https://github.com/jingmatrix/vector/blob/master/daemon/README.md Overview of the directory structure for the Vector daemon subsystem, detailing the organization of native C++ implementations and Kotlin packages for data, environment, IPC, system, and utilities. ```text src/main/ ├── jni/ # Native C++ implementations (dex2oat wrapper, logcat parser) └── kotlin/org/matrix/vector/daemon/ ├── data/ # SQLite schema, immutable state cache, and file operations ├── env/ # UNIX domain socket servers and native process monitors ├── ipc/ # AIDL endpoints (Application, Manager, Module, SystemServer) ├── system/ # System binder delegates and Notification UI ├── utils/ # Context forgery, signature verification, and JNI bridges ├── Cli.kt # Command-line interface definitions ├── VectorDaemon.kt # Main entry point and looper initialization └── VectorService.kt # Primary IDaemonService implementation ``` -------------------------------- ### Setting Include Directories Source: https://github.com/jingmatrix/vector/blob/master/daemon/src/main/jni/CMakeLists.txt Configures the include paths for the daemon library. 'PRIVATE' ensures these paths are only used for compiling the library itself. ```cmake target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) ``` -------------------------------- ### Library and Include Directories Source: https://github.com/jingmatrix/vector/blob/master/zygisk/src/main/cpp/CMakeLists.txt Adds a shared library target named 'zygisk' and specifies its source files. Includes public header directories. ```cmake add_subdirectory(${VECTOR_ROOT}/native native) add_library(${PROJECT_NAME} SHARED module.cpp ipc_bridge.cpp) target_include_directories(${PROJECT_NAME} PUBLIC include) ``` -------------------------------- ### Linking Libraries Source: https://github.com/jingmatrix/vector/blob/master/daemon/src/main/jni/CMakeLists.txt Links the daemon library with other static and system libraries. 'lsplant_static' and 'dex_builder_static' are likely custom static libraries. ```cmake target_link_libraries(${PROJECT_NAME} PRIVATE lsplant_static dex_builder_static android log) ``` -------------------------------- ### Linking Libraries Source: https://github.com/jingmatrix/vector/blob/master/dex2oat/src/main/cpp/CMakeLists.txt Links the 'dex2oat' executable and 'oat_hook' library against the 'log' and 'lsplt_static' libraries. ```cmake target_link_libraries(dex2oat log) target_link_libraries(oat_hook log lsplt_static) ``` -------------------------------- ### External Library and Include Directories Source: https://github.com/jingmatrix/vector/blob/master/dex2oat/src/main/cpp/CMakeLists.txt Configures the build to include an external library 'lsplt' and sets public include directories for both the 'oat_hook' library and the 'dex2oat' executable. ```cmake OPTION(LSPLT_BUILD_SHARED OFF) add_subdirectory(${VECTOR_ROOT}/external/lsplt/lsplt/src/main/jni external) target_include_directories(oat_hook PUBLIC include) target_include_directories(dex2oat PUBLIC include) ``` -------------------------------- ### Linking Libraries Source: https://github.com/jingmatrix/vector/blob/master/zygisk/src/main/cpp/CMakeLists.txt Links the 'zygisk' library with the 'native' and 'log' libraries. ```cmake target_link_libraries(${PROJECT_NAME} native log) ``` -------------------------------- ### Post-Build Command for Debug Symbols Source: https://github.com/jingmatrix/vector/blob/master/zygisk/src/main/cpp/CMakeLists.txt Configures a custom post-build command to handle debug symbols if DEBUG_SYMBOLS_PATH is defined. This includes creating directories, extracting debug symbols, stripping the binary, and linking debug symbols. ```cmake if (DEFINED DEBUG_SYMBOLS_PATH) message(STATUS "Debug symbols will be placed at ${DEBUG_SYMBOLS_PATH}") add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${DEBUG_SYMBOLS_PATH}/${ANDROID_ABI} COMMAND ${CMAKE_OBJCOPY} --only-keep-debug $ ${DEBUG_SYMBOLS_PATH}/${ANDROID_ABI}/${PROJECT_NAME}.debug COMMAND ${CMAKE_STRIP} --strip-all $ COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink ${DEBUG_SYMBOLS_PATH}/${ANDROID_ABI}/${PROJECT_NAME}.debug $) endif() ``` -------------------------------- ### Adding External Libraries Source: https://github.com/jingmatrix/vector/blob/master/daemon/src/main/jni/CMakeLists.txt Includes external libraries from a specified root directory. This is useful for managing dependencies. ```cmake add_subdirectory(${VECTOR_ROOT}/external external) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.