### Kinesis Video Trace Library Setup Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/trace/CMakeLists.txt Configures the CMake build for the trace library, sets the project language to C, and links it with the 'utils' target. It also includes setup and installation steps for the Kinesis Video library. ```cmake cmake_minimum_required(VERSION 3.6.3) project(trace LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(trace utils) kinesis_video_library_install() ``` -------------------------------- ### Install Pkgconfig Files Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Installs the generated pkgconfig files to the specified destination directory. ```cmake install( FILES ${CMAKE_CURRENT_BINARY_DIR}/libkvspic.pc ${CMAKE_CURRENT_BINARY_DIR}/libkvspicClient.pc ${CMAKE_CURRENT_BINARY_DIR}/libkvspicState.pc ${CMAKE_CURRENT_BINARY_DIR}/libkvspicUtils.pc DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ``` -------------------------------- ### Install Headers Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Installs the project's header files to the installation destination. ```cmake install( DIRECTORY ${PIC_HEADERS} DESTINATION .) ``` -------------------------------- ### Heap Library CMake Configuration Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/heap/CMakeLists.txt Sets up the heap library, links it with utilities, and installs it. ```cmake cmake_minimum_required(VERSION 3.6.3) project(heap LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(heap utils) kinesis_video_library_install() ``` -------------------------------- ### Kinesis Video Library Setup and Installation Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/state/CMakeLists.txt Configures the CMake project for the Kinesis Video Streams state module, sets up the library, and defines installation rules. ```cmake cmake_minimum_required(VERSION 3.6.3) project(state LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(state mkvgen) kinesis_video_library_install() ``` -------------------------------- ### Kinesis Video Duration Library Setup and Install Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/duration/CMakeLists.txt Configures the CMake project for the Kinesis Video Streams Duration library and installs it. Use this for setting up the build environment. ```cmake cmake_minimum_required(VERSION 3.6.3) project(duration LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) kinesis_video_library_install() ``` -------------------------------- ### Install Targets Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Installs the defined targets (libraries) to their respective installation directories based on CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_BINDIR. ```cmake install( TARGETS kvspic kvspicClient kvspicState kvspicUtils ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ``` -------------------------------- ### Kinesis Video View CMake Setup Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/view/CMakeLists.txt Configures the CMake build for the Kinesis Video Streams View project. It sets the minimum CMake version, defines the project name and language, sets up the Kinesis Video library, links necessary targets, and installs the library. ```cmake cmake_minimum_required(VERSION 3.6.3) project(view LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(view heap utils) kinesis_video_library_install() ``` -------------------------------- ### Clone Kinesis Video Streams PIC Repository Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/README.md Use this command to download the source code for the project. Ensure you have Git installed. ```bash git clone https://github.com/awslabs/amazon-kinesis-video-streams-pic.git ``` -------------------------------- ### MKVGen CMakeLists.txt Configuration Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/mkvgen/CMakeLists.txt Sets up the CMake build for the mkvgen project. It defines the minimum required CMake version, names the project, sets up Kinesis Video library integration, links necessary libraries, and handles installation. ```cmake cmake_minimum_required(VERSION 3.6.3) project(mkvgen LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(mkvgen utils) kinesis_video_library_install() ``` -------------------------------- ### Setup Kinesis Video Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/utils/CMakeLists.txt Configures the CMake project for the Kinesis Video Streams utility library. This includes setting the minimum CMake version, project name, language, and linking necessary libraries. ```cmake cmake_minimum_required(VERSION 3.6.3) project(utils LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(${PROJECT_NAME} ${CMAKE_DL_LIBS}) kinesis_video_library_install() ``` -------------------------------- ### Kinesis Video Streams Client CMake Configuration Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/src/client/CMakeLists.txt Configures the build for the Kinesis Video Streams client, setting the project name, linking libraries, and installing the final target. ```cmake cmake_minimum_required(VERSION 3.6.3) project(client LANGUAGES C) kinesis_video_library_setup(${PROJECT_NAME}) target_link_libraries(client mkvgen heap view utils state) kinesis_video_library_install() ``` -------------------------------- ### Find GTest Dependency Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/tst/CMakeLists.txt Locates the Google Test (GTest) framework, which is required for running the project's tests. It supports specifying a custom installation prefix if needed. ```cmake if (OPEN_SRC_INSTALL_PREFIX) find_package(GTest REQUIRED PATHS ${OPEN_SRC_INSTALL_PREFIX}) else() find_package(GTest REQUIRED) endif() SET(GTEST_LIBNAME GTest::gtest) if (TARGET GTest::GTest) SET(GTEST_LIBNAME GTest::GTest) endif() ``` -------------------------------- ### Configure PC File for Client Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Configures the pkg-config file for the kvspicClient library. ```cmake configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/libkvspicClient.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libkvspicClient.pc" @ONLY) ``` -------------------------------- ### Configure Project with CMake Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/README.md Create a build directory and run CMake to configure the build. This command assumes you are in the root of the cloned repository. ```bash mkdir -p amazon-kinesis-video-streams-pic/build; cd amazon-kinesis-video-streams-pic/build; cmake .. ``` -------------------------------- ### Configure PC File for Utils Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Configures the pkg-config file for the kvspicUtils library. ```cmake configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/libkvspicUtils.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libkvspicUtils.pc" @ONLY) ``` -------------------------------- ### Configure PC File for State Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Configures the pkg-config file for the kvspicState library. ```cmake configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/libkvspicState.pc.cmake" "${CMAKE_CURRENT_BINARY_DIR}/libkvspicState.pc" @ONLY) ``` -------------------------------- ### Build the Kinesis Video Streams PIC Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/README.md After configuring the build with CMake, run 'make' in the build directory to compile the library. ```bash make ``` -------------------------------- ### Define Test Executable and Link Libraries Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/tst/CMakeLists.txt Compiles all C++ source files in the current directory into a test executable named 'kvspic_test'. It then links this executable with necessary libraries including 'kvspic', GTest, and system libraries. ```cmake file(GLOB PIC_TEST_SOURCE_FILES "*/*.cpp") add_executable(kvspic_test ${PIC_TEST_SOURCE_FILES}) target_link_libraries(kvspic_test kvspic ${GTEST_LIBNAME} ${CMAKE_DL_LIBS} Threads::Threads) if(UNIX AND NOT APPLE) # rt needed for clock_gettime target_link_libraries(kvspic_test rt) endif() ``` -------------------------------- ### Add kvspicClient Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Defines the kvspicClient library with specified source files and sets version properties if building shared libraries. ```cmake add_library(kvspicClient ${LIBTYPE} ${PIC_CLIENT_SOURCE_FILES}) if(BUILD_SHARED_LIBS) set_target_properties(kvspicClient PROPERTIES VERSION 0.0.0 SOVERSION 0) endif() target_link_libraries(kvspicClient) ``` -------------------------------- ### Add kvspicState Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Defines the kvspicState library with specified source files and sets version properties if building shared libraries. ```cmake add_library(kvspicState ${LIBTYPE} ${PIC_STATE_SOURCE_FILES}) if(BUILD_SHARED_LIBS) set_target_properties(kvspicState PROPERTIES VERSION 0.0.0 SOVERSION 0) endif() target_link_libraries(kvspicState) ``` -------------------------------- ### Add kvspicUtils Library Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Defines the kvspicUtils library, links necessary libraries like CMAKE_DL_LIBS and Threads::Threads, and conditionally links 'rt' on Unix. ```cmake add_library(kvspicUtils ${LIBTYPE} ${PIC_UTILS_SOURCE_FILES}) if(BUILD_SHARED_LIBS) set_target_properties(kvspicUtils PROPERTIES VERSION 0.0.0 SOVERSION 0) endif() target_link_libraries(kvspicUtils ${CMAKE_DL_LIBS} Threads::Threads) if(UNIX AND NOT APPLE) # rt needed for clock_gettime target_link_libraries(kvspicUtils rt) endif() ``` -------------------------------- ### Set C++ Standard and Flags Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/tst/CMakeLists.txt Configures the C++ standard to C++11 and sets the CXX flags to include -fPIC. This ensures compatibility and position-independent code generation for the project. ```cmake set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") ``` -------------------------------- ### Conditional Library Linking (Unix) Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Links the 'rt' library for 'clock_gettime' on Unix systems, excluding macOS. ```cmake if(UNIX AND NOT APPLE) # rt needed for clock_gettime target_link_libraries(kvspic rt) endif() ``` -------------------------------- ### Add CTest Test Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/tst/CMakeLists.txt Registers the 'kvspic_test' executable as a test within the CTest testing framework. This allows the test to be discovered and run using the 'ctest' command. ```cmake add_test(${PROJECT_NAME} ${PROJECT_NAME}) ``` -------------------------------- ### Add Test Subdirectory Source: https://github.com/awslabs/amazon-kinesis-video-streams-pic/blob/master/CMakeLists.txt Conditionally adds the 'tst' subdirectory for building tests if BUILD_TEST is enabled. ```cmake if(BUILD_TEST) add_subdirectory(tst) endif() ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.