From d0ee0f59e6fecea598f855ba22ff34775956075e Mon Sep 17 00:00:00 2001 From: Marvin Gajek Date: Mon, 23 Dec 2024 13:34:09 +0100 Subject: [PATCH 1/4] add vcpkg git submodule --- .gitmodules | 3 +++ third-party/vcpkg | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 third-party/vcpkg diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..c057f4b --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "third-party/vcpkg"] + path = third-party/vcpkg + url = git@github.com:microsoft/vcpkg.git diff --git a/third-party/vcpkg b/third-party/vcpkg new file mode 160000 index 0000000..f06267d --- /dev/null +++ b/third-party/vcpkg @@ -0,0 +1 @@ +Subproject commit f06267da58f3c06b3a1aff9cbf5c2906e595ebc9 From 32e075cab206e22b9d8a7974acc3686bca60cc8f Mon Sep 17 00:00:00 2001 From: Marvin Gajek Date: Mon, 23 Dec 2024 13:34:25 +0100 Subject: [PATCH 2/4] remove obsolete cmake module --- CMakeLists.txt | 3 - cmake/AzureVcpkg.cmake | 171 ----------------------------------------- 2 files changed, 174 deletions(-) delete mode 100644 cmake/AzureVcpkg.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ed0f838..206e919 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,6 @@ option(BUILD_APP "Compile source file of main executable and link compiled libra list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(AzureVcpkg) -az_vcpkg_integrate() - if(BUILD_TEST) include(CTestConfig) endif() diff --git a/cmake/AzureVcpkg.cmake b/cmake/AzureVcpkg.cmake deleted file mode 100644 index c6e33b4..0000000 --- a/cmake/AzureVcpkg.cmake +++ /dev/null @@ -1,171 +0,0 @@ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. - -# We need to know an absolute path to our repo root to do things like referencing ./LICENSE.txt file. -set(AZ_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/..") - -macro(az_vcpkg_integrate) - message("Vcpkg integrate step.") - - # AUTO CMAKE_TOOLCHAIN_FILE: - # User can call `cmake -DCMAKE_TOOLCHAIN_FILE="path_to_the_toolchain"` as the most specific scenario. - # As the last alternative (default case), Azure SDK will automatically clone VCPKG folder and set toolchain from there. - if(NOT DEFINED CMAKE_TOOLCHAIN_FILE) - message("CMAKE_TOOLCHAIN_FILE is not defined. Define it for the user.") - # Set AZURE_SDK_DISABLE_AUTO_VCPKG env var to avoid Azure SDK from cloning and setting VCPKG automatically - # This option delegate package's dependencies installation to user. - if(NOT DEFINED ENV{AZURE_SDK_DISABLE_AUTO_VCPKG}) - message("AZURE_SDK_DISABLE_AUTO_VCPKG is not defined. Fetch a local copy of vcpkg.") - # GET VCPKG FROM SOURCE - # User can set env var AZURE_SDK_VCPKG_COMMIT to pick the VCPKG commit to fetch - set(VCPKG_COMMIT_STRING 43cf47eccfbe27006cf9534a5db809798f8c37fe) # default SDK tested commit - if(DEFINED ENV{AZURE_SDK_VCPKG_COMMIT}) - message("AZURE_SDK_VCPKG_COMMIT is defined. Using that instead of the default.") - set(VCPKG_COMMIT_STRING "$ENV{AZURE_SDK_VCPKG_COMMIT}") # default SDK tested commit - endif() - message("Vcpkg commit string used: ${VCPKG_COMMIT_STRING}") - include(FetchContent) - FetchContent_Declare( - vcpkg - GIT_REPOSITORY https://github.com/microsoft/vcpkg.git - GIT_TAG ${VCPKG_COMMIT_STRING} - ) - FetchContent_GetProperties(vcpkg) - # make sure to pull vcpkg only once. - if(NOT vcpkg_POPULATED) - FetchContent_Populate(vcpkg) - endif() - # use the vcpkg source path - set(CMAKE_TOOLCHAIN_FILE "${vcpkg_SOURCE_DIR}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "") - endif() - endif() - - # enable triplet customization - if(DEFINED ENV{VCPKG_DEFAULT_TRIPLET} AND NOT DEFINED VCPKG_TARGET_TRIPLET) - set(VCPKG_TARGET_TRIPLET "$ENV{VCPKG_DEFAULT_TRIPLET}" CACHE STRING "") - endif() - message("Vcpkg integrate step - DONE.") -endmacro() - -macro(az_vcpkg_portfile_prep targetName fileName contentToRemove) - # with sdk//vcpkg/ - file(READ "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/${fileName}" fileContents) - - # Windows -> Unix line endings - string(FIND fileContents "\r\n" crLfPos) - - if (crLfPos GREATER -1) - string(REPLACE "\r\n" "\n" fileContents ${fileContents}) - endif() - - # remove comment header - string(REPLACE "${contentToRemove}" "" fileContents ${fileContents}) - - # undo Windows -> Unix line endings (if applicable) - if (crLfPos GREATER -1) - string(REPLACE "\n" "\r\n" fileContents ${fileContents}) - endif() - unset(crLfPos) - - # output to an intermediate location - file (WRITE "${CMAKE_BINARY_DIR}/vcpkg_prep/${targetName}/${fileName}" ${fileContents}) - unset(fileContents) - - # Produce the files to help with the vcpkg release. - # Go to the /out/build//vcpkg directory, and copy (merge) "ports" folder to the vcpkg repo. - # Then, update the portfile.cmake file SHA512 from "1" to the actual hash (a good way to do it is to uninstall a package, - # clean vcpkg/downloads, vcpkg/buildtrees, run "vcpkg install ", and get the SHA from the error message). - configure_file( - "${CMAKE_BINARY_DIR}/vcpkg_prep/${targetName}/${fileName}" - "${CMAKE_BINARY_DIR}/vcpkg/ports/${targetName}-cpp/${fileName}" - @ONLY - ) -endmacro() - -macro(az_vcpkg_export targetName macroNamePart dllImportExportHeaderPath) - foreach(vcpkgFile "vcpkg.json" "portfile.cmake") - az_vcpkg_portfile_prep( - "${targetName}" - "${vcpkgFile}" - "# Copyright (c) Microsoft Corporation.\n# Licensed under the MIT License.\n\n" - ) - endforeach() - - # Standard names for folders such as "bin", "lib", "include". We could hardcode, but some other libs use it too (curl). - include(GNUInstallDirs) - - # When installing, copy our "inc" directory (headers) to "include" directory at the install location. - install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/inc/azure/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/azure") - - # Copy license as "copyright" (vcpkg dictates naming and location). - install(FILES "${AZ_ROOT_DIR}/LICENSE.txt" DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${targetName}-cpp" RENAME "copyright") - - # Indicate where to install targets. Mirrors what other ports do. - install( - TARGETS "${targetName}" - EXPORT "${targetName}-cppTargets" - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} # DLLs (if produced by build) go to "/bin" - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} # static .lib files - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} # .lib files for DLL build - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} # headers - ) - - # If building a Windows DLL, patch the dll_import_export.hpp - if(WIN32 AND BUILD_SHARED_LIBS) - add_compile_definitions(AZ_${macroNamePart}_BEING_BUILT) - target_compile_definitions(${targetName} PUBLIC AZ_${macroNamePart}_DLL) - - set(AZ_${macroNamePart}_DLL_INSTALLED_AS_PACKAGE "*/ + 1 /*") - configure_file( - "${CMAKE_CURRENT_SOURCE_DIR}/inc/${dllImportExportHeaderPath}" - "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${dllImportExportHeaderPath}" - @ONLY - ) - unset(AZ_${macroNamePart}_DLL_INSTALLED_AS_PACKAGE) - - get_filename_component(dllImportExportHeaderDir ${dllImportExportHeaderPath} DIRECTORY) - install( - FILES "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${dllImportExportHeaderPath}" - DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${dllImportExportHeaderDir}" - ) - unset(dllImportExportHeaderDir) - endif() - - # Export the targets file itself. - install( - EXPORT "${targetName}-cppTargets" - DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${targetName}-cpp" - NAMESPACE Azure:: # Not the C++ namespace, but a namespace in terms of cmake. - FILE "${targetName}-cppTargets.cmake" - ) - - # configure_package_config_file(), write_basic_package_version_file() - include(CMakePackageConfigHelpers) - - # Produce package config file. - configure_package_config_file( - "${CMAKE_CURRENT_SOURCE_DIR}/vcpkg/Config.cmake.in" - "${targetName}-cppConfig.cmake" - INSTALL_DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/${targetName}-cpp" - PATH_VARS - CMAKE_INSTALL_LIBDIR) - - # Produce version file. - write_basic_package_version_file( - "${targetName}-cppConfigVersion.cmake" - VERSION ${AZ_LIBRARY_VERSION} # the version that we extracted from package_version.hpp - COMPATIBILITY SameMajorVersion - ) - - # Install package config and version files. - install( - FILES - "${CMAKE_CURRENT_BINARY_DIR}/${targetName}-cppConfig.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/${targetName}-cppConfigVersion.cmake" - DESTINATION - "${CMAKE_INSTALL_DATAROOTDIR}/${targetName}-cpp" # to shares/ - ) - - # Export all the installs above as package. - export(PACKAGE "${targetName}-cpp") -endmacro() \ No newline at end of file From 3129186f27ad2abfcd0a973f5a115fdd12e932e0 Mon Sep 17 00:00:00 2001 From: Marvin Gajek Date: Mon, 23 Dec 2024 13:34:46 +0100 Subject: [PATCH 3/4] adjust Prerequisite and CMake sections --- README.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c897c6a..eccdf3a 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ A collection of sample code snippets demonstrating how to create bindings for va - Download and install [CMake from the official website](https://cmake.org/download/) or trough a package manager - Install [vcpkg from the official website](https://vcpkg.io/en/getting-started.html) or trough a package manager - Check dependencies required for your Linux, MacOS or Windows system in [pr.yml workflow](./.github/workflows/pr.yml) +- Add git submodules: `git subdmodule update --init` ### CMake @@ -43,14 +44,14 @@ In order to compile the source code and link the binaries run in a Unix terminal ```sh cd devops/scripts/bash/ -./compile_source_code.sh -CMakeToolchainFile +./compile_source_code.sh -CMakeToolchainFile third-party/vcpkg/scripts/buildsystems/vcpkg.cmake ``` In order to additionaly start the test executables in a Unix terminal: ```sh cd devops/scripts/bash/ -./compile_source_code.sh -CMakeToolchainFile -RunTests +./compile_source_code.sh -CMakeToolchainFile third-party/vcpkg/scripts/buildsystems/vcpkg.cmake -RunTests ``` #### Windows @@ -59,14 +60,14 @@ In order to compile the source code and link the binaries run in a PowerShell te ```sh cd devops\scripts\ps1 -.\compile_source_code.ps1 -CMakeToolchainFile +.\compile_source_code.ps1 -CMakeToolchainFile third-party/vcpkg/scripts/buildsystems/vcpkg.cmake ``` In order to additionaly start the test executables in a PowerShell terminal: ```sh cd devops\scripts\ps1 -.\compile_source_code.ps1 -CMakeToolchainFile -RunTests +.\compile_source_code.ps1 -CMakeToolchainFile third-party/vcpkg/scripts/buildsystems/vcpkg.cmake -RunTests ``` ### Bindings From 874c38d8bf0604f6121de5e0a380112ff66cfdce Mon Sep 17 00:00:00 2001 From: Marvin Gajek Date: Mon, 23 Dec 2024 13:38:24 +0100 Subject: [PATCH 4/4] document changes --- CHANGELOG.md | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5385e9d..3500663 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.7.1] - 23-12-2024 + +### Added + +- Added vcpkg git submodule + +### Removed + +- Removed obsolete vcpkg CMake module + +### Fixed + +- Changed license to LPGL-2.1 due to use of `ffmpeg` + ## [0.7.0] - 20-04-2024 ### Added @@ -17,8 +31,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Updated -- utilize lambda expression for `playbackCallback` -- Update python binding +- Utilized lambda expression for `playbackCallback` +- Updated python binding ## [0.5.0] - 17-04-2024 @@ -40,7 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- comment out lines in [install-dependencies.sh](.devcontainer/go/scripts/install-dependencies.sh) bash scripts +- Commented out lines in [install-dependencies.sh](.devcontainer/go/scripts/install-dependencies.sh) bash scripts ## [0.2.0] - 15-04-2024 @@ -50,7 +64,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed -- Rename, comment out lines and install missing apt dependencies in `install-dependencies.sh` bash scripts +- Renamed, commented out lines and installed missing apt dependencies in `install-dependencies.sh` bash scripts ## [0.1.0] - 15-04-2024