### Configuring Build for vsgpoints_example Executable (CMake) Source: https://github.com/vsg-dev/vsgpoints/blob/master/applications/vsgpoints_example/CMakeLists.txt This snippet defines the source files for the executable, creates the executable target, links it against the required vsg and vsgPoints libraries, conditionally links against vsgXchange if found, and specifies the installation directory for the built executable. ```CMake set(SOURCES ConvertMeshToPoints.cpp vsgpoints_example.cpp ) add_executable(vsgpoints_example ${SOURCES}) target_link_libraries(vsgpoints_example vsg::vsg vsgPoints::vsgPoints) if (vsgXchange_FOUND) target_compile_definitions(vsgpoints_example PRIVATE vsgXchange_FOUND) target_link_libraries(vsgpoints_example vsgXchange::vsgXchange) endif() install(TARGETS vsgpoints_example RUNTIME DESTINATION bin) ``` -------------------------------- ### Including Example Subdirectory (CMake) Source: https://github.com/vsg-dev/vsgpoints/blob/master/applications/CMakeLists.txt This CMake command adds the 'vsgpoints_example' subdirectory to the current build. It instructs CMake to process the CMakeLists.txt file found within that directory, integrating its defined targets and dependencies into the main project's build tree. This is a standard method for organizing complex projects into modular subdirectories. ```CMake add_subdirectory(vsgpoints_example) ``` -------------------------------- ### Installing CMake Library Target Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Defines the installation rule for the vsgPoints library target. When the 'install' command is executed, the built library artifact (e.g., .dll, .so, .dylib) will be installed to the default library directory within the installation prefix, following standard installation flags. ```CMake install(TARGETS vsgPoints ${INSTALL_TARGETS_DEFAULT_FLAGS}) ``` -------------------------------- ### Building vsgPoints Project with CMake - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md These commands build the vsgPoints project on a Unix-like system. It navigates into the directory, configures the build with CMake, compiles using multiple cores, and installs the built files. ```sh cd vsgPoints cmake . make -j 8 make install ``` -------------------------------- ### Installing CMake Header Directory Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Installs the directory containing the public header files (${VSGPOINTS_SOURCE_DIR}/include/vsgPoints) to the 'include' directory within the installation prefix. This makes the necessary header files available for other projects to include after vsgPoints has been installed. ```CMake install(DIRECTORY ${VSGPOINTS_SOURCE_DIR}/include/vsgPoints DESTINATION include) ``` -------------------------------- ### Adding Public Include Directories CMake Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Specifies the include directories that consumer projects need when linking against the vsgPoints library. It uses generator expressions to define paths based on whether the project is being built (`$`) or after it's been installed (`$`). The EXTRA_INCLUDES variable allows adding additional include paths externally. ```CMake target_include_directories(vsgPoints PUBLIC $ $ $ ${EXTRA_INCLUDES} ) ``` -------------------------------- ### Generating CMake Support Files Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Calls a custom CMake function or macro named vsg_add_cmake_support_files. This command is likely used to automate the creation of CMake package configuration files (like vsgPointsConfig.cmake) from a template (.in file), which enables other CMake projects to easily find and use the installed vsgPoints library using the find_package command. ```CMake vsg_add_cmake_support_files( CONFIG_TEMPLATE vsgPointsConfig.cmake.in ) ``` -------------------------------- ### Viewing .asc Point Cloud with vsgpoints_example - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command demonstrates how to use the `vsgpoints_example` utility to directly load and view a point cloud file in the .asc format. The utility automatically creates a viewer if no output file is specified. ```sh vsgpoints_example mydata.asc ``` -------------------------------- ### Generating Paged Database with vsgpoints_example - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command demonstrates how to generate a paged database scene graph from point data using `vsgpoints_example`. The `--plod` option enables this technique, and it requires specifying an output file using the `-o` option. ```sh # create a paged database, requires specification of output file vsgpoints_example mydata.BIN -o paged.vsgb --plod ``` -------------------------------- ### Converting Mesh Model to Point Cloud with vsgpoints_example - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command shows how to use `vsgpoints_example` to load a mesh model (like .gltf) and convert it into a point cloud as input for scene graph generation, instead of loading an existing point data file. The `--mesh` option is used for this purpose. ```sh # load a mesh model and convert to points as input rather than required loading of points data. vsgpoints_example mymodel.gltf --mesh ``` -------------------------------- ### Generating Flat Scene Graph with vsgpoints_example - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command shows how to generate a simple 'flat' scene graph representation, consisting of a group of point bricks, from point data using the `vsgpoints_example` utility and the `--flat` command-line option. ```sh # create a flat group of point bricks vsgpoints_example mydata.BIN --flat ``` -------------------------------- ### Generating vsg::LOD Scene Graph with vsgpoints_example - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md These commands illustrate how to generate a vsg::LOD (Level of Detail) scene graph from point data using the `vsgpoints_example` utility. The `--lod` option explicitly requests this method, although it is also the default behavior. ```sh # create vsg::LOD scene graph vsgpoints_example mydata.BIN --lod # or just rely upon the default being vsg::LOD scene graph vsgpoints_example mydata.BIN ``` -------------------------------- ### Setting Precision and Point Size with vsgpoints_example - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command demonstrates how to customize the precision of the point data (using `-p` for size in meters) and the rendered point size (using `--ps` for a multiplier relative to precision) when processing point clouds with `vsgpoints_example`. ```sh # choose 5mm precision and ~50mm rendered point size (10 x 0.005) vsgpoints_example mydata.3dc -p 0.005 --ps 10 ``` -------------------------------- ### Setting up CMake Build for vsgPoints Source: https://github.com/vsg-dev/vsgpoints/blob/master/CMakeLists.txt This CMake script configures the build environment for the vsgPoints project. It specifies the minimum required CMake version, defines project properties, sets the C++ standard to C++17, finds required dependencies like Vulkan, vsg, and vsgXchange, and includes subdirectories for the library source and applications. It also defines utility targets like clang-format, cppcheck, docs, and uninstall using VSG's CMake modules. ```CMake cmake_minimum_required(VERSION 3.12) project(vsgPoints VERSION 0.6.0 DESCRIPTION "VulkanSceneGraph Point Cloud rendering." LANGUAGES CXX ) set(VSGPOINTS_SOVERSION 0) SET(VSGPOINTS_RELEASE_CANDIDATE 0) set(VSGPOINTS_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}" CACHE INTERNAL "Root source directory of vsgPoints") set(VSGPOINTS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}" CACHE INTERNAL "Root binary directory of vsgPoints") # set the use of C++17 globally as all examples require it set(CMAKE_CXX_STANDARD 17) # Find Vulkan and the VSG if (VULKAN_SDK) set(ENV{VULKAN_SDK} ${VULKAN_SDK}) endif() find_package(vsg 1.1.4 REQUIRED) find_package(vsgXchange 1.0.5 REQUIRED) vsg_setup_build_vars() vsg_setup_dir_vars() vsg_add_target_clang_format( FILES include/vsgPoints/*.h src/vsgPoints/*.cpp ) vsg_add_target_clobber() vsg_add_target_cppcheck( FILES ${CMAKE_SOURCE_DIR}/src/vsgPoints/*.cpp ${CMAKE_SOURCE_DIR}/include/vsgPoints/*.h ) vsg_add_target_docs( FILES include ) vsg_add_target_uninstall() if (${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_SOURCE_DIR}) vsg_add_option_maintainer( PREFIX v RCLEVEL ${VSGPOINTS_RELEASE_CANDIDATE} ) endif() # source directories for vsgPoints library add_subdirectory(src) add_subdirectory(applications) vsg_add_feature_summary() ``` -------------------------------- ### Viewing .vsgb File with vsgviewer - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command demonstrates how to load and view a point cloud file that has already been converted to the VulkanSceneGraph native .vsgb format using the standard `vsgviewer` application. ```sh vsgviewer mydata.vsgb ``` -------------------------------- ### Initializing CMake Extension Variables Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Initializes CMake variables EXTRA_DEFINES and EXTRA_INCLUDES to empty lists. These variables serve as placeholders for adding compile definitions and include directories from subdirectories or external modules, providing a way to extend the build configuration without modifying the main CMakeLists.txt. ```CMake set(EXTRA_DEFINES) set(EXTRA_INCLUDES) ``` -------------------------------- ### Converting .BIN Point Cloud to .vsgb Format - Shell Source: https://github.com/vsg-dev/vsgpoints/blob/master/README.md This command shows how to convert a point cloud file in a custom .BIN format (double x,y,z; uint8_t r, g, b) to the VulkanSceneGraph native format (.vsgb) using the `vsgpoints_example` tool and the `-o` option. ```sh vsgpoints_example mydata.BIN -o mydata.vsgb ``` -------------------------------- ### Listing Library Source Files CMake Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Defines the CMake variable SOURCES as a list of the implementation (.cpp) files for the vsgPoints library. These files contain the actual code logic for the library. This list, along with the HEADERS list, is used by the add_library command to build the library target. ```CMake set(SOURCES AsciiPoints.cpp BIN.cpp Brick.cpp Bricks.cpp BrickShaderSet.cpp create.cpp ) ``` -------------------------------- ### Configuring CMake Library Properties Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Sets various properties for the vsgPoints target. It specifies the library's VERSION and SOVERSION using project-defined variables, enables POSITION_INDEPENDENT_CODE (crucial for shared libraries), and enforces the C++17 standard for compiling the library's sources using CXX_STANDARD. ```CMake set_property(TARGET vsgPoints PROPERTY VERSION ${VSGPOINTS_VERSION_MAJOR}.${VSGPOINTS_VERSION_MINOR}.${VSGPOINTS_VERSION_PATCH}) set_property(TARGET vsgPoints PROPERTY SOVERSION ${VSGPOINTS_SOVERSION}) set_property(TARGET vsgPoints PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET vsgPoints PROPERTY CXX_STANDARD 17) ``` -------------------------------- ### Adding Subdirectory: CMake Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/CMakeLists.txt This command tells CMake to process the CMakeLists.txt file found in the specified subdirectory (vsgPoints). This is commonly used to include sub-projects, modules, or components within a larger CMake build structure, incorporating their targets and configurations into the parent project. ```CMake add_subdirectory(vsgPoints) ``` -------------------------------- ### Creating CMake Library Target Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Creates a CMake library target named 'vsgPoints'. This command tells CMake to compile the source files listed in the SOURCES variable and potentially include the headers from the HEADERS variable in the build process. The type of library (static or shared) depends on the BUILD_SHARED_LIBS CMake variable. ```CMake add_library(vsgPoints ${HEADERS} ${SOURCES}) ``` -------------------------------- ### Listing Library Header Files CMake Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Defines the CMake variable HEADERS as a list of specific header files that are part of the public interface of the vsgPoints library. Each file path is constructed using the previously defined HEADER_PATH variable. This list is used as input for the add_library command. ```CMake set(HEADERS ${HEADER_PATH}/Export.h ${HEADER_PATH}/AsciiPoints.h ${HEADER_PATH}/BIN.h ${HEADER_PATH}/Brick.h ${HEADER_PATH}/Bricks.h ${HEADER_PATH}/BrickShaderSet.h ${HEADER_PATH}/Settings.h ${HEADER_PATH}/create.h ) ``` -------------------------------- ### Defining CMake Header Path Variable Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Sets the CMake variable HEADER_PATH to the directory containing the public header files for the vsgPoints library. It constructs the path using the VSGPOINTS_SOURCE_DIR variable, which is expected to be the root directory of the project source tree. This variable simplifies listing the header files later. ```CMake SET(HEADER_PATH ${VSGPOINTS_SOURCE_DIR}/include/vsgPoints) ``` -------------------------------- ### Managing CMake Library Alias and Find Package Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Creates a modern CMake alias `vsgPoints::vsgPoints` pointing to the `vsgPoints` target, facilitating consistent target usage. It also sets internal cache variables (`vsgPoints_FOUND` and `CMAKE_DISABLE_FIND_PACKAGE_vsgPoints`) to indicate that the library has been found (as it's being built in-source) and prevent CMake from attempting to find it externally via find_package. ```CMake add_library(vsgPoints::vsgPoints ALIAS vsgPoints) set(vsgPoints_FOUND TRUE CACHE INTERNAL "vsgPoints found.") set(CMAKE_DISABLE_FIND_PACKAGE_vsgPoints TRUE CACHE INTERNAL "Disable find_package(vsgPoints) as it's not necessary.") ``` -------------------------------- ### Linking Dependencies to CMake Target Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Specifies the libraries that the vsgPoints target depends on. It declares a PUBLIC dependency on vsg::vsg, meaning any target linking to vsgPoints will also gain a link dependency on vsg::vsg. It adds a PRIVATE dependency on EXTRA_LIBRARIES, useful for linking internal dependencies that consumers don't need to know about. ```CMake target_link_libraries(vsgPoints PUBLIC vsg::vsg PRIVATE ${EXTRA_LIBRARIES} ) ``` -------------------------------- ### Adding Private Compile Definitions CMake Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Adds compile definitions specified in the EXTRA_DEFINES variable to the vsgPoints target's private compile options. These definitions are only applied when compiling the library's own source files and are not propagated to projects that link against this library. ```CMake target_compile_definitions(vsgPoints PRIVATE ${EXTRA_DEFINES}) ``` -------------------------------- ### Conditional Shared Library Definition CMake Source: https://github.com/vsg-dev/vsgpoints/blob/master/src/vsgPoints/CMakeLists.txt Conditionally adds the compile definition VSGPOINTS_SHARED_LIBRARY to the INTERFACE properties of the vsgPoints target if the CMake variable BUILD_SHARED_LIBS is true. This definition is then propagated to any project that links to vsgPoints, allowing source code to conditionally use import/export macros for shared library symbols. ```CMake if (BUILD_SHARED_LIBS) target_compile_definitions(vsgPoints INTERFACE VSGPOINTS_SHARED_LIBRARY) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.