### Installing Library Target CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Defines the installation rule for the `vsgImGui` library target. This command ensures that the compiled library file is installed to the appropriate location during the CMake install step. ```CMake install(TARGETS vsgImGui ${INSTALL_TARGETS_DEFAULT_FLAGS}) ``` -------------------------------- ### Building vsgImGui with CMake/Make - Shell Source: https://github.com/vsg-dev/vsgimgui/blob/master/README.md Navigates into the cloned `vsgImGui` directory, configures the build system using CMake (which handles submodules automatically), and then compiles the project using Make with 8 parallel jobs. Requires CMake, Make, and a C++ compiler installed. ```Shell cd vsgImGui cmake . make -j 8 ``` -------------------------------- ### Installing Header Directory CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Installs the directory containing the vsgImGui public headers. This ensures that consuming projects can find the necessary header files after installation. ```CMake install(DIRECTORY ${VSGIMGUI_SOURCE_DIR}/include/vsgImGui DESTINATION include) ``` -------------------------------- ### Cloning vsgImGui Git Repository - Shell Source: https://github.com/vsg-dev/vsgimgui/blob/master/README.md Clones the `vsgImGui` source code from its GitHub repository using the `git clone` command. This is the first step to obtaining the library files locally before building. Requires Git to be installed. ```Shell git clone https://github.com/vsg-dev/vsgImGui.git ``` -------------------------------- ### Adding Uninstall Target - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom macro `vsg_add_target_uninstall` to create a custom CMake target that can be used to remove installed files generated by the build. ```CMake vsg_add_target_uninstall() ``` -------------------------------- ### Setting Library Version Variables - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Sets CMake variables to store the shared object version and release candidate level for the vsgImGui library. These variables can be used later in the build process or for installation. ```CMake set(VSGIMGUI_SOVERSION 0) SET(VSGIMGUI_RELEASE_CANDIDATE 0) ``` -------------------------------- ### Defining Build Option for Demo Windows CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Defines a CMake option `SHOW_DEMO_WINDOW` which allows users to toggle the inclusion of ImGui and ImPlot demo window source files in the build. It is set to `ON` by default. ```CMake OPTION(SHOW_DEMO_WINDOW "Toggle the build of the ImGui::ShowDemoWindow(bool*) and ImPlot::ShadowDemoWindow(bool*)" ON) ``` -------------------------------- ### Conditionally Including Demo Source Files CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Checks the value of the `SHOW_DEMO_WINDOW` option. If it is ON, it adds the standard ImGui and ImPlot demo source files to the `SOURCES` list. Otherwise, it includes a fallback demo source file. ```CMake if (SHOW_DEMO_WINDOW) set(SOURCES ${SOURCES} imgui/imgui_demo.cpp implot/implot_demo.cpp ) else() set(SOURCES ${SOURCES} vsgImGui/fallback_demo.cpp ) endif() ``` -------------------------------- ### Specifying Include Directories for Target CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Configures the include directories for the `vsgImGui` target. It adds build-interface include paths relative to the source directory and an install-interface path, making necessary headers available to projects that use the library. ```CMake target_include_directories(vsgImGui PUBLIC $ $ $ ${EXTRA_INCLUDES} ) ``` -------------------------------- ### Defining Header Paths and Files CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Sets the base path for vsgImGui headers and defines a list of header files (`HEADERS`) required for building the library. This list includes core vsgImGui headers, standard ImGui headers, and ImPlot headers. ```CMake SET(HEADER_PATH ${VSGIMGUI_SOURCE_DIR}/include/vsgImGui) set(HEADERS ${HEADER_PATH}/imgui.h ${HEADER_PATH}/SendEventsToImGui.h ${HEADER_PATH}/RenderImGui.h ${HEADER_PATH}/Texture.h imgui/imconfig.h imgui/imgui_internal.h imgui/imstb_rectpack.h imgui/imstb_textedit.h imgui/imstb_truetype.h imgui/misc/cpp/imgui_stdlib.h implot/implot.h implot/implot_internal.h ) ``` -------------------------------- ### Finding Dependencies and Setting Up VSG - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Checks if the VULKAN_SDK environment variable is set and uses it. It then finds the vsg package (version 1.1.10 or newer) and calls custom macros to set up VSG-related directory and build variables. ```CMake if (VULKAN_SDK) set(ENV{VULKAN_SDK} ${VULKAN_SDK}) endif() find_package(vsg 1.1.10) vsg_setup_dir_vars() vsg_setup_build_vars() ``` -------------------------------- ### Defining the Project - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Defines the project name, version, description, and required programming languages. This sets up fundamental project properties within the CMake build system. ```CMake project(vsgImGui VERSION 0.7.0 DESCRIPTION "VulkanSceneGraph, ImGui and ImPlot integration library" LANGUAGES CXX ) ``` -------------------------------- ### Adding Documentation Target - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom macro `vsg_add_target_docs` to create a custom CMake target that generates documentation (likely using Doxygen or similar tools) based on the specified source directory. ```CMake vsg_add_target_docs( FILES include ) ``` -------------------------------- ### Defining Core Source Files CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Defines a list of core C++ source files (`SOURCES`) that constitute the vsgImGui library. This includes source files from vsgImGui integration, standard ImGui source files, backend implementations, and ImPlot source files. ```CMake set(SOURCES vsgImGui/RenderImGui.cpp vsgImGui/SendEventsToImGui.cpp vsgImGui/Texture.cpp imgui/imgui.cpp imgui/imgui_draw.cpp imgui/imgui_tables.cpp imgui/imgui_widgets.cpp imgui/backends/imgui_impl_vulkan.cpp imgui/misc/cpp/imgui_stdlib.cpp implot/implot.cpp implot/implot_items.cpp ) ``` -------------------------------- ### Initializing Variables for Extensions CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Initializes CMake variables `EXTRA_DEFINES` and `EXTRA_INCLUDES`. These are intended to be used by other CMake scripts or subdirectories that wish to extend the build of the vsgImGui library by adding additional compile definitions or include directories. ```CMake set(EXTRA_DEFINES) set(EXTRA_INCLUDES) ``` -------------------------------- ### Setting ImGui User Config Definition CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Sets the `EXTRA_DEFINES` variable to include the ImGui user configuration header file. This definition is later applied to the library target. ```CMake set(EXTRA_DEFINES "IMGUI_USER_CONFIG=") ``` -------------------------------- ### Setting Source and Binary Directory Variables - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Defines CMake variables pointing to the project's source and binary directories. These variables are cached internally and provide convenient references to these paths throughout the build scripts. ```CMake set(VSGIMGUI_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Root source directory of vsgImGui") set(VSGIMGUI_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "Root binary directory of vsgImGui") ``` -------------------------------- ### Adding Feature Summary Target - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom macro `vsg_add_feature_summary` to create a custom CMake target that generates a summary of the project's configured features and dependencies. ```CMake vsg_add_feature_summary() ``` -------------------------------- ### Adding CMake Support Files CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Calls a custom CMake function `vsg_add_cmake_support_files` (presumably defined elsewhere, likely in a find module for vsg) to process configuration template files, such as `vsgImGuiConfig.cmake.in`, which are used to generate configuration files for consuming projects to find and use vsgImGui. ```CMake vsg_add_cmake_support_files( CONFIG_TEMPLATE vsgImGuiConfig.cmake.in ) ``` -------------------------------- ### Setting Library Target Properties CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Configures various properties for the `vsgImGui` library target, including the library version, shared object version, enabling position-independent code, and setting the required C++ standard to C++17. ```CMake set_property(TARGET vsgImGui PROPERTY VERSION ${VSGIMGUI_VERSION_MAJOR}.${VSGIMGUI_VERSION_MINOR}.${VSGIMGUI_VERSION_PATCH}) set_property(TARGET vsgImGui PROPERTY SOVERSION ${VSGIMGUI_SOVERSION}) set_property(TARGET vsgImGui PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET vsgImGui PROPERTY CXX_STANDARD 17) ``` -------------------------------- ### Adding Source Subdirectory - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Includes the CMakeLists.txt file located in the 'src' subdirectory. This recursively processes the build configuration for the main library source code within that directory. ```CMake # source directory for main vsgImGui library add_subdirectory(src) ``` -------------------------------- ### Copying ImGui/ImPlot Headers - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom CMake macro `vsg_copy_imgui_headers` to copy specified header files from the submodule directories into the project's build space. This prepares them for compilation. ```CMake vsg_copy_imgui_headers( FILES ${VSGIMGUI_SOURCE_DIR}/src/imgui/imgui.h ${VSGIMGUI_SOURCE_DIR}/src/imgui/imconfig.h ${VSGIMGUI_SOURCE_DIR}/src/imgui/imgui_internal.h ${VSGIMGUI_SOURCE_DIR}/src/imgui/imstb_textedit.h ${VSGIMGUI_SOURCE_DIR}/src/imgui//misc/cpp/imgui_stdlib.h ${VSGIMGUI_SOURCE_DIR}/src/implot/implot.h ${VSGIMGUI_SOURCE_DIR}/src/implot/implot_internal.h ) ``` -------------------------------- ### Setting Minimum CMake Version - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Specifies the minimum version of CMake required to build the project. This ensures that required commands and features are available. ```CMake cmake_minimum_required(VERSION 3.7) ``` -------------------------------- ### Adding Clang-Format Target - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom macro `vsg_add_target_clang_format` to create a custom CMake target that applies clang-format to the specified source and header files, enforcing coding style. ```CMake vsg_add_target_clang_format( FILES include/vsgImGui/RenderImGui.h include/vsgImGui/SendEventsToImGui.h include/vsgImGui/Texture.h src/vsgImGui/*.cpp ) ``` -------------------------------- ### Adding CMake Modules and Including Macros - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Appends a 'cmake' subdirectory to the CMake module search path and includes a custom macro file specific to the vsgImGui project. This makes custom build functions and variables available. ```CMake list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) include(vsgImGuiMacros) ``` -------------------------------- ### Adding vsgImGui Library Target CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Creates the primary CMake library target named `vsgImGui` using the collected header and source files. This target represents the compiled library. ```CMake add_library(vsgImGui ${HEADERS} ${SOURCES}) ``` -------------------------------- ### Updating Git Submodules - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Checks if the imgui and implot headers exist (indicating submodules are checked out). If not, it finds the Git executable and executes a command to update and initialize submodules recursively, failing the build if the command fails. ```CMake if ( (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/imgui/imgui.h) OR (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src/implot/implot.h) ) find_package(Git QUIET) execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} RESULT_VARIABLE GIT_SUBMOD_RESULT) if(NOT GIT_SUBMOD_RESULT EQUAL "0") message(FATAL_ERROR "git submodule update --init --recursive failed with ${GIT_SUBMOD_RESULT}, please checkout submodules") endif() endif() ``` -------------------------------- ### Applying Compile Definitions to Target CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Applies the compile definitions stored in the `EXTRA_DEFINES` variable to the `vsgImGui` library target, making them private to the library's compilation. ```CMake target_compile_definitions(vsgImGui PRIVATE ${EXTRA_DEFINES}) ``` -------------------------------- ### Adding Library Alias and Find_Package Variables CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Creates an alias `vsgImGui::vsgImGui` for the main library target, which is a modern CMake convention. It also sets cache variables to indicate that vsgImGui has been found and to potentially disable subsequent calls to `find_package(vsgImGui)`. ```CMake # add definitions to enable building vsgImGui as part of submodule add_library(vsgImGui::vsgImGui ALIAS vsgImGui) set(vsgImGui_FOUND TRUE CACHE INTERNAL "vsgImGui found.") set(CMAKE_DISABLE_FIND_PACKAGE_vsgImGui TRUE CACHE INTERNAL "Disable find_package(vsgImGui) as it's not necessary.") ``` -------------------------------- ### Adding Clobber Target - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom macro `vsg_add_target_clobber` to create a custom CMake target that cleans the build directory, removing generated files. This is useful for ensuring a clean rebuild. ```CMake vsg_add_target_clobber() ``` -------------------------------- ### Setting C++ Standard - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Globally sets the C++ standard to C++17 for all targets in the project. This ensures that the compiler uses the specified standard, required by the project's code. ```CMake set(CMAKE_CXX_STANDARD 17) ``` -------------------------------- ### Adding Cppcheck Target - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Uses a custom macro `vsg_add_target_cppcheck` to create a custom CMake target that runs the static analysis tool Cppcheck on the specified source and header files. ```CMake vsg_add_target_cppcheck( FILES include/vsgImGui/*.h src/vsgImGui/*.cpp ) ``` -------------------------------- ### Linking Dependencies to Target CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Links required libraries to the `vsgImGui` target. It declares a public dependency on `vsg::vsg` and private dependencies specified in `EXTRA_LIBRARIES`, ensuring that projects linking against vsgImGui will also link against vsg. ```CMake target_link_libraries(vsgImGui PUBLIC vsg::vsg PRIVATE ${EXTRA_LIBRARIES} ) ``` -------------------------------- ### Adding Maintainer Option - CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/CMakeLists.txt Conditionally adds a CMake option for maintainers if the current source directory is the top-level source directory. It uses a custom macro `vsg_add_option_maintainer` with a specified prefix and release candidate level. ```CMake if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) vsg_add_option_maintainer( PREFIX v RCLEVEL ${VSGIMGUI_RELEASE_CANDIDATE} ) endif() ``` -------------------------------- ### Conditionally Adding Shared Library Definition CMake Source: https://github.com/vsg-dev/vsgimgui/blob/master/src/CMakeLists.txt Checks if the project is being built as a shared library (`BUILD_SHARED_LIBS`). If true, it adds the `VSGIMGUI_SHARED_LIBRARY` definition to the interface of the `vsgImGui` target, which is typically used for marking symbols for export/import. ```CMake if (BUILD_SHARED_LIBS) target_compile_definitions(vsgImGui INTERFACE VSGIMGUI_SHARED_LIBRARY) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.