diff options
| author | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
|---|---|---|
| committer | Ethan Morgan <ethan@gweithio.com> | 2026-02-14 16:44:06 +0000 |
| commit | 54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch) | |
| tree | d915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports | |
Diffstat (limited to 'vcpkg/scripts/test_ports')
446 files changed, 12434 insertions, 0 deletions
diff --git a/vcpkg/scripts/test_ports/cblas-test/CMakeLists.txt b/vcpkg/scripts/test_ports/cblas-test/CMakeLists.txt new file mode 100644 index 0000000..743ddb6 --- /dev/null +++ b/vcpkg/scripts/test_ports/cblas-test/CMakeLists.txt @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.17) + +project(Find_CBLAS_external) +find_package(PkgConfig REQUIRED) +pkg_check_modules(CBLAS_PC REQUIRED IMPORTED_TARGET cblas) diff --git a/vcpkg/scripts/test_ports/cblas-test/portfile.cmake b/vcpkg/scripts/test_ports/cblas-test/portfile.cmake new file mode 100644 index 0000000..b6904bf --- /dev/null +++ b/vcpkg/scripts/test_ports/cblas-test/portfile.cmake @@ -0,0 +1,5 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Make sure BLAS can be found +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}" + OPTIONS -DVCPKG_HOST_TRIPLET=${HOST_TRIPLET}) diff --git a/vcpkg/scripts/test_ports/cblas-test/vcpkg.json b/vcpkg/scripts/test_ports/cblas-test/vcpkg.json new file mode 100644 index 0000000..6b1df97 --- /dev/null +++ b/vcpkg/scripts/test_ports/cblas-test/vcpkg.json @@ -0,0 +1,19 @@ +{ + "$comment": "Keep the platform expressions in sync with the wrappers installed by the portfiles!", + "name": "cblas-test", + "version-date": "2022-04-22", + "description": "Metapackage for packages which provide BLAS", + "license": null, + "dependencies": [ + "cblas", + { + "name": "pkgconf", + "host": true, + "platform": "windows" + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/cmake-user/portfile.cmake b/vcpkg/scripts/test_ports/cmake-user/portfile.cmake new file mode 100644 index 0000000..f1c3ae8 --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake-user/portfile.cmake @@ -0,0 +1,248 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+set(cmake_commands "")
+if("cmake-current" IN_LIST FEATURES)
+ list(APPEND cmake_commands "${CMAKE_COMMAND}")
+endif()
+if("cmake-3-16" IN_LIST FEATURES)
+ # For convenient updates, use
+ # vcpkg install ... --cmake-args=-DVCPKG_CMAKE_USER_UPDATE=1
+ set(cmake_version 3.16.3)
+ set(legacy_cmake_archive NOTFOUND)
+ string(REGEX REPLACE "([^.]*[.][^.]*).*" "\\1" cmake_major_minor "${cmake_version}")
+ if(VCPKG_HOST_IS_WINDOWS OR VCPKG_CMAKE_USER_UPDATE)
+ set(name "cmake-${cmake_version}-win64-x64")
+ vcpkg_download_distfile(legacy_cmake_archive
+ FILENAME "${name}.zip"
+ URLS "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${name}.zip"
+ "https://cmake.org/files/v${cmake_major_minor}/${name}.zip"
+ SHA512 724d22f3736f0f3503ceb6b49ebec64cd569c4c16ad4fae8ac38918b09ee67e3eaa8072e30546f14f4c13bb94c5639ec940ea1b4695c94225b2a597bb4da1ede
+ )
+ set(cmake_bin_dir "/bin")
+ endif()
+ if(VCPKG_HOST_IS_OSX OR VCPKG_CMAKE_USER_UPDATE)
+ set(name "cmake-${cmake_version}-Darwin-x86_64")
+ vcpkg_download_distfile(legacy_cmake_archive
+ FILENAME "${name}.tar.gz"
+ URLS "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${name}.tar.gz"
+ "https://cmake.org/files/v${cmake_major_minor}/${name}.tar.gz"
+ SHA512 3e59e2406f4e088b60922fbf23e92e1be3bb34c00f919625210fd93c059b5e6785afa40d3a501f36b281cde29de592f2ccffade6fa3980d0cf31dc845483184f
+ )
+ set(cmake_bin_dir "/CMake.app/Contents/bin")
+ endif()
+ if(VCPKG_HOST_IS_LINUX OR VCPKG_CMAKE_USER_UPDATE)
+ set(name "cmake-${cmake_version}-Linux-x86_64")
+ vcpkg_download_distfile(legacy_cmake_archive
+ FILENAME "${name}.tar.gz"
+ URLS "https://github.com/Kitware/CMake/releases/download/v${cmake_version}/${name}.tar.gz"
+ "https://cmake.org/files/v${cmake_major_minor}/${name}.tar.gz"
+ SHA512 03be16ad06fcabe40a36d0a510fdb58f5612108aed70cef7f68879d82b9e04ad62a9d0c30f3406df618ec219c74fc27b4be533d970bc60ac22333951d6cabe1a
+ )
+ set(cmake_bin_dir "/bin")
+ endif()
+ if(NOT legacy_cmake_archive)
+ message(FATAL_ERROR "Unable to test feature 'cmake-3-16' for '${HOST_TRIPLET}' host.")
+ endif()
+ if(VCPKG_CMAKE_USER_UPDATE)
+ message(STATUS "All downloads are up-to-date.")
+ message(FATAL_ERROR "Stopping due to VCPKG_CMAKE_USER_UPDATE being enabled.")
+ endif()
+
+ vcpkg_extract_source_archive(legacy_cmake
+ ARCHIVE "${legacy_cmake_archive}"
+ SOURCE_BASE "${cmake_version}"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/cmake"
+ )
+ list(APPEND cmake_commands "${legacy_cmake}${cmake_bin_dir}/cmake")
+endif()
+
+vcpkg_find_acquire_program(NINJA)
+
+function(get_packages out_packages cmake_version)
+ set(packages "")
+ if("find-package" IN_LIST FEATURES)
+ file(READ "${CMAKE_CURRENT_LIST_DIR}/vcpkg.json" vcpkg_json)
+ string(JSON packages_json GET "${vcpkg_json}" "features" "find-package" "dependencies")
+ string(JSON packages_count LENGTH "${packages_json}")
+ if(packages_count GREATER 0)
+ math(EXPR last "${packages_count} - 1")
+ foreach(i RANGE 0 ${last})
+ # Some ports may be excluded via platform expressions,
+ # because they don't support particular platforms.
+ # Using the installed vcpkg_abi_info.txt as an indicator.
+ string(JSON port GET "${packages_json}" "${i}" "name")
+ if(NOT EXISTS "${CURRENT_INSTALLED_DIR}/share/${port}/vcpkg_abi_info.txt")
+ continue()
+ endif()
+ string(JSON since ERROR_VARIABLE since_not_found GET "${packages_json}" "${i}" "\$since")
+ if(since AND cmake_version VERSION_LESS since)
+ continue()
+ endif()
+ if(NOT EXISTS "${CURRENT_INSTALLED_DIR}/share/${port}/vcpkg_abi_info.txt")
+ continue()
+ endif()
+ string(JSON package GET "${packages_json}" "${i}" "\$package")
+ list(APPEND packages "${package}")
+ endforeach()
+ endif()
+ endif()
+ if("pkg-check-modules" IN_LIST FEATURES)
+ list(APPEND packages "ZLIBviaPkgConfig")
+ endif()
+ set("${out_packages}" "${packages}" PARENT_SCOPE)
+endfunction()
+
+function(test_cmake_project)
+ cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "CMAKE_COMMAND;NAME" "OPTIONS")
+ if(NOT arg_NAME)
+ message(FATAL_ERROR "The NAME argument is mandatory.")
+ endif()
+ if(NOT arg_CMAKE_COMMAND)
+ set(arg_CMAKE_COMMAND "${CMAKE_COMMAND}")
+ endif()
+
+ execute_process(
+ COMMAND "${arg_CMAKE_COMMAND}" --version
+ OUTPUT_VARIABLE cmake_version_output
+ RESULT_VARIABLE cmake_version_result
+ )
+ string(REGEX MATCH "[1-9][0-9]*\\.[0-9]*\\.[0-9]*" cmake_version "${cmake_version_output}")
+ if(cmake_version_result OR NOT cmake_version)
+ message(FATAL_ERROR "Unable to determine version for '${arg_CMAKE_COMMAND}'.")
+ endif()
+
+ set(build_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${cmake_version}-${arg_NAME}")
+ set(base_options
+ # Interface: CMake
+ -G "Ninja"
+ "-DCMAKE_MAKE_PROGRAM=${NINJA}"
+ "-DCMAKE_VERBOSE_MAKEFILE=ON"
+ "-DCMAKE_INSTALL_PREFIX=${build_dir}/install"
+ "-DCMAKE_TOOLCHAIN_FILE=${SCRIPTS}/buildsystems/vcpkg.cmake"
+ # Interface: vcpkg.cmake and scripts/toolchains/*.cmake
+ "-DVCPKG_CHAINLOAD_TOOLCHAIN_FILE=${VCPKG_CHAINLOAD_TOOLCHAIN_FILE}"
+ "-DVCPKG_TARGET_ARCHITECTURE=${VCPKG_TARGET_ARCHITECTURE}"
+ "-DVCPKG_TARGET_TRIPLET=${TARGET_TRIPLET}"
+ "-DVCPKG_CRT_LINKAGE=${VCPKG_CRT_LINKAGE}"
+ "-DVCPKG_HOST_TRIPLET=${HOST_TRIPLET}"
+ "-DVCPKG_INSTALLED_DIR=${_VCPKG_INSTALLED_DIR}"
+ "-DVCPKG_MANIFEST_MODE=OFF"
+ # Interface: project/CMakeLists.txt
+ "-DCHECK_BUILD_TYPE=${VCPKG_BUILD_TYPE}"
+ "-DCHECK_CMAKE_VERSION=${cmake_version}"
+ # Interface: generic override
+ ${VCPKG_CMAKE_CONFIGURE_OPTIONS}
+ )
+
+ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
+ # Interface: CMake
+ list(APPEND base_options "-DCMAKE_SYSTEM_NAME=${VCPKG_CMAKE_SYSTEM_NAME}")
+ endif()
+ if(DEFINED VCPKG_CMAKE_SYSTEM_VERSION)
+ # Interface: scripts/toolchains/*.cmake
+ list(APPEND base_options "-DCMAKE_SYSTEM_VERSION=${VCPKG_CMAKE_SYSTEM_VERSION}")
+ endif()
+
+ if(DEFINED VCPKG_XBOX_CONSOLE_TARGET)
+ # Interface: scripts/toolchains/xbox.cmake
+ list(APPEND base_options "-DXBOX_CONSOLE_TARGET=${VCPKG_XBOX_CONSOLE_TARGET}")
+ endif()
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ list(APPEND base_options -DBUILD_SHARED_LIBS=ON)
+ else()
+ list(APPEND base_options -DBUILD_SHARED_LIBS=OFF)
+ endif()
+
+ message(STATUS "Running tests with CMake ${cmake_version} for '${arg_NAME}'")
+ file(REMOVE_RECURSE "${build_dir}")
+ file(MAKE_DIRECTORY "${build_dir}")
+ vcpkg_execute_required_process(
+ COMMAND
+ "${arg_CMAKE_COMMAND}" "${CMAKE_CURRENT_LIST_DIR}/project"
+ ${base_options}
+ ${arg_OPTIONS}
+ WORKING_DIRECTORY "${build_dir}"
+ LOGNAME "${TARGET_TRIPLET}-${cmake_version}-${arg_NAME}-config"
+ )
+ vcpkg_execute_required_process(
+ COMMAND
+ "${arg_CMAKE_COMMAND}" --build . --target install
+ WORKING_DIRECTORY "${build_dir}"
+ LOGNAME "${TARGET_TRIPLET}-${cmake_version}-${arg_NAME}-build"
+ )
+ # To produce better error messages for failing wrappers,
+ # we run execute_process directly here, for each wrapper.
+ string(REPLACE " OFF:" ":" message
+ " CMake ${cmake_version}: @step@ with `find_package(@package@)` failed.\n"
+ " See logs for more information:\n"
+ " @log_out@\n"
+ " @log_err@\n"
+ )
+ if(DEFINED ENV{BUILD_REASON}) # On Azure Pipelines, add extra markup.
+ string(REPLACE " CMake" "##vso[task.logissue type=error]CMake" message "${message}")
+ endif()
+ get_packages(packages "${cmake_version}")
+ foreach(package IN LISTS packages)
+ string(MAKE_C_IDENTIFIER "${package}" package_string)
+ set(find_package_build_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${cmake_version}-find-package-${package_string}-${arg_NAME}")
+ set(log_out "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${cmake_version}-find-package-${package_string}-${arg_NAME}-out.log")
+ set(log_err "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${cmake_version}-find-package-${package_string}-${arg_NAME}-err.log")
+
+ message(STATUS " find_package(${package})")
+ file(REMOVE_RECURSE "${find_package_build_dir}")
+ file(MAKE_DIRECTORY "${find_package_build_dir}")
+ execute_process(
+ COMMAND
+ "${arg_CMAKE_COMMAND}" "${CMAKE_CURRENT_LIST_DIR}/project"
+ ${base_options}
+ ${arg_OPTIONS}
+ "-DFIND_PACKAGES=${package}"
+ --trace-expand
+ OUTPUT_FILE "${log_out}"
+ ERROR_FILE "${log_err}"
+ RESULT_VARIABLE package_result
+ WORKING_DIRECTORY "${find_package_build_dir}"
+ )
+ if(package_result)
+ set(step "configuration")
+ string(CONFIGURE "${message}" package_message @ONLY)
+ message(SEND_ERROR "${package_message}")
+ else()
+ set(log_out "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${cmake_version}-find-package-${package_string}-${arg_NAME}-build-out.log")
+ set(log_err "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${cmake_version}-find-package-${package_string}-${arg_NAME}-build-err.log")
+ execute_process(
+ COMMAND
+ "${arg_CMAKE_COMMAND}" --build .
+ OUTPUT_FILE "${log_out}"
+ ERROR_FILE "${log_err}"
+ RESULT_VARIABLE package_result
+ WORKING_DIRECTORY "${find_package_build_dir}"
+ )
+ if(package_result)
+ set(step "build")
+ string(CONFIGURE "${message}" package_message @ONLY)
+ message(SEND_ERROR "${package_message}")
+ endif()
+ endif()
+ endforeach()
+endfunction()
+
+if(NOT DEFINED VCPKG_CHAINLOAD_TOOLCHAIN_FILE)
+ z_vcpkg_select_default_vcpkg_chainload_toolchain()
+endif()
+
+foreach(executable IN LISTS cmake_commands)
+ test_cmake_project(NAME "release"
+ CMAKE_COMMAND "${executable}"
+ OPTIONS
+ "-DCMAKE_BUILD_TYPE=Release"
+ )
+ if (NOT VCPKG_BUILD_TYPE)
+ test_cmake_project(NAME "debug"
+ CMAKE_COMMAND "${executable}"
+ OPTIONS
+ "-DCMAKE_BUILD_TYPE=Debug"
+ )
+ endif()
+endforeach()
diff --git a/vcpkg/scripts/test_ports/cmake-user/project/CMakeLists.txt b/vcpkg/scripts/test_ports/cmake-user/project/CMakeLists.txt new file mode 100644 index 0000000..3ebb7a3 --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake-user/project/CMakeLists.txt @@ -0,0 +1,150 @@ +cmake_minimum_required(VERSION 3.5)
+project(cmake-user LANGUAGES C)
+
+message(STATUS "CMAKE_COMMAND: ${CMAKE_COMMAND}")
+set(CHECK_CMAKE_VERSION "NOTFOUND" CACHE STRING "Version of CMake expected to be found")
+if(NOT CHECK_CMAKE_VERSION)
+ message(WARNING "CMake version check: skipped (actual: ${CMAKE_VERSION})")
+elseif(NOT CHECK_CMAKE_VERSION VERSION_EQUAL CMAKE_VERSION)
+ message(SEND_ERROR "CMake version check: failed (actual: ${CMAKE_VERSION} expected: ${CHECK_CMAKE_VERSION})")
+else()
+ message(STATUS "CMake version check: success (actual: ${CMAKE_VERSION})")
+endif()
+
+# add_library overload
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/lib.c" "int lib_unused() { return 1; }")
+add_library(lib "${CMAKE_CURRENT_BINARY_DIR}/lib.c")
+
+# add_executable overload
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/exe.c" "int main() { return 0; }")
+add_executable(exe "${CMAKE_CURRENT_BINARY_DIR}/exe.c")
+
+# install overload
+set(X_VCPKG_APPLOCAL_DEPS_INSTALL 1)
+install(TARGETS exe lib
+ RUNTIME DESTINATION bin
+ ARCHIVE DESTINATION lib
+ LIBRARY DESTINATION lib
+)
+
+# find_package overload and wrapper
+set(FIND_PACKAGES "" CACHE STRING "List of packages to be found and used")
+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}")
+foreach(package ${FIND_PACKAGES})
+ set(extra_args "")
+ if(package STREQUAL "Curses")
+ set(CURSES_NEED_WIDE 1)
+ elseif(package STREQUAL "ICU")
+ set(extra_args COMPONENTS uc)
+ endif()
+ string(TOUPPER "${package}" package_upper)
+ set(CMAKE_FIND_DEBUG_MODE ON)
+ find_package("${package}" ${extra_args} QUIET)
+ set(CMAKE_FIND_DEBUG_MODE OFF)
+ if(NOT ${package}_FOUND AND NOT ${package_upper}_FOUND)
+ message(SEND_ERROR "find_package(${package} ${extra_args}) check: failed")
+ continue()
+ endif()
+ # REQUIRED changes the behaviour find_package_handle_standard_args.
+ find_package("${package}" ${extra_args} REQUIRED)
+ message(STATUS "find_package(${package} ${extra_args}) check: success")
+
+ set(libraries_var "")
+ if(DEFINED ${package}_LIBRARIES)
+ set(libraries_var "${package}_LIBRARIES")
+ elseif(DEFINED ${package_upper}_LIBRARIES)
+ set(libraries_var "${package_upper}_LIBRARIES")
+ elseif(DEFINED ${package}_LIBRARY)
+ set(libraries_var "${package}_LIBRARY")
+ elseif(DEFINED ${package_upper}_LIBRARY)
+ set(libraries_var "${package_upper}_LIBRARY")
+ else()
+ message(STATUS "${package}_LIBRARY/IES: undefined")
+ continue()
+ endif()
+ set(libraries "${${libraries_var}}")
+ message(STATUS "${libraries_var}: ${libraries}")
+
+ if(package STREQUAL "Intl" AND NOT Intl_LIBRARY)
+ continue() # using libintl.h from C runtime library
+ endif()
+ target_link_libraries(exe PRIVATE ${libraries})
+
+ set(last_keyword "")
+ foreach(item IN LISTS libraries)
+ if(item STREQUAL "optimized" OR item STREQUAL "debug")
+ set(last_keyword "${item}")
+ continue()
+ endif()
+ string(FIND "${item}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/" starts_with_release)
+ string(FIND "${item}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/" starts_with_debug)
+ if(starts_with_release EQUAL "0")
+ if(last_keyword STREQUAL "optimized")
+ # okay
+ elseif(last_keyword STREQUAL "debug")
+ message(SEND_ERROR "Release lib for 'debug' keyword: ${item}")
+ elseif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+ message(SEND_ERROR "Release lib for 'Debug' build: ${item}")
+ endif()
+ elseif(starts_with_debug EQUAL "0")
+ if(last_keyword STREQUAL "debug")
+ # okay
+ elseif(last_keyword STREQUAL "optimized")
+ message(SEND_ERROR "Debug lib for 'optimized' keyword: ${item}")
+ elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
+ message(SEND_ERROR "Debug lib for 'Release' build: ${item}")
+ endif()
+ endif()
+ set(last_keyword "")
+ continue()
+ endforeach()
+
+ set(target "${package}::${package}")
+ string(REPLACE "SQLite3::" "SQLite::" target "${target}")
+ if(TARGET "${target}")
+ get_target_property(type "${target}" TYPE)
+ message(STATUS "${target}: ${type}")
+ if(type MATCHES "LIBRARY" AND NOT type MATCHES "INTERFACE")
+ get_target_property(configurations "${target}" IMPORTED_CONFIGURATIONS)
+ message(STATUS "IMPORTED_CONFIGURATIONS: ${configurations}")
+ if(configurations)
+ string(TOLOWER "${configurations}" configurations)
+ if("release" IN_LIST configurations)
+ set(property IMPORTED_IMPLIB_RELEASE)
+ get_target_property(location "${target}" "${property}")
+ if(NOT location)
+ set(property IMPORTED_LOCATION_RELEASE)
+ get_target_property(location "${target}" "${property}")
+ endif()
+ message(STATUS "${property}: ${location}")
+ string(FIND "${location}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" index)
+ if (NOT index EQUAL "0")
+ message(SEND_ERROR "Release lib is in wrong location.")
+ endif()
+ elseif(NOT CHECK_BUILD_TYPE OR CHECK_BUILD_TYPE STREQUAL "release")
+ message(SEND_ERROR "Release configuration is missing.")
+ endif()
+ if("debug" IN_LIST configurations)
+ set(property IMPORTED_IMPLIB_DEBUG)
+ get_target_property(location "${target}" "${property}")
+ if(NOT location)
+ set(property IMPORTED_LOCATION_DEBUG)
+ get_target_property(location "${target}" "${property}")
+ endif()
+ message(STATUS "${property}: ${location}")
+ string(FIND "${location}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" index)
+ if (NOT index EQUAL "0")
+ message(SEND_ERROR "Debug lib is in wrong location.")
+ endif()
+ elseif(NOT CHECK_BUILD_TYPE OR CHECK_BUILD_TYPE STREQUAL "debug")
+ message(SEND_ERROR "Debug configuration is missing.")
+ endif()
+ endif()
+ endif()
+ else()
+ get_directory_property(imported_targets IMPORTED_TARGETS)
+ if(imported_targets)
+ message(STATUS "Imported targets: ${imported_targets}")
+ endif()
+ endif()
+endforeach()
diff --git a/vcpkg/scripts/test_ports/cmake-user/project/FindZLIBviaPkgConfig.cmake b/vcpkg/scripts/test_ports/cmake-user/project/FindZLIBviaPkgConfig.cmake new file mode 100644 index 0000000..5f46a94 --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake-user/project/FindZLIBviaPkgConfig.cmake @@ -0,0 +1,11 @@ +# `pkgconf` is not recognized before CMake 3.22 +find_program(PKG_CONFIG_EXECUTABLE NAMES pkgconf REQUIRED) +find_package(PkgConfig REQUIRED) +pkg_check_modules(PC_ZLIB zlib) +if(PC_ZLIB_FOUND) + if(NOT PC_ZLIB_LDFLAGS) + message(SEND_ERROR "ZLIBviaPkgConfig_LIBRARIES is empty") + endif() + set(ZLIBviaPkgConfig_LIBRARIES "${PC_ZLIB_LDFLAGS}") + set(ZLIBviaPkgConfig_FOUND "${PC_ZLIB_FOUND}") +endif() diff --git a/vcpkg/scripts/test_ports/cmake-user/vcpkg.json b/vcpkg/scripts/test_ports/cmake-user/vcpkg.json new file mode 100644 index 0000000..4cc62e1 --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake-user/vcpkg.json @@ -0,0 +1,183 @@ +{ + "name": "cmake-user", + "version-string": "ci", + "description": "Test port to verify the vcpkg toolchain in cmake user projects", + "license": "MIT", + "default-features": [ + { + "name": "cmake-3-16", + "platform": "x64 & (windows | linux | osx) & !uwp" + }, + "cmake-current", + "find-package", + "pkg-check-modules" + ], + "features": { + "cmake-3-16": { + "description": "Run the tests with CMake 3.16" + }, + "cmake-current": { + "description": "Run the tests with vcpkg's current version of CMake" + }, + "find-package": { + "description": "Ports to be tested via find_package($package)", + "dependencies": [ + { + "$package": "ALSA", + "name": "alsa", + "platform": "linux" + }, + { + "$package": "Boost", + "name": "boost", + "platform": "!uwp" + }, + { + "$package": "BZip2", + "name": "bzip2" + }, + { + "$package": "CURL", + "name": "curl", + "default-features": false + }, + { + "$package": "EXPAT", + "name": "expat" + }, + { + "$package": "Fontconfig", + "name": "fontconfig", + "platform": "!mingw & !uwp" + }, + { + "$package": "GLUT", + "name": "freeglut", + "platform": "!android & !osx & !uwp" + }, + { + "$package": "Freetype", + "name": "freetype", + "default-features": false + }, + { + "$package": "GDAL", + "name": "gdal", + "default-features": false, + "platform": "!uwp" + }, + { + "$package": "Intl", + "name": "gettext-libintl" + }, + { + "$package": "GIF", + "name": "giflib" + }, + { + "$package": "ICU", + "name": "icu", + "platform": "!uwp" + }, + { + "$package": "LAPACK", + "name": "lapack", + "platform": "!android & !(uwp & arm)" + }, + { + "$package": "GnuTLS", + "name": "libgnutls", + "platform": "!android & (!windows | mingw)" + }, + { + "$package": "Iconv", + "name": "libiconv" + }, + { + "$package": "JPEG", + "name": "libjpeg-turbo" + }, + { + "$package": "LibLZMA", + "name": "liblzma" + }, + { + "$package": "PNG", + "name": "libpng" + }, + { + "$package": "PostgreSQL", + "name": "libpq", + "default-features": false, + "platform": "!uwp & !mingw" + }, + { + "$package": "LibXml2", + "name": "libxml2", + "default-features": false, + "features": [ + "icu" + ] + }, + { + "$package": "LibXslt", + "name": "libxslt", + "default-features": false, + "platform": "!uwp & !mingw" + }, + { + "$package": "Curses", + "name": "ncurses", + "platform": "!windows | mingw" + }, + { + "$package": "PhysFS", + "name": "physfs" + }, + { + "$package": "GnuTLS", + "name": "shiftmedia-libgnutls", + "platform": "windows & !arm & !mingw & !uwp & !xbox" + }, + { + "$package": "SQLite3", + "name": "sqlite3", + "default-features": false, + "features": [ + "unicode" + ] + }, + { + "$package": "TIFF", + "name": "tiff", + "default-features": false, + "features": [ + "lerc", + "libdeflate", + "zstd" + ] + }, + { + "$package": "wxWidgets", + "name": "wxwidgets", + "default-features": false, + "platform": "!android & !uwp" + }, + { + "$package": "ZLIB", + "name": "zlib" + } + ] + }, + "pkg-check-modules": { + "description": "Test `find_package(PkgConfig)` and pkg_check_modules(...)", + "dependencies": [ + { + "name": "pkgconf", + "host": true + }, + "zlib" + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/cmake/fix-dependency-libuv.patch b/vcpkg/scripts/test_ports/cmake/fix-dependency-libuv.patch new file mode 100644 index 0000000..a9a53de --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake/fix-dependency-libuv.patch @@ -0,0 +1,18 @@ +diff --git a/Source/Modules/CMakeBuildUtilities.cmake b/Source/Modules/CMakeBuildUtilities.cmake +index dba9d506..225779cd 100644 +--- a/Source/Modules/CMakeBuildUtilities.cmake ++++ b/Source/Modules/CMakeBuildUtilities.cmake +@@ -328,6 +328,13 @@ endif() + #--------------------------------------------------------------------- + # Build libuv library. + if(CMAKE_USE_SYSTEM_LIBUV) ++ find_package(libuv CONFIG REQUIRED) ++ if (TARGET libuv::uv) ++ add_library(LibUV::LibUV ALIAS libuv::uv) ++ else() ++ add_library(LibUV::LibUV ALIAS libuv::uv_a) ++ endif() ++elseif(0) + if(WIN32) + find_package(LibUV 1.38.0) + else() diff --git a/vcpkg/scripts/test_ports/cmake/portfile.cmake b/vcpkg/scripts/test_ports/cmake/portfile.cmake new file mode 100644 index 0000000..9ec71cf --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake/portfile.cmake @@ -0,0 +1,71 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) + +vcpkg_download_distfile(curl_8_16_patch + URLS https://github.com/Kitware/CMake/commit/c8143074cf3954b1e169904eb9d843cfbe14acc3.diff?full_index=1 + FILENAME Kitware-CMake-curl_8_16.diff + SHA512 25b448798a314705982d957f18cddc6ca235ef8283ed6d32bab0aa949cee518a273dec79dfd48bbe24bbf1781c098a1c3e892134c3aa69efcfec410b9f4d7b6f +) + +vcpkg_from_gitlab( + GITLAB_URL https://gitlab.kitware.com/ + OUT_SOURCE_PATH SOURCE_PATH + REPO cmake/cmake + REF v${VERSION} + SHA512 ac67fe802179f6cd9ed290f905976923ffa3843e63e0e680a971a1019a88b813e281bd912e71a02af5df101eb1dd1692f140e34466ba4fa1b822a03097d2467b + HEAD_REF master + PATCHES + fix-dependency-libuv.patch + "${curl_8_16_patch}" +) +set(OPTIONS "") +if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND OPTIONS "-DBUILD_CursesDialog=OFF") +else() + list(APPEND OPTIONS "-DBUILD_CursesDialog=ON") +endif() + +if(VCPKG_CROSSCOMPILING) + list(APPEND OPTIONS "-DQt6CoreTools_DIR=${CURRENT_HOST_INSTALLED_DIR}/share/Qt6CoreTools") + list(APPEND OPTIONS "-DQt6WidgetsTools_DIR=${CURRENT_HOST_INSTALLED_DIR}/share/Qt6WidgetsTools") + list(APPEND OPTIONS "-DQt6GuiTools_DIR=${CURRENT_HOST_INSTALLED_DIR}/share/Qt6GuiTools") +endif() + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + set(VCPKG_CXX_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_CXX_FLAGS}") + set(VCPKG_C_FLAGS "/D_CRT_DECLARE_NONSTDC_NAMES ${VCPKG_C_FLAGS}") +endif() + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + ${OPTIONS} + -DBUILD_TESTING=OFF + -DCMAKE_USE_SYSTEM_LIBRARIES=ON + -DBUILD_QtDialog=ON # Just to test Qt with CMake + -DCMake_QT_MAJOR_VERSION:STRING=6 +) + +vcpkg_cmake_install(ADD_BIN_TO_PATH) +vcpkg_copy_pdbs() + +if(VCPKG_TARGET_IS_OSX) + # On OSX everything is within a CMake.app folder + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools") + file(RENAME "${CURRENT_PACKAGES_DIR}/CMake.app" "${CURRENT_PACKAGES_DIR}/tools/CMake.app") + if(EXISTS "${CURRENT_PACKAGES_DIR}/debug/CMake.app") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/debug") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/CMake.app" "${CURRENT_PACKAGES_DIR}/tools/debug/CMake.app") + endif() +else() + set(tool_names cmake cmake-gui ctest cpack) + if(VCPKG_TARGET_IS_WINDOWS) + list(APPEND tool_names cmcldeps) + elseif(NOT VCPKG_TARGET_IS_ANDROID) + list(APPEND tool_names ccmake) + endif() + vcpkg_copy_tools(TOOL_NAMES ${tool_names} AUTO_CLEAN) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.rst") diff --git a/vcpkg/scripts/test_ports/cmake/vcpkg.json b/vcpkg/scripts/test_ports/cmake/vcpkg.json new file mode 100644 index 0000000..e97f7ea --- /dev/null +++ b/vcpkg/scripts/test_ports/cmake/vcpkg.json @@ -0,0 +1,44 @@ +{ + "name": "cmake", + "version": "4.0.0", + "description": "CMake is an open-source, cross-platform family of tools designed to build, test and package software.", + "homepage": "https://cmake.org/", + "license": "BSD-3-Clause", + "dependencies": [ + "cppdap", + { + "name": "curl", + "default-features": false + }, + "expat", + "jsoncpp", + { + "name": "libarchive", + "default-features": false, + "features": [ + "bzip2", + "lzma", + "zstd" + ] + }, + "libuv", + { + "name": "ncurses", + "platform": "!windows" + }, + "nghttp2", + { + "name": "qtbase", + "default-features": false, + "features": [ + "widgets" + ] + }, + "rhash", + { + "name": "vcpkg-cmake", + "host": true + }, + "zlib" + ] +} diff --git a/vcpkg/scripts/test_ports/lapack-test/CMakeLists.txt b/vcpkg/scripts/test_ports/lapack-test/CMakeLists.txt new file mode 100644 index 0000000..1874911 --- /dev/null +++ b/vcpkg/scripts/test_ports/lapack-test/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.17) + +project(Find_LAPACK_external) +find_package(LAPACK REQUIRED) +find_package(PkgConfig REQUIRED) +pkg_check_modules(LAPACK_PC REQUIRED IMPORTED_TARGET lapack) diff --git a/vcpkg/scripts/test_ports/lapack-test/portfile.cmake b/vcpkg/scripts/test_ports/lapack-test/portfile.cmake new file mode 100644 index 0000000..28b2faa --- /dev/null +++ b/vcpkg/scripts/test_ports/lapack-test/portfile.cmake @@ -0,0 +1,5 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Make sure LAPACK can be found +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}" + OPTIONS -DVCPKG_HOST_TRIPLET=${HOST_TRIPLET}) diff --git a/vcpkg/scripts/test_ports/lapack-test/vcpkg.json b/vcpkg/scripts/test_ports/lapack-test/vcpkg.json new file mode 100644 index 0000000..00c2832 --- /dev/null +++ b/vcpkg/scripts/test_ports/lapack-test/vcpkg.json @@ -0,0 +1,19 @@ +{ + "$comment": "Keep the platform expressions in sync with the wrappers installed by the portfiles!", + "name": "lapack-test", + "version-date": "2022-02-22", + "description": "Metapackage for packages which provide LAPACK", + "license": null, + "dependencies": [ + "lapack", + { + "name": "pkgconf", + "host": true, + "platform": "windows" + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/llfio-run-tests/portfile.cmake b/vcpkg/scripts/test_ports/llfio-run-tests/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/llfio-run-tests/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/llfio-run-tests/vcpkg.json b/vcpkg/scripts/test_ports/llfio-run-tests/vcpkg.json new file mode 100644 index 0000000..32c0cf4 --- /dev/null +++ b/vcpkg/scripts/test_ports/llfio-run-tests/vcpkg.json @@ -0,0 +1,22 @@ +{ + "name": "llfio-run-tests", + "version-string": "0", + "port-version": 1, + "description": "Ensures that LLFIO built with vcpkg version of dependencies produces working executables.", + "supports": "x64", + "dependencies": [ + { + "name": "llfio", + "features": [ + "run-tests" + ] + }, + { + "name": "llfio", + "features": [ + "run-tests", + "status-code" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/outcome-run-tests/portfile.cmake b/vcpkg/scripts/test_ports/outcome-run-tests/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/outcome-run-tests/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/outcome-run-tests/vcpkg.json b/vcpkg/scripts/test_ports/outcome-run-tests/vcpkg.json new file mode 100644 index 0000000..8a20395 --- /dev/null +++ b/vcpkg/scripts/test_ports/outcome-run-tests/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "outcome-run-tests", + "version-string": "0", + "port-version": 1, + "description": "Ensures that outcome built with vcpkg version of dependencies produces working executables.", + "supports": "x64", + "dependencies": [ + { + "name": "outcome", + "features": [ + "run-tests" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/portfile.cmake b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/portfile.cmake new file mode 100644 index 0000000..960fd7b --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/portfile.cmake @@ -0,0 +1,46 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS_RELEASE + -DTEST_STRING=release + OPTIONS_DEBUG + -DTEST_STRING=debug +) +vcpkg_cmake_install() + +function(make_rpath_absolute lib_dir) +string(REPLACE "/" "_" logname "make_rpath_absolute-${lib_dir}") + vcpkg_execute_required_process( + COMMAND "install_name_tool" -id ${CURRENT_INSTALLED_DIR}/${lib_dir}/librpath-macho-backend-lib++.dylib ${CURRENT_PACKAGES_DIR}/${lib_dir}/librpath-macho-backend-lib++.dylib + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}" + LOGNAME "${logname}-id" + ) + + vcpkg_execute_required_process( + COMMAND "install_name_tool" -change @rpath/librpath-macho-backend-lib++.dylib ${CURRENT_INSTALLED_DIR}/${lib_dir}/librpath-macho-backend-lib++.dylib ${CURRENT_PACKAGES_DIR}/${lib_dir}/librpath-macho-test-lib.dylib + WORKING_DIRECTORY "${CURRENT_PACKAGES_DIR}" + LOGNAME "${logname}-change" + ) +endfunction() + +if(NOT VCPKG_BUILD_TYPE) + vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}" + ) + vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/debug" + ) + vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug" + ) + make_rpath_absolute("debug/lib") +endif() +make_rpath_absolute("lib") +vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}") +vcpkg_copy_tools(TOOL_NAMES rpath-macho-test-tool AUTO_CLEAN) +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "This test port is part of vcpkg.") diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/CMakeLists.txt b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/CMakeLists.txt new file mode 100644 index 0000000..9939b6f --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.7) +project(rpath-macho-test CXX) + +set(TEST_STRING "" CACHE STRING "") + +set(CMAKE_SKIP_INSTALL_RPATH TRUE) + +add_library(rpath-macho-backend-lib++ transitive.cpp) +target_compile_definitions(rpath-macho-backend-lib++ PRIVATE "TEST_STRING=\"${TEST_STRING}\"") + +add_library(rpath-macho-test-lib lib.cpp) +target_link_libraries(rpath-macho-test-lib PRIVATE rpath-macho-backend-lib++) + +add_executable(rpath-macho-test-tool main.cpp) +target_link_libraries(rpath-macho-test-tool PRIVATE rpath-macho-test-lib) + +install(TARGETS rpath-macho-backend-lib++ rpath-macho-test-lib rpath-macho-test-tool) diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/lib.cpp b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/lib.cpp new file mode 100644 index 0000000..3727a06 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/lib.cpp @@ -0,0 +1,6 @@ +extern const char* getTestStringBackend(); + +const char* getTestString() +{ + return getTestStringBackend(); +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/main.cpp b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/main.cpp new file mode 100644 index 0000000..7253b5a --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/main.cpp @@ -0,0 +1,8 @@ +#include <stdio.h> + +extern const char* getTestString(); + +int main() +{ + puts(getTestString()); +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/transitive.cpp b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/transitive.cpp new file mode 100644 index 0000000..ab1ca00 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/project/transitive.cpp @@ -0,0 +1,4 @@ +const char* getTestStringBackend() +{ + return TEST_STRING; +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test-binaries/vcpkg.json b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/vcpkg.json new file mode 100644 index 0000000..8911159 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test-binaries/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "rpath-macho-test-binaries", + "version-string": "ci", + "description": "Provides installed binaries for rpath macho fixup test", + "supports": "native & osx", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake b/vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake new file mode 100644 index 0000000..c317fa8 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test/portfile.cmake @@ -0,0 +1,62 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +foreach(dir IN ITEMS tools/rpath-macho-test-binaries manual-tools/rpath-macho-test-binaries) + string(REPLACE "/" "_" logname "execute-rel-${dir}") + vcpkg_execute_required_process( + COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-macho-test-tool" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + if(NOT output STREQUAL "release") + message(SEND_ERROR "${dir}: $Actual: '${output}', expected: 'release'") + endif() +endforeach() + +if(NOT VCPKG_BUILD_TYPE) + foreach(dir IN ITEMS tools/rpath-macho-test-binaries/debug manual-tools/rpath-macho-test-binaries/debug debug/tools/rpath-macho-test-binaries) + string(REPLACE "/" "_" logname "execute-dbg-${dir}") + vcpkg_execute_required_process( + COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-macho-test-tool" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + if(NOT output STREQUAL "debug") + message(SEND_ERROR "${dir}: Actual: '${output}', expected: 'debug'") + endif() + endforeach() +endif() + +function(check_proper_rpath macho_lib) + vcpkg_execute_required_process( + COMMAND "otool" "-L" "${macho_lib}" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + + set(found_rpath_backend_lib OFF) + + string(REPLACE "\n" ";" output_lines "${output}") + # Ignore first line, it contains the path to the lib which we are checking + list(REMOVE_AT output_lines 0) + foreach(line IN LISTS output_lines) + if("${line}" MATCHES "\\s+/.*librpath-macho-backend-lib\\+\\+\\.dylib") + message(SEND_ERROR "${line} contains an absolute path") + endif() + if("${line}" MATCHES "@rpath/librpath-macho-backend-lib\\+\\+.dylib") + set(found_rpath_backend_lib ON) + endif() + endforeach() + + if(NOT found_rpath_backend_lib) + message(SEND_ERROR "@rpath/librpath-macho-backend-lib++.dylib not found in ${output}") + endif() +endfunction() + +check_proper_rpath("${CURRENT_INSTALLED_DIR}/lib/librpath-macho-test-lib.dylib") +check_proper_rpath("${CURRENT_INSTALLED_DIR}/debug/lib/librpath-macho-test-lib.dylib") diff --git a/vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json b/vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json new file mode 100644 index 0000000..c7c70c0 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-macho-test/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "rpath-macho-test", + "version-string": "ci", + "description": "Test rpath macho fixup", + "dependencies": [ + "rpath-macho-test-binaries" + ] +} diff --git a/vcpkg/scripts/test_ports/rpath-test-binaries/portfile.cmake b/vcpkg/scripts/test_ports/rpath-test-binaries/portfile.cmake new file mode 100644 index 0000000..0326a30 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test-binaries/portfile.cmake @@ -0,0 +1,29 @@ +set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled) +vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS_RELEASE + -DTEST_STRING=release + OPTIONS_DEBUG + -DTEST_STRING=debug +) +vcpkg_cmake_install() + +if(NOT VCPKG_BUILD_TYPE) + vcpkg_copy_tools(TOOL_NAMES rpath-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/debug/tools/${PORT}" + ) + vcpkg_copy_tools(TOOL_NAMES rpath-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}/debug" + ) + vcpkg_copy_tools(TOOL_NAMES rpath-test-tool + SEARCH_DIR "${CURRENT_PACKAGES_DIR}/debug/bin" + DESTINATION "${CURRENT_PACKAGES_DIR}/tools/${PORT}/debug" + ) +endif() +vcpkg_copy_tools(TOOL_NAMES rpath-test-tool DESTINATION "${CURRENT_PACKAGES_DIR}/manual-tools/${PORT}") +vcpkg_copy_tools(TOOL_NAMES rpath-test-tool AUTO_CLEAN) +file(WRITE "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright" "This test port is part of vcpkg.") diff --git a/vcpkg/scripts/test_ports/rpath-test-binaries/project/CMakeLists.txt b/vcpkg/scripts/test_ports/rpath-test-binaries/project/CMakeLists.txt new file mode 100644 index 0000000..1e6fb0c --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test-binaries/project/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.7) +project(rpath-test CXX) + +set(TEST_STRING "" CACHE STRING "") + +set(CMAKE_SKIP_INSTALL_RPATH TRUE) + +add_library(rpath-backend-lib transitive.cpp) +target_compile_definitions(rpath-backend-lib PRIVATE "TEST_STRING=\"${TEST_STRING}\"") + +add_library(rpath-test-lib lib.cpp) +target_link_libraries(rpath-test-lib PRIVATE rpath-backend-lib) + +add_executable(rpath-test-tool main.cpp) +target_link_libraries(rpath-test-tool PRIVATE rpath-test-lib) + +install(TARGETS rpath-backend-lib rpath-test-lib rpath-test-tool) diff --git a/vcpkg/scripts/test_ports/rpath-test-binaries/project/lib.cpp b/vcpkg/scripts/test_ports/rpath-test-binaries/project/lib.cpp new file mode 100644 index 0000000..3727a06 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test-binaries/project/lib.cpp @@ -0,0 +1,6 @@ +extern const char* getTestStringBackend(); + +const char* getTestString() +{ + return getTestStringBackend(); +} diff --git a/vcpkg/scripts/test_ports/rpath-test-binaries/project/main.cpp b/vcpkg/scripts/test_ports/rpath-test-binaries/project/main.cpp new file mode 100644 index 0000000..7253b5a --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test-binaries/project/main.cpp @@ -0,0 +1,8 @@ +#include <stdio.h> + +extern const char* getTestString(); + +int main() +{ + puts(getTestString()); +} diff --git a/vcpkg/scripts/test_ports/rpath-test-binaries/project/transitive.cpp b/vcpkg/scripts/test_ports/rpath-test-binaries/project/transitive.cpp new file mode 100644 index 0000000..ab1ca00 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test-binaries/project/transitive.cpp @@ -0,0 +1,4 @@ +const char* getTestStringBackend() +{ + return TEST_STRING; +} diff --git a/vcpkg/scripts/test_ports/rpath-test-binaries/vcpkg.json b/vcpkg/scripts/test_ports/rpath-test-binaries/vcpkg.json new file mode 100644 index 0000000..bf52bd7 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test-binaries/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "rpath-test-binaries", + "version-string": "ci", + "description": "Provides installed binaries for rpath fixup test", + "supports": "native & !windows", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/rpath-test/portfile.cmake b/vcpkg/scripts/test_ports/rpath-test/portfile.cmake new file mode 100644 index 0000000..481a935 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test/portfile.cmake @@ -0,0 +1,31 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +foreach(dir IN ITEMS tools/rpath-test-binaries manual-tools/rpath-test-binaries) + string(REPLACE "/" "_" logname "execute-rel-${dir}") + vcpkg_execute_required_process( + COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-test-tool" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + if(NOT output STREQUAL "release") + message(SEND_ERROR "${dir}: $Actual: '${output}', expected: 'release'") + endif() +endforeach() + +if(NOT VCPKG_BUILD_TYPE) + foreach(dir IN ITEMS tools/rpath-test-binaries/debug manual-tools/rpath-test-binaries/debug debug/tools/rpath-test-binaries) + string(REPLACE "/" "_" logname "execute-dbg-${dir}") + vcpkg_execute_required_process( + COMMAND "${CURRENT_INSTALLED_DIR}/${dir}/rpath-test-tool" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + OUTPUT_VARIABLE output + OUTPUT_STRIP_TRAILING_WHITESPACE + LOGNAME "${logname}" + ) + if(NOT output STREQUAL "debug") + message(SEND_ERROR "${dir}: Actual: '${output}', expected: 'debug'") + endif() + endforeach() +endif() diff --git a/vcpkg/scripts/test_ports/rpath-test/vcpkg.json b/vcpkg/scripts/test_ports/rpath-test/vcpkg.json new file mode 100644 index 0000000..7136d04 --- /dev/null +++ b/vcpkg/scripts/test_ports/rpath-test/vcpkg.json @@ -0,0 +1,8 @@ +{ + "name": "rpath-test", + "version-string": "ci", + "description": "Test rpath fixup", + "dependencies": [ + "rpath-test-binaries" + ] +} diff --git a/vcpkg/scripts/test_ports/sqlpp11-connector-mysql/portfile.cmake b/vcpkg/scripts/test_ports/sqlpp11-connector-mysql/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/sqlpp11-connector-mysql/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/sqlpp11-connector-mysql/vcpkg.json b/vcpkg/scripts/test_ports/sqlpp11-connector-mysql/vcpkg.json new file mode 100644 index 0000000..1a4bdb6 --- /dev/null +++ b/vcpkg/scripts/test_ports/sqlpp11-connector-mysql/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "sqlpp11-connector-mysql", + "version-string": "ci", + "description": "Overlay for an obsolete empty port in order to unblock sqlpp11 testing: platform-specific choice of testable implementation", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "supports": "!uwp", + "dependencies": [ + { + "name": "sqlpp11", + "default-features": false, + "features": [ + "mariadb" + ], + "platform": "x86 & windows" + }, + { + "name": "sqlpp11", + "default-features": false, + "features": [ + "mysql" + ], + "platform": "!(x86 & windows)" + } + ] +} diff --git a/vcpkg/scripts/test_ports/try-compile/CMakeLists.txt b/vcpkg/scripts/test_ports/try-compile/CMakeLists.txt new file mode 100644 index 0000000..1d1d93a --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.25)
+
+project(try-compile-test LANGUAGES C CXX)
+
+try_compile(result PROJECT test-try-compile SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/try")
+
+if(NOT result)
+ message(FATAL_ERROR "Compiler flags are not passed consistently to try_compile!")
+endif()
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/try-compile/portfile.cmake b/vcpkg/scripts/test_ports/try-compile/portfile.cmake new file mode 100644 index 0000000..b7c364e --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/portfile.cmake @@ -0,0 +1,9 @@ +
+string(APPEND VCPKG_C_FLAGS " -DVCPKG_LET_ME_PASS")
+string(APPEND VCPKG_CXX_FLAGS " -DVCPKG_LET_ME_PASS")
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CMAKE_CURRENT_LIST_DIR}"
+)
+
+set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/try-compile/try/CMakeLists.txt b/vcpkg/scripts/test_ports/try-compile/try/CMakeLists.txt new file mode 100644 index 0000000..d5f1696 --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/try/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25)
+
+project(try-compile-project LANGUAGES C CXX)
+
+add_library(result "${CMAKE_CURRENT_SOURCE_DIR}/try-compile.c")
+
diff --git a/vcpkg/scripts/test_ports/try-compile/try/try-compile.c b/vcpkg/scripts/test_ports/try-compile/try/try-compile.c new file mode 100644 index 0000000..d3d6712 --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/try/try-compile.c @@ -0,0 +1,5 @@ +
+
+#if !defined(VCPKG_LET_ME_PASS)
+ #error "You shall not pass without forwarding compiler flags to try_compile!"
+#endif
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/try-compile/vcpkg.json b/vcpkg/scripts/test_ports/try-compile/vcpkg.json new file mode 100644 index 0000000..8ccd705 --- /dev/null +++ b/vcpkg/scripts/test_ports/try-compile/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "try-compile", + "version": "1", + "description": "Test if try compile correctly passes on compiler flags", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/portfile.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/portfile.cmake new file mode 100644 index 0000000..0dc09c5 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/portfile.cmake @@ -0,0 +1,41 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+if(NOT VCPKG_CROSSCOMPILING)
+ file(INSTALL "${CURRENT_PORT_DIR}/test-macros.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+endif()
+
+include("${CURRENT_PORT_DIR}/test-macros.cmake")
+
+if("minimum-required" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_minimum_required.cmake")
+endif()
+if("list" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_list.cmake")
+endif()
+if("host-path-list" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_host_path_list.cmake")
+endif()
+if("function-arguments" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_function_arguments.cmake")
+endif()
+if("merge-libs" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_cmake_config_fixup_merge.cmake")
+endif()
+if("backup-restore-env-vars" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_backup_restore_env_vars.cmake")
+endif()
+if("setup-pkgconfig-path" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_setup_pkgconfig_path.cmake")
+endif()
+if("fixup-pkgconfig" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_fixup_pkgconfig.cmake")
+endif()
+if("fixup-rpath" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_calculate_corrected_rpath.cmake")
+ include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_calculate_corrected_rpath_macho.cmake")
+endif()
+if("execute-required-process" IN_LIST FEATURES)
+ include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg_execute_required_process.cmake")
+endif()
+
+unit_test_report_result()
diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-macros.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-macros.cmake new file mode 100644 index 0000000..af5fc7f --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-macros.cmake @@ -0,0 +1,173 @@ +include_guard(GLOBAL) + +function(set_fatal_error err) + set(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR "ON" CACHE BOOL "" FORCE) + set(Z_VCPKG_UNIT_TEST_FATAL_ERROR "${err}" CACHE STRING "" FORCE) +endfunction() +function(unset_fatal_error) + set(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR "OFF" CACHE BOOL "" FORCE) +endfunction() +function(set_has_error) + set(Z_VCPKG_UNIT_TEST_HAS_ERROR ON CACHE BOOL "" FORCE) +endfunction() + +macro(message level msg) + if("${level}" STREQUAL "FATAL_ERROR") + set_fatal_error("${msg}") + return() + else() + _message("${level}" "${msg}") # note: this results in incorrect printing, but that's fine + # message(STATUS "\${asdf}") will result in + # message(STATUS "${asdf}"), since that's how macro arguments work. + endif() +endmacro() + +# Call this at the end of testing. +macro(unit_test_report_result) + if(Z_VCPKG_UNIT_TEST_HAS_ERROR) + _message(FATAL_ERROR "At least one test failed") + endif() +endmacro() + +set(Z_VCPKG_UNIT_TEST_HAS_ERROR OFF CACHE BOOL "" FORCE) +unset_fatal_error() + +# Set <namespace>_MATCHED, preserve parent scope's CMAKE_MATCH_<...> +function(unit_test_match namespace value regex) + if("${value}" MATCHES "${regex}") + set("${namespace}_MATCHED" ON PARENT_SCOPE) + if("${CMAKE_MATCH_COUNT}" EQUAL "0") + return() + endif() + + foreach(match RANGE 1 "${CMAKE_MATCH_COUNT}") + set("${namespace}_CMAKE_MATCH_${match}" "${CMAKE_MATCH_${match}}" PARENT_SCOPE) + endforeach() + else() + set("${namespace}_MATCHED" OFF PARENT_SCOPE) + endif() +endfunction() + +function(unit_test_check_variable_unset utcvu_test utcvu_variable) + cmake_language(EVAL CODE "${utcvu_test}") + if(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + unset_fatal_error() + set_has_error() + message(SEND_ERROR "${utcvu_test} had an unexpected FATAL_ERROR; + expected: \"${utcvu_value}\"") + message(SEND_ERROR "FATAL_ERROR: ${Z_VCPKG_UNIT_TEST_FATAL_ERROR}") + return() + endif() + + unit_test_match(utcvu "${utcvu_variable}" [[^(ENV|CACHE)\{(.*)\}$]]) + if(utcvu_MATCHED) + message(STATUS "utcvu_variable: ${utcvu_CMAKE_MATCH_2}") + if("${utcvu_CMAKE_MATCH_1}" STREQUAL "ENV") + set(utcvu_actual_value "$ENV{${utcvu_CMAKE_MATCH_2}}") + elseif("${utcvu_CMAKE_MATCH_1}" STREQUAL "CACHE") + set(utcvu_actual_value "$CACHE{${utcvu_CMAKE_MATCH_2}}") + else() + _message(FATAL_ERROR "unexpected value for CMAKE_MATCH_1: ${utcvu_CMAKE_MATCH_1}") + endif() + else() + set(utcvu_actual_value "${${utcvu_variable}}") + endif() + + if(DEFINED "${utcvu_variable}") + message(SEND_ERROR "${utcvu_test} set ${utcvu_variable}; + expected: \"${utcvu_variable}\" unset + actual : \"${utcvu_actual_value}\"") + set_has_error() + return() + endif() +endfunction() + +function(unit_test_check_variable_equal utcve_test utcve_variable utcve_value) + cmake_language(EVAL CODE "${utcve_test}") + if(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + unset_fatal_error() + set_has_error() + message(SEND_ERROR "${utcve_test} had an unexpected FATAL_ERROR; + expected: \"${utcve_value}\"") + message(SEND_ERROR "FATAL_ERROR: ${Z_VCPKG_UNIT_TEST_FATAL_ERROR}") + return() + endif() + + unit_test_match(utcve "${utcve_variable}" "^ENV\\{") + if(NOT DEFINED "${utcve_variable}" AND NOT utcve_MATCHED) + message(SEND_ERROR "${utcve_test} failed to set ${utcve_variable}; + expected: \"${utcve_value}\"") + set_has_error() + return() + endif() + + unit_test_match(utcve "${utcve_variable}" [[^(ENV|CACHE)\{(.*)\}$]]) + if(utcve_MATCHED) + if("${utcve_CMAKE_MATCH_1}" STREQUAL "ENV") + set(utcve_actual_value "$ENV{${utcve_CMAKE_MATCH_2}}") + elseif("${utcve_CMAKE_MATCH_1}" STREQUAL "CACHE") + set(utcve_actual_value "$CACHE{${utcve_CMAKE_MATCH_2}}") + else() + _message(FATAL_ERROR "unexpected value for CMAKE_MATCH_1: ${utcve_CMAKE_MATCH_1}") + endif() + else() + set(utcve_actual_value "${${utcve_variable}}") + endif() + + if(NOT "${utcve_actual_value}" STREQUAL "${utcve_value}") + message(SEND_ERROR "${utcve_test} resulted in the wrong value for ${utcve_variable}; + expected: \"${utcve_value}\" + actual : \"${utcve_actual_value}\"") + set_has_error() + return() + endif() +endfunction() + +function(unit_test_check_variable_not_equal utcve_test utcve_variable utcve_value) + cmake_language(EVAL CODE "${utcve_test}") + if(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + unset_fatal_error() + set_has_error() + message(SEND_ERROR "${utcve_test} had an unexpected FATAL_ERROR; + expected: \"${utcve_value}\"") + message(SEND_ERROR "FATAL_ERROR: ${Z_VCPKG_UNIT_TEST_FATAL_ERROR}") + return() + endif() + + unit_test_match(utcve "${utcve_variable}" [[^(ENV|CACHE)\{(.*)\}$]]) + if(utcve_MATCHED) + if("${utcve_CMAKE_MATCH_1}" STREQUAL "ENV") + set(utcve_actual_value "$ENV{${utcve_CMAKE_MATCH_2}}") + elseif("${utcve_CMAKE_MATCH_1}" STREQUAL "CACHE") + set(utcve_actual_value "$CACHE{${utcve_CMAKE_MATCH_2}}") + else() + _message(FATAL_ERROR "unexpected value for CMAKE_MATCH_1: ${utcve_CMAKE_MATCH_1}") + endif() + else() + set(utcve_actual_value "${${utcve_variable}}") + endif() + + if("${utcve_actual_value}" STREQUAL "${utcve_value}") + message(SEND_ERROR "${utcve_test} failed to change ${utcve_variable}; + unchanged: \"${utcve_value}\"") + set_has_error() + return() + endif() +endfunction() + +function(unit_test_ensure_success utcve_test) + cmake_language(EVAL CODE "${utcve_test}") + if(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + set_has_error() + message(SEND_ERROR "${utcve_test} was expected to be successful.") + endif() + unset_fatal_error() +endfunction() +function(unit_test_ensure_fatal_error utcve_test) + cmake_language(EVAL CODE "${utcve_test}") + if(NOT Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + set_has_error() + message(SEND_ERROR "${utcve_test} was expected to be a FATAL_ERROR.") + endif() + unset_fatal_error() +endfunction() diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_backup_restore_env_vars.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_backup_restore_env_vars.cmake new file mode 100644 index 0000000..ae010b3 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_backup_restore_env_vars.cmake @@ -0,0 +1,38 @@ +# vcpkg_backup_env_variables(VARS <list>) +# vcpkg_restore_env_variables(VARS <list>) +# These functions used scoped variables and cannot be called in unit_test_check_*. + +set(ENV{A} [[::a;::b]]) +set(ENV{B} [[]]) + +# Backup doesn't change variables. +vcpkg_backup_env_variables(VARS A B) +unit_test_check_variable_equal([[]] ENV{A} [[::a;::b]]) +unit_test_check_variable_equal([[]] ENV{B} [[]]) + +# Restore restores. +set(ENV{A} [[::a;::b;::c]]) +set(ENV{B} [[::1]]) +vcpkg_restore_env_variables(VARS A B) +unit_test_check_variable_equal([[]] ENV{A} [[::a;::b]]) +unit_test_check_variable_equal([[]] ENV{B} [[]]) + +# Restore can be called more than once. +set(ENV{A} [[::a;::b;::c]]) +set(ENV{B} [[::1]]) +vcpkg_restore_env_variables(VARS A B) +unit_test_check_variable_equal([[]] ENV{A} [[::a;::b]]) +unit_test_check_variable_equal([[]] ENV{B} [[]]) + +# Backups are scoped. +function(change_and_backup) + set(ENV{A} [[::a;::b;::c]]) + set(ENV{B} [[::1]]) + vcpkg_backup_env_variables(VARS A B) + # no further change, no restore, in this scope +endfunction() +vcpkg_backup_env_variables(VARS A B) +change_and_backup() +vcpkg_restore_env_variables(VARS A B) +unit_test_check_variable_equal([[]] ENV{A} [[::a;::b]]) +unit_test_check_variable_equal([[]] ENV{B} [[]]) diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_execute_required_process.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_execute_required_process.cmake new file mode 100644 index 0000000..ff767c3 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_execute_required_process.cmake @@ -0,0 +1,189 @@ +# vcpkg_execute_required_process +#[[ + "ALLOW_IN_DOWNLOAD_MODE;OUTPUT_STRIP_TRAILING_WHITESPACE;ERROR_STRIP_TRAILING_WHITESPACE" + "WORKING_DIRECTORY;LOGNAME;TIMEOUT;OUTPUT_VARIABLE;ERROR_VARIABLE" + "COMMAND;SAVE_LOG_FILES" +]] + +block(SCOPE_FOR VARIABLES) + +set(logname "test-vcpkg_execute_required_process") + +function(count_log_files out_var) + set(count 0) + if(EXISTS "${CURRENT_BUILDTREES_DIR}/${logname}-out.log") + math(EXPR count "${count} + 1") + endif() + if(EXISTS "${CURRENT_BUILDTREES_DIR}/${logname}-err.log") + math(EXPR count "${count} + 1") + endif() + if(EXISTS "${CURRENT_BUILDTREES_DIR}/${logname}-extra.log") + math(EXPR count "${count} + 1") + endif() + set("${out_var}" "${count}" PARENT_SCOPE) +endfunction() + +function(reset_log_files) + file(REMOVE "${CURRENT_BUILDTREES_DIR}/${logname}-out.log") + file(REMOVE "${CURRENT_BUILDTREES_DIR}/${logname}-err.log") + file(REMOVE "${CURRENT_BUILDTREES_DIR}/${logname}-extra.log") +endfunction() + + +# ALLOW_IN_DOWNLOAD_MODE + +set(VCPKG_DOWNLOAD_MODE 1) +unit_test_ensure_success([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Success + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + ALLOW_IN_DOWNLOAD_MODE + )]] +) +unit_test_ensure_fatal_error([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Success + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + )]] +) + +set(VCPKG_DOWNLOAD_MODE "") +unit_test_ensure_success([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Success + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + ALLOW_IN_DOWNLOAD_MODE + )]] +) +unit_test_ensure_success([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Success + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + )]] +) + + +# COMMAND, LOGNAME + +reset_log_files() +unit_test_check_variable_equal([[count_log_files(count)]] count 0) + +unit_test_ensure_success([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Hello world + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + )]] +) +unit_test_check_variable_equal([[ count_log_files(count) ]] count 2) +unit_test_check_variable_equal([[ file(STRINGS "${CURRENT_BUILDTREES_DIR}/${logname}-out.log" stdout) ]] stdout "Hello world") + + +# WORKING_DIRECTORY, SAVE_LOG_FILES + +file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/subdir") +file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/subdir") +file(WRITE "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/source" "extra log") +file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/subdir") + +reset_log_files() +unit_test_check_variable_equal([[count_log_files(count)]] count 0) + +unit_test_ensure_success([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E rename source subdir/extra.log + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir" + LOGNAME "${logname}" + SAVE_LOG_FILES "subdir/extra.log" + )]] +) +unit_test_check_variable_equal([[ count_log_files(count) ]] count 3) +unit_test_check_variable_equal([[ file(STRINGS "${CURRENT_BUILDTREES_DIR}/${logname}-extra.log" extra) ]] extra "extra log") + + +# OUTPUT_VARIABLE, OUTPUT_STRIP_TRAILING_WHITESPACE + +reset_log_files() +unit_test_check_variable_equal([[count_log_files(count)]] count 0) + +unit_test_check_variable_equal([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Hello world + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + OUTPUT_VARIABLE outvar + )]] + outvar "Hello world\n" +) +unit_test_check_variable_equal([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E echo Hello world + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + OUTPUT_VARIABLE outvar + OUTPUT_STRIP_TRAILING_WHITESPACE + )]] + outvar "Hello world" +) +unit_test_check_variable_equal([[ count_log_files(count) ]] count 2) + + +# ERROR_VARIABLE + +reset_log_files() +unit_test_check_variable_equal([[count_log_files(count)]] count 0) + +file(WRITE "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/stderr.cmake" "message(WARNING on-stderr)\n") +unit_test_check_variable_not_equal([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -P "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/stderr.cmake" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + ERROR_VARIABLE outvar + ) + string(FIND "${outvar}" "on-stderr" pos) + ]] pos -1 +) +unit_test_check_variable_equal([[ count_log_files(count) ]] count 2) + + +# OUTPUT_VARIABLE == ERROR_VARIABLE + +reset_log_files() +unit_test_check_variable_equal([[count_log_files(count)]] count 0) + +file(WRITE "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/combined.cmake" [[ + message(WARNING on-stderr) + message(STATUS on-stdout) +]]) +unit_test_check_variable_not_equal([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -P "${CURRENT_BUILDTREES_DIR}/vcpkg_execute_required_process-dir/combined.cmake" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + OUTPUT_VARIABLE outvar + ERROR_VARIABLE outvar + ) + string(REGEX MATCH "on-stderr.*on-stdout" match "${outvar}") + ]] CMAKE_MATCH_0 "" +) +unit_test_check_variable_equal([[ count_log_files(count) ]] count 2) + + +# TIMEOUT (if not flaky) + +unit_test_ensure_fatal_error([[ + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -E sleep 10 + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "${logname}" + TIMEOUT 1 + )]] +) + + +endblock() diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_fixup_pkgconfig.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_fixup_pkgconfig.cmake new file mode 100644 index 0000000..758594b --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_fixup_pkgconfig.cmake @@ -0,0 +1,202 @@ +file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/lib/pkgconfig") +set(pc_file_release "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/unit-test-cmake.pc") +if(NOT VCPKG_BUILD_TYPE) + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig") + set(pc_file_debug "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/unit-test-cmake.pc") +endif() +set(reload_pc_strings 0) + +function(write_pkgconfig) + file(WRITE "${pc_file_release}" ${ARGN}) + if(NOT VCPKG_BUILD_TYPE) + file(WRITE "${pc_file_debug}" ${ARGN}) + endif() + file(STRINGS "${pc_file_release}" pc_strings_input) + set(pc_strings_INPUT "${pc_strings_input}" PARENT_SCOPE) + set(reload_pc_strings 1 PARENT_SCOPE) +endfunction() + +function(unit_test_pkgconfig_check_key build_types field value) + if(NOT build_types) + message(SEND_ERROR "The build_type parameter must be list of debug;release.") + endif() + if(VCPKG_BUILD_TYPE) + list(REMOVE_ITEM build_types debug) + endif() + if(NOT build_types) + return() + endif() + if(reload_pc_strings) + file(STRINGS "${pc_file_release}" pc_strings_release) + set(pc_strings_release "${pc_strings_release}" PARENT_SCOPE) + if(NOT VCPKG_BUILD_TYPE) + file(STRINGS "${pc_file_debug}" pc_strings_debug) + set(pc_strings_debug "${pc_strings_debug}" PARENT_SCOPE) + endif() + set(reload_pc_strings 0 PARENT_SCOPE) + endif() + foreach(build_type IN LISTS build_types) + set(listname "pc_strings_${build_type}") + set(expected "${field}${value}") + list(FILTER ${listname} INCLUDE REGEX "^${field}") + if(NOT "${${listname}}" STREQUAL "${expected}" AND NOT "${${listname}}_is_empty" STREQUAL "${value}_is_empty") + string(REPLACE "\$" "\\\$" pc_strings_INPUT "${pc_strings_INPUT}") + string(REPLACE "\$" "\\\$" expected "${expected}") + string(REPLACE "\$" "\\\$" "${listname}" "${${listname}}") + message(SEND_ERROR "vcpkg_fixup_pkgconfig() resulted in a wrong value for ${build_type} builds; + input : [[${pc_strings_INPUT}]] + expected: [[${expected}]] + actual : [[${${listname}}]]") + set_has_error() + return() + endif() + endforeach() +endfunction() + +# "Libs:" only +write_pkgconfig([[ +Libs: -L${prefix}/lib -l"aaa" +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa]]) + +# "Libs:" and "Libs.private:" +write_pkgconfig([[ +Libs: -L"${prefix}/lib" -l"aaa" +Libs.private: -l"bbb ccc" +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa "-lbbb ccc"]]) + unit_test_pkgconfig_check_key("debug;release" "Libs.private:" "") +else() + unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa]]) +endif() + +# line continuations +write_pkgconfig([[ +Libs.private: \ + -lbbb +Libs: -L"${prefix}/lib" \ + -l"aaa" +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa -lbbb]]) + unit_test_pkgconfig_check_key("debug;release" "Libs.private:" "") +else() + unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa]]) +endif() + +# Replace ';' with ' ' +write_pkgconfig([[ +Libs: -L${prefix}/lib\;-l"aaa" +Libs.private: -lbbb\;-l"ccc" +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +if(VCPKG_LIBRARY_LINKAGE STREQUAL "static") + unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa -lbbb -lccc]]) + unit_test_pkgconfig_check_key("debug;release" "Libs.private:" "") +else() + unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -laaa]]) +endif() + +# invalid: ...-NOTFOUND +write_pkgconfig([[Libs: LIB-NOTFOUND]]) +# Only warning: unit_test_ensure_fatal_error([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) # ...-NOTFOUND # ]]) + +# invalid: optimized/debug +write_pkgconfig([[Libs: -laaa -loptimized -lrel -ldebug -ldbg -lbbb]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug" "Libs:" [[ -laaa -ldbg -lbbb]]) +unit_test_pkgconfig_check_key("release" "Libs:" [[ -laaa -lrel -lbbb]]) + +write_pkgconfig([[Libs: -laaa -Loptimized -Lrel -Ldebug -Ldbg -lbbb]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug" "Libs:" [[ -laaa -Ldbg -lbbb]]) +unit_test_pkgconfig_check_key("release" "Libs:" [[ -laaa -Lrel -lbbb]]) + +write_pkgconfig([[Libs: optimized\;librel.a\;debug\;libdbg.a\;aaa.lib]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug" "Libs:" [[ libdbg.a aaa.lib]]) +unit_test_pkgconfig_check_key("release" "Libs:" [[ librel.a aaa.lib]]) + +write_pkgconfig([[Libs: aaa.lib\;optimized\;librel.a\;debug\;libdbg.a]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug" "Libs:" [[ aaa.lib libdbg.a]]) +unit_test_pkgconfig_check_key("release" "Libs:" [[ aaa.lib librel.a]]) + +write_pkgconfig([[Libs: aaa.lib optimized librel.a debug libdbg.a bbb.lib]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug" "Libs:" [[ aaa.lib libdbg.a bbb.lib]]) +unit_test_pkgconfig_check_key("release" "Libs:" [[ aaa.lib librel.a bbb.lib]]) + +# invalid: namespaced targets +write_pkgconfig([[Libs: -lAAA::aaa]]) +# Only warning: unit_test_ensure_fatal_error([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) # namespaced target # ]]) + +# prefix +write_pkgconfig( +"prefix=${CURRENT_PACKAGES_DIR} +execprefix=\${prefix} +libdir=${CURRENT_PACKAGES_DIR}/lib +includedir=${CURRENT_PACKAGES_DIR}/include +datarootdir=${CURRENT_PACKAGES_DIR}/share +datadir=\${datarootdir}/${PORT} +") +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("release" "prefix=" [[${pcfiledir}/../..]]) +unit_test_pkgconfig_check_key("release" "execprefix=" [[${prefix}]]) +unit_test_pkgconfig_check_key("release" "libdir=" [[${prefix}/lib]]) +unit_test_pkgconfig_check_key("release" "includedir=" [[${prefix}/include]]) +unit_test_pkgconfig_check_key("release" "datarootdir=" [[${prefix}/share]]) +unit_test_pkgconfig_check_key("release" "datadir=" [[${datarootdir}/unit-test-cmake]]) + +if(NOT VCPKG_BUILD_TYPE) + write_pkgconfig( +"prefix=${CURRENT_PACKAGES_DIR}/debug +execprefix=\${prefix} +libdir=${CURRENT_PACKAGES_DIR}/debug/lib +includedir=${CURRENT_PACKAGES_DIR}/include +datarootdir=${CURRENT_PACKAGES_DIR}/share +datadir=\${datarootdir}/${PORT} +") + unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) + unit_test_pkgconfig_check_key("debug" "prefix=" [[${pcfiledir}/../..]]) + unit_test_pkgconfig_check_key("debug" "execprefix=" [[${prefix}]]) + unit_test_pkgconfig_check_key("debug" "libdir=" [[${prefix}/lib]]) + unit_test_pkgconfig_check_key("debug" "includedir=" [[${prefix}/../include]]) + unit_test_pkgconfig_check_key("debug" "datarootdir=" [[${prefix}/../share]]) + unit_test_pkgconfig_check_key("debug" "datadir=" [[${datarootdir}/unit-test-cmake]]) +endif() + +# -I, -l or -L with ${blah} in variables +write_pkgconfig([[blah_libs=-L${blah}/lib64 -l${blah}/libblah.a -I${blah}/include]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug;release" "blah_libs=" [["-L${blah}/lib64" "-l${blah}/libblah.a" "-I${blah}/include"]]) + +# plain vs. quoted items +write_pkgconfig([[Libs: ${blah} "${quoted}" plain "C:/Program Files/blah.lib"]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ ${blah} "${quoted}" plain "C:/Program Files/blah.lib"]]) + +# lib spec starting with optimized/debug/general +write_pkgconfig([[ +Libs: -L${prefix}/lib -ldebuginfod +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -ldebuginfod]]) + +write_pkgconfig([[ +Libs: -L${prefix}/lib -loptimizedinfod +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -loptimizedinfod]]) + +write_pkgconfig([[ +Libs: -L${prefix}/lib -lgeneralinfod +]]) +unit_test_ensure_success([[ vcpkg_fixup_pkgconfig(SKIP_CHECK) ]]) +unit_test_pkgconfig_check_key("debug;release" "Libs:" [[ "-L${prefix}/lib" -lgeneralinfod]]) + +file(REMOVE_RECURSE "${pc_file_release}" "${pc_file_debug}") diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_host_path_list.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_host_path_list.cmake new file mode 100644 index 0000000..a7d5a58 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_host_path_list.cmake @@ -0,0 +1,329 @@ +# CACHE{var} is a fatal error
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(APPEND CACHE{var})]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(PREPEND CACHE{var})]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(APPEND CACHE{var} c d)]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(PREPEND CACHE{var} c d)]])
+
+# regular variable
+if(VCPKG_HOST_PATH_SEPARATOR STREQUAL ";")
+
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(APPEND var "a;b")]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(PREPEND var "a;b")]])
+
+set(var "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND var d e)]]
+ var "a;b;d;e"
+)
+set(var "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND var)]]
+ var "a;b"
+)
+set(var "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND var d e)]]
+ var "d;e;a;b"
+)
+set(var "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND var)]]
+ var "a;b"
+)
+
+set(var "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND var d e)]]
+ var "d;e"
+)
+set(var "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND var)]]
+ var ""
+)
+set(var "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND var d e)]]
+ var "d;e"
+)
+set(var "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND var)]]
+ var ""
+)
+
+unset(var)
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND var d e)]]
+ var "d;e"
+)
+unset(var)
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND var)]]
+ var ""
+)
+unset(var)
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND var d e)]]
+ var "d;e"
+)
+unset(var)
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND var)]]
+ var ""
+)
+
+endif(VCPKG_HOST_PATH_SEPARATOR STREQUAL ";")
+if(VCPKG_HOST_PATH_SEPARATOR STREQUAL ":")
+
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(APPEND var "a:b")]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(PREPEND var "a:b")]])
+
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var} d e)]]
+ ENV{var} "a:b:d:e"
+)
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var})]]
+ ENV{var} "a:b"
+)
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var} d e)]]
+ ENV{var} "d:e:a:b"
+)
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{var} "a:b"
+)
+
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var})]]
+ ENV{var} ""
+)
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{var} ""
+)
+
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var})]]
+ ENV{var} ""
+)
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{var} ""
+)
+
+endif(VCPKG_HOST_PATH_SEPARATOR STREQUAL ":")
+
+# environment ENV{var}iable
+if(VCPKG_HOST_PATH_SEPARATOR STREQUAL ";")
+
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(APPEND ENV{ENV{var}} "a;b")]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(PREPEND ENV{ENV{var}} "a;b")]])
+
+set(ENV{ENV{var}} "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{ENV{var}} d e)]]
+ ENV{ENV{var}} "a;b;d;e"
+)
+set(ENV{ENV{var}} "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{ENV{var}})]]
+ ENV{ENV{var}} "a;b"
+)
+set(ENV{ENV{var}} "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{ENV{var}} d e)]]
+ ENV{ENV{var}} "d;e;a;b"
+)
+set(ENV{ENV{var}} "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{ENV{var}})]]
+ ENV{ENV{var}} "a;b"
+)
+
+set(ENV{ENV{var}} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{ENV{var}} d e)]]
+ ENV{ENV{var}} "d;e"
+)
+set(ENV{ENV{var}} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{ENV{var}})]]
+ ENV{ENV{var}} ""
+)
+set(ENV{ENV{var}} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{ENV{var}} d e)]]
+ ENV{ENV{var}} "d;e"
+)
+set(ENV{ENV{var}} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{ENV{var}} ""
+)
+
+unset(ENV{ENV{var}})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{ENV{var}} d e)]]
+ ENV{ENV{var}} "d;e"
+)
+unset(ENV{ENV{var}})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{ENV{var}})]]
+ ENV{ENV{var}} ""
+)
+unset(ENV{ENV{var}})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{ENV{var}} d e)]]
+ ENV{ENV{var}} "d;e"
+)
+unset(ENV{ENV{var}})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{ENV{var}})]]
+ ENV{ENV{var}} ""
+)
+
+endif(VCPKG_HOST_PATH_SEPARATOR STREQUAL ";")
+if(VCPKG_HOST_PATH_SEPARATOR STREQUAL ":")
+
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(APPEND ENV{var} "a:b")]])
+unit_test_ensure_fatal_error([[vcpkg_host_path_list(PREPEND ENV{var} "a:b")]])
+
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var} d e)]]
+ ENV{var} "a:b:d:e"
+)
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var})]]
+ ENV{var} "a:b"
+)
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var} d e)]]
+ ENV{var} "d:e:a:b"
+)
+set(ENV{var} "a:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{var} "a:b"
+)
+
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var})]]
+ ENV{var} ""
+)
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+set(ENV{var} "")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{var} ""
+)
+
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(APPEND ENV{var})]]
+ ENV{var} ""
+)
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var} d e)]]
+ ENV{var} "d:e"
+)
+unset(ENV{var})
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(PREPEND ENV{var})]]
+ ENV{var} ""
+)
+
+endif(VCPKG_HOST_PATH_SEPARATOR STREQUAL ":")
+
+# REMOVE_DUPLICATES
+if(VCPKG_HOST_PATH_SEPARATOR STREQUAL ";")
+
+set(var "a;b;c;c:c")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(REMOVE_DUPLICATES var)]]
+ var "a;b;c;c:c"
+)
+
+set(var "a;b;c;b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(REMOVE_DUPLICATES var)]]
+ var "a;b;c"
+)
+
+set(var "a;b;a;d")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(REMOVE_DUPLICATES var)]]
+ var "a;b;d"
+)
+
+endif(VCPKG_HOST_PATH_SEPARATOR STREQUAL ";")
+if(VCPKG_HOST_PATH_SEPARATOR STREQUAL ":")
+
+set(var "a:b:c:c;c")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(REMOVE_DUPLICATES var)]]
+ var "a:b:c:c;c"
+)
+
+set(var "a:b:c:b")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(REMOVE_DUPLICATES var)]]
+ var "a:b:c"
+)
+
+set(var "a:b:a:d")
+unit_test_check_variable_equal(
+ [[vcpkg_host_path_list(REMOVE_DUPLICATES var)]]
+ var "a:b:d"
+)
+
+endif(VCPKG_HOST_PATH_SEPARATOR STREQUAL ":")
diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake new file mode 100644 index 0000000..c0f3ac8 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_list.cmake @@ -0,0 +1,813 @@ +# vcpkg_list(SET <list> <elements>...)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SET lst)]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SET lst "")]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SET lst "" "")]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SET lst a)]]
+ lst "a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SET lst a b)]]
+ lst "a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SET lst "a;b")]]
+ lst [[a\;b]]
+)
+unit_test_check_variable_equal(
+ [=[vcpkg_list(SET lst "a;b" "c" [[d\;e]])]=]
+ lst [[a\;b;c;d\\;e]]
+)
+
+# vcpkg_list(LENGTH <list> <out-var>)
+set(lst [[]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(LENGTH lst out)]]
+ out 0
+)
+set(lst [[;]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(LENGTH lst out)]]
+ out 2
+)
+set(lst [[a]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(LENGTH lst out)]]
+ out 1
+)
+set(lst [[a;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(LENGTH lst out)]]
+ out 2
+)
+set(lst [[a\\;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(LENGTH lst out)]]
+ out 1
+)
+set(lst [[a\;b;c\\;d]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(LENGTH lst out)]]
+ out 2
+)
+
+# vcpkg_list(GET <list> <element-index> <out-var>)
+set(lst "")
+unit_test_ensure_fatal_error([[vcpkg_list(GET lst 0 out)]])
+
+set(lst "a")
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst 0 out)]]
+ out "a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst -1 out)]]
+ out "a"
+)
+unit_test_ensure_fatal_error([[vcpkg_list(GET lst 2 out)]])
+unit_test_ensure_fatal_error([[vcpkg_list(GET lst -2 out)]])
+
+set(lst ";b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst 0 out)]]
+ out ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst -1 out)]]
+ out "b"
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst 0 out)]]
+ out "a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst -1 out)]]
+ out "b"
+)
+
+set(lst [[a\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst 0 out)]]
+ out "a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst -1 out)]]
+ out "c"
+)
+
+set(lst [[a;b\;c;d\\;e]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst 1 out)]]
+ out "b;c"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(GET lst -1 out)]]
+ out [[d\;e]]
+)
+
+# vcpkg_list(JOIN <list> <glue> <out-var>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(JOIN lst "-" out)]]
+ out ""
+)
+
+set(lst "a")
+unit_test_check_variable_equal(
+ [[vcpkg_list(JOIN lst "-" out)]]
+ out "a"
+)
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(JOIN lst "-" out)]]
+ out "-"
+)
+
+set(lst [[a;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(JOIN lst "-" out)]]
+ out [[a-b]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(JOIN lst "+" out)]]
+ out [[a+b]]
+)
+
+set(lst [[a;b\;c\\;d]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(JOIN lst "-" out)]]
+ out [[a-b;c\;d]]
+)
+
+# vcpkg_list(SUBLIST <list> <begin> <length> <out-var>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 0 out)]]
+ out ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 1 out)]]
+ out ""
+)
+unit_test_ensure_fatal_error([[vcpkg_list(SUBLIST lst 1 0 out)]])
+
+set(lst "a")
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 0 out)]]
+ out ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 1 out)]]
+ out "a"
+)
+unit_test_ensure_fatal_error([[vcpkg_list(SUBLIST lst 2 0 out)]])
+unit_test_ensure_fatal_error([[vcpkg_list(SUBLIST lst 2 1 out)]])
+
+set(lst ";;")
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 0 out)]]
+ out ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 1 out)]]
+ out ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 2 out)]]
+ out ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 0 3 out)]]
+ out ";;"
+)
+
+set(lst "a;b;c;d")
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 1 2 out)]]
+ out "b;c"
+)
+
+set(lst [[a\;b;c\;d;e]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 1 2 out)]]
+ out [[c\;d;e]]
+)
+
+set(lst [[a\;b;c\\;d;e;f;g;h]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(SUBLIST lst 1 -1 out)]]
+ out [[c\\;d;e;f;g;h]]
+)
+
+# vcpkg_list(FIND <list> <value> <out-var>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst "a" out)]]
+ out -1
+)
+
+set(lst "b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst "a" out)]]
+ out -1
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst "a" out)]]
+ out 0
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst b out)]]
+ out 1
+)
+
+set(lst ";b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst "" out)]]
+ out 0
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst b out)]]
+ out 1
+)
+
+set(lst [[a\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst "a;b" out)]]
+ out 0
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst c out)]]
+ out 1
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(FIND lst a out)]]
+ out -1
+)
+
+set(lst [[a\\;b;c]])
+unit_test_check_variable_equal(
+ [=[vcpkg_list(FIND lst [[a\;b]] out)]=]
+ out 0
+)
+
+# vcpkg_list(APPEND <list> [<element>...])
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst)]]
+ lst [[]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "")]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "" "")]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst a)]]
+ lst "a"
+)
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst)]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "")]]
+ lst ";;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst b)]]
+ lst ";;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "b;c" d)]]
+ lst [[;;b\;c;d]]
+)
+
+set(lst "a")
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst)]]
+ lst "a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "")]]
+ lst "a;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst b)]]
+ lst "a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "b;c" d)]]
+ lst [[a;b\;c;d]]
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst)]]
+ lst "a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "")]]
+ lst "a;b;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst c)]]
+ lst "a;b;c"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(APPEND lst "c;d" e)]]
+ lst [[a;b;c\;d;e]]
+)
+unit_test_check_variable_equal(
+ [=[vcpkg_list(APPEND lst [[c\;d]])]=]
+ lst [[a;b;c\\;d]]
+)
+
+# vcpkg_list(PREPEND <list> [<element>...])
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst)]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "")]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "" "")]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst a)]]
+ lst "a"
+)
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst)]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "")]]
+ lst ";;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst b)]]
+ lst "b;;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "b;c" d)]]
+ lst [[b\;c;d;;]]
+)
+
+set(lst "a")
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst)]]
+ lst "a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "")]]
+ lst ";a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst b)]]
+ lst "b;a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "b;c" d)]]
+ lst [[b\;c;d;a]]
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst)]]
+ lst "a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "")]]
+ lst ";a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst c)]]
+ lst "c;a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(PREPEND lst "c;d" e)]]
+ lst [[c\;d;e;a;b]]
+)
+unit_test_check_variable_equal(
+ [=[vcpkg_list(PREPEND lst [[c\;d]])]=]
+ lst [[c\\;d;a;b]]
+)
+
+# list(INSERT <list> <index> [<element>...])
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 0)]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 0 "")]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 0 "" "")]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 0 "a")]]
+ lst "a"
+)
+unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst 1 "")]])
+unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst -1 "")]])
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 0)]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 1)]]
+ lst ";"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 1 "")]]
+ lst ";;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 0 b)]]
+ lst "b;;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 1 b)]]
+ lst ";b;"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 2 b)]]
+ lst ";;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst -1 "b;c" d)]]
+ lst [[;b\;c;d;]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst -2 "b;c" d)]]
+ lst [[b\;c;d;;]]
+)
+unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst 3 "")]])
+unit_test_ensure_fatal_error([[vcpkg_list(INSERT lst -3 "")]])
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst -1 c)]]
+ lst "a;c;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 1 c)]]
+ lst "a;c;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 2 c)]]
+ lst "a;b;c"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst -2 c)]]
+ lst "c;a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(INSERT lst 1 "c;d")]]
+ lst [[a;c\;d;b]]
+)
+unit_test_check_variable_equal(
+ [=[vcpkg_list(INSERT lst 1 [[c\;d]] e)]=]
+ lst [[a;c\\;d;e;b]]
+)
+
+# vcpkg_list(POP_BACK <list>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst ""
+)
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst ""
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst "a"
+)
+
+set(lst "a;;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst "a;"
+)
+
+set(lst [[a\;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst ""
+)
+
+set(lst [[c;a\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst [[c;a\;b]]
+)
+
+# vcpkg_list(POP_FRONT <list>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_BACK lst)]]
+ lst ""
+)
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_FRONT lst)]]
+ lst ""
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_FRONT lst)]]
+ lst "b"
+)
+
+set(lst "a;;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_FRONT lst)]]
+ lst ";b"
+)
+
+set(lst [[a\;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_FRONT lst)]]
+ lst ""
+)
+
+set(lst [[c;a\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(POP_FRONT lst)]]
+ lst [[a\;b;c]]
+)
+
+# vcpkg_list(REMOVE_DUPLICATES <list>)
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst ""
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst "a;b"
+)
+
+set(lst "a;a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst "a;b"
+)
+
+set(lst "a;b;a")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst "a;b"
+)
+
+set(lst "c;a;b;a;c")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst "c;a;b"
+)
+
+set(lst "a;;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst "a;;b"
+)
+
+set(lst [[a\;b;a\;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst [[a\;b]]
+)
+
+set(lst [[c;a\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_DUPLICATES lst)]]
+ lst [[c;a\;b]]
+)
+
+# vcpkg_list(REVERSE <list>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REVERSE lst)]]
+ lst ""
+)
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REVERSE lst)]]
+ lst ";"
+)
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REVERSE lst)]]
+ lst "b;a"
+)
+set(lst "a;b;c;d;e;f;g")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REVERSE lst)]]
+ lst "g;f;e;d;c;b;a"
+)
+
+set(lst [[a\;b;a\;b\\;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REVERSE lst)]]
+ lst [[a\;b\\;c;a\;b]]
+)
+set(lst [[c;a\;b]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REVERSE lst)]]
+ lst [[a\;b;c]]
+)
+
+# vcpkg_list(REMOVE_ITEM <list> <value>)
+set(lst "")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst "a")]]
+ lst ""
+)
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst "")]]
+ lst ""
+)
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst a)]]
+ lst "b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst b)]]
+ lst "a"
+)
+
+set(lst "a;a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst a)]]
+ lst "b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst b)]]
+ lst "a;a"
+)
+
+set(lst "a;b;c;a;d")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst b)]]
+ lst "a;c;a;d"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst a)]]
+ lst "b;c;d"
+)
+
+set(lst "a;;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst "")]]
+ lst "a;b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst a)]]
+ lst ";b"
+)
+
+set(lst [[e;a\;b;c\;d]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst "a;b")]]
+ lst [[e;c\;d]]
+)
+
+set(lst [[c;a\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst "c")]]
+ lst [[a\;b]]
+)
+
+set(lst [[c;a\\;b;c]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_ITEM lst "a\\;b")]]
+ lst [[c;c]]
+)
+
+# vcpkg_list(REMOVE_AT <list> <index>)
+set(lst "")
+unit_test_ensure_fatal_error([[vcpkg_list(REMOVE_AT lst 0)]])
+
+set(lst ";")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 0)]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 1)]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst -1)]]
+ lst ""
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst -2)]]
+ lst ""
+)
+unit_test_ensure_fatal_error([[vcpkg_list(REMOVE_AT lst 2)]])
+unit_test_ensure_fatal_error([[vcpkg_list(REMOVE_AT lst -3)]])
+
+set(lst "a;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 0)]]
+ lst "b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 1)]]
+ lst "a"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst -1)]]
+ lst "a"
+)
+
+set(lst "a;;b")
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 0)]]
+ lst ";b"
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 1)]]
+ lst "a;b"
+)
+
+set(lst [[e;a\;b;c\;d]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 0)]]
+ lst [[a\;b;c\;d]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 1)]]
+ lst [[e;c\;d]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst -1)]]
+ lst [[e;a\;b]]
+)
+
+set(lst [[c;a\\;b;c\;d;e]])
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 0)]]
+ lst [[a\\;b;c\;d;e]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 1)]]
+ lst [[c;c\;d;e]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 2)]]
+ lst [[c;a\\;b;e]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst 3)]]
+ lst [[c;a\\;b;c\;d]]
+)
+unit_test_check_variable_equal(
+ [[vcpkg_list(REMOVE_AT lst -1)]]
+ lst [[c;a\\;b;c\;d]]
+)
diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_minimum_required.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_minimum_required.cmake new file mode 100644 index 0000000..93bfbcf --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-vcpkg_minimum_required.cmake @@ -0,0 +1,49 @@ +# -- error cases -- +# VCPKG_BASE_VERSION not set - vcpkg version is too old +set(VCPKG_BASE_VERSION_backup "${VCPKG_BASE_VERSION}") +unset(VCPKG_BASE_VERSION) +unset(VCPKG_BASE_VERSION CACHE) +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2021-01-01)]]) +unit_test_ensure_fatal_error([[vcpkg_minimum_required()]]) +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION "")]]) +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION "2021.01.01")]]) + +set(VCPKG_BASE_VERSION 2021-02-02) + +# VERSION not passed +unit_test_ensure_fatal_error([[vcpkg_minimum_required()]]) +# VERSION weird - empty +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION "")]]) +# VERSION weird - dotted +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2021.01.01)]]) +# VERSION weird - not a valid year +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 3000-01-01)]]) +# VERSION weird - list +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION "2021-01-01;2021-01-02")]]) +# VERSION weird - small year +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 21-01-01)]]) +# VERSION weird - small month +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2021-1-01)]]) +# VERSION weird - small day +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2021-01-1)]]) +# VERSION too-new - later year, earlier month, earlier day +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2022-01-01)]]) +# VERSION too-new - same year, later month, earlier day +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2021-03-01)]]) +# VERSION too-new - same year, same month, later day +unit_test_ensure_fatal_error([[vcpkg_minimum_required(VERSION 2021-02-03)]]) + +# -- successes -- +# same date +unit_test_ensure_success([[vcpkg_minimum_required(VERSION 2021-02-02)]]) + +# VERSION old - earlier year, later month, later day +unit_test_ensure_success([[vcpkg_minimum_required(VERSION 2020-03-03)]]) +# VERSION old - same year, earlier month, later day +unit_test_ensure_success([[vcpkg_minimum_required(VERSION 2021-01-03)]]) +# VERSION old - same year, same month, earlier day +unit_test_ensure_success([[vcpkg_minimum_required(VERSION 2021-02-01)]]) + +# reset to backup +unset(VCPKG_BASE_VERSION) +set(VCPKG_BASE_VERSION "${VCPKG_BASE_VERSION_backup}" CACHE STRING "") diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_calculate_corrected_rpath.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_calculate_corrected_rpath.cmake new file mode 100644 index 0000000..5750a05 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_calculate_corrected_rpath.cmake @@ -0,0 +1,121 @@ +# z_vcpkg_calculate_corrected_rpath(...) + +block(SCOPE_FOR VARIABLES) + +set(CURRENT_PACKAGES_DIR "/P") +set(CURRENT_INSTALLED_DIR "/I") + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/lib") +]] out [[$ORIGIN]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/plugins/group") +]] out [[$ORIGIN:$ORIGIN/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/debug/lib") +]] out [[$ORIGIN]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/debug/plugins/group") +]] out [[$ORIGIN:$ORIGIN/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/tools/port") +]] out [[$ORIGIN:$ORIGIN/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/tools/port/bin") +]] out [[$ORIGIN:$ORIGIN/../../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/tools/port/debug") +]] out [[$ORIGIN:$ORIGIN/../../../debug/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/tools/port/debug/bin") +]] out [[$ORIGIN:$ORIGIN/../../../../debug/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/manual-tools/port") +]] out [[$ORIGIN:$ORIGIN/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/manual-tools/port/bin") +]] out [[$ORIGIN:$ORIGIN/../../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/manual-tools/port/debug") +]] out [[$ORIGIN:$ORIGIN/../../../debug/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "" ELF_FILE_DIR "/P/manual-tools/port/debug/bin") +]] out [[$ORIGIN:$ORIGIN/../../../../debug/lib]]) + +# ORG_RPATH +set(X_VCPKG_RPATH_KEEP_SYSTEM_PATHS 1) +set(CURRENT_PACKAGES_DIR "/cxx/P") +set(CURRENT_INSTALLED_DIR "/cxx/I") + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/opt/lib:/usr/local/lib" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN:/opt/lib:/usr/local/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/cxx/I/lib" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/cxx/P/lib" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/cxx/I/foo/lib/pkgconfig/../../bar" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +set(X_VCPKG_RPATH_KEEP_SYSTEM_PATHS 0) +set(CURRENT_PACKAGES_DIR "/cxx/P") +set(CURRENT_INSTALLED_DIR "/cxx/I") + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/opt/lib:/usr/local/lib" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/cxx/I/foo/bar" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/cxx/P/foo/bar" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/cxx/I/foo/lib/pkgconfig/../../bar" ELF_FILE_DIR "/cxx/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +# https://github.com/microsoft/vcpkg/issues/37984 +set(CURRENT_PACKAGES_DIR "/c++/P") +set(CURRENT_INSTALLED_DIR "/c++/I") + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/c++/I/foo/bar" ELF_FILE_DIR "/c++/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/c++/P/foo/bar" ELF_FILE_DIR "/c++/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +set(CURRENT_PACKAGES_DIR "/(c)/P") +set(CURRENT_INSTALLED_DIR "/(c)/I") + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/(c)/I/foo/bar" ELF_FILE_DIR "/(c)/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_rpath(OUT_NEW_RPATH_VAR "out" ORG_RPATH "/(c)/P/foo/bar" ELF_FILE_DIR "/(c)/P/lib") +]] out [[$ORIGIN:$ORIGIN/../foo/bar]]) + + +endblock() diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_calculate_corrected_rpath_macho.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_calculate_corrected_rpath_macho.cmake new file mode 100644 index 0000000..ee4f42a --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_calculate_corrected_rpath_macho.cmake @@ -0,0 +1,56 @@ +# z_vcpkg_calculate_corrected_macho_rpath_macho(...) + +block(SCOPE_FOR VARIABLES) + +set(CURRENT_PACKAGES_DIR "/P") +set(CURRENT_INSTALLED_DIR "/I") + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/lib") +]] out [[@loader_path]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/plugins/group") +]] out [[@loader_path/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/debug/lib") +]] out [[@loader_path]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/debug/plugins/group") +]] out [[@loader_path/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port") +]] out [[@loader_path/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port/bin") +]] out [[@loader_path/../../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port/debug") +]] out [[@loader_path/../../../debug/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/tools/port/debug/bin") +]] out [[@loader_path/../../../../debug/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port") +]] out [[@loader_path/../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port/bin") +]] out [[@loader_path/../../../lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port/debug") +]] out [[@loader_path/../../../debug/lib]]) + +unit_test_check_variable_equal([[ + z_vcpkg_calculate_corrected_macho_rpath(OUT_NEW_RPATH_VAR "out" MACHO_FILE_DIR "/P/manual-tools/port/debug/bin") +]] out [[@loader_path/../../../../debug/lib]]) + +endblock() diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_cmake_config_fixup_merge.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_cmake_config_fixup_merge.cmake new file mode 100644 index 0000000..8809af4 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_cmake_config_fixup_merge.cmake @@ -0,0 +1,56 @@ +# z_vcpkg_cmake_config_fixup_merge(<out_list> <release_list> <debug_list>) +set(release_libs namespace::C++_shared) +set(debug_libs namespace::C++_shared) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged "namespace::C++_shared" +) + +set(release_libs A) +set(debug_libs B) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[\$<\$<NOT:\$<CONFIG:DEBUG>>:A>;\$<\$<CONFIG:DEBUG>:B>]] +) + +set(release_libs A B) +set(debug_libs A ) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[A;\$<\$<NOT:\$<CONFIG:DEBUG>>:B>]] +) + +set(release_libs A ) +set(debug_libs A B) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[A;\$<\$<CONFIG:DEBUG>:B>]] +) + +set(release_libs A C) +set(debug_libs C) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[\$<\$<NOT:\$<CONFIG:DEBUG>>:A>;\$<\$<CONFIG:DEBUG>:C>;\$<\$<NOT:\$<CONFIG:DEBUG>>:C>]] +) + +set(release_libs [[\$<\$<NOT:\$<CONFIG:DEBUG>>:A>;\$<\$<CONFIG:DEBUG>:B>]]) +set(debug_libs [[\$<\$<NOT:\$<CONFIG:DEBUG>>:A>;\$<\$<CONFIG:DEBUG>:B>]]) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[\$<\$<NOT:\$<CONFIG:DEBUG>>:A>;\$<\$<CONFIG:DEBUG>:B>]] +) + +set(release_libs optimized o1 debug d1) +set(debug_libs optimized o2 debug d2) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[\$<\$<NOT:\$<CONFIG:DEBUG>>:o1>;\$<\$<CONFIG:DEBUG>:d2>]] +) + +set(release_libs debug d1 optimized o1) +set(debug_libs debug d2 optimized o2) +unit_test_check_variable_equal( + [[z_vcpkg_cmake_config_fixup_merge(merged release_libs debug_libs)]] + merged [[\$<\$<CONFIG:DEBUG>:d2>;\$<\$<NOT:\$<CONFIG:DEBUG>>:o1>]] +) diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake new file mode 100644 index 0000000..e88eb68 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_function_arguments.cmake @@ -0,0 +1,63 @@ +# these both set `args` in the top level
+function(check_function_args start)
+ z_vcpkg_function_arguments(out "${start}")
+ set(args "${out}" PARENT_SCOPE)
+endfunction()
+function(check_all_function_args)
+ z_vcpkg_function_arguments(out)
+ set(args "${out}" PARENT_SCOPE)
+endfunction()
+
+unit_test_ensure_fatal_error([[check_function_args(-1)]])
+unit_test_ensure_fatal_error([[check_function_args(3)]])
+unit_test_ensure_fatal_error([[check_function_args(notanumber)]])
+unit_test_check_variable_equal(
+ [[check_all_function_args()]]
+ args ""
+)
+unit_test_check_variable_equal(
+ [[check_all_function_args("")]]
+ args ""
+)
+unit_test_check_variable_equal(
+ [[check_all_function_args("" "")]]
+ args ";"
+)
+unit_test_check_variable_equal(
+ [[check_all_function_args("" "" "" "")]]
+ args ";;;"
+)
+
+unit_test_check_variable_equal(
+ [[check_all_function_args(a b c)]]
+ args "a;b;c"
+)
+unit_test_check_variable_equal(
+ [[check_function_args(2 a b c)]]
+ args "b;c"
+)
+unit_test_check_variable_equal(
+ [[check_function_args(3 a b c)]]
+ args "c"
+)
+
+unit_test_check_variable_equal(
+ [=[check_all_function_args("a;b" [[c\;d]] e)]=]
+ args [[a\;b;c\\;d;e]]
+)
+unit_test_check_variable_equal(
+ [=[check_all_function_args("a;b" [[c\;d]] [[e\\;f]])]=]
+ args [[a\;b;c\\;d;e\\\;f]]
+)
+unit_test_check_variable_equal(
+ [=[check_function_args(2 "a;b" [[c\;d]] e)]=]
+ args [[c\\;d;e]]
+)
+unit_test_check_variable_equal(
+ [=[check_function_args(3 "a;b" [[c\;d]] e)]=]
+ args "e"
+)
+unit_test_check_variable_equal(
+ [=[check_function_args(4 "a;b" [[c\;d]] e)]=]
+ args ""
+)
diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_setup_pkgconfig_path.cmake b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_setup_pkgconfig_path.cmake new file mode 100644 index 0000000..a0b5da7 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/test-z_vcpkg_setup_pkgconfig_path.cmake @@ -0,0 +1,47 @@ +# z_vcpkg_setup_pkgconfig_path(BASE_DIR <list>) +# z_vcpkg_restore_pkgconfig_path() + +# These functions use vcpkg_backup/restore_env_variables which use scoped variables +# and cannot be called in unit_test_check_*. + +set(ENV{PKG_CONFIG} "/a/pkgconf") +set(ENV{PKG_CONFIG_PATH} "1") +set(saved_path "$ENV{PATH}") + +block(SCOPE_FOR VARIABLES) + +set(CURRENT_PACKAGES_DIR "P") +set(CURRENT_INSTALLED_DIR "I") + +z_vcpkg_setup_pkgconfig_path(CONFIG RELEASE) +unit_test_check_variable_equal([[]] ENV{PKG_CONFIG} [[/a/pkgconf]]) +unit_test_check_variable_not_equal( + [[ string(REGEX MATCH "^P.lib.pkgconfig.P.share.pkgconfig.I.lib.pkgconfig.I.share.pkgconfig.1\$" output "$ENV{PKG_CONFIG_PATH}") ]] + output "" +) + +z_vcpkg_restore_pkgconfig_path() +unit_test_check_variable_equal([[]] ENV{PKG_CONFIG} [[/a/pkgconf]]) +unit_test_check_variable_equal([[]] ENV{PKG_CONFIG_PATH} "1") + +z_vcpkg_setup_pkgconfig_path(CONFIG DEBUG) +unit_test_check_variable_equal([[]] ENV{PKG_CONFIG} [[/a/pkgconf]]) +unit_test_check_variable_not_equal([[]] ENV{PKG_CONFIG_PATH} "1") +unit_test_check_variable_not_equal( + [[ string(REGEX MATCH "^P.debug.lib.pkgconfig.P.share.pkgconfig.I.debug.lib.pkgconfig.I.share.pkgconfig.1\$" output "$ENV{PKG_CONFIG_PATH}") ]] + output "" +) + +z_vcpkg_restore_pkgconfig_path() +unit_test_check_variable_equal([[]] ENV{PKG_CONFIG} [[/a/pkgconf]]) +unit_test_check_variable_equal([[]] ENV{PKG_CONFIG_PATH} "1") + +# z_vcpkg_setup_pkgconfig_path changes PATH but it is not restored. +# It is hard to see which side effects a restore would have, so +# this is expected behaviour for now. +unit_test_check_variable_not_equal([[]] ENV{PATH} "${saved_path}") + +unit_test_ensure_fatal_error([[ z_vcpkg_setup_pkgconfig_path() ]]) +unit_test_ensure_fatal_error([[ z_vcpkg_setup_pkgconfig_path(CONFIG unknown) ]]) + +endblock() diff --git a/vcpkg/scripts/test_ports/unit-test-cmake/vcpkg.json b/vcpkg/scripts/test_ports/unit-test-cmake/vcpkg.json new file mode 100644 index 0000000..e981be1 --- /dev/null +++ b/vcpkg/scripts/test_ports/unit-test-cmake/vcpkg.json @@ -0,0 +1,61 @@ +{ + "name": "unit-test-cmake", + "version-string": "ci", + "description": "Ensures that the CMake scripts are unit tested.", + "license": "MIT", + "supports": "x64", + "default-features": [ + "backup-restore-env-vars", + "execute-required-process", + "fixup-pkgconfig", + { + "name": "fixup-rpath", + "platform": "!windows" + }, + "function-arguments", + "host-path-list", + "list", + "merge-libs", + "minimum-required", + "setup-pkgconfig-path" + ], + "features": { + "backup-restore-env-vars": { + "description": "Test the vcpkg_backup/restore_env_vars functions" + }, + "execute-required-process": { + "description": "Test the vcpkg_execute_required_process function" + }, + "fixup-pkgconfig": { + "description": "Test the vcpkg_fixup_pkgconfig function" + }, + "fixup-rpath": { + "description": "Test the rpath fixup function", + "supports": "!windows" + }, + "function-arguments": { + "description": "Test the z_vcpkg_function_arguments function" + }, + "host-path-list": { + "description": "Test the vcpkg_host_path_list function" + }, + "list": { + "description": "Test the vcpkg_list function" + }, + "merge-libs": { + "description": "Test the z_vcpkg_cmake_config_fixup_merge_lists function", + "dependencies": [ + { + "name": "vcpkg-cmake-config", + "host": true + } + ] + }, + "minimum-required": { + "description": "Test the vcpkg_minimum_required function" + }, + "setup-pkgconfig-path": { + "description": "Test the z_vcpkg_setup/restore_pkgconfig_path functions" + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-acquire-msys-test/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-acquire-msys-test/portfile.cmake new file mode 100644 index 0000000..7095dc6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-acquire-msys-test/portfile.cmake @@ -0,0 +1,3 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_acquire_msys(MSYS_ROOT Z_ALL_PACKAGES)
diff --git a/vcpkg/scripts/test_ports/vcpkg-acquire-msys-test/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-acquire-msys-test/vcpkg.json new file mode 100644 index 0000000..808294b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-acquire-msys-test/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "vcpkg-acquire-msys-test", + "version-string": "0", + "port-version": 1, + "description": "Test port to exercise vcpkg_acquire_msys", + "supports": "x86 & windows" +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/portfile.cmake new file mode 100644 index 0000000..7d4d2ec --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/portfile.cmake @@ -0,0 +1,3 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/project/CMakeLists.txt new file mode 100644 index 0000000..682d897 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/project/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.29) +project(angelscript-test CXX) +set(CMAKE_CXX_STANDARD 11) +add_executable(main main.cpp) +find_package(Angelscript CONFIG REQUIRED) +target_link_libraries(main PRIVATE Angelscript::angelscript) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/project/main.cpp new file mode 100644 index 0000000..b808911 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/project/main.cpp @@ -0,0 +1,6 @@ +#include <angelscript.h> +int main() +{ + auto LibraryVersion = asGetLibraryVersion(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/vcpkg.json new file mode 100644 index 0000000..4369acb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-angelscript/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-angelscript", + "version-string": "ci", + "description": "Validates angelscript", + "dependencies": [ + "angelscript", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/project/CMakeLists.txt new file mode 100644 index 0000000..8bbcf70 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/project/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.12) + +project(embedresource-test VERSION 0.0.1) + +set(CMAKE_CXX_STANDARD 17) + +find_package(EmbedResource REQUIRED) + +file(SIZE "${CMAKE_CURRENT_LIST_DIR}/main.cpp" MAIN_CPP_FILE_SIZE) +file(SIZE "${CMAKE_CURRENT_LIST_DIR}/CMakeLists.txt" CMAKELISTS_TXT_FILE_SIZE) + +add_resource_library(sample_test_resources OBJECT RESOURCE_COLLECTION_NAME testdata1 RESOURCES main.cpp GENERATOR_COMMAND echo "CMakeLists.txt" GENERATOR_DEPEND CMakeLists.txt) +add_resource_library(testdata3 OBJECT RESOURCES main.cpp) + +macro(setup_target target) + target_add_resource(${target} RESOURCE_COLLECTION_NAME testdata2 RESOURCES main.cpp) + get_target_property(type ${target} TYPE) + if ("${type}" STREQUAL "STATIC_LIBRARY") + target_link_libraries(${target} PRIVATE $<BUILD_INTERFACE:sample_test_resources> $<BUILD_INTERFACE:testdata3>) + else() + target_link_libraries(${target} PRIVATE sample_test_resources testdata3) + endif() + + target_compile_definitions(${target} PRIVATE MAIN_CPP_FILE_SIZE=${MAIN_CPP_FILE_SIZE}) + target_compile_definitions(${target} PRIVATE CMAKELISTS_TXT_FILE_SIZE=${CMAKELISTS_TXT_FILE_SIZE}) +endmacro() + +add_executable(sample_test_exe main.cpp) +setup_target(sample_test_exe) + +add_library(sample_test_shlib SHARED main.cpp) +target_compile_features(sample_test_shlib PRIVATE cxx_std_20) +setup_target(sample_test_shlib) + +add_library(sample_test_lib STATIC main.cpp) +setup_target(sample_test_lib) + +install(TARGETS sample_test_shlib EXPORT sample_test_shlib) +install(EXPORT sample_test_shlib FILE sampleTargets.cmake DESTINATION cmake) + +install(TARGETS sample_test_lib EXPORT sample_test_lib) +install(EXPORT sample_test_lib FILE sampleTargets.cmake DESTINATION cmake) + +enable_testing() +add_test(NAME sample_test_exe COMMAND sample_test_exe) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/project/main.cpp new file mode 100644 index 0000000..39d7a83 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/project/main.cpp @@ -0,0 +1,58 @@ +#include <EmbeddedResource.h> +#include <exception> +#include <iostream> +#include <stdexcept> +#include <string_view> + +DECLARE_RESOURCE_COLLECTION(testdata1); +DECLARE_RESOURCE_COLLECTION(testdata2); +DECLARE_RESOURCE_COLLECTION(testdata3); +DECLARE_RESOURCE(testdata3, main_cpp); + +void verify_resource(ResourceLoader const& r) +{ + if (r.name() == L"main.cpp") + { +#ifdef __cpp_lib_span + if (r.template data<uint8_t>().size() != MAIN_CPP_FILE_SIZE) { throw std::runtime_error("r.data.len() != MAIN_CPP_FILE_SIZE"); } +#endif +#ifdef __cpp_lib_string_view + if (r.string().size() != MAIN_CPP_FILE_SIZE) { throw std::runtime_error("r.string().size() != MAIN_CPP_FILE_SIZE"); } +#endif + } + else if (r.name() == L"CMakeLists.txt") + { +#ifdef __cpp_lib_span + if (r.template data<uint8_t>().size() != CMAKELISTS_TXT_FILE_SIZE) + { + throw std::runtime_error("r.data.len() != CMAKELISTS_TXT_FILE_SIZE"); + } +#endif +#ifdef __cpp_lib_string_view + if (r.string().size() != CMAKELISTS_TXT_FILE_SIZE) { throw std::runtime_error("r.string().size() != CMAKELISTS_TXT_FILE_SIZE"); } +#endif + } + else { throw std::runtime_error("Unknown resource name"); } +} + +int main(int argc, char* argv[]) +try +{ + std::string_view res = LOAD_RESOURCE(testdata3, main_cpp).data; + if (res.size() != MAIN_CPP_FILE_SIZE) { throw std::runtime_error("r.data.len() != MAIN_CPP_FILE_SIZE"); } + + auto resourceCollection1 = LOAD_RESOURCE_COLLECTION(testdata1); + for (auto const r : resourceCollection1) { verify_resource(r); } + + auto resourceCollection2 = LOAD_RESOURCE_COLLECTION(testdata2); + for (auto const r : resourceCollection2) { verify_resource(r); } + + auto resourceCollection3 = LOAD_RESOURCE_COLLECTION(testdata3); + for (auto const r : resourceCollection2) { verify_resource(r); } + + return 0; +} catch (const std::exception& ex) +{ + std::cerr << "Failed: " << ex.what() << std::endl; + return -1; +}
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/vcpkg.json new file mode 100644 index 0000000..a8267bb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ankurvdev-embedresource/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "vcpkg-ci-ankurvdev-embedresource", + "version-string": "ci", + "description": "Validates ankurvdev-embedresource", + "license": "BSD-3-Clause", + "dependencies": [ + "ankurvdev-embedresource", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-arrow/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-arrow/portfile.cmake new file mode 100644 index 0000000..46a1794 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-arrow/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ARROW_LINK_SHARED) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_INSTALLED_DIR}/share/arrow/example" + OPTIONS + -DARROW_LINK_SHARED=${ARROW_LINK_SHARED} +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-arrow/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-arrow/vcpkg.json new file mode 100644 index 0000000..8bf9a80 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-arrow/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "vcpkg-ci-arrow", + "version-date": "2022-07-25", + "description": "Builds an example app in order to validate the arrow port.", + "license": "Apache-2.0", + "dependencies": [ + { + "name": "arrow", + "default-features": false, + "features": [ + "csv", + "example" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake new file mode 100644 index 0000000..4c14b70 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/portfile.cmake @@ -0,0 +1,7 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_find_acquire_program(PKGCONFIG)
+
+vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project")
+
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt new file mode 100644 index 0000000..6e3b933 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.29)
+
+project(vcpkg-ci-aurora-au LANGUAGES CXX)
+
+find_package(Au CONFIG REQUIRED)
+
+add_executable(test_au_client test_au_client.cc)
+target_link_libraries(test_au_client PRIVATE Au::au)
+target_compile_features(test_au_client PRIVATE cxx_std_14)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc new file mode 100644 index 0000000..1b5e0fe --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/project/test_au_client.cc @@ -0,0 +1,18 @@ +#include <iostream>
+
+#include "au/au.hh"
+#include "au/io.hh"
+#include "au/units/hours.hh"
+#include "au/units/meters.hh"
+#include "au/units/miles.hh"
+
+using ::au::symbols::h;
+using ::au::symbols::mi;
+constexpr auto km = ::au::kilo(::au::symbols::m);
+
+int main(int argc, char **argv) {
+ constexpr auto v = 65.0 * mi / h;
+ std::cout << v << ", in km/h, rounded to nearest integer, is "
+ << round_as(km / h, v) << std::endl;
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json new file mode 100644 index 0000000..35f87eb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-aurora-au/vcpkg.json @@ -0,0 +1,13 @@ +{
+ "name": "vcpkg-ci-aurora-au",
+ "version-string": "ci",
+ "description": "Testing packages which provide AURORA-AU",
+ "license": null,
+ "dependencies": [
+ "aurora-au",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/project/CMakeLists.txt new file mode 100644 index 0000000..ef8945f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/project/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.10) +project(bgfx-test CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +find_package(bgfx CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE + bgfx::bgfx + # auxiliary targets + bgfx::bx + bgfx::bimg + bgfx::bimg_decode + bgfx::bimg_encode +) +if(ANDROID) + find_package(OpenGL COMPONENTS EGL GLES2 REQUIRED) + target_link_libraries(main PRIVATE nativewindow OpenGL::EGL OpenGL::GLES2) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/project/main.cpp new file mode 100644 index 0000000..94720d6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/project/main.cpp @@ -0,0 +1,9 @@ +#include <bgfx/bgfx.h> +#include <bgfx/platform.h> + +int main() +{ + bgfx::renderFrame(); + bgfx::Init init; + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/vcpkg.json new file mode 100644 index 0000000..b78e39c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bgfx/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-bgfx", + "version-string": "ci", + "description": "Port to force features of bgfx within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "bgfx", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-blas/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-blas/portfile.cmake new file mode 100644 index 0000000..165195b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-blas/portfile.cmake @@ -0,0 +1,10 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-blas/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-blas/project/CMakeLists.txt new file mode 100644 index 0000000..6f94f89 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-blas/project/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.18) # for BLAS::BLAS + +project(vcpkg-ci-blas C) + +find_package(BLAS REQUIRED) + +add_executable(fortran-interface main.c) +target_link_libraries(fortran-interface PRIVATE BLAS::BLAS) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(BLAS_PC REQUIRED IMPORTED_TARGET blas) + +add_executable(fortran-interface-pc main.c) +target_link_libraries(fortran-interface-pc PRIVATE PkgConfig::BLAS_PC) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-blas/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-blas/project/main.c new file mode 100644 index 0000000..cde97be --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-blas/project/main.c @@ -0,0 +1,17 @@ +extern void dgemm_(char*, char*, int*, int*,int*, double*, double*, int*, double*, int*, double*, double*, int*); + +int main() +{ + char ta = 'N'; + char tb = 'N'; + int m = 2; + int n = 2; + int k = 1; + double alpha = 0.5; + double A[2] = {1.0, 2.0}; // m x k + double B[2] = {3.0, 4.0}; // k x n + double beta = 0.05; + double C[4] = {100.0, 200.0, 300.0, 400.0}; // 2 x 2 + dgemm_(&ta, &tb, &m, &n, &k, &alpha, A, &m, B, &k, &beta, C, &m); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-blas/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-blas/vcpkg.json new file mode 100644 index 0000000..d83a9f7 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-blas/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "vcpkg-ci-blas", + "version-string": "ci", + "description": "Testing packages which provide BLAS", + "license": null, + "dependencies": [ + "blas", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-boost/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-boost/portfile.cmake new file mode 100644 index 0000000..0015715 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-boost/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-boost/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-boost/vcpkg.json new file mode 100644 index 0000000..7f5fc6c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-boost/vcpkg.json @@ -0,0 +1,67 @@ +{ + "name": "vcpkg-ci-boost", + "version": "1", + "description": "Boost features testing within CI.", + "dependencies": [ + "boost", + { + "name": "boost", + "default-features": false, + "features": [ + "mpi" + ], + "platform": "!staticcrt & !android & !(arm & windows) & !uwp" + }, + { + "name": "boost-asio", + "default-features": false, + "features": [ + "ssl" + ] + }, + { + "name": "boost-fiber", + "default-features": false, + "features": [ + "numa" + ], + "platform": "!uwp & !arm & !emscripten" + }, + { + "name": "boost-locale", + "default-features": false, + "features": [ + "icu" + ], + "platform": "!uwp" + }, + { + "name": "boost-mpi", + "default-features": false, + "features": [ + "python3" + ], + "platform": "!staticcrt & !static & !android & !(arm & windows) & !uwp" + }, + { + "name": "boost-odeint", + "default-features": false, + "features": [ + "mpi" + ], + "platform": "!staticcrt & !android & !(windows & arm) & !uwp" + }, + { + "name": "boost-python", + "default-features": false, + "platform": "!emscripten & !ios & !android & !uwp" + }, + { + "name": "boost-regex", + "default-features": false, + "features": [ + "icu" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-box2d/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-box2d/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/project/CMakeLists.txt new file mode 100644 index 0000000..e8cd743 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.30) +project(box2d-test C) + +find_package(box2d CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE box2d::box2d) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-box2d/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/project/main.c new file mode 100644 index 0000000..94c359b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/project/main.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include <box2d/box2d.h> + +int main() +{ + b2Version version = b2GetVersion(); + printf("b2 version: %d.%d.%d\n", version.major, version.minor, version.revision); + + b2WorldDef worldDef = b2DefaultWorldDef(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-box2d/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/vcpkg.json new file mode 100644 index 0000000..aabe80f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-box2d/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-box2d", + "version-string": "ci", + "description": "Port to validate box2d", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "box2d", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/portfile.cmake new file mode 100644 index 0000000..77b7277 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/portfile.cmake @@ -0,0 +1,19 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO bulletphysics/bullet3 + REF 3.25 + SHA512 7086e5fcf69635801bb311261173cb8d173b712ca1bd78be03df48fad884674e85512861190e45a1a62d5627aaad65cde08c175c44a3be9afa410d3dfd5358d4 + HEAD_REF master +) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DSOURCE_PATH=${SOURCE_PATH}" + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/project/CMakeLists.txt new file mode 100644 index 0000000..3e89f35 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/project/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.10) +project(bullet3-test CXX) + +set(CMAKE_CXX_STANDARD 11) + +block() + find_package(Bullet CONFIG REQUIRED) + + add_executable(main "${SOURCE_PATH}/examples/HelloWorld/HelloWorld.cpp") + target_link_libraries(main PRIVATE ${BULLET_LIBRARIES}) +endblock() + +if(WIN32) + set(unused "${PKG_CONFIG_EXECUTABLE}") + return() +endif() + +block() + find_package(PkgConfig REQUIRED) + pkg_check_modules(bullet bullet REQUIRED IMPORTED_TARGET) + + add_executable(main-pkgconfig "${SOURCE_PATH}/examples/HelloWorld/HelloWorld.cpp") + target_link_libraries(main-pkgconfig PRIVATE PkgConfig::bullet) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/vcpkg.json new file mode 100644 index 0000000..ecf08fa --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-bullet3/vcpkg.json @@ -0,0 +1,45 @@ +{ + "name": "vcpkg-ci-bullet3", + "version-string": "ci", + "description": "Port to force features of bullet3 within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + "bullet3", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "extras", + { + "name": "opencl", + "platform": "!uwp" + } + ], + "features": { + "extras": { + "description": "bullet3[extras]", + "dependencies": [ + { + "name": "bullet3", + "features": [ + "extras" + ] + } + ] + }, + "opencl": { + "description": "bullet3[opencl]", + "dependencies": [ + { + "name": "bullet3", + "features": [ + "opencl" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-capstone/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-capstone/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/project/CMakeLists.txt new file mode 100644 index 0000000..d70bdbd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.29) +project(capstone-test CXX) + +set(CMAKE_CXX_STANDARD 11) + +add_executable(main main.cpp) + +find_package(capstone CONFIG REQUIRED) +target_link_libraries(main PRIVATE capstone::capstone) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-capstone/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/project/main.cpp new file mode 100644 index 0000000..5ba9bce --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/project/main.cpp @@ -0,0 +1,8 @@ +#include <capstone/capstone.h> + +int main() +{ + csh handle; + cs_insn* insn = cs_malloc(handle); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-capstone/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/vcpkg.json new file mode 100644 index 0000000..b66ac26 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-capstone/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-capstone", + "version-string": "ci", + "description": "Validates capstone", + "dependencies": [ + "capstone", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/portfile.cmake new file mode 100644 index 0000000..7f70d16 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/portfile.cmake @@ -0,0 +1,164 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# For simplicity and speed, reusing source and build dirs +# - and the CMake cache - in multiple steps. +set(SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/src/project") +file(REMOVE_RECURSE "${SOURCE_PATH}") + + +message(STATUS "Testing toolchain find_library search path setup") + +file(COPY "${CURRENT_PORT_DIR}/project/" DESTINATION "${SOURCE_PATH}") +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}" + DISABLE_PARALLEL_CONFIGURE # keep separate logs +) +vcpkg_cmake_build() + + +message(STATUS "Testing toolchain capability VCPKG_LOCK_FIND_PACKAGE") + +set(VCPKG_BUILD_TYPE release) + +function(write_test_project TEST_CODE) + configure_file("${CURRENT_PORT_DIR}/project/vcpkg_lock_find_package/CMakeLists.txt.in" "${SOURCE_PATH}/CMakeLists.txt" @ONLY) +endfunction() + +include("${CURRENT_HOST_INSTALLED_DIR}/share/unit-test-cmake/test-macros.cmake") + +function(send_error summary) + set_has_error() + string(SHA1 id "${summary}") + string(SUBSTRING "${id}" 0 6 id) + set(log_base "${CURRENT_BUILDTREES_DIR}/test-${TARGET_TRIPLET}-${id}") + set(log_files "") + file(COPY_FILE "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-out.log" "${log_base}-out.log") + file(COPY_FILE "${CURRENT_BUILDTREES_DIR}/build-${TARGET_TRIPLET}-rel-err.log" "${log_base}-err.log") + message(SEND_ERROR " Test failed:\n${summary}\n See logs for more information:\n ${log_base}-out.log\n ${log_base}-err.log\n") +endfunction() + +macro(unit_test_ensure_cmake_success utecs_test) + write_test_project("${utecs_test}") + cmake_language(EVAL CODE "vcpkg_cmake_build()") + if(Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + send_error("${utecs_test} was expected to be successful.") + endif() + unset_fatal_error() +endmacro() + +macro(unit_test_ensure_cmake_error utece_test) + write_test_project("${utece_test}") + cmake_language(EVAL CODE "vcpkg_cmake_build()") + if(NOT Z_VCPKG_UNIT_TEST_HAS_FATAL_ERROR) + send_error("${utece_test} was expected to be successful.") + endif() + unset_fatal_error() +endmacro() + + +unit_test_ensure_cmake_error([[ + # No VCPKG_LOCK_FIND_PACKAGE + find_package(absentPackageX REQUIRED) +]]) +unit_test_ensure_cmake_success([[ + # No VCPKG_LOCK_FIND_PACKAGE + find_package(directPackageX REQUIRED) + find_package(transitivePackageX REQUIRED) + find_package(transitiveOptionalAbsentPackageX REQUIRED) + find_package(absentPackageX) + if(absentPackageX_FOUND) + message(FATAL_ERROR "absentPackageX_FOUND unexpectedly set to '${absentPackageX_FOUND}'.") + endif() +]]) + + +unit_test_ensure_cmake_success([[ + # Disabling an absent optional package + set(VCPKG_LOCK_FIND_PACKAGE_absentPackageX 0) + find_package(absentPackageX) +]]) + +unit_test_ensure_cmake_error([[ + # Disabling an absent required package + set(VCPKG_LOCK_FIND_PACKAGE_absentPackageX 0) + find_package(absentPackageX REQUIRED) +]]) + +unit_test_ensure_cmake_success([[ + # Disabling an available optional package + set(VCPKG_LOCK_FIND_PACKAGE_directPackageX 0) + find_package(directPackageX) + if(directPackageX_FOUND) + message(FATAL_ERROR "directPackageX_FOUND unexpectedly set to '${directPackageX_FOUND}'.") + endif() +]]) + +unit_test_ensure_cmake_error([[ + # Disabling an available required package + set(VCPKG_LOCK_FIND_PACKAGE_directPackageX 0) + find_package(directPackageX REQUIRED) +]]) + +unit_test_ensure_cmake_success([[ + # Core capability: a smart CMAKE_DISABLE_FIND_PACKAGE_<Pkg> + # Disabling only the direct package + set(VCPKG_LOCK_FIND_PACKAGE_directPackageX 0) + find_package(directPackageX) # optional + find_package(transitivePackageX REQUIRED) +]]) + +unit_test_ensure_cmake_error([[ + # For reference: CMake default behavior which we want to avoid + set(CMAKE_DISABLE_FIND_PACKAGE_directPackageX 1) + find_package(transitivePackageX REQUIRED) +]]) + + +unit_test_ensure_cmake_error([[ + # Requiring an absent optional package + set(VCPKG_LOCK_FIND_PACKAGE_absentPackageX 1) + find_package(absentPackageX) +]]) + +unit_test_ensure_cmake_error([[ + # Requiring an absent required package + set(VCPKG_LOCK_FIND_PACKAGE_absentPackageX 1) + find_package(absentPackageX REQUIRED) +]]) + +unit_test_ensure_cmake_success([[ + # Requiring an available optional package + set(VCPKG_LOCK_FIND_PACKAGE_directPackageX 1) + find_package(directPackageX) + if(NOT DEFINED directPackageX_FOUND) + message(FATAL_ERROR "directPackageX_FOUND unexpectedly undefined.") + elseif(NOT directPackageX_FOUND) + message(FATAL_ERROR "directPackageX_FOUND unexpectedly set to '${directPackageX_FOUND}'.") + endif() +]]) + +unit_test_ensure_cmake_success([[ + # Requiring an available required package + set(VCPKG_LOCK_FIND_PACKAGE_directPackageX 1) + find_package(directPackageX REQUIRED) + if(NOT DEFINED directPackageX_FOUND) + message(FATAL_ERROR "directPackageX_FOUND unexpectedly undefined.") + elseif(NOT directPackageX_FOUND) + message(FATAL_ERROR "directPackageX_FOUND unexpectedly set to '${directPackageX_FOUND}'.") + endif() +]]) + +unit_test_ensure_cmake_success([[ + # Core capability: a smart CMAKE_REQUIRE_FIND_PACKAGE_<Pkg> + # Requiring only the direct package + set(VCPKG_LOCK_FIND_PACKAGE_absentPackageX 1) + find_package(transitiveOptionalAbsentPackageX REQUIRED) +]]) + +unit_test_ensure_cmake_error([[ + # For reference: CMake default behavior which we want to avoid + set(CMAKE_REQUIRE_FIND_PACKAGE_absentPackageX 1) + find_package(transitiveOptionalAbsentPackageX REQUIRED) +]]) + +unit_test_report_result() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/CMakeLists.txt new file mode 100644 index 0000000..2171283 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/CMakeLists.txt @@ -0,0 +1,42 @@ +cmake_minimum_required(VERSION 3.30) +project(cmake-toolchain-file-test C CXX) + +foreach(var IN ITEMS + CMAKE_SYSROOT + CMAKE_FIND_ROOT_PATH + CMAKE_PREFIX_PATH + CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES + CMAKE_SYSTEM_IGNORE_PATH + CMAKE_FIND_ROOT_PATH_MODE_LIBRARY +) + list(JOIN "${var}" "\n " dirs) + message("" "${var}:\n ${dirs}\n") +endforeach() + +set(CMAKE_FIND_DEBUG_MODE 1) +set(link_libs "") +set(implicit_link_libs "${CMAKE_CXX_IMPLICIT_LINK_LIBRARIES}") +list(REMOVE_ITEM implicit_link_libs ${CMAKE_C_IMPLICIT_LINK_LIBRARIES}) +foreach(lib IN LISTS implicit_link_libs) + if(EXISTS "${lib}") + message("" "Absolute path: ${lib}\n") + else() + string(MAKE_C_IDENTIFIER "${lib}" id) + find_library(${id}_LIBRARY NAMES "${lib}" NO_CACHE) + if(NOT ${id}_LIBRARY) + find_library(${id}_LIBRARY NAMES "${lib}" PATHS ${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES} NO_DEFAULT_PATH NO_CACHE) + endif() + list(APPEND link_libs "${${id}_LIBRARY}") + endif() +endforeach() + +# Pull link errors into config step set of log files +try_compile(link_libs_accepted + SOURCES "${CMAKE_CURRENT_LIST_DIR}/main.c" + LINK_LIBRARIES ${link_libs} + LOG_DESCRIPTION "Checking linking with ${link_libs}" + OUTPUT_VARIABLE output +) +if(NOT link_libs_accepted) + message(FATAL_ERROR "${output}") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/main.c new file mode 100644 index 0000000..d0510dd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/main.c @@ -0,0 +1,7 @@ +#include <stdio.h> + +int main() +{ + printf("Hello %s\n", "world"); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/CMakeLists.txt.in b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/CMakeLists.txt.in new file mode 100644 index 0000000..c80e1da --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/CMakeLists.txt.in @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.30) +project(cmake-toolchain-file-test C) + +set(CMAKE_FIND_DEBUG_MODE 1) +set(VCPKG_TRACE_FIND_PACKAGE 1) + +set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) +set(CMAKE_PREFIX_PATH "${CMAKE_CURRENT_LIST_DIR}/vcpkg_lock_find_package") + +@TEST_CODE@ diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/directPackageXConfig.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/directPackageXConfig.cmake new file mode 100644 index 0000000..636bc1a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/directPackageXConfig.cmake @@ -0,0 +1 @@ +# intentionally empty diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/transitiveOptionalAbsentPackageXConfig.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/transitiveOptionalAbsentPackageXConfig.cmake new file mode 100644 index 0000000..c55e262 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/transitiveOptionalAbsentPackageXConfig.cmake @@ -0,0 +1,2 @@ +# Optional dependency! +find_package(absentPackageX) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/transitivePackageXConfig.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/transitivePackageXConfig.cmake new file mode 100644 index 0000000..2a47fac --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/project/vcpkg_lock_find_package/transitivePackageXConfig.cmake @@ -0,0 +1,2 @@ +include(CMakeFindDependencyMacro) +find_dependency(directPackageX) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/vcpkg.json new file mode 100644 index 0000000..d754f71 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-cmake-toolchain-file/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-cmake-toolchain-file", + "version-string": "ci", + "description": "Validate vcpkg.cmake toolchain file", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "unit-test-cmake", + "host": true + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/project/CMakeLists.txt new file mode 100644 index 0000000..b24d994 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.29) +project(crashpad-test CXX) + +set(CMAKE_CXX_STANDARD 11) + +add_executable(main main.cpp) + +find_package(crashpad CONFIG REQUIRED) +target_link_libraries(main PRIVATE crashpad::crashpad) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/project/main.cpp new file mode 100644 index 0000000..f450f9e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/project/main.cpp @@ -0,0 +1,7 @@ +#include "client/crashpad_client.h" + +int main() +{ + auto *client = new crashpad::CrashpadClient(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/vcpkg.json new file mode 100644 index 0000000..1903999 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-crashpad/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-crashpad", + "version-string": "ci", + "description": "Validates crashpad", + "dependencies": [ + "crashpad", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-curl/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-curl/portfile.cmake new file mode 100644 index 0000000..d66f1b3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-curl/portfile.cmake @@ -0,0 +1,14 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + OPTIONS_RELEASE + "-DCURL_CONFIG=${CURRENT_INSTALLED_DIR}/tools/curl/bin/curl-config" + OPTIONS_DEBUG + "-DCURL_CONFIG=${CURRENT_INSTALLED_DIR}/tools/curl/debug/bin/curl-config" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-curl/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-curl/project/CMakeLists.txt new file mode 100644 index 0000000..ae54cc3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-curl/project/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.30) +project(libcurl-test C) + +block(SCOPE_FOR VARIABLES) + # blocked by FindOpenSSL in CMake 3.30: set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig 1) + + find_package(CURL COMPONENTS libz REQUIRED) + + add_executable(main main.c) + target_link_libraries(main PRIVATE CURL::libcurl) +endblock() + +block(SCOPE_FOR VARIABLES) + find_package(PkgConfig REQUIRED) + pkg_check_modules(libcurl_pc libcurl REQUIRED IMPORTED_TARGET) + + add_executable(main-pkgconfig main.c) + target_link_libraries(main-pkgconfig PRIVATE PkgConfig::libcurl_pc) +endblock() + +block(SCOPE_FOR VARIABLES) +if(NOT CMAKE_HOST_WIN32) + find_program(CURL_CONFIG NAMES curl-config REQUIRED) + execute_process(COMMAND "${CURL_CONFIG}" --cflags OUTPUT_VARIABLE curl-config-cflags OUTPUT_STRIP_TRAILING_WHITESPACE) + separate_arguments(curl-config-cflags UNIX_COMMAND "${curl-config-cflags}") + execute_process(COMMAND "${CURL_CONFIG}" --libs OUTPUT_VARIABLE curl-config-libs OUTPUT_STRIP_TRAILING_WHITESPACE) + separate_arguments(curl-config-libs UNIX_COMMAND "${curl-config-libs}") + string(REGEX REPLACE "(^-|;-)framework;" "\\1framework " curl-config-libs "${curl-config-libs}") + + add_executable(main-curl-config main.c) + target_compile_options(main-curl-config PRIVATE ${curl-config-cflags}) + target_link_libraries(main-curl-config PRIVATE ${curl-config-libs}) +endif() +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-curl/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-curl/project/main.c new file mode 100644 index 0000000..7002d69 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-curl/project/main.c @@ -0,0 +1,10 @@ +#include <curl/curl.h> + +int main() +{ + CURL *curl = curl_easy_init(); + if(curl) { + curl_easy_cleanup(curl); + } + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-curl/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-curl/vcpkg.json new file mode 100644 index 0000000..d778693 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-curl/vcpkg.json @@ -0,0 +1,122 @@ +{ + "name": "vcpkg-ci-curl", + "version-string": "ci", + "description": "Port to force features of certain ports within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "curl", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "compression", + "misc", + "security" + ], + "features": { + "compression": { + "description": "Compression features", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "zstd" + ] + }, + { + "$comment": "Known to break aws-sdk-cpp.", + "name": "curl", + "default-features": false, + "features": [ + "brotli" + ], + "platform": "!osx" + } + ] + }, + "misc": { + "description": "Misc features", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "c-ares", + "http2", + "httpsrr", + "idn", + "rtmp", + "ssh", + "ssls-export" + ] + }, + { + "name": "curl", + "default-features": false, + "features": [ + "psl" + ], + "platform": "!uwp" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "ldap", + "tool" + ], + "platform": "!android & !uwp" + } + ] + }, + "security": { + "description": "Security features", + "dependencies": [ + { + "name": "curl", + "default-features": false, + "features": [ + "gsasl", + "mbedtls", + "openssl", + "ssl", + "wolfssl" + ], + "platform": "!uwp" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "gssapi" + ], + "platform": "linux | osx" + }, + { + "name": "curl", + "default-features": false, + "features": [ + "sspi" + ], + "platform": "windows & !uwp" + }, + { + "$comment": "On arm, gnutls crypto symbols clash with openssl.", + "name": "curl", + "default-features": false, + "features": [ + "gnutls" + ], + "platform": "!android & !uwp & !xbox & !arm" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/project/CMakeLists.txt new file mode 100644 index 0000000..253dd11 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/project/CMakeLists.txt @@ -0,0 +1,35 @@ +cmake_minimum_required(VERSION 3.30) +project(dartsim-test CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) + +# https://github.com/dartsim/dart/issues/753#issuecomment-264694898 +# https://github.com/dartsim/dart/pull/956/files +if(MSVC) + add_compile_options("/permissive-") +endif() + +block(SCOPE_FOR VARIABLES) + find_package(DART CONFIG REQUIRED) + add_library(target::dart ALIAS dart) + + add_executable(main-dart main.cpp) + target_link_libraries(main-dart PRIVATE target::dart) + + # check link libs from all components + file(GLOB components RELATIVE "${DART_DIR}" "${DART_DIR}/dart_*Component.cmake") + list(TRANSFORM components REPLACE "^dart_(.*)Component.cmake\$" "\\1") + find_package(DART CONFIG COMPONENTS ${components}) + + add_executable(main-all main.cpp) + target_link_libraries(main-all PRIVATE ${DART_LIBRARIES}) +endblock() + +block(SCOPE_FOR VARIABLES) + find_package(PkgConfig REQUIRED) + pkg_check_modules(dartsim_pc dart REQUIRED IMPORTED_TARGET) + + add_executable(main-pkconfig main.cpp) + target_link_libraries(main-pkconfig PRIVATE PkgConfig::dartsim_pc) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/project/main.cpp new file mode 100644 index 0000000..61bbe04 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/project/main.cpp @@ -0,0 +1,6 @@ +#include <dart/dart.hpp> + +int main() +{ + dart::simulation::WorldPtr world(new dart::simulation::World); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/vcpkg.json new file mode 100644 index 0000000..8579597 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dartsim/vcpkg.json @@ -0,0 +1,54 @@ +{ + "name": "vcpkg-ci-dartsim", + "version-string": "ci", + "description": "Validates dartsim within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "dartsim", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "dartsim", + "default-features": false, + "features": [ + "collision-bullet", + "collision-ode", + "spdlog", + "utils" + ] + }, + { + "name": "dartsim", + "default-features": false, + "features": [ + "utils-urdf" + ], + "platform": "!staticcrt" + }, + { + "name": "dartsim", + "default-features": false, + "features": [ + "gui", + "gui-osg" + ], + "platform": "!arm & !android" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dawn/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/CMakeLists.txt new file mode 100755 index 0000000..234c04e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.15) +project(vcpkg_ci_dawn) + +set(CMAKE_CXX_STANDARD 17) + +find_package(glfw3 CONFIG REQUIRED) + +################################################################################ +# Use cmake config # +################################################################################ +find_package(Dawn CONFIG REQUIRED) +add_executable(vcpkg_ci_dawn main.cpp webgpu_glfw3.cpp) +target_link_libraries(vcpkg_ci_dawn PRIVATE glfw dawn::webgpu_dawn) +if (EMSCRIPTEN) + target_link_options(vcpkg_ci_dawn PRIVATE -sASYNCIFY) + set(TARGET_NAME "vcpkg_ci_dawn") + configure_file("${CMAKE_CURRENT_LIST_DIR}/main.html" "${CMAKE_BINARY_DIR}/${TARGET_NAME}.html" @ONLY) +endif () + +################################################################################ +# Use pkg-config # +################################################################################ +find_package(PkgConfig) +pkg_check_modules(webgpu_dawn REQUIRED IMPORTED_TARGET unofficial_webgpu_dawn) +add_executable(vcpkg_ci_dawn_pc main.cpp webgpu_glfw3.cpp) +target_link_libraries(vcpkg_ci_dawn_pc PRIVATE glfw PkgConfig::webgpu_dawn) +if (EMSCRIPTEN) + target_link_options(vcpkg_ci_dawn_pc PRIVATE -sASYNCIFY) + set(TARGET_NAME "vcpkg_ci_dawn_pc") + configure_file("${CMAKE_CURRENT_LIST_DIR}/main.html" "${CMAKE_BINARY_DIR}/${TARGET_NAME}.html" @ONLY) +endif () diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/main.cpp new file mode 100755 index 0000000..74bf086 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/main.cpp @@ -0,0 +1,391 @@ +// +// Copyright (c) 2024 xiaozhuai +// + +#define GLFW_INCLUDE_NONE + +#include <cstdio> +#include <string> +#include <vector> + +#include "GLFW/glfw3.h" +#include "webgpu/webgpu_cpp.h" + +#if defined(__EMSCRIPTEN__) +#include "emscripten/emscripten.h" +#endif + +#define LOG(fmt, ...) printf(fmt "\n", ##__VA_ARGS__) + +#if !defined(__PRETTY_FUNCTION__) && !defined(__GNUC__) +#define MY_PRETTY_FUNCTION __FUNCSIG__ +#else +#define MY_PRETTY_FUNCTION __PRETTY_FUNCTION__ +#endif + +#define ASSERT(expr, fmt, ...) \ + do { \ + if (!(expr)) { \ + LOG("Assertion failed: %s:%d, func: \"%s\", expr: \"%s\", message: " /**/ \ + fmt, /**/ \ + __FILE__, __LINE__, MY_PRETTY_FUNCTION, #expr, /**/ \ + ##__VA_ARGS__); \ + abort(); \ + } \ + } while (0) + +wgpu::Instance create_instance() { + wgpu::InstanceDescriptor instance_desc; + std::vector<wgpu::InstanceFeatureName> required_features = { + wgpu::InstanceFeatureName::TimedWaitAny, + }; + instance_desc.requiredFeatureCount = required_features.size(); + instance_desc.requiredFeatures = required_features.data(); + return wgpu::CreateInstance(&instance_desc); +} + +wgpu::Surface create_surface(const wgpu::Instance &instance, GLFWwindow *window); + +wgpu::Adapter request_adapter(const wgpu::Instance &instance, const wgpu::Surface &surface) { + wgpu::RequestAdapterOptions adapter_options; + adapter_options.compatibleSurface = surface; + adapter_options.powerPreference = wgpu::PowerPreference::HighPerformance; + + wgpu::Adapter adapter; + auto adapter_future = instance.RequestAdapter( + &adapter_options, wgpu::CallbackMode::WaitAnyOnly, + [&adapter](wgpu::RequestAdapterStatus status, wgpu::Adapter adapter_ret, wgpu::StringView message) { + ASSERT(status == wgpu::RequestAdapterStatus::Success && adapter_ret != nullptr, "Failed to get adapter: %s", + message.data); + adapter = std::move(adapter_ret); + }); + ASSERT(instance.WaitAny(adapter_future, wgpu::kLimitU64Undefined) == wgpu::WaitStatus::Success, + "Failed to wait for adapter request"); + + return adapter; +} + +void device_lost_callback(const wgpu::Device &, wgpu::DeviceLostReason, wgpu::StringView message) { + LOG("Device lost: %s", message.data); +} + +void device_uncaptured_error_callback(const wgpu::Device &, wgpu::ErrorType type, wgpu::StringView message) { + const char *error_type; + switch (type) { + case wgpu::ErrorType::Validation: + error_type = "Validation"; + break; + case wgpu::ErrorType::OutOfMemory: + error_type = "Out of memory"; + break; + case wgpu::ErrorType::Internal: + error_type = "Internal"; + break; + case wgpu::ErrorType::Unknown: + error_type = "Unknown"; + break; + default: + ASSERT(false, "Unknown ErrorType"); + } + LOG("Uncaptured Error %s: %s", error_type, message.data); +} + +wgpu::Device request_device(const wgpu::Instance &instance, const wgpu::Adapter &adapter) { + wgpu::DeviceDescriptor device_desc; + + device_desc.SetDeviceLostCallback(wgpu::CallbackMode::AllowSpontaneous, device_lost_callback); + device_desc.SetUncapturedErrorCallback(device_uncaptured_error_callback); + + wgpu::Device device; + auto device_future = adapter.RequestDevice( + &device_desc, wgpu::CallbackMode::WaitAnyOnly, + [&device](wgpu::RequestDeviceStatus status, wgpu::Device device_ret, wgpu::StringView message) { + ASSERT(status == wgpu::RequestDeviceStatus::Success && device_ret != nullptr, "Failed to get device: %s", + message.data); + device = std::move(device_ret); + }); + ASSERT(instance.WaitAny(device_future, wgpu::kLimitU64Undefined) == wgpu::WaitStatus::Success, + "Failed to wait for device request"); + + return device; +} + +wgpu::ShaderModule create_shader(const wgpu::Device &device, const std::string &shader_code) { + wgpu::ShaderSourceWGSL shader_code_desc; + shader_code_desc.sType = wgpu::SType::ShaderSourceWGSL; + shader_code_desc.code = shader_code.c_str(); + wgpu::ShaderModuleDescriptor shader_desc; + shader_desc.nextInChain = &shader_code_desc; + return device.CreateShaderModule(&shader_desc); +} + +struct alignas(16) Uniforms { + struct { + float width = 0.0f; + float height = 0.0f; + } resolution; + float time = 0.0f; +}; + +void glfw_error_callback(int error, const char *description) { LOG("GLFW error, %d, %s", error, description); } + +struct AppState { + wgpu::Instance instance; + wgpu::Surface surface; + wgpu::Adapter adapter; + wgpu::Device device; + wgpu::Queue queue; + wgpu::SurfaceConfiguration surface_config; + int surface_width = 0; + int surface_height = 0; +}; + +int main() { + glfwSetErrorCallback(glfw_error_callback); + ASSERT(glfwInit(), "GLFW init failed"); + glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API); + auto *window = glfwCreateWindow(1024, 1024, "vcpkg-ci-dawn", nullptr, nullptr); + + AppState state; + state.instance = create_instance(); + state.surface = create_surface(state.instance, window); + state.adapter = request_adapter(state.instance, state.surface); + state.device = request_device(state.instance, state.adapter); + state.queue = state.device.GetQueue(); + + wgpu::SurfaceCapabilities surface_capabilities; + state.surface.GetCapabilities(state.adapter, &surface_capabilities); + glfwGetFramebufferSize(window, &state.surface_width, &state.surface_height); + + state.surface_config.device = state.device; + state.surface_config.usage = wgpu::TextureUsage::RenderAttachment; + state.surface_config.format = surface_capabilities.formats[0]; + state.surface_config.presentMode = surface_capabilities.presentModes[0]; + state.surface_config.alphaMode = surface_capabilities.alphaModes[0]; + state.surface_config.width = state.surface_width; + state.surface_config.height = state.surface_height; + state.surface.Configure(&state.surface_config); + + glfwSetWindowUserPointer(window, &state); + + glfwSetKeyCallback(window, [](GLFWwindow *window, int key, int scancode, int action, int mods) { + if (key == GLFW_KEY_ESCAPE && action == GLFW_RELEASE) { + glfwSetWindowShouldClose(window, GLFW_TRUE); + } + }); + glfwSetFramebufferSizeCallback(window, [](GLFWwindow *window, int width, int height) { + auto &state = *static_cast<AppState *>(glfwGetWindowUserPointer(window)); + state.surface_width = width; + state.surface_height = height; + state.surface_config.width = width; + state.surface_config.height = height; + state.surface.Configure(&state.surface_config); + }); + + std::string shader_source = R"( +struct Uniforms { + resolution: vec2f, + time: f32, +}; + +@group(0) +@binding(0) +var<uniform> uniforms: Uniforms; + +struct VertexInput { + @location(0) + pos: vec2f, +}; + +struct VertexOutput { + @builtin(position) + pos: vec4f, +}; + +@vertex +fn vs_main(input: VertexInput) -> VertexOutput { + var output: VertexOutput; + output.pos = vec4f(input.pos, 0.0, 1.0); + return output; +} + +struct FragmentInput { + @builtin(position) + coord: vec4f, +}; + +struct FragmentOutput { + @location(0) + color: vec4f, +}; + +fn palette(t: f32) -> vec3f{ + let a = vec3f(0.5, 0.5, 0.5); + let b = vec3f(0.5, 0.5, 0.5); + let c = vec3f(1.0, 1.0, 1.0); + let d = vec3f(0.263, 0.416, 0.557); + return a + b * cos(6.28318 * (c * t + d)); +} + +@fragment +fn fs_main(input: FragmentInput) -> FragmentOutput { + var uv = (input.coord.xy * 2.0 - uniforms.resolution) / min(uniforms.resolution.x, uniforms.resolution.y); + let uv0 = uv; + var color = vec3f(0.0); + for (var i: f32 = 0.0; i < 4.0; i += 1.0) { + uv = fract(uv * 1.5) - 0.5; + var d = length(uv) * exp(-length(uv0)); + let col = palette(length(uv0) + i * 0.4 + uniforms.time * 0.4); + d = sin(d * 8.0 + uniforms.time) / 8.0; + d = abs(d); + d = pow(0.01 / d, 1.2); + color += col * d; + } + var output: FragmentOutput; + output.color = vec4f(color, 1.0); + return output; +} +)"; + auto shader_module = create_shader(state.device, shader_source); + + constexpr float vertices[12] = {-1.0, -1.0, 1.0, -1.0, 1.0, 1.0, -1.0, -1.0, 1.0, 1.0, -1.0, 1.0}; + constexpr int vertex_count = std::size(vertices) / 2; + wgpu::BufferDescriptor vertex_buffer_desc; + vertex_buffer_desc.size = sizeof(vertices); + vertex_buffer_desc.usage = wgpu::BufferUsage::Vertex | wgpu::BufferUsage::CopyDst; + wgpu::Buffer vertex_buffer = state.device.CreateBuffer(&vertex_buffer_desc); + state.queue.WriteBuffer(vertex_buffer, 0, vertices, sizeof(vertices)); + + Uniforms uniforms; + wgpu::BufferDescriptor uniform_buffer_desc; + uniform_buffer_desc.size = sizeof(uniforms); + uniform_buffer_desc.usage = wgpu::BufferUsage::Uniform | wgpu::BufferUsage::CopyDst; + wgpu::Buffer uniform_buffer = state.device.CreateBuffer(&uniform_buffer_desc); + state.queue.WriteBuffer(uniform_buffer, 0, &uniforms, sizeof(uniforms)); + + wgpu::RenderPipelineDescriptor pipeline_desc; + + std::vector<wgpu::VertexAttribute> vertex_attributes(1); + vertex_attributes[0].format = wgpu::VertexFormat::Float32x2; + vertex_attributes[0].offset = 0; + vertex_attributes[0].shaderLocation = 0; + std::vector<wgpu::VertexBufferLayout> vertex_layouts(1); + vertex_layouts[0].arrayStride = 2 * sizeof(float); + vertex_layouts[0].attributeCount = vertex_attributes.size(); + vertex_layouts[0].attributes = vertex_attributes.data(); + vertex_layouts[0].stepMode = wgpu::VertexStepMode::Vertex; + + pipeline_desc.vertex.bufferCount = vertex_layouts.size(); + pipeline_desc.vertex.buffers = vertex_layouts.data(); + + pipeline_desc.vertex.module = shader_module; + pipeline_desc.vertex.entryPoint = "vs_main"; + pipeline_desc.vertex.constantCount = 0; + pipeline_desc.vertex.constants = nullptr; + + pipeline_desc.primitive.topology = wgpu::PrimitiveTopology::TriangleList; + pipeline_desc.primitive.stripIndexFormat = wgpu::IndexFormat::Undefined; + pipeline_desc.primitive.frontFace = wgpu::FrontFace::CCW; + pipeline_desc.primitive.cullMode = wgpu::CullMode::None; + + wgpu::FragmentState fragment_state; + fragment_state.module = shader_module; + fragment_state.entryPoint = "fs_main"; + fragment_state.constantCount = 0; + fragment_state.constants = nullptr; + + wgpu::BlendState blend_state; + blend_state.color.srcFactor = wgpu::BlendFactor::SrcAlpha; + blend_state.color.dstFactor = wgpu::BlendFactor::OneMinusSrcAlpha; + blend_state.color.operation = wgpu::BlendOperation::Add; + blend_state.alpha.srcFactor = wgpu::BlendFactor::Zero; + blend_state.alpha.dstFactor = wgpu::BlendFactor::One; + blend_state.alpha.operation = wgpu::BlendOperation::Add; + + wgpu::ColorTargetState color_target; + color_target.format = state.surface_config.format; + color_target.blend = &blend_state; + color_target.writeMask = wgpu::ColorWriteMask::All; + + fragment_state.targetCount = 1; + fragment_state.targets = &color_target; + pipeline_desc.fragment = &fragment_state; + + pipeline_desc.depthStencil = nullptr; + pipeline_desc.multisample.count = 1; + pipeline_desc.multisample.mask = ~0u; + + pipeline_desc.multisample.alphaToCoverageEnabled = false; + pipeline_desc.layout = nullptr; + + wgpu::RenderPipeline pipeline = state.device.CreateRenderPipeline(&pipeline_desc); + + std::vector<wgpu::BindGroupEntry> bind_group_entries(1); + bind_group_entries[0].binding = 0; + bind_group_entries[0].buffer = uniform_buffer; + bind_group_entries[0].size = uniform_buffer.GetSize(); + + wgpu::BindGroupDescriptor bind_group_desc; + bind_group_desc.layout = pipeline.GetBindGroupLayout(0); + bind_group_desc.entryCount = bind_group_entries.size(); + bind_group_desc.entries = bind_group_entries.data(); + wgpu::BindGroup bind_group = state.device.CreateBindGroup(&bind_group_desc); + + const double start_time = glfwGetTime(); + while (!glfwWindowShouldClose(window)) { + glfwPollEvents(); +#if defined(__EMSCRIPTEN__) + emscripten_sleep(0); +#endif + + const double time = glfwGetTime() - start_time; + + wgpu::SurfaceTexture surface_texture; + state.surface.GetCurrentTexture(&surface_texture); + ASSERT(surface_texture.status == wgpu::SurfaceGetCurrentTextureStatus::SuccessOptimal || + surface_texture.status == wgpu::SurfaceGetCurrentTextureStatus::SuccessSuboptimal, + "Failed to get current texture"); + if (surface_texture.status == wgpu::SurfaceGetCurrentTextureStatus::SuccessSuboptimal) { + LOG("Surface texture is suboptimal"); + } + + wgpu::Texture texture = surface_texture.texture; + wgpu::TextureView frame = texture.CreateView(); + + uniforms.resolution.width = static_cast<float>(texture.GetWidth()); + uniforms.resolution.height = static_cast<float>(texture.GetHeight()); + uniforms.time = static_cast<float>(time); + state.queue.WriteBuffer(uniform_buffer, 0, &uniforms, sizeof(uniforms)); + + auto encoder = state.device.CreateCommandEncoder(); + + wgpu::RenderPassColorAttachment color_attachment; + color_attachment.view = frame; + color_attachment.loadOp = wgpu::LoadOp::Clear; + color_attachment.storeOp = wgpu::StoreOp::Store; + color_attachment.clearValue = {0.1f, 0.2f, 0.3f, 1.0f}; + wgpu::RenderPassDescriptor pass_desc; + pass_desc.colorAttachmentCount = 1; + pass_desc.colorAttachments = &color_attachment; + pass_desc.depthStencilAttachment = nullptr; + + auto pass = encoder.BeginRenderPass(&pass_desc); + pass.SetPipeline(pipeline); + pass.SetVertexBuffer(0, vertex_buffer, 0, vertex_buffer.GetSize()); + pass.SetBindGroup(0, bind_group, 0, nullptr); + pass.Draw(vertex_count); + pass.End(); + + wgpu::CommandBuffer command_buffer = encoder.Finish(); + state.queue.Submit(1, &command_buffer); + +#if !defined(__EMSCRIPTEN__) + ASSERT(state.surface.Present(), "Failed to present the surface"); + state.device.Tick(); +#endif + } + + glfwDestroyWindow(window); + glfwTerminate(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/main.html b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/main.html new file mode 100755 index 0000000..37f8b9e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/main.html @@ -0,0 +1,19 @@ +<!DOCTYPE html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <title>@TARGET_NAME@</title> + <style> + html, body { margin: 0; padding: 0; width: 100%; height: 100%; } + .canvas-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; } + #canvas { max-width: 100%; max-height: 100%; } + </style> +</head> +<body> +<div class="canvas-container"> + <canvas id="canvas" width="1024" height="1024"></canvas> +</div> +</body> +<script type="text/javascript">var Module = {canvas: document.getElementById('canvas')};</script> +<script type="text/javascript" src="@TARGET_NAME@.js"></script> +</html> diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/webgpu_glfw3.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/webgpu_glfw3.cpp new file mode 100644 index 0000000..269ea1f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/project/webgpu_glfw3.cpp @@ -0,0 +1,121 @@ +// +// Copyright (c) 2025 xiaozhuai +// + +#define GLFW_INCLUDE_NONE + +#include <memory> + +#include "GLFW/glfw3.h" +#include "webgpu/webgpu_cpp.h" + +#if defined(_WIN32) +#define GLFW_EXPOSE_NATIVE_WIN32 +#endif + +#if defined(__APPLE__) +#define GLFW_EXPOSE_NATIVE_COCOA +#endif + +#if defined(__linux__) || defined(__FreeBSD__) || defined(__OpenBSD__) +#define DAWN_USE_X11 +#endif + +#if defined(DAWN_USE_X11) +#define GLFW_EXPOSE_NATIVE_X11 +#endif + +#if defined(DAWN_USE_WAYLAND) +#define GLFW_EXPOSE_NATIVE_WAYLAND +#endif + +#if defined(__EMSCRIPTEN__) +#include "emscripten/emscripten.h" +#else +#include "GLFW/glfw3native.h" +#endif + +#if defined(__APPLE__) +#include <objc/message.h> +#include <objc/objc.h> +#include <objc/runtime.h> +template <typename T, typename... Args> +T objc_call(id obj, const char *sel, Args... args) { + using FuncPtr = T (*)(id, SEL, Args...); + return reinterpret_cast<FuncPtr>(objc_msgSend)(obj, sel_registerName(sel), args...); +} +template <typename T, typename... Args> +T objc_call(const char *clazz, const char *sel, Args... args) { + return objc_call<T>(reinterpret_cast<id>(objc_getClass(clazz)), sel, args...); +} +#endif + +std::unique_ptr<wgpu::ChainedStruct> setup_window_and_get_surface_descriptor(GLFWwindow *window) { + if (glfwGetWindowAttrib(window, GLFW_CLIENT_API) != GLFW_NO_API) { + return nullptr; + } + +#if defined(__EMSCRIPTEN__) + auto desc = std::make_unique<wgpu::EmscriptenSurfaceSourceCanvasHTMLSelector>(); + desc->selector = "#canvas"; + return desc; +#elif defined(_WIN32) + auto desc = std::make_unique<wgpu::SurfaceSourceWindowsHWND>(); + desc->hwnd = glfwGetWin32Window(window); + desc->hinstance = GetModuleHandle(nullptr); + return desc; +#elif defined(__APPLE__) + // NSWindow *ns_window = glfwGetCocoaWindow(window); + // NSView *view = [ns_window contentView]; + // [view setWantsLayer:YES]; + // CAMetalLayer *layer = [CAMetalLayer layer]; + // CGFloat scale_factor = [ns_window backingScaleFactor]; + // [layer setContentsScale:scale_factor]; + // [view setLayer:layer]; + auto ns_window = glfwGetCocoaWindow(window); + CFRetain(ns_window); + auto view = objc_call<id>(ns_window, "contentView"); + CFRetain(view); + objc_call<void, BOOL>(view, "setWantsLayer:", YES); + auto layer = objc_call<id>("CAMetalLayer", "layer"); + auto scale_factor = objc_call<CGFloat>(ns_window, "backingScaleFactor"); + objc_call<void, CGFloat>(layer, "setContentsScale:", scale_factor); + objc_call<void, id>(view, "setLayer:", layer); + auto desc = std::make_unique<wgpu::SurfaceSourceMetalLayer>(); + desc->layer = layer; + CFRelease(view); + CFRelease(ns_window); + return desc; +#elif defined(DAWN_USE_WAYLAND) || defined(DAWN_USE_X11) +#if defined(GLFW_PLATFORM_WAYLAND) && defined(DAWN_USE_WAYLAND) + if (glfwGetPlatform() == GLFW_PLATFORM_WAYLAND) { + auto desc = std::make_unique<wgpu::SurfaceSourceWaylandSurface>(); + desc->display = glfwGetWaylandDisplay(); + desc->surface = glfwGetWaylandWindow(window); + return desc; + } else // NOLINT(readability/braces) +#endif +#if defined(DAWN_USE_X11) + { + auto desc = std::make_unique<wgpu::SurfaceSourceXlibWindow>(); + desc->display = glfwGetX11Display(); + desc->window = glfwGetX11Window(window); + return desc; + } +#else + { + return nullptr; + } +#endif +#else + return nullptr; +#endif +} + +wgpu::Surface create_surface(const wgpu::Instance &instance, GLFWwindow *window) { + auto chainedDescriptor = setup_window_and_get_surface_descriptor(window); + wgpu::SurfaceDescriptor descriptor; + descriptor.nextInChain = chainedDescriptor.get(); + wgpu::Surface surface = instance.CreateSurface(&descriptor); + return surface; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dawn/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/vcpkg.json new file mode 100644 index 0000000..4729e40 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dawn/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "vcpkg-ci-dawn", + "version-date": "2025-09-28", + "description": "Validates dawn", + "license": null, + "supports": "!uwp & !android & !ios", + "dependencies": [ + "dawn", + "glfw3", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/portfile.cmake new file mode 100644 index 0000000..a1b99a7 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/portfile.cmake @@ -0,0 +1,5 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+)
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/project/CMakeLists.txt new file mode 100644 index 0000000..f077136 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(dbus-cxx-test CXX)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+find_package(dbus-cxx CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE dbus-cxx::dbus-cxx)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/project/main.cpp new file mode 100644 index 0000000..dcef36c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/project/main.cpp @@ -0,0 +1,6 @@ +#include <dbus-cxx.h>
+int main()
+{
+ auto connection = DBus::Connection::create(DBus::BusType::SESSION);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/vcpkg.json new file mode 100644 index 0000000..e4f9d9a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dbus-cxx/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-dbus-cxx", + "version-string": "ci", + "description": "Validates dbus-cxx", + "dependencies": [ + "dbus-cxx", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/project/CMakeLists.txt new file mode 100644 index 0000000..843bb2f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.10) +project(dcmtk-test CXX) + +set(CMAKE_CXX_STANDARD 17) + +find_package(DCMTK CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE DCMTK::DCMTK) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(DCMTK dcmtk REQUIRED IMPORTED_TARGET) + +add_executable(main-pkgconfig main.cpp) +target_link_libraries(main-pkgconfig PRIVATE PkgConfig::DCMTK) +target_compile_options(main-pkgconfig PRIVATE "\$<\$<CXX_COMPILER_ID:MSVC>:/Zc:__cplusplus>") diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/project/main.cpp new file mode 100644 index 0000000..c807e95 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/project/main.cpp @@ -0,0 +1,9 @@ +#include <dcmtk/dcmdata/dcjson.h> +#include <dcmtk/dcmtls/tlslayer.h> + +int main() +{ + auto djfp = DcmJsonFormatPretty(OFTrue); + DcmTLSTransportLayer::initializeOpenSSL(); // https://github.com/microsoft/vcpkg/issues/38476 + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/vcpkg.json new file mode 100644 index 0000000..18bd2f0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-dcmtk/vcpkg.json @@ -0,0 +1,25 @@ +{ + "name": "vcpkg-ci-dcmtk", + "version-string": "ci", + "description": "Port to force features of dcmtk within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "dcmtk", + "features": [ + "iconv", + "openssl", + "tiff", + "tools", + "xml2", + "zlib", + "openjpeg" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/portfile.cmake new file mode 100644 index 0000000..7485803 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/portfile.cmake @@ -0,0 +1,21 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_install() + +if(NOT VCPKG_CROSSCOMPILING) + if(CMAKE_HOST_WIN32) + vcpkg_host_path_list(PREPEND ENV{PATH} "${CURRENT_INSTALLED_DIR}/bin") + elseif(CMAKE_HOST_APPLE) + vcpkg_host_path_list(PREPEND ENV{DYLD_LIBRARY_PATH} "${CURRENT_INSTALLED_DIR}/lib") + else() + vcpkg_host_path_list(PREPEND ENV{LD_LIBRARY_PATH} "${CURRENT_INSTALLED_DIR}/lib") + endif() + vcpkg_execute_required_process( + COMMAND "${CURRENT_PACKAGES_DIR}/bin/${PORT}/main" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME release-test + ) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/project/CMakeLists.txt new file mode 100644 index 0000000..3c51fa2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.16) +project(duckdb-test C CXX) + +add_executable(main main.c) + +find_package(DuckDB CONFIG REQUIRED) +if(BUILD_SHARED_LIBS) + add_library(imported::duckdb ALIAS duckdb) +else() + add_library(imported::duckdb ALIAS duckdb_static) +endif() +target_link_libraries(main PRIVATE imported::duckdb) +install(TARGETS main RUNTIME DESTINATION bin/vcpkg-ci-duckdb) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/project/main.c new file mode 100644 index 0000000..6dfa22b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/project/main.c @@ -0,0 +1,33 @@ +#include <stdio.h> +#include <duckdb.h> + +int main() +{ + duckdb_database db; + if (duckdb_open(NULL, &db) == DuckDBError) { + printf("open failed\n"); + return 1; + } + duckdb_connection con; + if (duckdb_connect(db, &con) == DuckDBError) { + printf("connect failed\n"); + return 2; + } + const char* query_icu = + "LOAD icu;" + "SELECT current_localtime();" + "PRAGMA collations;" + "SELECT list(collname) FROM pragma_collations();" + ; + duckdb_result result; + if (duckdb_query(con, query_icu, &result) == DuckDBError) { + printf("icu query failed: %s\n", duckdb_result_error(&result)); + return 3; + } + else { + printf("success\n"); + } + duckdb_disconnect(&con); + duckdb_close(&db); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/vcpkg.json new file mode 100644 index 0000000..6c113d7 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-duckdb/vcpkg.json @@ -0,0 +1,18 @@ +{ + "name": "vcpkg-ci-duckdb", + "version-string": "ci", + "description": "Test the icu feature", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "duckdb", + "features": [ + "icu" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/portfile.cmake new file mode 100644 index 0000000..d40bca1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/portfile.cmake @@ -0,0 +1,19 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO Exiv2/exiv2 + REF v0.28.7 + SHA512 b53f4989abcd5d346f2a9c726a06707c47e1990ecb2e5e193c963e01d452fefe4dddd14e25eb08ef35e2f8288b8ec4bdee60725aa7dcd6b1c0348ed56c803fc0 + HEAD_REF master +) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DSOURCE_PATH=${SOURCE_PATH}" + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/project/CMakeLists.txt new file mode 100644 index 0000000..f02d2f2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/project/CMakeLists.txt @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.10) +project(exiv2-test CXX) + +set(CMAKE_CXX_STANDARD 11) + +block() + find_package(exiv2 CONFIG REQUIRED) + + add_executable(main "${SOURCE_PATH}/samples/exifdata.cpp") + target_link_libraries(main PRIVATE Exiv2::exiv2lib) +endblock() + +block() + find_package(PkgConfig REQUIRED) + pkg_check_modules(exiv2 exiv2 REQUIRED IMPORTED_TARGET) + + add_executable(main-pkgconfig "${SOURCE_PATH}/samples/exifdata.cpp") + target_link_libraries(main-pkgconfig PRIVATE PkgConfig::exiv2) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/vcpkg.json new file mode 100644 index 0000000..7d1e244 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-exiv2/vcpkg.json @@ -0,0 +1,36 @@ +{ + "name": "vcpkg-ci-exiv2", + "version-string": "ci", + "description": "Port to validate exiv2 within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "exiv2", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "exiv2", + "features": [ + "bmff", + "nls", + "png", + "xmp" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/project/CMakeLists.txt new file mode 100644 index 0000000..0759a0b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/project/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.30) +project(ffmpeg-test C) + +find_package(FFMPEG REQUIRED) + +add_executable(main main.c) +target_include_directories(main PRIVATE ${FFMPEG_INCLUDE_DIRS}) +target_link_directories(main PRIVATE ${FFMPEG_LIBRARY_DIRS}) +target_link_libraries(main PRIVATE ${FFMPEG_LIBRARIES}) + +# FAQ: using the static lib in a shared lib +# https://ffmpeg.org/platform.html#Advanced-linking-configuration +if(UNIX AND NOT BUILD_SHARED_LIBS) + add_library(shared SHARED main.c) + target_include_directories(shared PRIVATE ${FFMPEG_INCLUDE_DIRS}) + target_link_directories(shared PRIVATE ${FFMPEG_LIBRARY_DIRS}) + target_link_libraries(shared PRIVATE ${FFMPEG_LIBRARIES}) + if(NOT APPLE) + target_link_options(shared PRIVATE -Wl,-Bsymbolic) + endif() +endif() + + +find_package(PkgConfig REQUIRED) +pkg_check_modules(ffmpeg_pc + libavcodec libavfilter libavutil libswscale libavdevice libavformat libswresample + REQUIRED + IMPORTED_TARGET +) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::ffmpeg_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/project/main.c new file mode 100644 index 0000000..ae557e4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/project/main.c @@ -0,0 +1,11 @@ +#include <stdio.h> +#include "libavcodec/avcodec.h" +#include "libavutil/avutil.h" + +int main() +{ + char codecVersions[256]; + avcodec_find_encoder(AV_CODEC_ID_H264); + printf("ffmpeg version: %s\n", av_version_info()); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/vcpkg.json new file mode 100644 index 0000000..27dc9ec --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ffmpeg/vcpkg.json @@ -0,0 +1,204 @@ +{ + "name": "vcpkg-ci-ffmpeg", + "version-string": "ci", + "description": "Port to force features of certain ports within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "dependencies": [ + { + "name": "ffmpeg", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "ci" + ], + "features": { + "ci": { + "description": "vcpkg CI feature configuration", + "dependencies": [ + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "avcodec", + "avdevice", + "avfilter", + "avformat", + "avresample", + "bzip2", + "freetype", + "gpl", + "iconv", + "lzma", + "mp3lame", + "nonfree", + "openh264", + "openjpeg", + "openmpt", + "openssl", + "opus", + "postproc", + "snappy", + "soxr", + "speex", + "swresample", + "swscale", + "theora", + "vorbis", + "vpx", + "webp", + "xml2", + "zlib" + ] + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "alsa" + ], + "platform": "linux" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "sdl2" + ], + "platform": "!osx" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "ass", + "dvdvideo", + "ffmpeg", + "fontconfig", + "fribidi", + "modplug", + "opencl", + "srt" + ], + "platform": "!uwp" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "fdk-aac" + ], + "platform": "!android" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "ilbc" + ], + "platform": "!(arm & uwp)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "ssh" + ], + "platform": "!(uwp | arm)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "x264" + ], + "platform": "!(arm & windows)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "drawtext" + ], + "platform": "!(uwp | android)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "dav1d" + ], + "platform": "!(uwp | arm | x86 | osx)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "aom" + ], + "platform": "!(windows & arm) & !uwp" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "x265" + ], + "platform": "!uwp & !(arm & windows)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "avisynthplus" + ], + "platform": "windows & !arm & !uwp & !static" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "tesseract" + ], + "platform": "!(windows & arm) & !static & !uwp" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "opengl" + ], + "platform": "!uwp & !(arm64 & windows) & !android" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "qsv" + ], + "platform": "!arm & (android | linux | windows) & !uwp" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "nvcodec" + ], + "platform": "!android & !osx & !uwp & !(arm64 & windows)" + }, + { + "name": "ffmpeg", + "default-features": false, + "features": [ + "vulkan" + ], + "platform": "(linux | windows) & !arm & !uwp" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/project/CMakeLists.txt new file mode 100644 index 0000000..d62d080 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/project/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.30) +project(fluidsynth-test LANGUAGES C CXX) + +find_package(FluidSynth CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE FluidSynth::libfluidsynth) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(fluidsynth_pc fluidsynth REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::fluidsynth_pc) +set_target_properties(main-pkconfig PROPERTIES LINKER_LANGUAGE CXX) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/project/main.c new file mode 100644 index 0000000..0a4f7a2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/project/main.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <fluidsynth.h> + +int main() +{ + fluid_settings_t* settings = new_fluid_settings(); + int ret = fluid_settings_setint(settings, "vcpkg.test", 123); + delete_fluid_settings(settings); + + printf("Result: %d\n", ret); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/vcpkg.json new file mode 100644 index 0000000..b9cca1b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-fluidsynth/vcpkg.json @@ -0,0 +1,47 @@ +{ + "name": "vcpkg-ci-fluidsynth", + "version-string": "ci", + "description": "Port to validate fluidsynth in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "fluidsynth", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "fluidsynth", + "features": [ + "pulseaudio" + ], + "platform": "linux" + }, + { + "name": "fluidsynth", + "features": [ + "sndfile" + ], + "platform": "!xbox" + }, + { + "name": "fluidsynth", + "features": [ + "libinstpatch" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-folly/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-folly/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-folly/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-folly/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-folly/vcpkg.json new file mode 100644 index 0000000..7308e8b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-folly/vcpkg.json @@ -0,0 +1,42 @@ +{ + "name": "vcpkg-ci-folly", + "version-string": "ci", + "description": "Port to force features of folly within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "folly", + "default-features": false + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "folly", + "features": [ + "bzip2", + { + "name": "libaio", + "platform": "linux" + }, + "libsodium", + { + "name": "liburing", + "platform": "linux" + }, + "lz4", + "lzma", + "snappy", + "zstd" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-freerdp/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-freerdp/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-freerdp/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-freerdp/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-freerdp/vcpkg.json new file mode 100644 index 0000000..ca62751 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-freerdp/vcpkg.json @@ -0,0 +1,31 @@ +{ + "name": "vcpkg-ci-freerdp", + "version-string": "ci", + "description": "Force non-default features of freerdp within vcpkg CI", + "homepage": "https://github.com/microsoft/vcpkg", + "dependencies": [ + { + "name": "freerdp", + "features": [ + "client", + "ffmpeg" + ] + }, + { + "name": "freerdp", + "features": [ + "x11" + ], + "platform": "linux" + }, + { + "name": "freerdp", + "features": [ + "server", + "urbdrc", + "winpr-tools" + ], + "platform": "!android & !ios & !uwp" + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gdal/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-gdal/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gdal/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gdal/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-gdal/vcpkg.json new file mode 100644 index 0000000..ee66c61 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gdal/vcpkg.json @@ -0,0 +1,64 @@ +{ + "name": "vcpkg-ci-gdal", + "version-date": "2023-12-28", + "description": "Port to force features of certain ports within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "gdal", + "features": [ + "archive", + "freexl" + ] + }, + { + "name": "gdal", + "features": [ + "postgresql" + ], + "platform": "linux" + }, + { + "name": "gdal", + "features": [ + "cfitsio", + "kea", + "poppler" + ], + "platform": "native" + }, + { + "name": "gdal", + "features": [ + "arrow", + "arrow-adbc", + "parquet" + ], + "platform": "(arm64 | x64) & !linux" + }, + { + "name": "gdal", + "features": [ + "mysql-libmariadb" + ], + "platform": "windows & x86" + }, + { + "name": "gdal", + "features": [ + "aws-ec2-windows" + ], + "platform": "windows & !mingw" + }, + { + "name": "tiff", + "features": [ + "lerc", + "libdeflate", + "webp", + "zstd" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ggml/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-ggml/portfile.cmake new file mode 100644 index 0000000..7a16fdb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ggml/portfile.cmake @@ -0,0 +1,14 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ggml-org/ggml + REF v0.9.1 + SHA512 c31aeaaba328cd217f34191f1ce87720bb34dc39dc036f2ba8c92710636706f5be2cfcf86dc8c38ec737b020908da0e136447de10e7d9e6db698c812e7d21ae3 + HEAD_REF master +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/examples/test-cmake" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ggml/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-ggml/vcpkg.json new file mode 100644 index 0000000..caddf96 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ggml/vcpkg.json @@ -0,0 +1,128 @@ +{ + "name": "vcpkg-ci-ggml", + "version-string": "ci", + "description": "Port to validate ggml", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "$comment": "Lacks default (CPU) backend on arm64 windows", + "name": "ggml", + "default-features": false, + "features": [ + { + "name": "vulkan", + "platform": "windows & arm64" + } + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "blas", + "platform": "!(windows & static)" + }, + { + "$comment": "Lacks pkg-config link libs for static builds", + "name": "cuda", + "platform": "windows & x64 & !uwp & !xbox & !static" + }, + { + "name": "metal", + "platform": "osx" + }, + { + "name": "opencl", + "platform": "!arm32" + }, + { + "name": "openmp", + "platform": "!osx" + }, + { + "name": "vulkan", + "platform": "!x86" + } + ], + "features": { + "blas": { + "description": "Enable BLAS support", + "dependencies": [ + { + "name": "ggml", + "default-features": false, + "features": [ + "blas" + ] + } + ] + }, + "cuda": { + "description": "Enable CUDA support", + "dependencies": [ + { + "name": "ggml", + "default-features": false, + "features": [ + "cuda" + ] + } + ] + }, + "metal": { + "description": "Enable Metal support", + "supports": "osx", + "dependencies": [ + { + "name": "ggml", + "default-features": false, + "features": [ + "metal" + ] + } + ] + }, + "opencl": { + "description": "Enable OpenCL support", + "dependencies": [ + { + "name": "ggml", + "default-features": false, + "features": [ + "opencl" + ] + } + ] + }, + "openmp": { + "description": "Enable OpenMP support", + "supports": "!osx", + "dependencies": [ + { + "name": "ggml", + "default-features": false, + "features": [ + "openmp" + ] + } + ] + }, + "vulkan": { + "description": "Enable Vulkan support", + "supports": "!x86", + "dependencies": [ + { + "name": "ggml", + "default-features": false, + "features": [ + "vulkan" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gmime/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/portfile.cmake new file mode 100644 index 0000000..9081513 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/portfile.cmake @@ -0,0 +1,11 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DFEATURES=${FEATURES}" + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gmime/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/project/CMakeLists.txt new file mode 100644 index 0000000..d64e5ac --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/project/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.10) + +project(vcpkg-ci-gmime C) + +set(CMAKE_C_STANDARD 11) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(gmime REQUIRED IMPORTED_TARGET gmime-3.0) + +add_executable(main main.c) +target_link_libraries(main PRIVATE PkgConfig::gmime) + +if("crypto" IN_LIST FEATURES) + target_compile_definitions(main PRIVATE ENABLE_CRYPTO) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gmime/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/project/main.c new file mode 100644 index 0000000..8431aa3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/project/main.c @@ -0,0 +1,26 @@ +#include <glib.h> +#include <gmime/gmime.h> + +void verify_callback(GMimeObject *parent, GMimeObject *part, gpointer user_data) +{ +#ifdef ENABLE_CRYPTO + if (GMIME_IS_MULTIPART_SIGNED(part)) + { + GMimeMultipartSigned *mps = (GMimeMultipartSigned *)part; + GError *err = NULL; + GMimeSignatureList *signatures = g_mime_multipart_signed_verify(mps, GMIME_VERIFY_NONE, &err); + g_object_unref(signatures); + } +#endif +} + +int main() +{ + g_mime_init(); + GMimeParser *parser = g_mime_parser_new(); + GMimeMessage *message = g_mime_parser_construct_message(parser, NULL); + g_mime_message_foreach(message, verify_callback, NULL); + g_object_unref(message); + g_object_unref(parser); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gmime/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/vcpkg.json new file mode 100644 index 0000000..cbef40d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gmime/vcpkg.json @@ -0,0 +1,31 @@ +{ + "name": "vcpkg-ci-gmime", + "version-string": "ci", + "description": "Validates gmime", + "dependencies": [ + "gmime", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "crypto", + "platform": "!windows | mingw" + } + ], + "features": { + "crypto": { + "description": "gmime[crypo]", + "dependencies": [ + { + "name": "gmime", + "features": [ + "crypto" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/portfile.cmake new file mode 100644 index 0000000..6d23f0a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/portfile.cmake @@ -0,0 +1,22 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Using release typelibs also for debug: +# vcpkg is unable to build the debug variant for MSVC +# as long as it doesn't install the python interpreter +# for the debug CRT. +set(ENV{GI_TYPELIB_PATH} "${CURRENT_INSTALLED_DIR}/lib/girepository-1.0") + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_check_features(OUT_FEATURE_OPTIONS options + FEATURES + run-test RUN_TEST +) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + ${options} + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build(ADD_BIN_TO_PATH) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/CMakeLists.txt new file mode 100644 index 0000000..24119e2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.30) +project(gobject-introspection-test C) + +option(RUN_TEST "Run the test program") + +set(CMAKE_SKIP_RPATH FALSE) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(gobject-introspection_pc gobject-introspection-1.0 REQUIRED IMPORTED_TARGET) + +add_executable(main-pkgconfig main.c) +target_link_libraries(main-pkgconfig PRIVATE + PkgConfig::gobject-introspection_pc +) + +add_custom_target(run-test + COMMAND main-pkgconfig + COMMENT "Running the test program" +) +if(RUN_TEST) + set_target_properties(run-test PROPERTIES EXCLUDE_FROM_ALL 0) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/main.c new file mode 100644 index 0000000..d6f41a6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/main.c @@ -0,0 +1,39 @@ +#include <girepository.h> +#include <stdio.h> + +int main() +{ + GError *error = NULL; + + GIRepository *repository = g_irepository_get_default(); + GSList* paths = g_irepository_get_search_path(); + for (; paths != NULL; paths = paths->next) + g_message("Search path entry: %s\n", (const char*)paths->data); + + GITypelib *typelib = g_irepository_require(repository, "GIRepository", NULL, 0, &error); + if (error) + { + g_error("ERROR: %s\n", error->message); + return 1; + } + + GIBaseInfo *base_info = g_irepository_find_by_name(repository, "GIRepository", "get_minor_version"); + if (!base_info) + { + g_error("ERROR: %s\n", "Could not find GIRepository get_minor_version"); + return 1; + } + + GIArgument retval; + if (!g_function_info_invoke((GIFunctionInfo *)base_info, NULL, 0, NULL, 0, &retval, &error)) + { + g_error("ERROR: %s\n", error->message); + return 1; + } + + g_message("GI Repository minor version: %d", retval.v_uint); + + g_base_info_unref(base_info); + + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/vcpkg.json new file mode 100644 index 0000000..7a1c761 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/vcpkg.json @@ -0,0 +1,54 @@ +{ + "name": "vcpkg-ci-gobject-introspection", + "version-string": "ci", + "description": "Port to force features of gobject-introspection within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + + "dependencies": [ + { + "name": "gobject-introspection", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "ports", + "platform": "!static & !(arm & windows)" + }, + { + "name": "run-test", + "platform": "!static & !(arm & windows)" + } + ], + "features": { + "ports": { + "description": "Test introspection in ports", + "supports": "!static", + "dependencies": [ + { + "name": "gobject-introspection", + "default-features": false, + "features": [ + "cairo" + ] + }, + { + "name": "harfbuzz", + "default-features": false, + "features": [ + "introspection" + ] + } + ] + }, + "run-test": { + "supports": "!static", + "description": "Run a test program." + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gperftools/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-gperftools/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gperftools/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gperftools/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-gperftools/vcpkg.json new file mode 100644 index 0000000..b987136 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gperftools/vcpkg.json @@ -0,0 +1,31 @@ +{ + "name": "vcpkg-ci-gperftools", + "version-string": "ci", + "description": "Validates gperftools", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + "gperftools", + { + "name": "gperftools", + "features": [ + "tools" + ], + "platform": "native" + }, + { + "name": "gperftools", + "features": [ + "libunwind" + ], + "platform": "linux, osx" + }, + { + "name": "gperftools", + "features": [ + "override" + ], + "platform": "windows & static & staticcrt & !mingw" + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/portfile.cmake new file mode 100644 index 0000000..8e99ad6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/portfile.cmake @@ -0,0 +1,14 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + OPTIONS_RELEASE + "-DGM_CONFIG=${CURRENT_INSTALLED_DIR}/tools/graphicsmagick/bin/GraphicsMagick-config" + OPTIONS_DEBUG + "-DGM_CONFIG=${CURRENT_INSTALLED_DIR}/tools/graphicsmagick/debug/bin/GraphicsMagick-config" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/project/CMakeLists.txt new file mode 100644 index 0000000..b3d3192 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/project/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.30) +project(graphicsmagick-test C) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(graphicsmagick_pc GraphicsMagick REQUIRED IMPORTED_TARGET) + +add_executable(main-pkgconfig main.c) +target_link_libraries(main-pkgconfig PRIVATE PkgConfig::graphicsmagick_pc) + +find_program(GM_CONFIG NAMES GraphicsMagick-config REQUIRED) +if(NOT CMAKE_HOST_WIN32) + execute_process(COMMAND "${GM_CONFIG}" --cppflags --cflags OUTPUT_VARIABLE gm-config-cflags OUTPUT_STRIP_TRAILING_WHITESPACE) + separate_arguments(gm-config-cflags UNIX_COMMAND "${gm-config-cflags}") + execute_process(COMMAND "${GM_CONFIG}" --ldflags --libs OUTPUT_VARIABLE gm-config-libs OUTPUT_STRIP_TRAILING_WHITESPACE) + separate_arguments(gm-config-libs UNIX_COMMAND "${gm-config-libs}") + string(REGEX REPLACE "(^-|;-)framework;" "\\1framework " gm-config-libs "${gm-config-libs}") + + add_executable(main-gm-config main.c) + target_compile_options(main-gm-config PRIVATE ${gm-config-cflags}) + target_link_libraries(main-gm-config PRIVATE ${gm-config-libs}) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/project/main.c new file mode 100644 index 0000000..1d66d32 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/project/main.c @@ -0,0 +1,8 @@ +#include <magick/api.h> + +int main() +{ + InitializeMagick(NULL); + DestroyMagick(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/vcpkg.json new file mode 100644 index 0000000..6934e8a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-graphicsmagick/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-graphicsmagick", + "version-string": "ci", + "description": "Port to force features of certain ports within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "graphicsmagick", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt new file mode 100644 index 0000000..a7dfd85 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.30) +project(gz-common-test) + +find_package(gz-common6 QUIET REQUIRED COMPONENTS av) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE gz-common6::gz-common6-av) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(gz-common_pc gz-common6-av REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.cpp) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::gz-common_pc) +if(MSVC) + target_compile_features(main-pkconfig PRIVATE cxx_std_17) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp new file mode 100644 index 0000000..916dda8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/project/main.cpp @@ -0,0 +1,9 @@ +#include <gz/common/Console.hh> +#include <gz/common/VideoEncoder.hh> + +int main() +{ + gz::common::VideoEncoder v{}; + gzwarn << "Hello vcpkg" << std::endl; + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json new file mode 100644 index 0000000..d08b106 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-gz-common/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-gz-common", + "version-string": "ci", + "description": "Port to force features of gz-common within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "gz-common", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/project/CMakeLists.txt new file mode 100644 index 0000000..4d03bc6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/project/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.30) +project(hello-imgui-test CXX) + +set(CMAKE_CXX_STANDARD 17) + +find_package(hello-imgui CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE + hello-imgui::hello_imgui +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/project/main.cpp new file mode 100644 index 0000000..12433aa --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/project/main.cpp @@ -0,0 +1,10 @@ +#include <hello_imgui/hello_imgui.h> + +int main() +{ + HelloImGui::Run([]() { + ImGui::Text("Hello vcpkg"); + ImGui::ShowDemoWindow(); + }); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/vcpkg.json new file mode 100644 index 0000000..a74ede4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-hello-imgui/vcpkg.json @@ -0,0 +1,77 @@ +{ + "name": "vcpkg-ci-hello-imgui", + "version-string": "ci", + "description": "Port to force features of hello-imgui within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "hello-imgui", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "hello-imgui", + "features": [ + "glfw-binding", + "opengl3-binding", + "test-engine" + ], + "platform": "linux" + }, + { + "$comment": "No platform backend available since removal of imgui[sdl2-binding]", + "name": "hello-imgui", + "features": [ + "opengl3-binding" + ], + "platform": "android" + }, + { + "name": "hello-imgui", + "features": [ + "glfw-binding", + "metal-binding" + ], + "platform": "ios | osx" + }, + { + "name": "hello-imgui", + "features": [ + "glfw-binding", + "opengl3-binding" + ], + "platform": "x64 & windows" + }, + { + "name": "hello-imgui", + "features": [ + "experimental-dx11-binding", + "glfw-binding" + ], + "platform": "x86 & windows" + }, + { + "name": "hello-imgui", + "features": [ + "experimental-vulkan-binding", + "glfw-binding", + "test-engine" + ], + "platform": "arm64 & windows" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-icu/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-icu/portfile.cmake new file mode 100644 index 0000000..cb50a44 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-icu/portfile.cmake @@ -0,0 +1,12 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" + "-DVCPKG_CHECK_CMAKE_BUILD_TYPE=${VCPKG_BUILD_TYPE}" + "-DVCPKG_CROSSCOMPILING=${VCPKG_CROSSCOMPILING}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/CMakeLists.txt new file mode 100644 index 0000000..fcd52b2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.16) +project(icu-test C CXX) + +include("${CMAKE_CURRENT_LIST_DIR}/test-functions.cmake") + +find_package(ICU MODULE COMPONENTS i18n REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE ICU::i18n) + + +find_package(PkgConfig REQUIRED) +pkg_check_modules(icu_pc icu-i18n REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::icu_pc) + +# Validate other components + +set(required_components data dt in io tu uc) +if(VCPKG_CROSSCOMPILING) + list(REMOVE_ITEM required_components tu) # comes with (host) tools +endif() +vcpkg_check_cmake_package_find(ICU MODULE REQUIRED COMPONENTS ${required_components}) +vcpkg_check_cmake_package_variables() +vcpkg_check_cmake_package_targets() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/main.c new file mode 100644 index 0000000..4054c74 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/main.c @@ -0,0 +1,9 @@ +#include "unicode/udat.h" + +int main() +{ + UErrorCode status = U_ZERO_ERROR; + UDateFormat* dateFormatter = udat_open(UDAT_NONE, UDAT_SHORT, NULL, NULL, -1, NULL, 0, &status); + udat_close(dateFormatter); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/test-functions.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/test-functions.cmake new file mode 100644 index 0000000..976e6a3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-icu/project/test-functions.cmake @@ -0,0 +1,163 @@ +set(VCPKG_CHECK_CMAKE_BUILD_TYPE "" CACHE STRING "Build type to be checked") + +set(Z_VCPKG_CHECK_CMAKE_PACKAGE_LAST_SEEN "" CACHE INTERNAL "Last loaded package name") + +# Call and trace find_package in distinct scope +function(z_vcpkg_check_cmake_package_trace_find) + set(CMAKE_FIND_DEBUG_MODE ON) + set(VCPKG_TRACE_FIND_PACKAGE ON) + find_package(${ARGN}) +endfunction() + +# Call and trace find_package, ensure that it called twice +macro(vcpkg_check_cmake_package_find package) + z_vcpkg_check_cmake_package_trace_find("${package}" ${ARGN}) + message(STATUS "Checking that find_package(${package} ...) can be called again") + find_package("${package}" ${ARGN} QUIET) + message(STATUS "Checking that find_package(${package} ...) can be called again - done") + set(Z_VCPKG_CHECK_CMAKE_PACKAGE_LAST_SEEN "${package}" CACHE INTERNAL "Last loaded package name") +endmacro() + +# Check that library variables match the debug/release build type. +# The variable names might be passed in explicitly or guessed from a prefix. +# If no args are given, the prefix is the name of the last package loaded +# by vcpkg_check_cmake_package_find(). +function(vcpkg_check_cmake_package_variables) + cmake_parse_arguments(PARSE_ARGV 0 arg "" "PREFIX" "") + if(arg_PREFIX AND arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "'PREFIX value' must not be used together with other values.") + endif() + if(NOT arg_PREFIX AND NOT arg_UNPARSED_ARGUMENTS) + if(Z_VCPKG_CHECK_CMAKE_PACKAGE_LAST_SEEN) + set(arg_PREFIX "${Z_VCPKG_CHECK_CMAKE_PACKAGE_LAST_SEEN}") + else() + message(FATAL_ERROR "Unable to determine the prefix to be checked.") + endif() + endif() + + set(libraries_vars "${arg_UNPARSED_ARGUMENTS}") + if(libraries_vars STREQUAL "") + string(REGEX REPLACE "_\$" "" prefix "${arg_PREFIX}") + if(DEFINED "${prefix}_LIBRARIES") + set(libraries_vars "${prefix}_LIBRARIES") + elseif(DEFINED "${package}_LIBRARY") + set(libraries_vars "${prefix}_LIBRARY") + endif() + if(DEFINED "${prefix}_LIBRARY_DIR") + list(APPEND "libraries_vars" "${${prefix}_LIBRARY_DIR}") + endif() + if(DEFINED "${prefix}_LIBRARY_DIRS") + list(APPEND "libraries_vars" "${${prefix}_LIBRARY_DIRS}") + endif() + endif() + if(libraries_vars STREQUAL "") + message(FATAL_ERROR "Unable to determine the variables to be checked.") + endif() + + set(link_keywords debug general optimized) + foreach(var IN LISTS libraries_vars) + set(libraries "${${var}}") + message(STATUS "${var}: ${libraries}") + set(last_keyword "") + foreach(item IN LISTS libraries) + if(item IN_LIST link_keywords) + set(last_keyword "${item}") + continue() + endif() + string(FIND "${item}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib/" starts_with_release) + string(FIND "${item}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib/" starts_with_debug) + if(starts_with_release EQUAL "0") + if(last_keyword STREQUAL "optimized") + # okay + elseif(last_keyword STREQUAL "debug") + message(SEND_ERROR "Release lib for 'debug' keyword: ${item}") + elseif(CMAKE_BUILD_TYPE STREQUAL "Debug") + message(SEND_ERROR "Release lib for 'Debug' build: ${item}") + endif() + elseif(starts_with_debug EQUAL "0") + if(last_keyword STREQUAL "debug") + # okay + elseif(last_keyword STREQUAL "optimized") + message(SEND_ERROR "Debug lib for 'optimized' keyword: ${item}") + elseif(CMAKE_BUILD_TYPE STREQUAL "Release") + message(SEND_ERROR "Debug lib for 'Release' build: ${item}") + endif() + endif() + set(last_keyword "") + continue() + endforeach() + endforeach() +endfunction() + +# Check that imported target properties match the debug/release build type. +# The target names might be passed in explicitly or guessed from a namespace. +# If no args are given, the namespace is the name of the last package loaded +# by vcpkg_check_cmake_package_find(). +function(vcpkg_check_cmake_package_targets) + cmake_parse_arguments(PARSE_ARGV 0 arg "" "NAMESPACE" "") + if(arg_NAMESPACE AND arg_UNPARSED_ARGUMENTS) + message(FATAL_ERROR "'NAMESPACE value' must not be used together with other values.") + endif() + if(NOT arg_NAMESPACE AND NOT arg_UNPARSED_ARGUMENTS) + if(Z_VCPKG_CHECK_CMAKE_PACKAGE_LAST_SEEN) + set(arg_NAMESPACE "${Z_VCPKG_CHECK_CMAKE_PACKAGE_LAST_SEEN}") + else() + message(FATAL_ERROR "Unable to determine the namespace to be checked.") + endif() + endif() + + set(targets "${arg_UNPARSED_ARGUMENTS}") + if(targets STREQUAL "") + string(REGEX REPLACE "::::\$" "::" namespace "${arg_NAMESPACE}::") + get_directory_property(targets IMPORTED_TARGETS) + list(FILTER targets INCLUDE REGEX "^${namespace}") + endif() + if(targets STREQUAL "") + message(FATAL_ERROR "Unable to determine the targets to be checked.") + endif() + + foreach(target IN LISTS targets) + if(NOT TARGET "${target}") + message(FATAL_ERROR "No such target: ${target}") + endif() + get_target_property(type "${target}" TYPE) + message(STATUS "${target}: ${type}") + if(type MATCHES "LIBRARY" AND NOT type MATCHES "INTERFACE") + get_target_property(configurations "${target}" IMPORTED_CONFIGURATIONS) + message(STATUS " IMPORTED_CONFIGURATIONS: ${configurations}") + if(configurations) + string(TOLOWER "${configurations}" configurations) + if("release" IN_LIST configurations) + set(property IMPORTED_IMPLIB_RELEASE) + get_target_property(location "${target}" "${property}") + if(NOT location) + set(property IMPORTED_LOCATION_RELEASE) + get_target_property(location "${target}" "${property}") + endif() + message(STATUS " ${property}: ${location}") + string(FIND "${location}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib" index) + if (NOT index EQUAL "0") + message(SEND_ERROR "Release lib is in wrong location.") + endif() + elseif(NOT VCPKG_CHECK_CMAKE_BUILD_TYPE OR VCPKG_CHECK_CMAKE_BUILD_TYPE STREQUAL "release") + message(SEND_ERROR "Release configuration is missing.") + endif() + if("debug" IN_LIST configurations) + set(property IMPORTED_IMPLIB_DEBUG) + get_target_property(location "${target}" "${property}") + if(NOT location) + set(property IMPORTED_LOCATION_DEBUG) + get_target_property(location "${target}" "${property}") + endif() + message(STATUS " ${property}: ${location}") + string(FIND "${location}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib" index) + if (NOT index EQUAL "0") + message(SEND_ERROR "Debug lib is in wrong location.") + endif() + elseif(NOT VCPKG_CHECK_CMAKE_BUILD_TYPE OR VCPKG_CHECK_CMAKE_BUILD_TYPE STREQUAL "debug") + message(SEND_ERROR "Debug configuration is missing.") + endif() + endif() + endif() + endforeach() +endfunction() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-icu/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-icu/vcpkg.json new file mode 100644 index 0000000..7aef590 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-icu/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-icu", + "version-string": "ci", + "description": "Port to valdiate icu", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "icu", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-imgui/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-imgui/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-imgui/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-imgui/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-imgui/vcpkg.json new file mode 100644 index 0000000..316531b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-imgui/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "vcpkg-ci-imgui", + "version-date": "2024-05-17", + "description": "Force test-engine feature of imgui within vcpkg CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "imgui", + "features": [ + "test-engine" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-itk/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-itk/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-itk/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-itk/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-itk/project/CMakeLists.txt new file mode 100644 index 0000000..da9a7a4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-itk/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.7) +project(itk-test) + +find_package(ITK CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE + $<TARGET_NAME:ITKFFT> +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-itk/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-itk/project/main.cpp new file mode 100644 index 0000000..ff248ec --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-itk/project/main.cpp @@ -0,0 +1,9 @@ +#include <itkImage.h> +#include <itkVnlForwardFFTImageFilter.h> + +int main() +{ + using FilterType = itk::VnlForwardFFTImageFilter<itk::Image<float, 2>>; + auto fftFilter = FilterType::New(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-itk/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-itk/vcpkg.json new file mode 100644 index 0000000..fd84799 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-itk/vcpkg.json @@ -0,0 +1,58 @@ +{ + "name": "vcpkg-ci-itk", + "version-string": "ci", + "description": "Validates itk; intentional permutation of features", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "itk", + "features": [ + "opencv" + ], + "platform": "arm64" + }, + { + "name": "itk", + "features": [ + "rtk", + "tools" + ], + "platform": "arm64 | x64" + }, + { + "name": "itk", + "features": [ + "fftw", + "opencl" + ], + "platform": "android | osx" + }, + { + "name": "itk", + "features": [ + "vtk" + ], + "platform": "osx | windows" + }, + { + "name": "itk", + "features": [ + "cuda" + ], + "platform": "x64 & windows & !staticcrt" + }, + { + "name": "itk", + "features": [ + "cufftw", + "opencl" + ], + "platform": "x64 & (linux | windows) & static" + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-juce/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-juce/portfile.cmake new file mode 100644 index 0000000..c735c7a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-juce/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DWITH_CURL=${VCPKG_TARGET_IS_LINUX}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-juce/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-juce/project/CMakeLists.txt new file mode 100644 index 0000000..259a88b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-juce/project/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.29) +project(juce-test VERSION 1 LANGUAGES C CXX) + +set(CMAKE_CXX_STANDARD 11) + +option(WITH_CURL "Link curl") + +find_package(JUCE CONFIG REQUIRED) + +juce_add_console_app(core + PRODUCT_NAME "vcpkg-ci-juce" + NEEDS_CURL "${WITH_CURL}" +) +target_sources(core PRIVATE main.cpp) +target_link_libraries(core PRIVATE juce::juce_core) + +juce_add_console_app(everything + PRODUCT_NAME "vcpkg-ci-juce" + NEEDS_CURL "${WITH_CURL}" +) +target_sources(everything PRIVATE main.cpp) +file(GLOB all_modules RELATIVE "${JUCE_MODULES_DIR}" "${JUCE_MODULES_DIR}/*") +list(TRANSFORM all_modules PREPEND juce::) +target_link_libraries(everything PRIVATE ${all_modules}) +target_compile_definitions(everything PRIVATE JUCE_WEB_BROWSER=0) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-juce/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-juce/project/main.cpp new file mode 100644 index 0000000..d7f625d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-juce/project/main.cpp @@ -0,0 +1,7 @@ +#include <juce_core/juce_core.h> + +int main() +{ + juce::Logger::writeToLog("vcpkg"); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-juce/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-juce/vcpkg.json new file mode 100644 index 0000000..8033bb2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-juce/vcpkg.json @@ -0,0 +1,28 @@ +{ + "name": "vcpkg-ci-juce", + "version-string": "ci", + "description": "Validates juce", + "dependencies": [ + "juce", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "extras" + ], + "features": { + "extras": { + "description": "Install juce[extras]", + "dependencies": [ + { + "name": "juce", + "features": [ + "extras" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libaec/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libaec/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/project/CMakeLists.txt new file mode 100644 index 0000000..a69ef63 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.30) +project(libaec-test C) + +find_package(libaec CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE libaec::aec) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libaec/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/project/main.c new file mode 100644 index 0000000..22df70a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/project/main.c @@ -0,0 +1,28 @@ +#include <stdint.h> +#include <libaec.h> + +int main() +{ + int32_t source[] = { 1, 1, 1, 4}; + int source_length = 4; + + unsigned char dest[64]; + int dest_lenth = 64; + + struct aec_stream strm; + strm.bits_per_sample = 32; + strm.block_size = 16; + strm.rsi = 128; + strm.flags = AEC_DATA_SIGNED | AEC_DATA_PREPROCESS; + strm.next_in = (unsigned char *)source; + strm.avail_in = source_length * sizeof(int32_t); + strm.next_out = (unsigned char *)dest; + strm.avail_out = dest_lenth; + if (aec_encode_init(&strm) != AEC_OK) + return 1; + if (aec_encode(&strm, AEC_FLUSH) != AEC_OK) + return 1; + aec_encode_end(&strm); + + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libaec/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/vcpkg.json new file mode 100644 index 0000000..d5ccd61 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libaec/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-libaec", + "version-string": "ci", + "description": "Port to force features of libaec within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libaec", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libavif/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libavif/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/project/CMakeLists.txt new file mode 100644 index 0000000..37e5786 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/project/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.30) +project(libavif-test C) + +find_package(libavif CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE + $<TARGET_NAME:avif> +) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libavif_pc libavif REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::libavif_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libavif/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/project/main.c new file mode 100644 index 0000000..f305e9f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/project/main.c @@ -0,0 +1,10 @@ +#include <stdio.h> +#include <avif/avif.h> + +int main() +{ + char codecVersions[256]; + avifCodecVersions(codecVersions); + printf("Codec Versions: %s\n", codecVersions); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libavif/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/vcpkg.json new file mode 100644 index 0000000..7734f77 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libavif/vcpkg.json @@ -0,0 +1,34 @@ +{ + "name": "vcpkg-ci-libavif", + "version-string": "ci", + "description": "Port to force features of libavif within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libavif", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "libavif", + "features": [ + "aom", + "dav1d" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/cmake-project.diff b/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/cmake-project.diff new file mode 100644 index 0000000..2d2302f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/cmake-project.diff @@ -0,0 +1,29 @@ +diff --git a/examples/streamer/CMakeLists.txt b/examples/streamer/CMakeLists.txt +index 1bdeb7c..9cf65dd 100644 +--- a/examples/streamer/CMakeLists.txt ++++ b/examples/streamer/CMakeLists.txt +@@ -2,6 +2,15 @@ cmake_minimum_required(VERSION 3.7) + if(POLICY CMP0079) + cmake_policy(SET CMP0079 NEW) + endif() ++project(vcpkg-ci) ++add_definitions(-DWIN32_LEAN_AND_MEAN) ++set(THREADS_PREFER_PTHREAD_FLAG ON) ++find_package(Threads REQUIRED) ++find_package(nlohmann_json CONFIG REQUIRED) ++find_package(LibDataChannel CONFIG REQUIRED) ++if(NOT TARGET LibDataChannel::LibDataChannel) ++ add_library(LibDataChannel::LibDataChannel ALIAS LibDataChannel::LibDataChannelStatic) ++endif() + + set(STREAMER_SOURCES + main.cpp +@@ -47,7 +56,7 @@ set_target_properties(streamer PROPERTIES + find_package(Threads REQUIRED) + target_link_libraries(streamer LibDataChannel::LibDataChannel Threads::Threads nlohmann_json::nlohmann_json) + +-if(MSVC) ++if(0) + add_custom_command(TARGET streamer POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different + "$<TARGET_FILE_DIR:datachannel>/datachannel.dll" diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/portfile.cmake new file mode 100644 index 0000000..1e6cc15 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/portfile.cmake @@ -0,0 +1,14 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO paullouisageneau/libdatachannel + REF v0.23.2 + SHA512 49e19e40874167ef505829841a8b944f8489cb7a15ff6e5a8d74c886c5ff28a32c2724871be2244c805dd6b0919878e06d31c43b27c8d242222adae8509e0d59 + HEAD_REF master + PATCHES + cmake-project.diff +) + +vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}/examples/streamer") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/vcpkg.json new file mode 100644 index 0000000..8d6056f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libdatachannel/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "vcpkg-ci-libdatachannel", + "version-string": "ci", + "description": "Validates libdatachannel", + "dependencies": [ + { + "name": "libdatachannel", + "features": [ + "srtp", + "ws" + ] + }, + "nlohmann-json", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/CMakeLists.txt new file mode 100644 index 0000000..b067144 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.29) +project(libftdi1-test CXX) + +set(CMAKE_CXX_STANDARD 11) + +add_executable(main main.cpp) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libftdipp1 IMPORTED_TARGET REQUIRED libftdipp1) +target_link_libraries(main PRIVATE PkgConfig::libftdipp1) + +# subdir to scope side effects +add_subdirectory(cmake-usage) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/cmake-usage/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/cmake-usage/CMakeLists.txt new file mode 100644 index 0000000..2f1cca3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/cmake-usage/CMakeLists.txt @@ -0,0 +1,6 @@ +# not modern +find_package(LIBFTDI1 NAMES LibFTDI1 REQUIRED) +include("${LIBFTDI_USE_FILE}") + +add_executable(cmake-usage ../main.cpp) +target_link_libraries(cmake-usage PRIVATE ${LIBFTDIPP_LIBRARIES}) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/main.cpp new file mode 100644 index 0000000..48c64a5 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/project/main.cpp @@ -0,0 +1,7 @@ +#include "ftdi.hpp" + +int main() +{ + auto *context = new Ftdi::Context(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/vcpkg.json new file mode 100644 index 0000000..dcb905e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libftdi1/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-libftdi1", + "version-string": "ci", + "description": "Validates libftdi1", + "dependencies": [ + { + "name": "libftdi1", + "features": [ + "cpp" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libgit2/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libgit2/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libgit2/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libgit2/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libgit2/vcpkg.json new file mode 100644 index 0000000..f4c01aa --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libgit2/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "vcpkg-ci-libgit2", + "version-string": "ci", + "description": "Validates libgit2 with ssh and tools.", + "dependencies": [ + { + "name": "libgit2", + "default-features": false, + "features": [ + "ssh", + "tools" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/project/CMakeLists.txt new file mode 100644 index 0000000..7e04f35 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/project/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.10) +project(libgwenhywfar-test C) + +find_package(PkgConfig REQUIRED) + +block() + pkg_check_modules(gwenhywfar IMPORTED_TARGET REQUIRED gwenhywfar) + + add_executable(libgwenhywfar_pkgconfig main.c) + target_link_libraries(libgwenhywfar_pkgconfig PkgConfig::gwenhywfar) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/project/main.c new file mode 100644 index 0000000..6a24a6a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/project/main.c @@ -0,0 +1,8 @@ +#include <gwenhywfar/gwenhywfar.h> /* based on gwenhywfar.pc */ + +int main() +{ + int result = GWEN_Init(); + GWEN_Fini(); + return result; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/vcpkg.json new file mode 100644 index 0000000..3f9f827 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libgwenhywfar/vcpkg.json @@ -0,0 +1,49 @@ +{ + "name": "vcpkg-ci-libgwenhywfar", + "version-string": "ci", + "description": "Validates libgwenhywfar", + "dependencies": [ + { + "name": "libgwenhywfar", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "openssl", + "platform": "!arm64" + }, + { + "name": "qt5", + "platform": "!(osx & static)" + } + ], + "features": { + "openssl": { + "description": "Use openssl", + "dependencies": [ + { + "name": "libgwenhywfar", + "features": [ + "openssl" + ] + } + ] + }, + "qt5": { + "description": "Install qt5 binding", + "dependencies": [ + { + "name": "libgwenhywfar", + "features": [ + "qt5" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libhat/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/portfile.cmake new file mode 100644 index 0000000..8a2079b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/portfile.cmake @@ -0,0 +1,5 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libhat/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/project/CMakeLists.txt new file mode 100644 index 0000000..3b8ccd1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(libhat-test LANGUAGES CXX)
+set(CMAKE_CXX_STANDARD 20)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+find_package(libhat CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE libhat::libhat)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libhat/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/project/main.cpp new file mode 100644 index 0000000..3ac6612 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/project/main.cpp @@ -0,0 +1,6 @@ +#include <libhat/signature.hpp>
+int main()
+{
+ auto sig = hat::parse_signature("01 02 03 04 05 06 07 08 09").value();
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libhat/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/vcpkg.json new file mode 100644 index 0000000..75328bb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libhat/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libhat", + "version-string": "ci", + "description": "Validates libhat", + "dependencies": [ + "libhat", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libheif/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libheif/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/project/CMakeLists.txt new file mode 100644 index 0000000..c2920c0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.30) +project(libheif-test C CXX) + +find_package(libheif CONFIG REQUIRED) + +add_executable(main main.c) +add_library(imported::heif ALIAS heif) +target_link_libraries(main PRIVATE imported::heif) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libheif_pc libheif REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::libheif_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libheif/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/project/main.c new file mode 100644 index 0000000..122d9e3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/project/main.c @@ -0,0 +1,8 @@ +#include <libheif/heif.h> + +int main() +{ + heif_context* ctx = heif_context_alloc(); + heif_context_free(ctx); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libheif/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/vcpkg.json new file mode 100644 index 0000000..4bac465 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libheif/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "vcpkg-ci-libheif", + "version-string": "ci", + "description": "Port to test libheif in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libheif", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "ci" + ], + "features": { + "ci": { + "description": "Feature depenencies. openjpeg is a plugin.", + "dependencies": [ + { + "name": "libheif", + "features": [ + "openjpeg" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libigl/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/portfile.cmake new file mode 100644 index 0000000..cf5bbb5 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/portfile.cmake @@ -0,0 +1,17 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO libigl/libigl + REF v2.6.0 + SHA512 7c6ae5b94020a01df5d6d0a358592293595d8d8bf04bf42e6acc09bcd6ed012071069373a71ed6f24ce878aa79447dd189b42bc8a3a70819ef05dccc60a2cf68 + HEAD_REF master +) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DSOURCE_PATH=${SOURCE_PATH}" + "-DFEATURES=${FEATURES}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libigl/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/project/CMakeLists.txt new file mode 100644 index 0000000..e3b1851 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/project/CMakeLists.txt @@ -0,0 +1,47 @@ +cmake_minimum_required(VERSION 3.16) +project(libigl-test C CXX) + +set(CMAKE_CXX_STANDARD 11) + +add_definitions("-DTUTORIAL_SHARED_PATH=\"${SOURCE_PATH}/placeholder\"") + +find_package(libigl CONFIG REQUIRED) + +# Other than in the upstream build ("${SOURCE_PATH}/tutorial/CMakeLists.txt"), +# the imported targets use a different prefix, e.g. +# igl::glfw -> igl::igl_glfw +# igl_copyleft::cgal -> igl_copyleft::igl_copyleft_cgal + +add_executable(101_FileIO "${SOURCE_PATH}/tutorial/101_FileIO/main.cpp") +target_link_libraries(101_FileIO PRIVATE igl::igl_core) + +if("cgal" IN_LIST FEATURES) + add_executable(609_Boolean "${SOURCE_PATH}/tutorial/609_Boolean/main.cpp") + target_link_libraries(609_Boolean PRIVATE igl::igl_glfw igl_copyleft::igl_copyleft_cgal) +endif() + +if("embree" IN_LIST FEATURES) + add_executable(706_FacetOrientation "${SOURCE_PATH}/tutorial/706_FacetOrientation/main.cpp") + target_link_libraries(706_FacetOrientation PRIVATE igl::igl_glfw igl::igl_embree) +endif() + +if("glfw" IN_LIST FEATURES) + add_executable(102_DrawMesh "${SOURCE_PATH}/tutorial/102_DrawMesh/main.cpp") + target_link_libraries(102_DrawMesh PRIVATE igl::igl_glfw) + + add_executable(111_MatCap "${SOURCE_PATH}/tutorial/111_MatCap/main.cpp" "${CMAKE_CURRENT_LIST_DIR}/stb_image_implementation.c") + target_link_libraries(111_MatCap PRIVATE igl::igl_glfw igl::igl_stb) +endif() + +if("imgui" IN_LIST FEATURES) + add_executable(109_ImGuizmo "${SOURCE_PATH}/tutorial/109_ImGuizmo/main.cpp") + target_link_libraries(109_ImGuizmo PRIVATE igl::igl_imgui) + + add_executable(113_Shadows "${SOURCE_PATH}/tutorial/113_Shadows/main.cpp" "${CMAKE_CURRENT_LIST_DIR}/stb_image_implementation.c") + target_link_libraries(113_Shadows PRIVATE igl::igl_imgui igl::igl_stb) +endif() + +if("xml" IN_LIST FEATURES) + add_executable(601_Serialization "${SOURCE_PATH}/tutorial/601_Serialization/main.cpp") + target_link_libraries(601_Serialization PRIVATE igl::igl_xml) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libigl/project/stb_image_implementation.c b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/project/stb_image_implementation.c new file mode 100644 index 0000000..9177288 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/project/stb_image_implementation.c @@ -0,0 +1,2 @@ +#define STB_IMAGE_IMPLEMENTATION +#include <stb_image.h> diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libigl/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/vcpkg.json new file mode 100644 index 0000000..d288886 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libigl/vcpkg.json @@ -0,0 +1,100 @@ +{ + "name": "vcpkg-ci-libigl", + "version-string": "ci", + "description": "Port to force features of libigl within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libigl", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "cgal", + "platform": "!android & !(x86 & windows)" + }, + { + "name": "embree", + "platform": "linux | osx | (windows & !uwp & !arm)" + }, + { + "name": "glfw", + "platform": "!android" + }, + { + "name": "imgui", + "platform": "!android" + }, + "xml" + ], + "features": { + "cgal": { + "description": "libigl[cgal]", + "dependencies": [ + { + "name": "libigl", + "default-features": false, + "features": [ + "cgal", + "glfw" + ] + } + ] + }, + "embree": { + "description": "libigl[embree]", + "dependencies": [ + { + "name": "libigl", + "default-features": false, + "features": [ + "embree", + "glfw" + ] + } + ] + }, + "glfw": { + "description": "libigl[glfw] and stb", + "dependencies": [ + { + "name": "libigl", + "default-features": false, + "features": [ + "glfw" + ] + } + ] + }, + "imgui": { + "description": "libigl[imgui] and stb", + "dependencies": [ + { + "name": "libigl", + "default-features": false, + "features": [ + "imgui" + ] + } + ] + }, + "xml": { + "description": "libigl[xml]", + "dependencies": [ + { + "name": "libigl", + "default-features": false, + "features": [ + "xml" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt new file mode 100644 index 0000000..924854f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/project/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.25.1) +project(libmem-test CXX) +set(CMAKE_CXX_STANDARD 17)
+find_package(libmem CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE libmem::libmem)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp new file mode 100644 index 0000000..3590741 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/project/main.cpp @@ -0,0 +1,7 @@ +#include <libmem/libmem.h>
+int main()
+{
+ lm_module_t moduled;
+ LM_FindModule("user32.dll", &moduled);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmem/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/vcpkg.json new file mode 100644 index 0000000..d31a99d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmem/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libmem", + "version-string": "ci", + "description": "Validates libmem", + "dependencies": [ + "libmem", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/project/CMakeLists.txt new file mode 100644 index 0000000..b4a85a0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.30) +project(libmodbus-test C) + +find_package(libmodbus CONFIG REQUIRED) +add_library(imported::modbus ALIAS modbus) + +add_executable(main main.c) +target_link_libraries(main PRIVATE imported::modbus) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libmodbus_pc libmodbus REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::libmodbus_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/project/main.c new file mode 100644 index 0000000..aaffb06 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/project/main.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <modbus.h> + +int main() +{ + modbus_t *ctx = modbus_new_rtu("/dev/ttyUSB0", 115200, 'N', 8, 1); + if (ctx == NULL) { + fprintf(stderr, "Unable to create the libmodbus context\n"); + return -1; + } + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/vcpkg.json new file mode 100644 index 0000000..293ffea --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmodbus/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-libmodbus", + "version-string": "ci", + "description": "Port to validate libmodbus in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libmodbus", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/portfile.cmake new file mode 100644 index 0000000..e081d5a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/portfile.cmake @@ -0,0 +1,16 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO ArtifexSoftware/mupdf + REF 1.26.10 + SHA512 c0f802fd2b181587df1748a8db7163bbcd3951b943d1321afcff56fccb515dfe99061288bc691323d0854305a1d4205c99457954b10439adb122975429cbce72 + HEAD_REF master +) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DSOURCE_PATH=${SOURCE_PATH}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/project/CMakeLists.txt new file mode 100644 index 0000000..3173088 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.10) +project(libmupdf-test C CXX) + +find_package(unofficial-libmupdf REQUIRED) + +add_executable(example "${SOURCE_PATH}/docs/examples/example.c") +target_link_libraries(example PRIVATE unofficial::libmupdf::libmupdf) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/vcpkg.json new file mode 100644 index 0000000..95715de --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libmupdf/vcpkg.json @@ -0,0 +1,13 @@ +{ + "name": "vcpkg-ci-libmupdf", + "version-string": "ci", + "description": "Port to validate libmupdf within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "dependencies": [ + "libmupdf", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/project/CMakeLists.txt new file mode 100644 index 0000000..ac01649 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/project/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.30) +project(libpqxx-test CXX) + +set(CMAKE_CXX_STANDARD 17) + +find_package(libpqxx CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE libpqxx::pqxx) + +if(NOT (WIN32 AND NOT MINGW)) + find_package(PkgConfig REQUIRED) + pkg_check_modules(libpqxx IMPORTED_TARGET REQUIRED libpqxx) + + add_executable(main-pkgconfig main.cpp) + target_link_libraries(main-pkgconfig PRIVATE PkgConfig::libpqxx) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/project/main.cpp new file mode 100644 index 0000000..ba1f273 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/project/main.cpp @@ -0,0 +1,8 @@ +#include <pqxx/pqxx> + +int main() +{ + pqxx::connection cx{"postgresql://vcpkg@localhost/tests"}; + pqxx::work tx{cx}; + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/vcpkg.json new file mode 100644 index 0000000..15437cc --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libpqxx/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libpqxx", + "version-string": "ci", + "description": "Validates libpqxx", + "dependencies": [ + "libpqxx", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/project/CMakeLists.txt new file mode 100644 index 0000000..fa6d240 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/project/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.30) +project(libremidi-test CXX) + +find_package(libremidi CONFIG REQUIRED) +add_library(imported::libremidi ALIAS libremidi) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE imported::libremidi) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/project/main.cpp new file mode 100644 index 0000000..4820cab --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/project/main.cpp @@ -0,0 +1,12 @@ +#include <libremidi/libremidi.hpp> +#include <libremidi/backends.hpp> +#include <iostream> + +int main() +{ + std::cout << "Default midi2 API: " << libremidi::get_api_display_name(libremidi::midi2::default_api()) << std::endl; + libremidi::midi_any::for_all_backends([](auto& backend) { + std::cout << "- " << backend.display_name << std::endl; + }); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/vcpkg.json new file mode 100644 index 0000000..add089f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libremidi/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libremidi", + "version-string": "ci", + "description": "Validates libremidi", + "dependencies": [ + "libremidi", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/CMakeLists.txt new file mode 100644 index 0000000..33f6bad --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/CMakeLists.txt @@ -0,0 +1,63 @@ +cmake_minimum_required(VERSION 3.7) +project(libressl-test C) + +find_package(PkgConfig REQUIRED) + +# libressl provides cmake config +find_package(LibreSSL CONFIG REQUIRED) +message(STATUS "LibreSSL CONFIG: ${LibreSSL_DIR}") +string(FIND "${LibreSSL_DIR}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" index) +if(NOT index STREQUAL "0") + message(SEND_ERROR "LibreSSL CONFIG is not from vcpkg.") +endif() + +pkg_check_modules(libtls IMPORTED_TARGET REQUIRED libtls) +if(NOT libtls_VERSION STREQUAL LibreSSL_VERSION) + message(SEND_ERROR "Unexpected libtls_VERSION '${libtls_VERSION}' (expected: '${LibreSSL_VERSION}')") +endif() + +# libressl promises openssl compatibility +# NB: The port doesn't provide a wrapper, so there is no support +# for multi-config and for transitive usage requirements. +find_package(OpenSSL MODULE REQUIRED) +foreach(target IN ITEMS OpenSSL::SSL OpenSSL::Crypto) + set(location_found FALSE) + foreach(property IN ITEMS IMPORTED_LOCATION IMPORTED_LOCATION_DEBUG IMPORTED_LOCATION_RELEASE) + get_target_property(location ${target} ${property}) + if(NOT location) + continue() + endif() + set(location_found TRUE) + message(STATUS "${target} ${property}: ${location}") + string(FIND "${location}" "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}" index) + if(NOT index STREQUAL "0") + message(SEND_ERROR "${target} ${property} is not from vcpkg.") + endif() + endforeach() + if(NOT location_found) + message(SEND_ERROR "No location for ${target} binary") + endif() +endforeach() +if(NOT OPENSSL_VERSION STREQUAL "2.0.0") + message(SEND_ERROR "Unexpected OPENSSL_VERSION '${OPENSSL_VERSION}' (expected: '2.0.0')") +endif() + +pkg_check_modules(openssl IMPORTED_TARGET REQUIRED openssl) +# NB: openssl.pc carries libressl version (3.x), but doesn't provide 3.x OpenSSL API. +if(NOT openssl_VERSION STREQUAL LibreSSL_VERSION) + message(SEND_ERROR "Unexpected openssl_VERSION '${openssl_VERSION}' (expected: '${LibreSSL_VERSION}')") +endif() + +# compile and link tests + +add_executable(openssl_cmake openssl.c) +target_link_libraries(openssl_cmake OpenSSL::SSL) + +add_executable(openssl_pkgconfig openssl.c) +target_link_libraries(openssl_pkgconfig PkgConfig::openssl) + +add_executable(libressl_cmake libressl.c) +target_link_libraries(libressl_cmake LibreSSL::TLS) + +add_executable(libressl_pkgconfig libressl.c) +target_link_libraries(libressl_pkgconfig PkgConfig::libtls) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/libressl.c b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/libressl.c new file mode 100644 index 0000000..2814d3c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/libressl.c @@ -0,0 +1,6 @@ +#include <tls.h> + +int main() +{ + return tls_init(); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/openssl.c b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/openssl.c new file mode 100644 index 0000000..880991a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/project/openssl.c @@ -0,0 +1,10 @@ +#include <openssl/ssl.h> + +#if OPENSSL_VERSION_NUMBER != 0x20000000L +# error Unexpected version +#endif + +int main() +{ + return SSL_library_init(); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libressl/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/vcpkg.json new file mode 100644 index 0000000..3b04b3e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libressl/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-libressl", + "version-string": "ci", + "description": "Validates libressl", + "dependencies": [ + "libressl", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/project/CMakeLists.txt new file mode 100644 index 0000000..ad46b40 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.30) +project(libsrtp-test C) + +find_package(libSRTP CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE libSRTP::srtp2) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(libsrtp_pc libsrtp2 REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::libsrtp_pc) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/project/main.c new file mode 100644 index 0000000..2756986 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/project/main.c @@ -0,0 +1,8 @@ +#include <stdio.h> +#include <srtp2/srtp.h> + +int main() +{ + printf("libsrtp versions: %s\n", srtp_get_version_string()); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/vcpkg.json new file mode 100644 index 0000000..2ac5383 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-libsrtp/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "vcpkg-ci-libsrtp", + "version-string": "ci", + "description": "Port to force features of libsrtp within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "libsrtp", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "libsrtp", + "features": [ + "openssl" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-lief/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-lief/portfile.cmake new file mode 100644 index 0000000..62422ca --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-lief/portfile.cmake @@ -0,0 +1,7 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+)
+
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-lief/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-lief/project/CMakeLists.txt new file mode 100644 index 0000000..9c994ed --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-lief/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.24)
+
+project(vcpkg-ci-lief LANGUAGES C CXX)
+
+set(CMAKE_CXX_STANDARD 14)
+
+find_package(LIEF CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE LIEF::LIEF)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-lief/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-lief/project/main.cpp new file mode 100644 index 0000000..752dbe1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-lief/project/main.cpp @@ -0,0 +1,11 @@ +#include <iostream>
+#include <LIEF/LIEF.hpp>
+#include <LIEF/version.h>
+
+int main()
+{
+ // Outputs a string representation of the PUBLIC access flag (index 1)
+ std::cout << "access flags public = " << LIEF::DEX::to_string(LIEF::DEX::access_flags_list[1]) << std::endl;
+ std::cout << "Version = " << LIEF_VERSION << std::endl;
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-lief/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-lief/vcpkg.json new file mode 100644 index 0000000..848008e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-lief/vcpkg.json @@ -0,0 +1,27 @@ +{
+ "name": "vcpkg-ci-lief",
+ "version-string": "ci",
+ "description": "Testing packages which provide lief",
+ "license": null,
+ "dependencies": [
+ {
+ "name": "lief",
+ "features": [
+ "art",
+ "c-api",
+ "dex",
+ "enable-json",
+ "extra-warnings",
+ "logging",
+ "logging-debug",
+ "oat",
+ "use-ccache",
+ "vdex"
+ ]
+ },
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/portfile.cmake new file mode 100644 index 0000000..0122f05 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/portfile.cmake @@ -0,0 +1,9 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) +set(ENV{PKG_CONFIG} "${PKGCONFIG}") + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/project/CMakeLists.txt new file mode 100644 index 0000000..a3aa216 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/project/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.16) +project(llama-cpp-test) + +find_package(llama CONFIG REQUIRED) + +add_executable(test-cmake main.cxx) +add_library(imported::llama ALIAS llama) +target_link_libraries(test-cmake PRIVATE imported::llama) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(llama-cpp llama REQUIRED IMPORTED_TARGET) + +add_executable(test-pkconfig main.cxx) +target_link_libraries(test-pkconfig PRIVATE PkgConfig::llama-cpp) + +# Verify that ggml::ggml-vulkan can be used with apps +# which instantiate VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE. +if(TARGET ggml::ggml-vulkan) + find_package(Vulkan REQUIRED) + target_link_libraries(test-cmake PRIVATE Vulkan::Vulkan) + target_compile_definitions(test-cmake PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1) + target_link_libraries(test-pkconfig PRIVATE Vulkan::Vulkan) + target_compile_definitions(test-pkconfig PRIVATE VULKAN_HPP_DISPATCH_LOADER_DYNAMIC=1) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/project/main.cxx b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/project/main.cxx new file mode 100644 index 0000000..f407142 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/project/main.cxx @@ -0,0 +1,15 @@ +#include <llama.h> + +// Verify that ggml::ggml-vulkan can be used with apps which +// instantiate VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE. +#if defined(VULKAN_HPP_DISPATCH_LOADER_DYNAMIC) && VULKAN_HPP_DISPATCH_LOADER_DYNAMIC == 1 +#include <vulkan/vulkan.hpp> +VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE +#endif + +int main() +{ + auto context_params = llama_context_default_params(); + ggml_backend_load_all(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/vcpkg.json new file mode 100644 index 0000000..4a46322 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-llama-cpp/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-llama-cpp", + "version-string": "ci", + "description": "Port to validate llama-cpp", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "llama-cpp", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-llvm/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-llvm/portfile.cmake new file mode 100644 index 0000000..0015715 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-llvm/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json new file mode 100644 index 0000000..ec09695 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-llvm/vcpkg.json @@ -0,0 +1,48 @@ +{ + "name": "vcpkg-ci-llvm", + "version-string": "0", + "description": "LLVM features testing within CI.", + "license": null, + "supports": "!uwp & !(arm & windows)", + "dependencies": [ + { + "name": "llvm", + "default-features": false, + "features": [ + "clang", + "compiler-rt", + "default-targets", + "enable-abi-breaking-checks", + "enable-bindings", + "enable-eh", + "enable-rtti", + "enable-terminfo", + "enable-zlib", + "lld", + "lldb", + "tools" + ] + }, + { + "$comment": "Platform restriction due to CI artifact upload quirks; libc", + "name": "llvm", + "default-features": false, + "features": [ + "libc" + ], + "platform": "linux" + }, + { + "$comment": "Platform restriction due to CI artifact upload quirks; features which need utils", + "name": "llvm", + "default-features": false, + "features": [ + "bolt", + "openmp", + "polly", + "utils" + ], + "platform": "!static & !x86" + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/portfile.cmake new file mode 100644 index 0000000..8a2079b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/portfile.cmake @@ -0,0 +1,5 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/CMakeLists.txt new file mode 100644 index 0000000..79c30f2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(mapbox-variant-test LANGUAGES CXX)
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+find_package(unofficial-mapbox-variant CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE unofficial::mapbox-variant::variant)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/main.cpp new file mode 100644 index 0000000..1f59c1a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/project/main.cpp @@ -0,0 +1,17 @@ +#include <mapbox/variant.hpp>
+#include <stdexcept>
+struct check
+{
+ template <typename T>
+ void operator()(T const& val) const
+ {
+ if (val != 0) throw std::runtime_error("invalid");
+ }
+};
+int main()
+{
+ typedef mapbox::util::variant<bool, int, double> variant_type;
+ variant_type v(0);
+ mapbox::util::apply_visitor(check(), v);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/vcpkg.json new file mode 100644 index 0000000..3cdcb61 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mapbox-variant/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-mapbox-variant", + "version-string": "ci", + "description": "Validates mapbox-variant", + "dependencies": [ + "mapbox-variant", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mathgl/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mathgl/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mathgl/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mathgl/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mathgl/vcpkg.json new file mode 100644 index 0000000..a7976a1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mathgl/vcpkg.json @@ -0,0 +1,26 @@ +{ + "name": "vcpkg-ci-mathgl", + "version-date": "2022-12-28", + "description": "Ensures that the vcpkg CI build of mathgl tests all features and examples", + "license": "MIT", + "dependencies": [ + { + "name": "mathgl", + "features": [ + "arma", + "examples", + "fltk", + "gif", + "glut", + "gsl", + "hdf5", + "jpeg", + "opengl", + "png", + "qt5", + "wx", + "zlib" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mdl-sdk/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mdl-sdk/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mdl-sdk/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mdl-sdk/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mdl-sdk/vcpkg.json new file mode 100644 index 0000000..9ad7fbc --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mdl-sdk/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "vcpkg-ci-mdl-sdk", + "version-string": "ci", + "description": "Port to force features of certain ports within CI", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "mdl-sdk", + "default-features": false, + "features": [ + "dds", + "openimageio" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/build-type.diff b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/build-type.diff new file mode 100644 index 0000000..7886576 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/build-type.diff @@ -0,0 +1,40 @@ +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index c5fff1a..03a86ca 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -20,6 +20,7 @@ find_package(mimalloc 2.2 CONFIG REQUIRED) + message(STATUS "Found mimalloc installed at: ${MIMALLOC_LIBRARY_DIR} (${MIMALLOC_VERSION_DIR})") + + ++if(BUILD_SHARED_LIBS) + # link with a dynamic shared library + # use `LD_PRELOAD` to actually override malloc/free at runtime with mimalloc + add_executable(dynamic-override main-override.c) +@@ -27,15 +28,19 @@ target_link_libraries(dynamic-override PUBLIC mimalloc) + + add_executable(dynamic-override-cxx main-override.cpp) + target_link_libraries(dynamic-override-cxx PUBLIC mimalloc) ++endif() + + ++if(0) + # overriding with a static object file works reliable as the symbols in the + # object file have priority over those in library files + add_executable(static-override-obj main-override.c ${MIMALLOC_OBJECT_DIR}/mimalloc${CMAKE_C_OUTPUT_EXTENSION}) + target_include_directories(static-override-obj PUBLIC ${MIMALLOC_INCLUDE_DIR}) + target_link_libraries(static-override-obj PUBLIC mimalloc-static) ++endif() + + ++if(NOT BUILD_SHARED_LIBS AND NOT WIN32) + # overriding with a static library works too if using the `mimalloc-override.h` + # header to redefine malloc/free. (the library already overrides new/delete) + add_executable(static-override-static main-override-static.c) +@@ -49,6 +54,7 @@ target_link_libraries(static-override PUBLIC mimalloc-static) + + add_executable(static-override-cxx main-override.cpp) + target_link_libraries(static-override-cxx PUBLIC mimalloc-static) ++endif() + + + ## test memory errors diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/portfile.cmake new file mode 100644 index 0000000..8a46d4c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/portfile.cmake @@ -0,0 +1,40 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO microsoft/mimalloc + REF "v${VERSION}" + SHA512 55262050f63868e3029cd929a74d312dc0f34b606534b1d0b3735eecc8eed68aae97523a50228b4ac4044e1e03192f2909440e3a27607e2d364607ac0bda828f + HEAD_REF master + PATCHES + build-type.diff +) +# Ensure that the test uses the installed mimalloc only +file(REMOVE_RECURSE + "${SOURCE_PATH}/bin" + "${SOURCE_PATH}/include" + "${SOURCE_PATH}/src" +) + +vcpkg_cmake_configure( + SOURCE_PATH "${SOURCE_PATH}/test" + OPTIONS + "-DCMAKE_PROJECT_INCLUDE=${CURRENT_PORT_DIR}/vcpkg-tests.cmake" + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) + +set(ENV{MIMALLOC_VERBOSE} 1) +set(ENV{MIMALLOC_SHOW_ERRORS} 1) +set(ENV{MIMALLOC_DISABLE_REDIRECT} 1) + +vcpkg_cmake_install(ADD_BIN_TO_PATH) + +if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic" OR NOT VCPKG_TARGET_IS_WINDOWS) + vcpkg_copy_tools(TOOL_NAMES pkgconfig-override-cxx AUTO_CLEAN) +endif() + +file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug") + +vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE") diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/vcpkg-tests.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/vcpkg-tests.cmake new file mode 100644 index 0000000..659cb7d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/vcpkg-tests.cmake @@ -0,0 +1,59 @@ +macro(deferred_tests) + +find_package(PkgConfig REQUIRED) + +# Legacy variables + +message(STATUS "MIMALLOC_INCLUDE_DIR: ${MIMALLOC_INCLUDE_DIR}") +message(STATUS "MIMALLOC_LIBRARY_DIR: ${MIMALLOC_LIBRARY_DIR}") +find_file(mimalloc_h NAMES mimalloc.h PATHS "${MIMALLOC_INCLUDE_DIR}" NO_DEFAULT_PATH REQUIRED) +set(names + mimalloc + mimalloc-secure + mimalloc-static + mimalloc-static-secure + mimalloc-debug + mimalloc-secure-debug + mimalloc-static-debug + mimalloc-static-secure-debug +) +find_library(mimalloc_lib NAMES ${names} PATHS "${MIMALLOC_LIBRARY_DIR}" NO_DEFAULT_PATH REQUIRED) + +# pkgconfig + +pkg_check_modules(PC_MIMALLOC mimalloc IMPORTED_TARGET REQUIRED) + +add_executable(pkgconfig-override $<IF:$<BOOL:${BUILD_SHARED_LIBS}>,main-override.c,main-override-static.c>) +target_link_libraries(pkgconfig-override PRIVATE PkgConfig::PC_MIMALLOC) + +if(BUILD_SHARED_LIBS OR NOT WIN32) + add_executable(pkgconfig-override-cxx main-override.cpp) + target_link_libraries(pkgconfig-override-cxx PRIVATE PkgConfig::PC_MIMALLOC) +endif() + +# Runtime + +if(NOT CMAKE_CROSSCOMPILING) + if(BUILD_SHARED_LIBS) + add_custom_target(run-dynamic-override ALL COMMAND $<TARGET_NAME:dynamic-override>) + add_custom_target(run-dynamic-override-cxx ALL COMMAND $<TARGET_NAME:dynamic-override-cxx>) + elseif(NOT WIN32) + add_custom_target(run-static-override ALL COMMAND $<TARGET_NAME:static-override>) + add_custom_target(run-static-override-cxx ALL COMMAND $<TARGET_NAME:static-override-cxx>) + endif() + if(TARGET pkgconfig-override-cxx) + add_custom_target(run-pkgconfig-override-cxx ALL COMMAND $<TARGET_NAME:pkgconfig-override-cxx>) + endif() +endif() + +# Deployment + +if(TARGET pkgconfig-override-cxx) + install(TARGETS pkgconfig-override-cxx) +else() + install(CODE [[ # placeholder # ]]) +endif() + +endmacro() + +cmake_language(DEFER CALL deferred_tests) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/vcpkg.json new file mode 100644 index 0000000..9c453dd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mimalloc/vcpkg.json @@ -0,0 +1,33 @@ +{ + "name": "vcpkg-ci-mimalloc", + "version": "2.2.3", + "description": "Validates mimalloc", + "dependencies": [ + "mimalloc", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "features": { + "ci": { + "description": "Test feature permutation", + "dependencies": [ + { + "name": "mimalloc", + "features": [ + "override" + ], + "platform": "native & !(windows & static)" + }, + { + "name": "mimalloc", + "features": [ + "secure" + ], + "platform": "arm64 & static" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-minc/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-minc/portfile.cmake new file mode 100644 index 0000000..d1ab44a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-minc/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-minc/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-minc/project/CMakeLists.txt new file mode 100644 index 0000000..9bf614b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-minc/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.30) +project(minc-test C CXX) + +find_package(LIBMINC CONFIG REQUIRED) + +add_executable(main main.c) +target_include_directories(main PRIVATE ${LIBMINC_INCLUDE_DIRS}) +target_link_directories(main PRIVATE ${LIBMINC_LIBRARY_DIRS}) +target_link_libraries(main PRIVATE ${LIBMINC_LIBRARIES}) + +if(NOT EXISTS "${LIBMINC_USE_FILE}") + message(SEND_ERROR "No such LIBMINC_USE_FILE: ${LIBMINC_USE_FILE}") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-minc/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-minc/project/main.c new file mode 100644 index 0000000..272158f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-minc/project/main.c @@ -0,0 +1,16 @@ +#include <stdio.h> +#include <minc2.h> + +int main() +{ + int result; + mihandle_t hvol; + + result = miopen_volume("/tmp/test.mnc", MI2_OPEN_READ, &hvol); + if (result != MI_NOERROR) { + fprintf(stderr, "Error opening the input file.\n"); + } + + miclose_volume(hvol); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-minc/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-minc/vcpkg.json new file mode 100644 index 0000000..c53f777 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-minc/vcpkg.json @@ -0,0 +1,34 @@ +{ + "name": "vcpkg-ci-minc", + "version-string": "ci", + "description": "Port to force features of minc within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "minc", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "minc", + "features": [ + "minc1" + ], + "platform": "native" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/portfile.cmake new file mode 100644 index 0000000..165195b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/portfile.cmake @@ -0,0 +1,10 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/project/CMakeLists.txt new file mode 100644 index 0000000..0008a44 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/project/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.30) + +project(vcpkg-ci-mpg123 C) + +find_package(mpg123 REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE MPG123::libmpg123) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(MPG123_PC REQUIRED IMPORTED_TARGET libmpg123) + +add_executable(main-pc main.c) +target_link_libraries(main-pc PRIVATE PkgConfig::MPG123_PC) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/project/main.c new file mode 100644 index 0000000..4ae5af4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/project/main.c @@ -0,0 +1,11 @@ +#include <mpg123.h> + +int main() +{ + mpg123_handle *m = mpg123_new(NULL, NULL); + mpg123_open(m, "vcpkg"); + mpg123_scan(m); + mpg123_close(m); + mpg123_delete(m); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/vcpkg.json new file mode 100644 index 0000000..44a9a09 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mpg123/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-mpg123", + "version-string": "ci", + "description": "Validates mpg123", + "dependencies": [ + "mpg123", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-msh3/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/CMakeLists.txt new file mode 100644 index 0000000..1455618 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.10) +project(msh3-test C) + +block() + set(CMAKE_DISABLE_FIND_PACKAGE_PkgConfig 1) + + find_package(msh3 CONFIG REQUIRED) + if(NOT TARGET msh3) + message(SEND_ERROR "No target 'msh3'") + endif() + + add_executable(msh3_cmake main.c) + target_link_libraries(msh3_cmake msh3) +endblock() + +block() + find_package(PkgConfig REQUIRED) + pkg_check_modules(libmsh3 IMPORTED_TARGET REQUIRED libmsh3) + + add_executable(msh3_pkgconfig main.c) + target_link_libraries(msh3_pkgconfig PkgConfig::libmsh3) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/main.c new file mode 100644 index 0000000..e55b40d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/project/main.c @@ -0,0 +1,8 @@ +#include <msh3.h> + +int main() +{ + MSH3_API* api = MsH3ApiOpen(); + if (api) + MsH3ApiClose(api); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-msh3/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/vcpkg.json new file mode 100644 index 0000000..330016d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-msh3/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "vcpkg-ci-msh3", + "version-string": "ci", + "description": "Validates msh3", + "dependencies": [ + "msh3", + { + "name": "msquic", + "features": [ + "0-rtt" + ], + "platform": "windows & !static" + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-msys2/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-msys2/portfile.cmake new file mode 100644 index 0000000..fe2753e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-msys2/portfile.cmake @@ -0,0 +1,364 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +set(msys_repo_url "https://mirror.msys2.org/msys/x86_64") +set(mingw64_repo_url "https://mirror.msys2.org/mingw/mingw64") +set(mingw32_repo_url "https://mirror.msys2.org/mingw/mingw32") +set(clangarm64_repo_url "https://mirror.msys2.org/mingw/clangarm64") + +# Ignore these updates (e.g. for known problems) +vcpkg_list(SET ignored_updates + https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-ca-certificates-20211016-3-any.pkg.tar.zst +) + +# Known removals that shall not be reported as errors +# (Packages to be removed from vcpkg scripts ASAP.) +vcpkg_list(SET known_delisted + libcrypt +) + +# Ignore these dependencies (e.g. interactive or effectively optional) +vcpkg_list(SET ignored_dependencies + autoconf2.13 autoconf2.69 autoconf2.71 + automake1.11 automake1.12 automake1.13 automake1.14 automake1.15 + db + gdbm + info + less + libiconv-devel + libltdl + mingw-w64-x86_64-tzdata +) + +# Ignore these provides (e.g. effectively optional) +vcpkg_list(SET ignored_provides + gnome-common + perl-Archive-Tar perl-Attribute-Handlers perl-AutoLoader perl-CPAN-Meta-Requirements perl-CPAN-Meta-YAML perl-CPAN-Meta perl-CPAN perl-Carp perl-Compress-Raw-Bzip2 perl-Compress-Raw-Zlib perl-Config-Perl-V perl-DB_File perl-Data-Dumper perl-Devel-PPPort perl-Devel-SelfStubber perl-Digest-MD5 perl-Digest-SHA perl-Digest perl-Dumpvalue perl-Encode perl-Env perl-Exporter perl-ExtUtils-CBuilder perl-ExtUtils-Constant perl-ExtUtils-Install perl-ExtUtils-MakeMaker perl-ExtUtils-Manifest perl-ExtUtils-PL2Bat perl-ExtUtils-ParseXS perl-File-Fetch perl-File-Path perl-File-Temp perl-Filter-Simple perl-Filter-Util-Call perl-FindBin perl-Getopt-Long perl-HTTP-Tiny perl-I18N-Collate perl-I18N-LangTags perl-IO-Compress perl-IO-Socket-IP perl-IO-Zlib perl-IO perl-IPC-Cmd perl-IPC-SysV perl-JSON-PP perl-Locale-Maketext-Simple perl-Locale-Maketext perl-MIME-Base64 perl-Math-BigInt-FastCalc perl-Math-BigInt perl-Math-BigRat perl-Math-Complex perl-Memoize perl-Module-CoreList perl-Module-Load-Conditional perl-Module-Load perl-Module-Loaded perl-Module-Metadata perl-NEXT perl-Net-Ping perl-Params-Check perl-PathTools perl-Perl-OSType perl-PerlIO-via-QuotedPrint perl-Pod-Checker perl-Pod-Escapes perl-Pod-Perldoc perl-Pod-Simple perl-Pod-Usage perl-Safe perl-Scalar-List-Utils perl-Search-Dict perl-SelfLoader perl-Socket perl-Storable perl-Sys-Syslog perl-Term-ANSIColor perl-Term-Cap perl-Term-Complete perl-Term-ReadLine perl-Test-Harness perl-Test-Simple perl-Test perl-Text-Abbrev perl-Text-Balanced perl-Text-ParseWords perl-Text-Tabs perl-Thread-Queue perl-Thread-Semaphore perl-Tie-File perl-Tie-RefHash perl-Time-HiRes perl-Time-Local perl-Time-Piece perl-Unicode-Collate perl-Unicode-Normalize perl-Win32 perl-Win32API-File perl-XSLoader perl-autodie perl-autouse perl-base perl-bignum perl-constant perl-encoding-warnings perl-experimental perl-if perl-lib perl-libnet perl-parent perl-perlfaq perl-podlators perl-threads-shared perl-threads perl-version +) + + +string(TIMESTAMP now "%s" UTC) + +function(age_in_days out_var timestamp) + set(age "") + if(timestamp) + math(EXPR age "(${now} - ${timestamp}) / 3600 / 24") + endif() + set(${out_var} "${age}" PARENT_SCOPE) +endfunction() + +function(pretty_age out_var age_in_days) + if(age_in_days STREQUAL "") + set(${out_var} "(timestamp unknown)" PARENT_SCOPE) + else() + set(${out_var} "(${age_in_days} days ago)" PARENT_SCOPE) + endif() +endfunction() + +function(get_vcpkg_builddate out_var name) + if(NOT DEFINED Z_VCPKG_MSYS_${name}_ARCHIVE) + z_vcpkg_acquire_msys_download_package(Z_VCPKG_MSYS_${name}_ARCHIVE + URL "${Z_VCPKG_MSYS_${name}_URL}" + SHA512 "${Z_VCPKG_MSYS_${name}_SHA512}" + FILENAME "${Z_VCPKG_MSYS_${name}_FILENAME}" + ) + set(Z_VCPKG_MSYS_${name}_ARCHIVE "${Z_VCPKG_MSYS_${name}_ARCHIVE}" PARENT_SCOPE) + endif() + set(pkginfo_dir "${CURRENT_BUILDTREES_DIR}/vcpkg") + file(REMOVE_RECURSE "${pkginfo_dir}/${name}.txt" "${pkginfo_dir}/_tmp") + file(MAKE_DIRECTORY "${pkginfo_dir}/_tmp") + execute_process( + COMMAND "${CMAKE_COMMAND}" -E tar xzf "${Z_VCPKG_MSYS_${name}_ARCHIVE}" .PKGINFO + WORKING_DIRECTORY "${pkginfo_dir}/_tmp" + ) + file(RENAME "${pkginfo_dir}/_tmp/.PKGINFO" "${pkginfo_dir}/${name}.txt") + file(STRINGS "${pkginfo_dir}/${name}.txt" builddate REGEX "builddate = [0-9]+") + string(REPLACE "builddate = " "" builddate "${builddate}") + set(${out_var} "${builddate}" PARENT_SCOPE) +endfunction() + +function(get_vcpkg_provides out_var name) + if(NOT DEFINED Z_VCPKG_MSYS_${name}_ARCHIVE) + z_vcpkg_acquire_msys_download_package(Z_VCPKG_MSYS_${name}_ARCHIVE + URL "${Z_VCPKG_MSYS_${name}_URL}" + SHA512 "${Z_VCPKG_MSYS_${name}_SHA512}" + FILENAME "${Z_VCPKG_MSYS_${name}_FILENAME}" + ) + set(Z_VCPKG_MSYS_${name}_ARCHIVE "${Z_VCPKG_MSYS_${name}_ARCHIVE}" PARENT_SCOPE) + endif() + set(pkginfo_dir "${CURRENT_BUILDTREES_DIR}/vcpkg") + file(REMOVE_RECURSE "${pkginfo_dir}/${name}.txt" "${pkginfo_dir}/_tmp") + file(MAKE_DIRECTORY "${pkginfo_dir}/_tmp") + execute_process( + COMMAND "${CMAKE_COMMAND}" -E tar xzf "${Z_VCPKG_MSYS_${name}_ARCHIVE}" .PKGINFO + WORKING_DIRECTORY "${pkginfo_dir}/_tmp" + ) + file(RENAME "${pkginfo_dir}/_tmp/.PKGINFO" "${pkginfo_dir}/${name}.txt") + file(STRINGS "${pkginfo_dir}/${name}.txt" provides REGEX "provides = .+") + string(REPLACE "provides = " "" provides "${provides}") + set(${out_var} "${provides}" PARENT_SCOPE) +endfunction() + +function(update_vcpkg_download script_file name new_url) + message(STATUS "- Updating vcpkg...") + if(NOT new_url MATCHES [[^https://mirror\.msys2\.org/.*/(([^/]*)-[^-/]+-[^-/]+-[^-/]+\.pkg\.tar\.(xz|zst))$]]) + message(FATAL_ERROR "Supplied URL does not match the expected pattern: ${arg_URL}") + endif() + set(filename "msys2-${CMAKE_MATCH_1}") + vcpkg_download_distfile(archive + URLS "${new_url}" + FILENAME "${filename}" + SKIP_SHA512 + ) + execute_process( + COMMAND "${CMAKE_COMMAND}" -E sha512sum "${archive}" + OUTPUT_VARIABLE sha512 + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + string(REGEX REPLACE " .*" "" sha512 "${sha512}") + vcpkg_replace_string("${SCRIPTS}/cmake/${script_file}" "${Z_VCPKG_MSYS_${name}_URL}" "${new_url}") + vcpkg_replace_string("${SCRIPTS}/cmake/${script_file}" "${Z_VCPKG_MSYS_${name}_SHA512}" "${sha512}") +endfunction() + +function(pretty_dependencies out_var list_name) + foreach(dependency IN LISTS ignored_dependencies) + list(TRANSFORM ${list_name} REPLACE "^${dependency}\$" "(${dependency})") + endforeach() + list(JOIN ${list_name} " " list_string) + set(${out_var} "${list_string}" PARENT_SCOPE) +endfunction() + +function(analyze_package_list list_var script) + message(STATUS "*** Analyzing packages in '${script}'") + vcpkg_list(SET critical) # Packages which can be upgraded and are fairly old in vcpkg + vcpkg_list(SET mismatched_deps) # Packages which have vcpkg deps different from msys2 deps + vcpkg_list(SET missing) # Packages used in (new) deps but not declared + vcpkg_list(SET upgradable) # Packages which can be upgrade but are fairly fresh in vcpkg + vcpkg_list(SET vanished) # Packages which vanished from the msys2 database + + # Preload details from direct packages + foreach(name IN LISTS ${list_var}) + if(NOT Z_VCPKG_MSYS_${name}_DIRECT) + continue() + endif() + get_vcpkg_provides(vcpkg_provides "${name}") + set(Z_VCPKG_MSYS_${name}_PROVIDES "${vcpkg_provides}") + foreach(provided IN LISTS vcpkg_provides) + set(Z_VCPKG_MSYS_${provided}_PROVIDED_BY "${name}") + endforeach() + endforeach() + + # msys2.org removes packages 1.75 years after it was removed from the active database, + # cf. https://www.msys2.org/docs/faq/#how-long-are-old-packages-kept-on-repomsys2org + # We don't know the date of that replacement, and mirrors might use a shorter time. + # But we can compare the build date of the package currently downloaded by vcpkg + # and the build date of the package in the msys2 database. + # If this time span exceeds 'max_age', an update is marked as critical. + set(max_age 365) # days + math(EXPR minimum_builddate "${now} - 6 * 30 * 24 * 3600") + foreach(name IN LISTS ${list_var}) + if(Z_VCPKG_MSYS_${name}_DIRECT) + message(STATUS "${name} (DIRECT)") + elseif("DIRECT_ONLY" IN_LIST ARGN) + continue() + else() + message(STATUS "${name}") + endif() + set(vcpkg_url "${Z_VCPKG_MSYS_${name}_URL}") + set(vcpkg_deps "${Z_VCPKG_MSYS_${name}_DEPS}") + set(vcpkg_provides "${Z_VCPKG_MSYS_${name}_PROVIDES}") + + set(repo "msys") + if(name MATCHES "^mingw-w64-x86_64") + set(repo "mingw64") + elseif(name MATCHES "^mingw-w64-i686") + set(repo "mingw32") + elseif(name MATCHES "^mingw-w64-clang-aarch64") + set(repo "clangarm64") + endif() + + file(GLOB files "${${repo}_repo_files}/${name}-*/desc") + set(found 0) + foreach(file IN LISTS files) + # Find the package + file(STRINGS "${file}" desc) + if(NOT desc MATCHES "%NAME%;${name};") + continue() + elseif(NOT desc MATCHES "%FILENAME%;([^;]+)") + continue() + endif() + set(found 1) + set(current_url "${${repo}_repo_url}/${CMAKE_MATCH_1}") + # Check the URL + if(NOT vcpkg_url STREQUAL current_url AND NOT current_url IN_LIST ignored_updates) + get_vcpkg_builddate(vcpkg_builddate "${name}") + age_in_days(vcpkg_age "${vcpkg_builddate}") + pretty_age(vcpkg_age_pretty "${vcpkg_age}") + set(current_age "") + if(desc MATCHES "%BUILDDATE%;([0-9]+)") + age_in_days(current_age "${CMAKE_MATCH_1}") + endif() + pretty_age(current_age_string "${current_age}") + message(STATUS "- vcpkg: ${vcpkg_url} ${vcpkg_age_pretty}") + message(STATUS "+ msys2: ${current_url} ${current_age_string}") + + set(age_diff "0") + if(NOT vcpkg_age STREQUAL "" AND NOT current_age STREQUAL "") + math(EXPR age_diff "${current_age} - ${vcpkg_age}") + endif() + if(age_diff GREATER max_age) + if("update-all" IN_LIST FEATURES) + update_vcpkg_download("${script}" "${name}" "${current_url}") + else() + vcpkg_list(APPEND critical "${name}") + endif() + elseif(NOT vcpkg_url STREQUAL current_url) + if("update-all" IN_LIST FEATURES) + update_vcpkg_download("${script}" "${name}" "${current_url}") + else() + vcpkg_list(APPEND upgradable "${name}") + endif() + endif() + endif() + # Check the dependencies + if(desc MATCHES "%DEPENDS%;([^%]*)" OR vcpkg_deps) + list(JOIN CMAKE_MATCH_1 " " current_deps) + separate_arguments(current_deps UNIX_COMMAND "${current_deps}") + list(TRANSFORM current_deps REPLACE "[<=>].*" "") + list(SORT current_deps) + list(SORT vcpkg_deps) + pretty_dependencies(current_deps_string current_deps) + if(Z_VCPKG_MSYS_${name}_DIRECT AND NOT current_deps STREQUAL "") + message(STATUS "* msys2 dependencies: ${current_deps_string}") + elseif(NOT vcpkg_deps STREQUAL current_deps) + pretty_dependencies(vcpkg_deps_string vcpkg_deps) + message(STATUS "- vcpkg dependencies: ${vcpkg_deps_string}") + message(STATUS "+ msys2 dependencies: ${current_deps_string}") + list(REMOVE_ITEM current_deps ${ignored_dependencies}) + if(NOT vcpkg_deps STREQUAL current_deps) + vcpkg_list(APPEND mismatched_deps "${name}") + endif() + list(REMOVE_ITEM current_deps ${known_packages} ${${list_var}} ${ignored_dependencies}) + set(missing_deps "") + foreach(dep IN LISTS current_deps) + if(NOT DEFINED Z_VCPKG_MSYS_${dep}_PROVIDED_BY) + list(APPEND missing_deps "${dep}") + endif() + endforeach() + if(missing_deps) + list(JOIN missing_deps " " missing_deps_string) + message(STATUS "! unknown dependencies: ${missing_deps_string}") + vcpkg_list(APPEND missing ${missing_deps}) + endif() + endif() + endif() + # Check the "provides" + if(desc MATCHES "%PROVIDES%;([^%]*)" OR vcpkg_provides) + list(JOIN CMAKE_MATCH_1 " " current_provides) + separate_arguments(current_provides UNIX_COMMAND "${current_provides}") + list(TRANSFORM current_provides REPLACE "[<=>].*" "") + list(REMOVE_ITEM current_provides ${ignored_provides}) + list(JOIN vcpkg_provides " " vcpkg_provides_string) + if(NOT vcpkg_provides STREQUAL current_provides) + list(JOIN vcpkg_provides " " vcpkg_provides_string) + list(JOIN current_provides " " current_provides_string) + message(STATUS "- vcpkg provides: ${vcpkg_provides_string}") + message(STATUS "+ msys2 provides: ${current_provides_string}") + elseif(NOT vcpkg_provides STREQUAL "") + message(STATUS "* provides: ${vcpkg_provides_string}") + endif() + endif() + endforeach() + if(NOT found AND NOT name IN_LIST known_delisted) + vcpkg_list(APPEND vanished "${name}") + get_vcpkg_builddate(vcpkg_builddate "${name}") + age_in_days(vcpkg_age "${vcpkg_builddate}") + pretty_age(vcpkg_age_pretty "${vcpkg_age}") + message(STATUS "- vcpkg: ${vcpkg_url} ${vcpkg_age_pretty}") + message(STATUS "! msys2: no match for ${name}") + + age_in_days(current_age "${now}") + set(age_diff "0") + if(NOT vcpkg_age STREQUAL "" AND NOT current_age STREQUAL "") + math(EXPR age_diff "${current_age} - ${vcpkg_age}") + endif() + if(age_diff GREATER max_age) + vcpkg_list(APPEND critical "${name}") + endif() + endif() + endforeach() + + if(mismatched_deps) + list(JOIN mismatched_deps " " mismatched_deps) + message(WARNING "The following msys2 packages have changed dependencies: ${mismatched_deps}") + endif() + if(missing) + list(SORT missing) + list(REMOVE_DUPLICATES missing) + list(JOIN missing " " missing) + message(WARNING "The following msys2 packages would be needed to update all dependencies: ${missing}") + endif() + if(upgradable) + list(JOIN upgradable " " upgradable) + message(WARNING "The following msys2 packages could be updated: ${upgradable}") + endif() + if(critical) + list(JOIN critical " " critical) + message(SEND_ERROR "The following msys2 packages were build more than 6 months ago and should be updated: ${critical}") + endif() + if(vanished) + list(JOIN vanished " " vanished) + message(SEND_ERROR "The following msys2 packages are no longer in the database: ${vanished}") + endif() + message(STATUS "*** Analyzing packages in '${script}' done") +endfunction() + +message(STATUS "*** Downloading current msys2 package lists") +string(TIMESTAMP stamp "%Y-%m-%d" UTC) +foreach(repo IN ITEMS msys mingw32 mingw64 clangarm64) + string(REPLACE "/" "-" local_file "msys2-${stamp}-${repo}.files") + set(archive "${DOWNLOADS}/${local_file}") + vcpkg_download_distfile(repo_files_archive + URLS "${${repo}_repo_url}/${repo}.files" + FILENAME "${local_file}" + SKIP_SHA512 + ) + vcpkg_extract_source_archive(repo_files + ARCHIVE "${repo_files_archive}" + NO_REMOVE_ONE_LEVEL + ) + set(${repo}_repo_files "${repo_files}") +endforeach() +message(STATUS "*** Downloading current msys2 package lists done") + +set(Z_VCPKG_MSYS_PACKAGES_RESOLVED "" CACHE INTERNAL "") +vcpkg_acquire_msys(msys_root Z_ALL_PACKAGES) +analyze_package_list(Z_VCPKG_MSYS_PACKAGES_RESOLVED "vcpkg_acquire_msys.cmake") +set(known_packages "${Z_VCPKG_MSYS_PACKAGES_RESOLVED}") + +set(Z_VCPKG_MSYS_PACKAGES_RESOLVED "" CACHE INTERNAL "") +vcpkg_find_acquire_program(PKGCONFIG) +vcpkg_acquire_msys(msys_root + NO_DEFAULT_PACKAGES + Z_DECLARE_EXTRA_PACKAGES_COMMAND "z_vcpkg_find_acquire_pkgconfig_msys_declare_packages" + PACKAGES + mingw-w64-clang-aarch64-pkgconf + mingw-w64-x86_64-pkgconf + mingw-w64-i686-pkgconf +) +analyze_package_list(Z_VCPKG_MSYS_PACKAGES_RESOLVED "vcpkg_find_acquire_program(PKGCONFIG).cmake") + +set(CMAKE_Fortran_COMPILER "") +if(NOT VCPKG_TARGET_IS_WINDOWS) + set(CMAKE_Fortran_COMPILER "true") +endif() +set(Z_VCPKG_MSYS_PACKAGES_RESOLVED "" CACHE INTERNAL "") +include("${SCRIPTS}/cmake/vcpkg_find_fortran.cmake") +vcpkg_find_fortran(FORTRAN) +vcpkg_acquire_msys(msys_root + NO_DEFAULT_PACKAGES + Z_DECLARE_EXTRA_PACKAGES_COMMAND "z_vcpkg_find_fortran_msys_declare_packages" + PACKAGES + mingw-w64-x86_64-gcc-fortran + mingw-w64-i686-gcc-fortran +) +analyze_package_list(Z_VCPKG_MSYS_PACKAGES_RESOLVED "vcpkg_find_fortran.cmake") diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-msys2/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-msys2/vcpkg.json new file mode 100644 index 0000000..039d3df --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-msys2/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-msys2", + "version": "1", + "description": "Test vcpkg msys2 freshness", + "license": "MIT", + "supports": "(windows | mingw) & native", + "features": { + "update-all": { + "description": "Update all outdated packages in vcpkg_acquire_msys.cmake" + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/portfile.cmake new file mode 100644 index 0000000..9957972 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DFEATURES=${FEATURES}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/CMakeLists.txt new file mode 100644 index 0000000..b39b93a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.10...3.30) +project(mysql-connector-cpp-test CXX) + +if(APPLE) + set(CMAKE_CXX_STANDARD 11) +endif() + +# proper export +add_executable(unofficial-mysql-connector-cpp main.cpp) +find_package(unofficial-mysql-connector-cpp CONFIG REQUIRED) +target_link_libraries(unofficial-mysql-connector-cpp PRIVATE unofficial::mysql-connector-cpp::connector) + +# partial re-implementation +add_executable(mysql-concpp-xdevapi main.cpp) +find_package(mysql-concpp CONFIG REQUIRED) +target_link_libraries(mysql-concpp-xdevapi PRIVATE $<IF:$<TARGET_EXISTS:mysql::concpp-xdevapi>,mysql::concpp-xdevapi,mysql::concpp-xdevapi-static>) + +if("jdbc" IN_LIST FEATURES) + # proper export + add_executable(unofficial-mysql-connector-cpp-jdbc jdbc.cpp) + target_link_libraries(unofficial-mysql-connector-cpp-jdbc PRIVATE unofficial::mysql-connector-cpp::connector-jdbc) + + # partial re-implementation + add_executable(mysql-concpp-jdbc jdbc.cpp) + target_link_libraries(mysql-concpp-jdbc PRIVATE $<IF:$<TARGET_EXISTS:mysql::concpp-jdbc>,mysql::concpp-jdbc,mysql::concpp-jdbc-static>) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/jdbc.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/jdbc.cpp new file mode 100644 index 0000000..2dd74e2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/jdbc.cpp @@ -0,0 +1,7 @@ +#include <mysql/jdbc.h> + +int main() +{ + sql::Driver* driver = sql::mysql::get_driver_instance(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/main.cpp new file mode 100644 index 0000000..de32b2d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/project/main.cpp @@ -0,0 +1,7 @@ +#include <mysqlx/xdevapi.h> + +int main() +{ + mysqlx::Session sess("mysqlx://vcpkg@127.0.0.1"); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/vcpkg.json new file mode 100644 index 0000000..e844982 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mysql-connector-cpp/vcpkg.json @@ -0,0 +1,31 @@ +{ + "name": "vcpkg-ci-mysql-connector-cpp", + "version-string": "ci", + "description": "Validates mysql-connector-cpp", + "dependencies": [ + "mysql-connector-cpp", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "jdbc", + "platform": "x64 & static" + } + ], + "features": { + "jdbc": { + "description": "Test jdbc", + "dependencies": [ + { + "name": "mysql-connector-cpp", + "features": [ + "jdbc" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/portfile.cmake new file mode 100644 index 0000000..8a2079b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/portfile.cmake @@ -0,0 +1,5 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/project/CMakeLists.txt new file mode 100644 index 0000000..b700acb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(mzying2001-sw-test LANGUAGES CXX)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+find_package(sw CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE sw::sw)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/project/main.cpp new file mode 100644 index 0000000..8c9197e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/project/main.cpp @@ -0,0 +1,13 @@ +#include <sw/SimpleWindow.h>
+int main()
+{
+ sw::Window wnd;
+ sw::Button btn;
+ wnd.SetLayout<sw::FillLayout>();
+ btn.AddHandler(sw::ButtonBase_Clicked,
+ [](sw::UIElement& sender, sw::RoutedEventArgs& e) {
+ sw::MsgBox::Show(L"Hello, SimpleWindow!");
+ });
+ wnd.AddChild(btn);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/vcpkg.json new file mode 100644 index 0000000..c30a469 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-mzying2001-sw/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-mzying2001-sw", + "version-string": "ci", + "description": "Validates mzying2001-sw", + "dependencies": [ + "mzying2001-sw", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-nanobind/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-nanobind/portfile.cmake new file mode 100644 index 0000000..b6dc884 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-nanobind/portfile.cmake @@ -0,0 +1,20 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# This test does not support cross-compilation due to nanobind's usage of the +# Python interpreter to figure out Python module suffix. +if(VCPKG_CROSSCOMPILING) + message(WARNING "Skipping vcpkg-ci-nanobind because it is not expected to work when cross-compiling") + return() +endif() + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO wjakob/nanobind_example + REF 4b5c9bd484dec77e085a188dcefc536aed69aae9 + SHA512 ec7eeb25b5c5ee2e8bbcc48e78719dc6e5211cf54794dd3c370ad3e8d685fbc8b79435890da3b9481656169efaa87b77e3ea55ce864efd670dd9ea0600dee77d + HEAD_REF master +) + +vcpkg_cmake_configure(SOURCE_PATH "${SOURCE_PATH}") + +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-nanobind/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-nanobind/vcpkg.json new file mode 100644 index 0000000..5c5baf8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-nanobind/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-ci-nanobind", + "version-date": "2025-04-03", + "description": "A nanobind example project", + "homepage": "https://nanobind.readthedocs.io/en/latest/", + "license": "BSD-3-Clause", + "dependencies": [ + "nanobind", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-netgen/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-netgen/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-netgen/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-netgen/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-netgen/vcpkg.json new file mode 100644 index 0000000..a532ee7 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-netgen/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-netgen", + "version-string": "ci", + "description": "Force non-default features of netgen within vcpkg CI", + "homepage": "https://github.com/microsoft/vcpkg", + "dependencies": [ + { + "name": "netgen", + "features": [ + "cgns", + "jpeg", + "mpeg", + "occ" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-nss/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-nss/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-nss/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-nss/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-nss/project/CMakeLists.txt new file mode 100644 index 0000000..d51af06 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-nss/project/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.30) +project(nss-test C) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(nss_pc nss REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::nss_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-nss/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-nss/project/main.c new file mode 100644 index 0000000..dc5c8ce --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-nss/project/main.c @@ -0,0 +1,9 @@ +#include <nss.h> + +int main() +{ + const char* configdir = "./DONOTUSE"; + SECStatus rv = NSS_Initialize(configdir, "", "", SECMOD_DB, NSS_INIT_NOROOTINIT | NSS_INIT_OPTIMIZESPACE); + NSS_Shutdown(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-nss/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-nss/vcpkg.json new file mode 100644 index 0000000..301ed63 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-nss/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-nss", + "version-string": "ci", + "description": "Port to validate nss in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "nss", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-octave/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-octave/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-octave/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-octave/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-octave/vcpkg.json new file mode 100644 index 0000000..1bf4ba9 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-octave/vcpkg.json @@ -0,0 +1,32 @@ +{ + "name": "vcpkg-ci-octave", + "version": "0.0.0", + "description": "Test the octave feature", + "dependencies": [ + { + "name": "octave", + "features": [ + "amd", + "arpack", + "bz2", + "camd", + "ccolamd", + "cholmod", + "colamd", + "curl", + "cxsparse", + "fltk", + "fontconfig", + "freetype", + "graphicsmagick", + "gui", + "hdf5", + "klu", + "portaudio", + "qhull", + "spqr", + "umfpack" + ] + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openblas/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/portfile.cmake new file mode 100644 index 0000000..d2a6e58 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/portfile.cmake @@ -0,0 +1,4 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openblas/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/project/CMakeLists.txt new file mode 100644 index 0000000..4d061e7 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/project/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.10) + +project(vcpkg-ci-openblas C) + +find_package(OpenBLAS CONFIG REQUIRED) + +add_executable(fortran-interface main.c) +target_link_libraries(fortran-interface PRIVATE OpenBLAS::OpenBLAS) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openblas/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/project/main.c new file mode 100644 index 0000000..04badb6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/project/main.c @@ -0,0 +1,19 @@ +#include <../openblas/cblas.h> /* check for header. */ + +extern void dgemm_(char*, char*, int*, int*,int*, double*, double*, int*, double*, int*, double*, double*, int*); + +int main() +{ + char ta = 'N'; + char tb = 'N'; + int m = 2; + int n = 2; + int k = 1; + double alpha = 0.5; + double A[2] = {1.0, 2.0}; // m x k + double B[2] = {3.0, 4.0}; // k x n + double beta = 0.05; + double C[4] = {100.0, 200.0, 300.0, 400.0}; // 2 x 2 + dgemm_(&ta, &tb, &m, &n, &k, &alpha, A, &m, B, &k, &beta, C, &m); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openblas/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/vcpkg.json new file mode 100644 index 0000000..de772b6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openblas/vcpkg.json @@ -0,0 +1,37 @@ +{ + "name": "vcpkg-ci-openblas", + "version-string": "ci", + "description": "Test openblas", + "license": null, + "dependencies": [ + "openblas", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test (mostly) everything", + "dependencies": [ + { + "name": "openblas", + "features": [ + "dynamic-arch" + ], + "platform": "linux" + }, + { + "name": "openblas", + "features": [ + "threads" + ], + "platform": "!windows" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-opencv/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-opencv/portfile.cmake new file mode 100644 index 0000000..0015715 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-opencv/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json new file mode 100644 index 0000000..b00ea1c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-opencv/vcpkg.json @@ -0,0 +1,223 @@ +{ + "name": "vcpkg-ci-opencv", + "version-string": "ci", + "description": "Port to force features of certain ports within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "dependencies": [ + { + "name": "opencv", + "default-features": false, + "features": [ + "ade", + "calib3d", + "contrib", + "eigen", + "ffmpeg", + "fs", + "highgui", + "intrinsics", + "jpeg", + "nonfree", + "png", + "quirc", + "thread", + "tiff" + ] + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "openmp" + ], + "platform": "!osx" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "jpegxl", + "openexr" + ], + "platform": "!uwp" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "opencl" + ], + "platform": "!uwp & !osx" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "dnn", + "webp" + ], + "platform": "!android" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "directml", + "dshow", + "msmf", + "win32ui" + ], + "platform": "windows & !uwp" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "tbb" + ], + "platform": "!uwp & !static" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "gapi", + "gstreamer" + ], + "platform": "!uwp & !(windows & static) & !android" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "python" + ], + "platform": "!uwp & !(windows & static) & !android & !linux" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "ovis" + ], + "platform": "!uwp & !android & !(windows & static)" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "cuda", + "cudnn", + "dnn-cuda" + ], + "platform": "(windows & x64 & !uwp) | (linux & x64) | (linux & arm64)" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "freetype", + "gdcm", + "ipp", + "openjpeg", + "qt", + "sfm", + "vtk", + "vulkan" + ], + "platform": "!uwp & !android & !(windows & (arm | arm64)) & !(osx & arm64)" + }, + { + "name": "opencv", + "default-features": false, + "features": [ + "aravis" + ], + "platform": "!android & !uwp" + }, + { + "name": "opencv2", + "default-features": false, + "features": [ + "eigen", + "jpeg", + "png", + "tiff" + ], + "platform": "!uwp & !(arm & windows) & !android" + }, + { + "name": "opencv2", + "default-features": false, + "features": [ + "jasper", + "opengl", + "qt" + ], + "platform": "!uwp & !android & !(windows & (arm | arm64))" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "eigen", + "jpeg", + "nonfree", + "png", + "quirc", + "tiff" + ] + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "openmp" + ], + "platform": "!osx" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "dnn", + "webp" + ], + "platform": "!android" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "msmf", + "ovis", + "tbb" + ], + "platform": "windows & x64 & !static & !uwp" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "gstreamer" + ], + "platform": "!uwp & !android & !(windows & static)" + }, + { + "name": "opencv3", + "default-features": false, + "features": [ + "contrib", + "freetype", + "gdcm", + "ipp", + "jasper", + "opengl", + "qt", + "sfm", + "vtk" + ], + "platform": "!uwp & !android & !(windows & (arm | arm64)) & !(osx & arm64)" + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/project/CMakeLists.txt new file mode 100644 index 0000000..09db055 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.7) +project(vcpkg-ci-openimageio CXX) + +add_executable(main main.cpp) + +find_package(OpenImageIO CONFIG REQUIRED) +target_link_libraries(main PRIVATE OpenImageIO::OpenImageIO) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/project/main.cpp new file mode 100644 index 0000000..c0f900e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/project/main.cpp @@ -0,0 +1,7 @@ +#include <OpenImageIO/imageio.h> + +int main(int, char**) +{ + auto inp = OIIO::ImageInput::open("none"); + return inp ? 0 : 1; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json new file mode 100644 index 0000000..73d989b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openimageio/vcpkg.json @@ -0,0 +1,48 @@ +{ + "name": "vcpkg-ci-openimageio", + "version-string": "ci", + "port-version": 1, + "description": "OpenImageIO testing within CI.", + "license": "MIT", + "dependencies": [ + { + "name": "openimageio", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "openimageio-features" + ], + "features": { + "openimageio-features": { + "description": "Enable OpenImageIO features", + "dependencies": [ + { + "name": "openimageio", + "default-features": false, + "features": [ + "ffmpeg", + "freetype", + "gif", + "libheif", + "libraw", + "opencolorio", + "opencv", + "openjpeg", + { + "name": "pybind11", + "platform": "!(windows & static) & !uwp & !mingw" + }, + "tools", + "viewer", + "webp" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/project/CMakeLists.txt new file mode 100644 index 0000000..4d66529 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.7) +project(openvpn3-test CXX) + +add_executable(main main.cpp) + +find_package(unofficial-openvpn3 CONFIG REQUIRED) +target_link_libraries(main PRIVATE unofficial::openvpn3::ovpncli) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/project/main.cpp new file mode 100644 index 0000000..ba1584a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/project/main.cpp @@ -0,0 +1,21 @@ +#include <openvpn/ovpncli.hpp> + +using namespace openvpn::ClientAPI; + +// Cf. https://github.com/OpenVPN/openvpn3/blob/master/README.rst#openvpn-3-client-core +class Client : public OpenVPNClient +{ +public: + void acc_event(const AppCustomControlMessageEvent &) override {} + void event(const Event&) override {} + void external_pki_cert_request(ExternalPKICertRequest &) override {} + void external_pki_sign_request(ExternalPKISignRequest &) override {} + void log(const LogInfo&) override {} + bool pause_on_connection_timeout() override { return false; } +}; + +int main() +{ + Client c; + return OpenVPNClient::stats_n(); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/vcpkg.json new file mode 100644 index 0000000..81c8f5f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-openvpn3/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-openvpn3", + "version-string": "ci", + "description": "Validates openvpn3", + "dependencies": [ + "openvpn3", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/portfile.cmake new file mode 100644 index 0000000..62422ca --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/portfile.cmake @@ -0,0 +1,7 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+)
+
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/CMakeLists.txt new file mode 100644 index 0000000..d8007be --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.26)
+
+project(vcpkg-ci-orange-math LANGUAGES CXX)
+
+set(CMAKE_CXX_STANDARD 23)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+add_executable(main main.cpp)
+
+find_package(omath CONFIG REQUIRED)
+target_link_libraries(main PRIVATE omath::omath)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp new file mode 100644 index 0000000..ae7779f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/project/main.cpp @@ -0,0 +1,8 @@ +#include <omath/omath.hpp>
+
+int main()
+{
+ omath::Vector2 w = omath::Vector2(20.0, 30.0);
+ return 0;
+}
+
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/vcpkg.json new file mode 100644 index 0000000..dcbdd38 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-orange-math/vcpkg.json @@ -0,0 +1,13 @@ +{
+ "name": "vcpkg-ci-orange-math",
+ "version-string": "ci",
+ "description": "Testing packages which provide orange-math",
+ "license": null,
+ "dependencies": [
+ "orange-math",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-paraview/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-paraview/portfile.cmake new file mode 100644 index 0000000..0015715 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-paraview/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-paraview/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-paraview/vcpkg.json new file mode 100644 index 0000000..db38ffb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-paraview/vcpkg.json @@ -0,0 +1,43 @@ +{ + "name": "vcpkg-ci-paraview", + "version-date": "2022-12-01", + "description": "Port to force features of certain ports within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "paraview", + "default-features": false, + "features": [ + "tools" + ] + }, + { + "name": "paraview", + "default-features": false, + "features": [ + "mpi", + "python" + ], + "platform": "!(windows & static) & !x86" + }, + { + "name": "vtk", + "default-features": false, + "features": [ + "gdal", + "utf8", + "vtkm" + ], + "platform": "!x86" + }, + { + "name": "vtk", + "default-features": false, + "features": [ + "openvr" + ], + "platform": "!osx & !(windows & staticcrt)" + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-plplot/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/portfile.cmake new file mode 100644 index 0000000..69f16ae --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/portfile.cmake @@ -0,0 +1,11 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + ${options} + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-plplot/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/project/CMakeLists.txt new file mode 100644 index 0000000..e77cc8f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/project/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.30) +project(plplot-test C CXX) + +find_package(plplot CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE + PLPLOT::plplot +) +target_compile_definitions(main PRIVATE USING_CMAKE) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(plplot_pc plplot REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::plplot_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-plplot/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/project/main.c new file mode 100644 index 0000000..b2d4cd8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/project/main.c @@ -0,0 +1,24 @@ + +#ifdef USING_CMAKE +#include <plplot/plplot.h> +#else +#include <plplot.h> +#endif + +int main() +{ + PLFLT x[5], y[5]; + for (int i = 0; i < 5; i++) + { + x[i] = 0.25 * (PLFLT)(i); + y[i] = 2.0 * x[i]; + } + + plinit(); + plenv(0.0, 1.0, 0.0, 2.0, 0, 0); + pllab("x", "y", "2D line plot"); + plline(5, x, y); + plend(); + + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-plplot/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/vcpkg.json new file mode 100644 index 0000000..e4e41f0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-plplot/vcpkg.json @@ -0,0 +1,34 @@ +{ + "name": "vcpkg-ci-plplot", + "version-string": "ci", + "description": "Port to force features of plplot within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "plplot", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "plplot", + "features": [ + "wxwidgets" + ], + "platform": "!android" + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-podofo/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-podofo/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/project/CMakeLists.txt new file mode 100644 index 0000000..eb248ce --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/project/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.16) +project(podofo-test) + +set(CMAKE_CXX_STANDARD 17) + +find_package(podofo CONFIG REQUIRED) + +add_executable(main main.cxx) +target_link_libraries(main PRIVATE podofo::podofo) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(podofo_pc libpodofo REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.cxx) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::podofo_pc) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-podofo/project/main.cxx b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/project/main.cxx new file mode 100644 index 0000000..595c445 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/project/main.cxx @@ -0,0 +1,16 @@ +#include <stdio.h> +#include <podofo/podofo.h> + +int main() +{ + PoDoFo::PdfMemDocument document; + auto font = document.GetFonts().SearchFont("Arial"); + if (document.GetPages().GetCount() > 0) + { + auto& page = document.GetPages().GetPageAt(0); + auto& signature = page.CreateField<PoDoFo::PdfSignature>("Signature2", PoDoFo::Rect()); + char x509certbuffer[256], pkeybuffer[256]; + PoDoFo::PdfSignerCms signer(x509certbuffer, pkeybuffer); + } + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-podofo/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/vcpkg.json new file mode 100644 index 0000000..5fbea68 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-podofo/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-podofo", + "version-string": "ci", + "description": "Port to fvalidate podofo CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "podofo", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/portfile.cmake new file mode 100644 index 0000000..9354a1e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_get_vcpkg_installed_python(PYTHON3) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPython_EXECUTABLE=${PYTHON3}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/project/CMakeLists.txt new file mode 100644 index 0000000..bc169ae --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/project/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.30) +project(pybind11-test CXX) + +set(PYBIND11_FINDPYTHON ON) +find_package(pybind11 CONFIG REQUIRED) + +# Easy +pybind11_add_module(test-pybind11 main.cpp) + +# Advanced +Python_add_library(test-python main.cpp) +target_link_libraries(test-python PRIVATE pybind11::headers) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/project/main.cpp new file mode 100644 index 0000000..4f4b09e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/project/main.cpp @@ -0,0 +1,10 @@ +#include <pybind11/pybind11.h> + +int mul(int i, int j) { + return i * j; +} + +PYBIND11_MODULE(example, m) { + m.doc() = "vcpkg pybind11 test"; + m.def("mul", &mul, "Multiplies two numbers"); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/vcpkg.json new file mode 100644 index 0000000..2406412 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-pybind11/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "vcpkg-ci-pybind11", + "version-string": "ci", + "description": "Port to test pybind11 in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + "pybind11", + "python3", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-python3/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-python3/portfile.cmake new file mode 100644 index 0000000..8c5cd4f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-python3/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+)
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-python3/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-python3/project/CMakeLists.txt new file mode 100644 index 0000000..6339bfa --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-python3/project/CMakeLists.txt @@ -0,0 +1,87 @@ +cmake_minimum_required(VERSION 3.12)
+project(python3-test)
+
+set(Python_ARTIFACTS_PREFIX "_MEOW")
+
+# We need to opt-out of CMP0148 to be able to test the pre-CMake 3.12 Python
+# find modules. The old policy is deprecated, so, at some point, this aspect
+# of the test will have to go away.
+if(POLICY CMP0148)
+ cmake_policy(SET CMP0148 OLD)
+endif()
+
+# The purpose of this test is to ensure that we get the expected values
+# from the finders, not crosscompiling. So, let's not even go there.
+# These find_package() calls aren't required because FindPythonInterp
+# seems to not return a result in CI. Probably because FindPythonInterp
+# prefers the system Python instead of the executable from the python3
+# port.
+if(NOT CMAKE_CROSSCOMPILING)
+ find_package(PythonInterp)
+endif()
+find_package(PythonLibs)
+
+# The old find modules should NOT be prefixed.
+if(DEFINED PythonInterp_MEOW_FOUND OR DEFINED PYTHON_MEOW_EXECUTABLE)
+ message(FATAL_ERROR "FindPythonInterp prefixed the result variables")
+endif()
+if(DEFINED PythonLibs_MEOW_FOUND OR DEFINED PYTHON_MEOW_LIBRARIES)
+ message(FATAL_ERROR "FindPythonLibs prefixed the result variables")
+endif()
+
+function(test_result NAME TYPE EXPECTED UNEXPECTED)
+ if(NOT ${TYPE} ${EXPECTED}${NAME})
+ message(FATAL_ERROR "${EXPECTED}${NAME} should be ${TYPE}")
+ endif()
+ if(${TYPE} ${UNEXPECTED}${NAME})
+ message(FATAL_ERROR "${UNEXPECTED}${NAME} should not be ${TYPE}")
+ endif()
+endfunction()
+
+function(test_new_finder EXPECTED UNEXPECTED)
+ test_result(::Python TARGET ${EXPECTED} ${UNEXPECTED})
+ test_result(_LIBRARIES DEFINED ${EXPECTED} ${UNEXPECTED})
+
+ if(NOT CMAKE_CROSSCOMPILING)
+ test_result(_EXECUTABLE DEFINED ${EXPECTED} ${UNEXPECTED})
+ test_result(_STDLIB DEFINED ${EXPECTED} ${UNEXPECTED})
+ test_result(::Interpreter TARGET ${EXPECTED} ${UNEXPECTED})
+ endif()
+endfunction()
+
+if(NOT CMAKE_CROSSCOMPILING)
+ set(_INTERPRETER "Interpreter")
+endif()
+
+# The new find modules should be prefixed if CMake is 4.0+
+find_package(Python REQUIRED COMPONENTS ${_INTERPRETER} Development)
+if(CMAKE_VERSION VERSION_GREATER_EQUAL 4.0)
+ set(EXPECTED_PYTHON Python_MEOW)
+ set(UNEXPECTED_PYTHON Python)
+else()
+ set(EXPECTED_PYTHON Python)
+ set(UNEXPECTED_PYTHON Python_MEOW)
+endif()
+test_new_finder(${EXPECTED_PYTHON} ${UNEXPECTED_PYTHON})
+
+# Also test non-prefixed. Use Python3:: to avoid conflicts with Python_MEOW::
+# The test against Python3_MEOW should never happen because the prefix variable
+# should be Python3_ARTIFACT_PREFIX, but we set Python_ARTIFACT_PREFIX.
+find_package(Python3 REQUIRED COMPONENTS ${_INTERPRETER} Development)
+test_new_finder(Python3 Python3_MEOW)
+
+# Test embedding the libraries found.
+function(add_test_executable TARGET LIBRARIES INCLUDES)
+ add_executable(${TARGET} main.c)
+ target_link_libraries(${TARGET} PRIVATE ${LIBRARIES})
+ if(INCLUDES)
+ target_include_directories(${TARGET} PRIVATE ${INCLUDES})
+ endif()
+endfunction()
+
+# We're purposefully not testing the result of the old finders.
+# The python3 port never added a vcpkg-cmake-wrapper for FindPythonLibs,
+# and it seems like a poor use of time to do so at this point - the
+# old finders are soft removed as of CMake 3.27.
+add_test_executable(new_with_prefix "${EXPECTED_PYTHON}::Python" "")
+add_test_executable(new_without_prefix "${Python3_LIBRARIES}" "${Python3_INCLUDE_DIRS}")
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-python3/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-python3/project/main.c new file mode 100644 index 0000000..cdd5cbe --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-python3/project/main.c @@ -0,0 +1,19 @@ +#include <Python.h>
+
+int main()
+{
+ PyConfig config;
+ PyConfig_InitPythonConfig(&config);
+ config.write_bytecode = 0;
+ PyConfig_SetString(&config, &config.program_name, L"test");
+
+ PyStatus status = Py_InitializeFromConfig(&config);
+ if (PyStatus_Exception(status)) {
+ PyConfig_Clear(&config);
+ Py_ExitStatusException(status);
+ }
+
+ Py_FinalizeEx();
+ PyConfig_Clear(&config);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-python3/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-python3/vcpkg.json new file mode 100644 index 0000000..a2eca55 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-python3/vcpkg.json @@ -0,0 +1,37 @@ +{
+ "name": "vcpkg-ci-python3",
+ "version-string": "ci",
+ "description": "Port to test python3 in CI",
+ "homepage": "https://github.com/microsoft/vcpkg",
+ "license": "MIT",
+ "dependencies": [
+ "python3",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ],
+ "default-features": [
+ "ci"
+ ],
+ "features": {
+ "ci": {
+ "description": "Test features in CI",
+ "dependencies": [
+ {
+ "name": "python3",
+ "features": [
+ {
+ "name": "extensions",
+ "platform": "!(windows & staticcrt)"
+ },
+ {
+ "name": "readline",
+ "platform": "!windows"
+ }
+ ]
+ }
+ ]
+ }
+ }
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/portfile.cmake new file mode 100644 index 0000000..e3a7604 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/portfile.cmake @@ -0,0 +1,13 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+if(EXISTS "${CURRENT_INSTALLED_DIR}/share/Qt6Pdf/Qt6PdfTargets.cmake")
+ file(COPY_FILE "${CURRENT_INSTALLED_DIR}/share/Qt6Pdf/Qt6PdfTargets.cmake" "${CURRENT_BUILDTREES_DIR}/Qt6PdfTargets.cmake-${TARGET_TRIPLET}.log")
+endif()
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+ OPTIONS
+ "-DFEATURES=${FEATURES}"
+)
+
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/project/CMakeLists.txt new file mode 100644 index 0000000..be214f8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/project/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.24)
+
+project(vcpkg-ci-qtwebengine LANGUAGES C CXX)
+
+add_executable(main main.cpp)
+
+if("pdf" IN_LIST FEATURES)
+ find_package(Qt6 REQUIRED COMPONENTS Pdf)
+ target_link_libraries(main PRIVATE Qt6::Pdf)
+ target_compile_definitions(main PRIVATE REQUIRE_PDF)
+endif()
+
+if("webengine" IN_LIST FEATURES)
+ find_package(Qt6 REQUIRED COMPONENTS WebEngineCore)
+ target_link_libraries(main PRIVATE Qt6::WebEngineCore)
+ target_compile_definitions(main PRIVATE REQUIRE_WEBENGINE)
+endif()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/project/main.cpp new file mode 100644 index 0000000..ecb352b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/project/main.cpp @@ -0,0 +1,18 @@ +#ifdef REQUIRE_PDF
+#include <QPdfDocument>
+#endif
+#ifdef REQUIRE_WEBENGINE
+#include <QWebEnginePage>
+#endif
+
+int main()
+{
+#ifdef REQUIRE_PDF
+ QPdfDocument doc(nullptr);
+#endif
+#ifdef REQUIRE_WEBENGINE
+ QObject* parent = nullptr;
+ QWebEnginePage page(parent);
+#endif
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/vcpkg.json new file mode 100644 index 0000000..545ad61 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-qtwebengine/vcpkg.json @@ -0,0 +1,45 @@ +{ + "name": "vcpkg-ci-qtwebengine", + "version-string": "ci", + "description": "Testing qtwebengine", + "license": null, + "dependencies": [ + "qtwebengine", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "ci" + ], + "features": { + "ci": { + "description": "Default CI configuration", + "dependencies": [ + { + "name": "vcpkg-ci-qtwebengine", + "default-features": false, + "features": [ + "pdf" + ], + "platform": "android | ios | (linux & !x86) | osx | (windows & x64 & !static)" + }, + { + "name": "vcpkg-ci-qtwebengine", + "default-features": false, + "features": [ + "webengine" + ], + "platform": "!static & ((linux & !x86) | osx | (windows & x64 & !static))" + } + ] + }, + "pdf": { + "description": "Test PDF module" + }, + "webengine": { + "description": "Test WebEngine module" + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt new file mode 100644 index 0000000..13a2678 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/project/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.7) +project(soci-test CXX) + +if(APPLE) + set(CMAKE_CXX_STANDARD 11) +endif() + +add_executable(main main.cpp) + +find_package(unofficial-rest-rpc CONFIG REQUIRED) +target_link_libraries(main unofficial::rest-rpc::rest-rpc) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp new file mode 100644 index 0000000..4165c75 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/project/main.cpp @@ -0,0 +1,9 @@ +#include <rest_rpc.hpp> + +int main() +{ + rest_rpc::rpc_client client("127.0.0.1", 8080); + client.connect(); + client.run(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json new file mode 100644 index 0000000..814d21d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rest-rpc/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-rest-rpc", + "version-string": "ci", + "description": "Validates rest-rpc", + "dependencies": [ + "rest-rpc", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/project/CMakeLists.txt new file mode 100644 index 0000000..650d167 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/project/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.10) +project(rtlsdr-test C) + +find_package(PkgConfig REQUIRED) + +block() + find_package(rtlsdr CONFIG REQUIRED) + + add_executable(rtlsdr_cmake main.c) + target_link_libraries(rtlsdr_cmake $<IF:$<TARGET_EXISTS:rtlsdr::rtlsdr>,rtlsdr::rtlsdr,rtlsdr::rtlsdr_static>) +endblock() + +block() + pkg_check_modules(librtlsdr IMPORTED_TARGET REQUIRED librtlsdr) + + add_executable(rtlsdr_pkgconfig main.c) + target_link_libraries(rtlsdr_pkgconfig PkgConfig::librtlsdr) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/project/main.c new file mode 100644 index 0000000..8dc76e6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/project/main.c @@ -0,0 +1,6 @@ +#include <rtl-sdr.h> + +int main() +{ + return (int)rtlsdr_get_device_count(); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/vcpkg.json new file mode 100644 index 0000000..9f3b1ca --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-rtlsdr/vcpkg.json @@ -0,0 +1,31 @@ +{ + "name": "vcpkg-ci-rtlsdr", + "version-string": "ci", + "description": "Validates rtlsdr", + "dependencies": [ + "rtlsdr", + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + { + "name": "tools", + "platform": "!android" + } + ], + "features": { + "tools": { + "description": "Install rtlsdr tools", + "dependencies": [ + { + "name": "rtlsdr", + "features": [ + "tools" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ryu/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/CMakeLists.txt new file mode 100644 index 0000000..c69040d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.30)
+project(vcpkg-ci-ryu LANGUAGES C)
+find_package(ryu CONFIG REQUIRED)
+add_executable(test test.c)
+target_link_libraries(test PUBLIC RYU::ryu RYU::ryu_printf)
+install(TARGETS test RUNTIME DESTINATION bin/vcpkg-ci-ryu)
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ryu/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/portfile.cmake new file mode 100644 index 0000000..a5327e0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/portfile.cmake @@ -0,0 +1,9 @@ +set(VCPKG_POLICY_SKIP_ALL_POST_BUILD_CHECKS enabled) +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}") +vcpkg_cmake_install() +if(NOT VCPKG_CROSSCOMPILING) + vcpkg_execute_required_process(COMMAND "${CURRENT_PACKAGES_DIR}/bin/vcpkg-ci-ryu/test" WORKING_DIRECTORY "." LOGNAME release-test) + if(NOT VCPKG_BUILD_TYPE) + vcpkg_execute_required_process(COMMAND "${CURRENT_PACKAGES_DIR}/debug/bin/vcpkg-ci-ryu/test" WORKING_DIRECTORY "." LOGNAME debug-test) + endif() +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ryu/test.c b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/test.c new file mode 100644 index 0000000..b5fbd1f --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/test.c @@ -0,0 +1,21 @@ +#include <string.h> +#include <stdio.h> + +#include <ryu/ryu.h> +#include <ryu/ryu2.h> + +int main() { + char* result = d2s(3.14); + if (strcmp(result, "3.14E0") != 0) { + printf("Unexpected ryu: %s\n", result); + return 1; + } + + result = d2fixed(3.14159, 1); + if (strcmp(result, "3.1") != 0) { + printf("Unexpected ryu_printf: %s\n", result); + return 2; + } + + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-ryu/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/vcpkg.json new file mode 100644 index 0000000..4a937cd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-ryu/vcpkg.json @@ -0,0 +1,11 @@ +{ + "name": "vcpkg-ci-ryu", + "version-date": "2024-12-17", + "dependencies": [ + "ryu", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/project/CMakeLists.txt new file mode 100644 index 0000000..8032dee --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/project/CMakeLists.txt @@ -0,0 +1,25 @@ +cmake_minimum_required(VERSION 3.30) +project(sdl3-image-test C CXX) # C++ for tiff[lerc] + +block(SCOPE_FOR VARIABLES) + find_package(SDL3_image CONFIG REQUIRED) + + add_executable(main main.c) + target_link_libraries(main PRIVATE + $<IF:$<TARGET_EXISTS:SDL3_image::SDL3_image-shared>,SDL3_image::SDL3_image-shared,SDL3_image::SDL3_image-static> + ) +endblock() + +block(SCOPE_FOR VARIABLES) + find_package(PkgConfig REQUIRED) + pkg_check_modules(PC_SDL3_IMAGE sdl3-image REQUIRED IMPORTED_TARGET) + + add_executable(main-pkconfig main.c) + if(WIN32 AND NOT MINGW) + target_link_libraries(main-pkconfig PRIVATE PkgConfig::PC_SDL3_IMAGE) + else() + # Use raw flags, avoid find_library + target_compile_options(main-pkconfig PRIVATE ${PC_SDL3_IMAGE_CFLAGS}) + target_link_libraries(main-pkconfig PRIVATE ${PC_SDL3_IMAGE_LDFLAGS}) + endif() +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/project/main.c new file mode 100644 index 0000000..ed8a3bc --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/project/main.c @@ -0,0 +1,7 @@ +#include <SDL3_image/SDL_image.h> + +int main() +{ + IMG_Version(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/vcpkg.json new file mode 100644 index 0000000..369e623 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-image/vcpkg.json @@ -0,0 +1,36 @@ +{ + "name": "vcpkg-ci-sdl3-image", + "version-string": "ci", + "description": "Port to force features of sdl3-image within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "sdl3-image", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "sdl3-image", + "features": [ + "jpeg", + "png", + "tiff", + "webp" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/project/CMakeLists.txt new file mode 100644 index 0000000..3e8d4a3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.30) +project(sdl3-ttf-test C) + +find_package(SDL3_ttf CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE SDL3_ttf::SDL3_ttf) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(PC_SDL3_TTF sdl3-ttf REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::PC_SDL3_TTF) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/project/main.c new file mode 100644 index 0000000..dc280e5 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/project/main.c @@ -0,0 +1,9 @@ +#include <SDL3_ttf/SDL_ttf.h> + +int main() +{ + TTF_Init(); + TTF_Version(); + TTF_Quit(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/vcpkg.json new file mode 100644 index 0000000..c348ea9 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sdl3-ttf/vcpkg.json @@ -0,0 +1,68 @@ +{ + "name": "vcpkg-ci-sdl3-ttf", + "version-string": "ci", + "description": "Port to validate sdl3-ttf in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "sdl3-ttf", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "vcpkg-ci-sdl3-ttf", + "features": [ + "harfbuzz", + "plutosvg-freetype", + "svg" + ] + } + ] + }, + "harfbuzz": { + "description": "Use sdl3-ttf[harfbuzz]", + "dependencies": [ + { + "name": "sdl3-ttf", + "features": [ + "harfbuzz" + ] + } + ] + }, + "plutosvg-freetype": { + "description": "Use plutosvg[freetype]", + "dependencies": [ + { + "name": "plutosvg", + "features": [ + "freetype" + ] + } + ] + }, + "svg": { + "description": "Use sdl3-ttf[svg]", + "dependencies": [ + { + "name": "sdl3-ttf", + "features": [ + "svg" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/portfile.cmake new file mode 100644 index 0000000..0860f0c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-Dslang_DIR=${CURRENT_HOST_INSTALLED_DIR}/share/slang" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/project/CMakeLists.txt new file mode 100644 index 0000000..b986fbc --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/project/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.25) +project(shader-slang-test) + +find_package(slang CONFIG REQUIRED) + +set(CMAKE_EXECUTE_PROCESS_COMMAND_ECHO STDOUT) + +execute_process( + COMMAND "${SLANGC_EXECUTABLE}" -v + COMMAND_ERROR_IS_FATAL ANY +) + +add_custom_target(run-slang ALL + COMMAND slang::slangc -v +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/vcpkg.json new file mode 100644 index 0000000..a4514ad --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-shader-slang/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-shader-slang", + "version-string": "ci", + "description": "Test port to validate shader-slang", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "shader-slang", + "host": true + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-skia/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-skia/portfile.cmake new file mode 100644 index 0000000..b9d37dd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-skia/portfile.cmake @@ -0,0 +1,6 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_INSTALLED_DIR}/share/skia/example" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-skia/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-skia/vcpkg.json new file mode 100644 index 0000000..e59883b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-skia/vcpkg.json @@ -0,0 +1,48 @@ +{ + "name": "vcpkg-ci-skia", + "version-date": "2023-04-03", + "description": "Builds an app in order to validate the skia port.", + "license": "BSD-3-Clause", + "dependencies": [ + { + "name": "skia", + "default-features": false + }, + { + "name": "skia", + "default-features": false, + "features": [ + "metal" + ], + "platform": "osx" + }, + { + "name": "skia", + "default-features": false, + "features": [ + "graphite" + ], + "platform": "windows & !uwp" + }, + { + "name": "skia", + "default-features": false, + "features": [ + "dawn" + ], + "platform": "!android & !uwp" + }, + { + "name": "skia", + "default-features": false, + "features": [ + "vulkan" + ], + "platform": "linux | osx | (windows & !uwp)" + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-soci/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-soci/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-soci/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-soci/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-soci/project/CMakeLists.txt new file mode 100644 index 0000000..31535c1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-soci/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.7) +project(soci-test CXX) + +if(APPLE) + set(CMAKE_CXX_STANDARD 11) +endif() + +add_executable(main main.cpp) + +find_package(SOCI CONFIG REQUIRED) +target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_mysql>,SOCI::soci_mysql,SOCI::soci_mysql_static>) +target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_postgresql>,SOCI::soci_postgresql,SOCI::soci_postgresql_static>) +target_link_libraries(main PRIVATE $<IF:$<TARGET_EXISTS:SOCI::soci_sqlite3>,SOCI::soci_sqlite3,SOCI::soci_sqlite3_static>) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-soci/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-soci/project/main.cpp new file mode 100644 index 0000000..86377ac --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-soci/project/main.cpp @@ -0,0 +1,11 @@ +#include <soci/soci.h> +#include <soci/mysql/soci-mysql.h> +#include <soci/postgresql/soci-postgresql.h> +#include <soci/sqlite3/soci-sqlite3.h> + +int main() +{ + soci::session mysql_db(soci::mysql, "test:mysql"); + soci::session pgsql_db(soci::postgresql, "test:postgresql"); + soci::session sqlite3_db(soci::sqlite3, "test.db"); +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-soci/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-soci/vcpkg.json new file mode 100644 index 0000000..8ff0c29 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-soci/vcpkg.json @@ -0,0 +1,20 @@ +{ + "name": "vcpkg-ci-soci", + "version-string": "ci", + "description": "Validates soci", + "supports": "x64 & (linux | osx | windows) & !uwp", + "dependencies": [ + { + "name": "soci", + "features": [ + "mysql", + "postgresql", + "sqlite3" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sqlpp11/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-sqlpp11/portfile.cmake new file mode 100644 index 0000000..065116c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sqlpp11/portfile.cmake @@ -0,0 +1 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-sqlpp11/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-sqlpp11/vcpkg.json new file mode 100644 index 0000000..777022e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-sqlpp11/vcpkg.json @@ -0,0 +1,36 @@ +{ + "name": "vcpkg-ci-sqlpp11", + "version-string": "ci", + "description": "Port to force features of sqlpp11 within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "sqlpp11", + "features": [ + "sqlite3" + ] + }, + { + "name": "sqlpp11", + "features": [ + "postgresql" + ], + "platform": "!uwp" + }, + { + "name": "sqlpp11", + "features": [ + "mariadb" + ], + "platform": "android | (x86 & windows)" + }, + { + "name": "sqlpp11", + "features": [ + "mysql" + ], + "platform": "!android & !uwp & !(x86 & windows)" + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/portfile.cmake new file mode 100644 index 0000000..52f7481 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_find_acquire_program(PKGCONFIG) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/project/CMakeLists.txt new file mode 100644 index 0000000..d129464 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(tdlib-test CXX)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+find_package(Td CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE Td::TdStatic)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(tdclient REQUIRED IMPORTED_TARGET tdclient)
+add_executable(main2 main.cpp)
+target_link_libraries(main2 PRIVATE PkgConfig::tdclient)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/project/main.cpp new file mode 100644 index 0000000..79f5bf2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/project/main.cpp @@ -0,0 +1,8 @@ +#include <td/telegram/Client.h>
+#include <memory>
+int main()
+{
+ std::unique_ptr<td::ClientManager> client_manager_;
+ auto response = client_manager_->receive(10);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/vcpkg.json new file mode 100644 index 0000000..07724ae --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tdlib/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-tdlib", + "version-string": "ci", + "description": "Validates tdlib", + "dependencies": [ + "tdlib", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/portfile.cmake new file mode 100644 index 0000000..8a2079b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/portfile.cmake @@ -0,0 +1,5 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/project/CMakeLists.txt new file mode 100644 index 0000000..ceedefc --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/project/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(tgbot-cpp-test CXX)
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+find_package(Threads)
+find_package(Boost COMPONENTS system REQUIRED)
+find_package(CURL REQUIRED)
+find_package(TgBot CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_compile_definitions(main PRIVATE HAVE_CURL)
+target_link_libraries(main PRIVATE TgBot::TgBot)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/project/main.cpp new file mode 100644 index 0000000..dfe54c5 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/project/main.cpp @@ -0,0 +1,10 @@ +#include <tgbot/tgbot.h>
+using namespace TgBot;
+int main()
+{
+ CurlHttpClient curlHttpClient;
+ Bot bot("TOKEN", curlHttpClient);
+ bot.getApi().deleteWebhook();
+ auto fileContent = FileTools::read("file.txt");
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/vcpkg.json new file mode 100644 index 0000000..845adad --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tgbot-cpp/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-tgbot-cpp", + "version-string": "ci", + "description": "Validates tgbot-cpp", + "dependencies": [ + "tgbot-cpp", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/project/CMakeLists.txt new file mode 100644 index 0000000..4a54d5b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/project/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.30) +project(tomlplusplus-test CXX) + + +find_package(tomlplusplus CONFIG REQUIRED) + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE tomlplusplus::tomlplusplus) + + +find_package(PkgConfig REQUIRED) +pkg_check_modules(tomlplusplus_pc tomlplusplus REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.cpp) +target_compile_features(main-pkconfig PRIVATE cxx_std_17) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::tomlplusplus_pc) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/project/main.cpp new file mode 100644 index 0000000..3382010 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/project/main.cpp @@ -0,0 +1,22 @@ +#include <iostream> +#include <toml++/toml.hpp> + +int main(int argc, char** argv) +{ + if (argc < 2) + return 1; + + try + { + toml::table tbl; + tbl = toml::parse_file(argv[1]); + std::cout << tbl << "\n"; + } + catch (const toml::parse_error& err) + { + std::cerr << "Parsing failed: " << err << "\n"; + return 2; + } + + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/vcpkg.json new file mode 100644 index 0000000..155989e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tomlplusplus/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-ci-tomlplusplus", + "version-string": "ci", + "description": "Port to force features of tomlplusplus within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + "tomlplusplus", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/project/CMakeLists.txt new file mode 100644 index 0000000..9c5208a --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/project/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.30) +project(tree-sitter-test C) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(tree-sitter_pc tree-sitter REQUIRED IMPORTED_TARGET) +pkg_check_modules(tree-sitter-c_pc tree-sitter-c REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE + PkgConfig::tree-sitter_pc + PkgConfig::tree-sitter-c_pc +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/project/main.c new file mode 100644 index 0000000..cab3ce6 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/project/main.c @@ -0,0 +1,21 @@ +#include <stdio.h> +#include <string.h> +#include <tree_sitter/api.h> +#include <tree_sitter/tree-sitter-c.h> + +int main() +{ + TSParser *parser = ts_parser_new(); + ts_parser_set_language(parser, tree_sitter_c()); + + const char *source_code = "int main() { return -1; }\n"; + TSTree *tree = ts_parser_parse_string(parser, NULL, source_code, strlen(source_code)); + TSNode root_node = ts_tree_root_node(tree); + char *string = ts_node_string(root_node); + printf("Syntax tree: %s\n", string); + + free(string); + ts_tree_delete(tree); + ts_parser_delete(parser); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/vcpkg.json new file mode 100644 index 0000000..b418ddd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-tree-sitter/vcpkg.json @@ -0,0 +1,15 @@ +{ + "name": "vcpkg-ci-tree-sitter", + "version-string": "ci", + "description": "Port to test the tree-sitter group of port in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + "tree-sitter", + "tree-sitter-c", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unarr/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/portfile.cmake new file mode 100644 index 0000000..dd25706 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/portfile.cmake @@ -0,0 +1,10 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unarr/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/project/CMakeLists.txt new file mode 100644 index 0000000..95009f8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/project/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.25.1)
+project(unarr-test LANGUAGES C)
+set(CMAKE_C_STANDARD 99)
+set(CMAKE_C_STANDARD_REQUIRED ON)
+
+find_package(unarr CONFIG REQUIRED)
+add_executable(main main.c)
+target_link_libraries(main PRIVATE unarr::unarr)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(libunarr REQUIRED IMPORTED_TARGET libunarr)
+add_executable(main2 main.c)
+target_link_libraries(main2 PRIVATE PkgConfig::libunarr)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unarr/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/project/main.c new file mode 100644 index 0000000..0a987df --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/project/main.c @@ -0,0 +1,8 @@ +#include <unarr.h>
+int main()
+{
+ ar_stream *stream;
+ ar_archive *ar = ar_open_rar_archive(stream);
+ ar_close_archive(ar);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unarr/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/vcpkg.json new file mode 100644 index 0000000..38d8fe9 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unarr/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-unarr", + "version-string": "ci", + "description": "Validates unarr", + "dependencies": [ + "unarr", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/portfile.cmake new file mode 100644 index 0000000..6f0a127 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/portfile.cmake @@ -0,0 +1,10 @@ +SET(VCPKG_POLICY_EMPTY_PACKAGE enabled)
+
+vcpkg_find_acquire_program(PKGCONFIG)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${CURRENT_PORT_DIR}/project"
+ OPTIONS
+ "-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
+)
+vcpkg_cmake_build()
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/project/CMakeLists.txt new file mode 100644 index 0000000..43652ce --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/project/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.5)
+
+project(vcpkg-ci-unicorn C)
+
+set(CMAKE_C_STANDARD 11)
+
+find_package(PkgConfig REQUIRED)
+pkg_check_modules(unicorn REQUIRED IMPORTED_TARGET unicorn)
+
+add_executable(main main.c)
+
+target_link_libraries(main PRIVATE PkgConfig::unicorn)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/project/main.c new file mode 100644 index 0000000..9f7b3ed --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/project/main.c @@ -0,0 +1,8 @@ +#include <unicorn/unicorn.h>
+
+int main()
+{
+ uc_engine* uc;
+ uc_open(UC_ARCH_X86, UC_MODE_32, &uc);
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/vcpkg.json new file mode 100644 index 0000000..71ef60d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unicorn/vcpkg.json @@ -0,0 +1,13 @@ +{
+ "name": "vcpkg-ci-unicorn",
+ "version-string": "ci",
+ "description": "Testing packages which provide unicorn",
+ "license": null,
+ "dependencies": [
+ "unicorn",
+ {
+ "name": "vcpkg-cmake",
+ "host": true
+ }
+ ]
+}
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake new file mode 100644 index 0000000..0122f05 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/portfile.cmake @@ -0,0 +1,9 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) +set(ENV{PKG_CONFIG} "${PKGCONFIG}") + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt new file mode 100644 index 0000000..48baa06 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.30) +project(unixodbc-test C) + +# legacy vcpkg-only name, now forwarding to "unofficial" names +find_package(unixodbc CONFIG REQUIRED) + +add_executable(main main.c) +target_link_libraries(main PRIVATE UNIX::odbc) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(unixodbc_pc odbc REQUIRED IMPORTED_TARGET) + +add_executable(main-pkconfig main.c) +target_link_libraries(main-pkconfig PRIVATE PkgConfig::unixodbc_pc) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c new file mode 100644 index 0000000..cf182c1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/project/main.c @@ -0,0 +1,27 @@ +/* https://www.unixodbc.org/doc/ProgrammerManual/Tutorial/ has + * #include <odbc/sql.h> + * but actual pkgconfig files and MS ODBC documentation suggest + * #include <sql.h> + */ +#include <sql.h> +#include <stdio.h> + +int main() +{ + SQLHENV odbc_handle; + long result = SQLAllocHandle(SQL_HANDLE_ENV, SQL_NULL_HANDLE, &odbc_handle); + if ((result != SQL_SUCCESS) && (result != SQL_SUCCESS_WITH_INFO)) + return 1; + + SQLCHAR l_dsn[100], l_desc[100]; + SQLUSMALLINT l_len1, l_len2, l_next; + for (short int l_next = SQL_FETCH_FIRST; + SQLDataSources(odbc_handle, l_next, l_dsn, sizeof(l_dsn), &l_len1, l_desc, sizeof(l_desc), &l_len2) == SQL_SUCCESS; + l_next = SQL_FETCH_NEXT) + { + printf("Server '%s' (%s)\n", l_dsn, l_desc); + } + + SQLFreeHandle(SQL_HANDLE_ENV, odbc_handle); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json new file mode 100644 index 0000000..6973fa9 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-unixodbc/vcpkg.json @@ -0,0 +1,14 @@ +{ + "name": "vcpkg-ci-unixodbc", + "version-string": "ci", + "description": "Test port for unixodbc usage", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + "unixodbc" + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/portfile.cmake new file mode 100644 index 0000000..bc78596 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/portfile.cmake @@ -0,0 +1,4 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure(SOURCE_PATH "${CURRENT_PORT_DIR}/project") +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/project/CMakeLists.txt new file mode 100644 index 0000000..9a09081 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/project/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.30) +project(uwebsockets-test CXX) + +find_package(unofficial-uwebsockets CONFIG REQUIRED) + +add_executable(main main.cxx) +target_link_libraries(main PRIVATE + $<TARGET_NAME:unofficial::uwebsockets::uwebsockets> +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/project/main.cxx b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/project/main.cxx new file mode 100644 index 0000000..1c64685 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/project/main.cxx @@ -0,0 +1,10 @@ +#include <string> +#include <uwebsockets/App.h> + +int main() +{ + uWS::App().get("/hello", [](auto *res, auto *req) { + res->end("Hello World!"); + }); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/vcpkg.json new file mode 100644 index 0000000..17fa450 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-uwebsockets/vcpkg.json @@ -0,0 +1,34 @@ +{ + "name": "vcpkg-ci-uwebsockets", + "version-string": "ci", + "description": "Port to test features of uwebsockets within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "uwebsockets", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ], + "default-features": [ + "all" + ], + "features": { + "all": { + "description": "Test all features", + "dependencies": [ + { + "name": "uwebsockets", + "features": [ + "ssl", + "zlib" + ] + } + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/portfile.cmake new file mode 100644 index 0000000..3795fc8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/portfile.cmake @@ -0,0 +1,44 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +include("${CURRENT_HOST_INSTALLED_DIR}/share/unit-test-cmake/test-macros.cmake") + +if("scripts-cl-cpp-wrapper" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-scripts-cl_cpp_wrapper.cmake") +endif() + +if("vcpkg-make-cl-cpp-wrapper" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-vcpkg-make-cl_cpp_wrapper.cmake") +endif() + +if("z-vcpkg-make-prepare-compile-flags" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_prepare_compile_flags.cmake") +endif() + +if("z-vcpkg-make-normalize-arch" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_normalize_arch.cmake") +endif() + +if("z-vcpkg-make-determine-host-arch" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_determine_host_arch.cmake") +endif() + +if("z-vcpkg-make-determine-target-arch" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_determine_target_arch.cmake") +endif() + +if("z-vcpkg-make-determine-target-triplet" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_determine_target_triplet.cmake") +endif() + +if("z-vcpkg-make-z-adapt-lib-link-names" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_adapt_lib_link_names.cmake") +endif() + +if("z-vcpkg-make-get-configure-triplets" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_get_configure_triplets.cmake") +endif() + +if("z-vcpkg-make-get-crosscompiling" IN_LIST FEATURES) + include("${CMAKE_CURRENT_LIST_DIR}/test-z_vcpkg_make_get_crosscompiling.cmake") +endif() + +unit_test_report_result() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-cl_cpp_wrapper/configure b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-cl_cpp_wrapper/configure new file mode 100755 index 0000000..90f66c8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-cl_cpp_wrapper/configure @@ -0,0 +1,6 @@ +#!/bin/sh + +echo "${CPP:-cpp} ${CPPFLAGS} ${CFLAGS} ${TEST_FLAGS} > stdout.c < source.c" || exit 1 +${CPP:-cpp} ${CPPFLAGS} ${CFLAGS} ${TEST_FLAGS} > stdout.c < source.c || exit 2 +grep OOPS_ECHOED_INVOCATION stdout.c && exit 3 +exit 0 diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-cl_cpp_wrapper/source.c b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-cl_cpp_wrapper/source.c new file mode 100644 index 0000000..5d70292 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-cl_cpp_wrapper/source.c @@ -0,0 +1,5 @@ +#ifdef EXPECT_SUCCESS +/* okay */ +#else +#error "Forced error" +#endif diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-scripts-cl_cpp_wrapper.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-scripts-cl_cpp_wrapper.cmake new file mode 100644 index 0000000..67d8b70 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-scripts-cl_cpp_wrapper.cmake @@ -0,0 +1,25 @@ +block() +set(SOURCE_PATH "${CURRENT_PORT_DIR}/test-cl_cpp_wrapper") +set(VCPKG_BUILD_TYPE release) + +vcpkg_backup_env_variables(VARS CPP TEST_FLAGS) + +# Test that that CPP processes stdin +# vcpkg_configure_make picks scripts/buildsystems/make_wrapper/cl_cpp_wrapper + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + set(ENV{CPP} "cl_cpp_wrapper") +endif() + +unit_test_ensure_fatal_error([[ + set(ENV{TEST_FLAGS} -DEXPECT_FAILURE) + vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE USE_WRAPPERS) +]]) + +unit_test_ensure_success([[ + set(ENV{TEST_FLAGS} -DEXPECT_SUCCESS) + vcpkg_configure_make(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE USE_WRAPPERS) +]]) + +vcpkg_restore_env_variables(VARS CPP TEST_FLAGS) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-vcpkg-make-cl_cpp_wrapper.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-vcpkg-make-cl_cpp_wrapper.cmake new file mode 100644 index 0000000..b7a15ff --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-vcpkg-make-cl_cpp_wrapper.cmake @@ -0,0 +1,33 @@ +block() +set(SOURCE_PATH "${CURRENT_PORT_DIR}/test-cl_cpp_wrapper") +set(VCPKG_BUILD_TYPE release) + +vcpkg_backup_env_variables(VARS CPP TEST_FLAGS) + +# Test that that CPP processes stdin +# vcpkg_make_configure picks (installed) ports/vcpkg-make/wrappers/cl_cpp_wrapper + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + set(ENV{CPP} "cl_cpp_wrapper") +endif() + +unit_test_ensure_fatal_error([[ + set(ENV{TEST_FLAGS} -DEXPECT_FAILURE) + vcpkg_make_configure(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE) +]]) + +unit_test_ensure_success([[ + set(ENV{TEST_FLAGS} -DEXPECT_SUCCESS) + vcpkg_make_configure(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE) +]]) + +# In verbose mode (V=1), the command line is echoed. +# This is is diagnostic output and must not go to stdout. +unit_test_ensure_success([[ + set(ENV{TEST_FLAGS} "-DEXPECT_SUCCESS -DOOPS_ECHOED_INVOCATION") + set(ENV{V} 1) + vcpkg_make_configure(SOURCE_PATH "${SOURCE_PATH}" COPY_SOURCE) +]]) + +vcpkg_restore_env_variables(VARS CPP TEST_FLAGS) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_adapt_lib_link_names.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_adapt_lib_link_names.cmake new file mode 100644 index 0000000..4d38ae4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_adapt_lib_link_names.cmake @@ -0,0 +1,55 @@ +block(SCOPE_FOR VARIABLES) + +# Test 1: Basic Transformation +set(all_libs_list "libexample.dll;libutil.a;libutil2.lib;libutil3.so") +set(expected "-llibexample.dll;-llibutil;-llibutil2;-llibutil3") +set(VCPKG_TARGET_IS_WINDOWS FALSE) +set(VCPKG_TARGET_IS_MINGW FALSE) +set(VCPKG_LIBRARY_LINKAGE "static") + +unit_test_check_variable_equal( + [[ z_vcpkg_make_prepare_link_flags(IN_OUT_VAR all_libs_list VCPKG_TRANSFORM_LIBS) ]] + all_libs_list + "${expected}" +) + +# Test 2: Remove uuid on Windows +set(all_libs_list "libexample.dll;uuid.lib") +set(expected "-llibexample.dll") +set(VCPKG_TARGET_IS_WINDOWS TRUE) +set(VCPKG_TARGET_IS_MINGW FALSE) +set(VCPKG_LIBRARY_LINKAGE "static") + +unit_test_check_variable_equal( + [[ z_vcpkg_make_prepare_link_flags(IN_OUT_VAR all_libs_list VCPKG_TRANSFORM_LIBS) ]] + all_libs_list + "${expected}" +) + +# Test 3: MinGW Dynamic Linkage Handling +set(all_libs_list "libexample.so;uuid.a") +set(expected "-llibexample;-Wl,-Bstatic,-luuid,-Bdynamic") +set(VCPKG_TARGET_IS_WINDOWS FALSE) +set(VCPKG_TARGET_IS_MINGW TRUE) +set(VCPKG_LIBRARY_LINKAGE "dynamic") + +unit_test_check_variable_equal( + [[ z_vcpkg_make_prepare_link_flags(IN_OUT_VAR all_libs_list VCPKG_TRANSFORM_LIBS) ]] + all_libs_list + "${expected}" +) + +# Test 4: No Transformation Flag +set(all_libs_list "libexample.dll;uuid.lib") +set(expected "libexample.dll;uuid.lib") +set(VCPKG_TARGET_IS_WINDOWS FALSE) +set(VCPKG_TARGET_IS_MINGW FALSE) +set(VCPKG_LIBRARY_LINKAGE "static") + +unit_test_check_variable_equal( + [[ z_vcpkg_make_prepare_link_flags(IN_OUT_VAR all_libs_list) ]] + all_libs_list + "${expected}" +) + +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_host_arch.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_host_arch.cmake new file mode 100644 index 0000000..73e76db --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_host_arch.cmake @@ -0,0 +1,19 @@ +vcpkg_backup_env_variables(VARS PROCESSOR_ARCHITECTURE PROCESSOR_ARCHITEW6432) + +set(result_arch "NOTFOUND") + +# Test Case 1: x86_64 Architecture (Windows) +set(ENV{PROCESSOR_ARCHITECTURE} "AMD64") +unit_test_check_variable_equal( + [[ z_vcpkg_make_determine_host_arch(result_arch) ]] + result_arch "x86_64" +) + +# Test Case 2: i686 Architecture (Windows) +set(ENV{PROCESSOR_ARCHITEW6432} "x86") +unit_test_check_variable_equal( + [[ z_vcpkg_make_determine_host_arch(result_arch) ]] + result_arch "i686" +) + +vcpkg_restore_env_variables(VARS PROCESSOR_ARCHITECTURE PROCESSOR_ARCHITEW6432) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_target_arch.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_target_arch.cmake new file mode 100644 index 0000000..c82221c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_target_arch.cmake @@ -0,0 +1,15 @@ +# Test Case 1: Single Target Architecture +set(VCPKG_TARGET_ARCHITECTURE "x86_64") +set(VCPKG_OSX_ARCHITECTURES "x86_64") # Empty for non-OSX +set(result_arch) +z_vcpkg_make_determine_target_arch(result_arch) +unit_test_check_variable_equal([[]] result_arch "x86_64") + +# Test Case 2: Universal Architecture (OSX) +if (VCPKG_HOST_IS_OSX) + set(VCPKG_TARGET_ARCHITECTURE "x86_64") + set(VCPKG_OSX_ARCHITECTURES "x86_64;arm64") + set(result_arch) + z_vcpkg_make_determine_target_arch(result_arch) + unit_test_check_variable_equal([[]] result_arch "universal") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_target_triplet.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_target_triplet.cmake new file mode 100644 index 0000000..f1eeff0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_determine_target_triplet.cmake @@ -0,0 +1,31 @@ +if(VCPKG_TARGET_IS_ANDROID) + # tbd + +elseif(VCPKG_TARGET_IS_LINUX) + unit_test_check_variable_equal( + [[ z_vcpkg_make_determine_target_triplet(triplet COMPILER_NAME "cc") ]] + triplet "" + ) + unit_test_check_variable_equal( + [[ z_vcpkg_make_determine_target_triplet(triplet COMPILER_NAME "aarch64-linux-gnu-gcc") ]] + triplet "aarch64-linux-gnu" + ) + unit_test_check_variable_equal( + [[ z_vcpkg_make_determine_target_triplet(triplet COMPILER_NAME "i686-linux-gnu-clang") ]] + triplet "i686-linux-gnu" + ) + unit_test_check_variable_equal( + [[ z_vcpkg_make_determine_target_triplet(triplet COMPILER_NAME "x86_64-linux-gnu-gcc-13") ]] + triplet "x86_64-linux-gnu" + ) + +elseif(VPCKG_TARGET_IS_OSX) + # tbd + +elseif(VCPKG_TARGET_IS_UWP) + # tbd + +elseif(VCPKG_TARGET_IS_WINDOWS) + # tbd + +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_get_configure_triplets.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_get_configure_triplets.cmake new file mode 100644 index 0000000..df525da --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_get_configure_triplets.cmake @@ -0,0 +1,94 @@ +z_vcpkg_make_get_configure_triplets(triplets) + +# Either none or both of --host, --build +if(triplets MATCHES "--host|--build") + unit_test_check_variable_not_equal( + [[ string(REGEX MATCH "--host=([^;]+)" actual "${triplets}") ]] + CMAKE_MATCH_1 "" + ) + unit_test_check_variable_not_equal( + [[ string(REGEX MATCH "--build=([^;]+)" actual "${triplets}") ]] + CMAKE_MATCH_1 "" + ) +endif() + +# Get the actual --build option, for use in the following tests. +block(SCOPE_FOR VARIABLES PROPAGATE build_opt) + if(triplets STREQUAL "") + # Initially empty triplets are okay (= native build). + # Force non-empty triplets via explicit --host. + set(VCPKG_MAKE_BUILD_TRIPLET "--host=vcpkg") + z_vcpkg_make_get_configure_triplets(triplets) + endif() + string(REGEX MATCH "--host=[^;]*" host_opt "${triplets};") + unit_test_check_variable_not_equal( + [[ # match --host ]] + host_opt "" + ) + string(REGEX MATCH "--build=[^;]*" build_opt "${triplets};") + unit_test_check_variable_not_equal( + [[ # match --build ]] + build_opt "" + ) +endblock() + +# --host precedence: VCPKG_MAKE_BUILD_TRIPLET, COMPILER_NAME, hard-coded +if(VCPKG_MAKE_BUILD_TRIPLET MATCHES "--host=([^;]*)") + set(expected "${CMAKE_MATCH_1}") + z_vcpkg_make_get_configure_triplets(output COMPILER_NAME "x86_64-linux-gnu-clang-12") + unit_test_check_variable_equal( + [[ string(REGEX MATCH "--host=([^;]*)" actual "${output}") ]] + CMAKE_MATCH_1 "${expected}" + ) +elseif(VCPKG_TARGET_IS_ANDROID) + unit_test_check_variable_equal( + [[ string(REGEX MATCH "--host=[^;]*-([^-;]*-(android|[^-;]*))" output "${triplets}") ]] + CMAKE_MATCH_1 "linux-android" + ) + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_configure_triplets(actual COMPILER_NAME "/bin/armv7a-linux-androideabi28-clang") ]] + actual "--host=armv7a-linux-androideabi28;${build_opt}" + ) +elseif(VCPKG_TARGET_IS_MINGW) + unit_test_check_variable_equal( + [[ string(REGEX MATCH "--host=[^;]*-(mingw32|[^-;]*)" output "${triplets}") ]] + CMAKE_MATCH_1 "mingw32" + ) +elseif(VCPKG_TARGET_IS_LINUX) + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_configure_triplets(actual COMPILER_NAME "gcc") ]] + actual "" + ) + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_configure_triplets(actual COMPILER_NAME "/bin/aarch64-linux-gnu-gcc-13") ]] + actual "--host=aarch64-linux-gnu;${build_opt}" + ) + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_configure_triplets(actual COMPILER_NAME "/usr/bin/x86_64-linux-gnu-clang-12") ]] + actual "--host=x86_64-linux-gnu;${build_opt}" + ) +elseif(VCPKG_TARGET_IS_UWP) + unit_test_check_variable_equal( + [[ string(REGEX MATCH "--host=[^;]*-([^-;]*-[^-;]*)" output "${triplets}") ]] + CMAKE_MATCH_1 "unknown-mingw32" + ) +elseif(VCPKG_TARGET_IS_WINDOWS) + unit_test_check_variable_equal( + [[ string(REGEX MATCH "--host=[^;]*-([^-;]*-[^-;]*)" output "${triplets}") ]] + CMAKE_MATCH_1 "pc-mingw32" + ) +endif() + +# VCPKG_MAKE_BUILD_TRIPLET robustness +block(SCOPE_FOR VARIABLES) + set(VCPKG_MAKE_BUILD_TRIPLET "--host=HHH;--build=BBB") + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_configure_triplets(actual) ]] + actual "--host=HHH;--build=BBB" + ) + set(VCPKG_MAKE_BUILD_TRIPLET "--build=bbb;--host=hhh") + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_configure_triplets(actual) ]] + actual "--build=bbb;--host=hhh" + ) +endblock() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_get_crosscompiling.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_get_crosscompiling.cmake new file mode 100644 index 0000000..47148b8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_get_crosscompiling.cmake @@ -0,0 +1,53 @@ +# Named expected values +string(COMPARE NOTEQUAL "host" "build" crosscompiling) +string(COMPARE EQUAL "host" "build" native) + +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result) ]] + result "${native}" +) + +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --host=BBB --build=BBB) ]] + result "${native}" +) + +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --build=HHH --host=HHH) ]] + result "${native}" +) + +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --host=HHH --build=BBB) ]] + result "${crosscompiling}" +) + +# arguable, but without --build it leads to cross_compiling=maybe. +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --host=HHH) ]] + result "${crosscompiling}" +) + +# arguable, but without --host it leads to cross_compiling=maybe. +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --build=BBB) ]] + result "${crosscompiling}" +) + +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --host=HHH --build=BBB) ]] + result "${crosscompiling}" +) + +unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result --build=BBB --host=HHH) ]] + result "${crosscompiling}" +) + +if(NOT VCPKG_CROSSCOMPILING) + z_vcpkg_make_get_configure_triplets(configure_triplets) + unit_test_check_variable_equal( + [[ z_vcpkg_make_get_crosscompiling(result ${configure_triplets}) ]] + result "${native}" + ) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_normalize_arch.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_normalize_arch.cmake new file mode 100644 index 0000000..fdfe384 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_normalize_arch.cmake @@ -0,0 +1,28 @@ +set(test_cases + "amd64" "x86_64" + "AMD64" "x86_64" + "x64" "x86_64" + "x86" "i686" + "X86" "i686" + "ARM64" "aarch64" + "arm64" "aarch64" + "ARM" "arm" + "arm" "arm" + "x86_64" "x86_64" + "i686" "i686" + "aarch64" "aarch64" +) + +list(LENGTH test_cases num_items) +math(EXPR num_tests "${num_items} / 2 - 1") + +foreach(idx RANGE 0 ${num_tests}) + math(EXPR input_idx "${idx} * 2") + math(EXPR output_idx "${idx} * 2 + 1") + list(GET test_cases ${input_idx} input) + list(GET test_cases ${output_idx} expected) + + set(result_arch) + z_vcpkg_make_normalize_arch(result_arch ${input}) + unit_test_check_variable_equal([[]] result_arch "${expected}") +endforeach() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_prepare_compile_flags.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_prepare_compile_flags.cmake new file mode 100644 index 0000000..89743b8 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/test-z_vcpkg_make_prepare_compile_flags.cmake @@ -0,0 +1,99 @@ +set(VCPKG_COMBINED_C_FLAGS_Release "-O2 -DNDEBUG") +set(VCPKG_COMBINED_CXX_FLAGS_Release "-O2 -DNDEBUG") +set(VCPKG_COMBINED_C_FLAGS_Debug "-g -O0 -DDEBUG") +set(VCPKG_COMBINED_CXX_FLAGS_Debug "-g -O0 -DDEBUG") +set(VCPKG_COMBINED_SHARED_LINKER_FLAGS_Release "-L/mylibpath") +set(VCPKG_COMBINED_SHARED_LINKER_FLAGS_Debug "-L/debuglibpath") +set(CURRENT_INSTALLED_DIR "C:/vcpkg_installed/x64-windows") + +# Test Case: Release Flag Generation +set(flags_out) +z_vcpkg_make_prepare_compile_flags( + COMPILER_FRONTEND "MSVC" + CONFIG "Release" + FLAGS_OUT flags_out + LANGUAGES "C" "CXX" +) + +set(expected_cflags "-Xcompiler -O2 -Xcompiler -DNDEBUG") +set(expected_cxxflags "-Xcompiler -O2 -Xcompiler -DNDEBUG") +set(expected_ldflags "-Xlinker -Xlinker -Xlinker -L/mylibpath") + +unit_test_check_variable_equal([[]] CFLAGS_Release "${expected_cflags}") +unit_test_check_variable_equal([[]] CXXFLAGS_Release "${expected_cxxflags}") +unit_test_check_variable_equal([[]] LDFLAGS_Release "${expected_ldflags}") + + +# Test Case: Debug flag generation +set(flags_out) +z_vcpkg_make_prepare_compile_flags( + COMPILER_FRONTEND "MSVC" + CONFIG "Debug" + FLAGS_OUT flags_out + LANGUAGES "C" "CXX" +) + +# Expected Debug flags +set(expected_cflags "-Xcompiler -g -Xcompiler -O0 -Xcompiler -DDEBUG") +set(expected_cxxflags "-Xcompiler -g -Xcompiler -O0 -Xcompiler -DDEBUG") +set(expected_ldflags "-Xlinker -Xlinker -Xlinker -L/debuglibpath") + +# Check the values of the Debug flags +unit_test_check_variable_equal([[]] CFLAGS_Debug "${expected_cflags}") +unit_test_check_variable_equal([[]] CXXFLAGS_Debug "${expected_cxxflags}") +unit_test_check_variable_equal([[]] LDFLAGS_Debug "${expected_ldflags}") + +# Test Case: NO_FLAG_ESCAPING (MSVC, Debug) +set(flags_out) +unset(CFLAGS_Debug) +unset(CXXFLAGS_Debug) +unset(LDFLAGS_Debug) +z_vcpkg_make_prepare_compile_flags( + NO_FLAG_ESCAPING + COMPILER_FRONTEND "MSVC" + CONFIG "Debug" + FLAGS_OUT flags_out + LANGUAGES "C" "CXX" +) + +set(expected_cflags "-g -O0 -DDEBUG") +set(expected_cxxflags "-g -O0 -DDEBUG") +set(expected_ldflags "-L/debuglibpath") + +unit_test_check_variable_equal([[]] CFLAGS_Debug "${expected_cflags}") +unit_test_check_variable_equal([[]] CXXFLAGS_Debug "${expected_cxxflags}") +unit_test_check_variable_equal([[]] LDFLAGS_Debug "${expected_ldflags}") + +# Test Case: Different Languages and Compiler Frontend (GCC) +set(flags_out) +z_vcpkg_make_prepare_compile_flags( + COMPILER_FRONTEND "GCC" + CONFIG "Release" + FLAGS_OUT flags_out + LANGUAGES "C" "CXX" "ASM" +) + +unit_test_check_variable_unset([[]] "${ASMFLAGS_Release}") +set(expected_gcc_cflags "-O2 -DNDEBUG") +unit_test_check_variable_equal([[]] expected_gcc_cflags "${CFLAGS_Release}") + +# Test Case: No Languages Defined (Should Default to C;CXX) +set(flags_out) +unset(CFLAGS_Release) +unset(CXXFLAGS_Release) +unset(LDFLAGS_Release) +unset(ASMFLAGS_Release) +z_vcpkg_make_prepare_compile_flags( + COMPILER_FRONTEND "MSVC" + CONFIG "Release" + FLAGS_OUT flags_out +) + +# Verify that both CFLAGS and CXXFLAGS are set since they should default to C and C++ +if(NOT CFLAGS_Release) + message(FATAL_ERROR "CFLAGS_Release not set") +endif() + +if(NOT CXXFLAGS_Release) + message(FATAL_ERROR "CXXFLAGS_Release not set") +endif()
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/vcpkg.json new file mode 100644 index 0000000..ecd76d4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-make/vcpkg.json @@ -0,0 +1,65 @@ +{ + "name": "vcpkg-ci-vcpkg-make", + "version-string": "ci", + "description": "Ensures that the vcpkg-make port functions are unit tested.", + "license": "MIT", + "dependencies": [ + { + "name": "unit-test-cmake", + "host": true + }, + { + "name": "vcpkg-make", + "host": true + } + ], + "default-features": [ + { + "name": "scripts-cl-cpp-wrapper", + "platform": "windows & !mingw" + }, + { + "name": "vcpkg-make-cl-cpp-wrapper", + "platform": "windows & !mingw" + }, + "z-vcpkg-make-normalize-arch", + "z-vcpkg-make-determine-host-arch", + "z-vcpkg-make-determine-target-arch", + "z-vcpkg-make-determine-target-triplet", + "z-vcpkg-make-get-configure-triplets", + "z-vcpkg-make-prepare-compile-flags", + "z-vcpkg-make-z-adapt-lib-link-names" + ], + "features": { + "scripts-cl-cpp-wrapper": { + "description": "Test the cl_cpp_wrapper in scripts" + }, + "vcpkg-make-cl-cpp-wrapper": { + "description": "Test the cl_cpp_wrapper in vcpkg-make" + }, + "z-vcpkg-make-normalize-arch": { + "description": "Test the z_vcpkg_make_normalize_arch function" + }, + "z-vcpkg-make-determine-host-arch": { + "description": "Test the z_vcpkg_make_determine_host_arch function" + }, + "z-vcpkg-make-determine-target-arch": { + "description": "Test the z_vcpkg_make_determine_target_arch function" + }, + "z-vcpkg-make-determine-target-triplet": { + "description": "Test the z_vcpkg_make_determine_target_arch triplet" + }, + "z-vcpkg-make-get-configure-triplets": { + "description": "Test the z_vcpkg_make_get_configure_triplets function" + }, + "z-vcpkg-make-get-crosscompiling": { + "description": "Test the z_vcpkg_make_get_crosscompiling function" + }, + "z-vcpkg-make-prepare-compile-flags": { + "description": "Test the z_vcpkg_make_prepare_compile_flags function" + }, + "z-vcpkg-make-z-adapt-lib-link-names": { + "description": "Test the z_vcpkg_make_z_adapt_lib_link_names function" + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-tool-nodejs/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-tool-nodejs/portfile.cmake new file mode 100644 index 0000000..6cf4616 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-tool-nodejs/portfile.cmake @@ -0,0 +1,20 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +find_program(NODEJS + NAMES node + PATHS + "${CURRENT_INSTALLED_DIR}/tools/node" + "${CURRENT_INSTALLED_DIR}/tools/node/bin" + NO_DEFAULT_PATH + REQUIRED +) +execute_process( + COMMAND "${NODEJS}" --version + COMMAND_ECHO STDOUT + COMMAND_ERROR_IS_FATAL ANY +) +execute_process( + COMMAND "${NODEJS}" -p "process.arch" + COMMAND_ECHO STDOUT + COMMAND_ERROR_IS_FATAL ANY +) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-tool-nodejs/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-tool-nodejs/vcpkg.json new file mode 100644 index 0000000..20f8b6d --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vcpkg-tool-nodejs/vcpkg.json @@ -0,0 +1,9 @@ +{ + "name": "vcpkg-ci-vcpkg-tool-nodejs", + "version-string": "ci", + "description": "Test port to validate vcpkg-tool-nodejs", + "supports": "native", + "dependencies": [ + "vcpkg-tool-nodejs" + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/portfile.cmake new file mode 100644 index 0000000..b7616f5 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/portfile.cmake @@ -0,0 +1,22 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO vsg-dev/vsgQt + REF v0.4.0 + SHA512 0c753d573eeec77bdddab0f3499b7fbabc4c0840246501dd83ef1e3a96effacf9cd9a84d5c1c35b49462520a2840ddd02eeefa92c55b23dc44ce9fc285cbee3b + HEAD_REF master +) + +vcpkg_check_features(OUT_FEATURE_OPTIONS options + FEATURES + vsgxchange USE_VSGXCHANGE +) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS + "-DSOURCE_PATH=${SOURCE_PATH}" + ${options} +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/project/CMakeLists.txt new file mode 100644 index 0000000..1140386 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/project/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.16) +project(vsgqt-test) + +set(CMAKE_CXX_STANDARD 17) + +find_package(vsgQt CONFIG REQUIRED) + +add_executable(vsgqtviewer "${SOURCE_PATH}/examples/vsgqtviewer/main.cpp") +target_link_libraries(vsgqtviewer PRIVATE vsgQt::vsgQt) + +if (USE_VSGXCHANGE) + find_package(vsgXchange CONFIG REQUIRED) + target_compile_definitions(vsgqtviewer PRIVATE vsgXchange_FOUND) + target_link_libraries(vsgqtviewer PRIVATE vsgXchange::vsgXchange) +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/vcpkg.json new file mode 100644 index 0000000..c1052c0 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vsgqt/vcpkg.json @@ -0,0 +1,28 @@ +{ + "name": "vcpkg-ci-vsgqt", + "version-string": "ci", + "description": "Port to validate vsgqt in CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vsgqt", + "default-features": false + } + ], + "default-features": [ + "vsgxchange" + ], + "features": { + "vsgxchange": { + "description": "Build with vsgxchange", + "dependencies": [ + "vsgxchange" + ] + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vxl/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/portfile.cmake new file mode 100644 index 0000000..8700efd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/portfile.cmake @@ -0,0 +1,8 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" + OPTIONS_DEBUG + -DBUILD_TYPE=debug +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vxl/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/project/CMakeLists.txt new file mode 100644 index 0000000..2ac14a1 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/project/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.7) +project(vnl-test CXX) + +if(APPLE) + set(CMAKE_CXX_STANDARD "11") +endif() + +find_package(VXL CONFIG REQUIRED) + +# The use file doesn't only set variables, +# but also directly calls include_directories(). +# (Calling link_directories() must remain disabled in vcpkg.) +# The imported targets don't carry the main include directories! +include("${VXL_CMAKE_DIR}/UseVXL.cmake") + +# Catch wrong link directories. +find_library(vcpkg_ci_vnl_library NAMES vnl REQUIRED) +cmake_path(GET vcpkg_ci_vnl_library PARENT_PATH vcpkg_ci_vnl_library_dir) +if(BUILD_TYPE STREQUAL "debug" AND NOT vcpkg_ci_vnl_library_dir MATCHES "/debug/lib\$") + message(SEND_ERROR "vil library directory is wrong." + "\n Expected path: '${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib'" + "\n Actual path: '${vcpkg_ci_vnl_library_dir}'" + ) +endif() + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE + $<TARGET_NAME:vil> # required. Needs image format deps + $<TARGET_NAME:vnl_algo> # test only: wants netlib + $<TARGET_NAME:vgl> # test only: wants polyclipping + $<TARGET_NAME:vgl_algo> # test only: wants image formats +) + diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vxl/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/project/main.cpp new file mode 100644 index 0000000..681dc8b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/project/main.cpp @@ -0,0 +1,10 @@ +//#include <vxl_config.h> +#include <vil/vil_rgb.h> +#include <vil/vil_load.h> +#include <vil/vil_image_view.h> + +int main() +{ + vil_image_view<vil_rgb<vxl_byte> > img = vil_load("foo.tiff"); + return 0; +}
\ No newline at end of file diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-vxl/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/vcpkg.json new file mode 100644 index 0000000..0c0986e --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-vxl/vcpkg.json @@ -0,0 +1,19 @@ +{ + "name": "vcpkg-ci-vxl", + "version-string": "ci", + "description": "Port to force features of vxl within CI", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "vxl", + "features": [ + "core-imaging" + ] + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/portfile.cmake new file mode 100644 index 0000000..0122f05 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/portfile.cmake @@ -0,0 +1,9 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_find_acquire_program(PKGCONFIG) +set(ENV{PKG_CONFIG} "${PKGCONFIG}") + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/project/CMakeLists.txt new file mode 100644 index 0000000..a9e3405 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/project/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.16) +project(whisper-cpp-test) + +find_package(whisper CONFIG REQUIRED) + +add_executable(test-cmake main.cxx) +add_library(imported::whisper ALIAS whisper) +target_link_libraries(test-cmake PRIVATE imported::whisper) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(whisper-cpp whisper REQUIRED IMPORTED_TARGET) + +add_executable(test-pkconfig main.cxx) +target_link_libraries(test-pkconfig PRIVATE PkgConfig::whisper-cpp) diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/project/main.cxx b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/project/main.cxx new file mode 100644 index 0000000..c9228dd --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/project/main.cxx @@ -0,0 +1,7 @@ +#include <whisper.h> + +int main() +{ + auto context_params = whisper_context_default_params(); + return 0; +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/vcpkg.json new file mode 100644 index 0000000..8f653d4 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-whisper-cpp/vcpkg.json @@ -0,0 +1,17 @@ +{ + "name": "vcpkg-ci-whisper-cpp", + "version-string": "ci", + "description": "Port to validate whisper-cpp", + "homepage": "https://github.com/microsoft/vcpkg", + "license": "MIT", + "dependencies": [ + { + "name": "whisper-cpp", + "default-features": false + }, + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-wxwidgets/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-wxwidgets/portfile.cmake new file mode 100644 index 0000000..d301fa7 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-wxwidgets/portfile.cmake @@ -0,0 +1,34 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS + FEATURES + wxrc USE_WXRC +) + +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_INSTALLED_DIR}/share/wxwidgets/example" + DISABLE_PARALLEL_CONFIGURE # Need separate dbg log for following test + OPTIONS + ${OPTIONS} + -DCMAKE_CONFIG_RUN=1 + "-DPRINT_VARS=CMAKE_CONFIG_RUN;wxWidgets_LIBRARIES" +) +vcpkg_cmake_build() + +if(NOT VCPKG_BUILD_TYPE) + # Check that debug libs are still used after re-configuration, #24489 + set(config_log "config-${TARGET_TRIPLET}-dbg") + vcpkg_execute_required_process( + COMMAND "${CMAKE_COMMAND}" -DCMAKE_CONFIG_RUN=2 . + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg" + LOGNAME "${config_log}-2" + ) + file(STRINGS "${CURRENT_BUILDTREES_DIR}/${config_log}-out.log" expected REGEX "wxWidgets_LIBRARIES:=") + file(STRINGS "${CURRENT_BUILDTREES_DIR}/${config_log}-2-out.log" actual REGEX "wxWidgets_LIBRARIES:=") + if(NOT actual STREQUAL expected) + message(FATAL_ERROR "wxWidgets libraries changed after CMake re-run\n" + "actual:\n${actual}\n" + "expected:\n ${expected}\n" + ) + endif() +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-wxwidgets/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-wxwidgets/vcpkg.json new file mode 100644 index 0000000..10ba1aa --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-wxwidgets/vcpkg.json @@ -0,0 +1,30 @@ +{ + "name": "vcpkg-ci-wxwidgets", + "version-date": "2022-04-05", + "port-version": 1, + "description": "Builds a GUI app in order to validate the wxwidgets port.", + "dependencies": [ + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "wxwidgets", + "default-features": false, + "features": [ + "example" + ] + } + ], + "default-features": [ + { + "name": "wxrc", + "platform": "native" + } + ], + "features": { + "wxrc": { + "description": "Test wxrc" + } + } +} diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/portfile.cmake new file mode 100644 index 0000000..8a2079b --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/portfile.cmake @@ -0,0 +1,5 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) +vcpkg_cmake_configure( + SOURCE_PATH "${CURRENT_PORT_DIR}/project" +) +vcpkg_cmake_build() diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/project/CMakeLists.txt b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/project/CMakeLists.txt new file mode 100644 index 0000000..2a289ef --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/project/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.28)
+project(yandex-disk-cpp-client-test LANGUAGES CXX)
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+find_package(yandex-disk-cpp-client CONFIG REQUIRED)
+add_executable(main main.cpp)
+target_link_libraries(main PRIVATE yandex-disk-cpp-client::yandex-disk-cpp-client)
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/project/main.cpp b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/project/main.cpp new file mode 100644 index 0000000..0b2f175 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/project/main.cpp @@ -0,0 +1,7 @@ +#include <YandexDiskClient.h>
+int main()
+{
+ YandexDiskClient yandex("TOKEN");
+ auto quota = yandex.getQuotaInfo();
+ return 0;
+}
diff --git a/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/vcpkg.json new file mode 100644 index 0000000..1d92df2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-ci-yandex-disk-cpp-client/vcpkg.json @@ -0,0 +1,12 @@ +{ + "name": "vcpkg-ci-yandex-disk-cpp-client", + "version-string": "ci", + "description": "Validates yandex-disk-cpp-client", + "dependencies": [ + "yandex-disk-cpp-client", + { + "name": "vcpkg-cmake", + "host": true + } + ] +} diff --git a/vcpkg/scripts/test_ports/vcpkg-find-acquire-program/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-find-acquire-program/portfile.cmake new file mode 100644 index 0000000..d31679c --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-find-acquire-program/portfile.cmake @@ -0,0 +1,72 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +if(VCPKG_HOST_IS_WINDOWS) + # The version-agnostic tool dir may already exist. + # Simulate/test with NASM. + file(REMOVE_RECURSE "${DOWNLOADS}/tools/nasm") + file(MAKE_DIRECTORY "${DOWNLOADS}/tools/nasm") +endif(VCPKG_HOST_IS_WINDOWS) + +# For each vcpkg_find_acquire_program(NAME).cmake script, +# there must be a literal call to vcpkg_find_acquire_program(NAME) +vcpkg_list(SET variables) +macro(vcpkg_find_acquire_program NAME_AND_VAR) + vcpkg_list(APPEND variables "${NAME_AND_VAR}") + _vcpkg_find_acquire_program("${NAME_AND_VAR}") +endmacro() + +vcpkg_find_acquire_program(BAZEL) +vcpkg_find_acquire_program(BISON) +vcpkg_find_acquire_program(FLEX) +vcpkg_find_acquire_program(GIT) +vcpkg_find_acquire_program(GN) +vcpkg_find_acquire_program(GPERF) +vcpkg_find_acquire_program(NASM) +vcpkg_find_acquire_program(NINJA) +vcpkg_find_acquire_program(PERL) +vcpkg_find_acquire_program(PKGCONFIG) +vcpkg_find_acquire_program(PYTHON3) +vcpkg_find_acquire_program(SCONS) +vcpkg_find_acquire_program(YASM) + +if(NOT VCPKG_HOST_IS_OSX) + vcpkg_find_acquire_program(MESON) # System python too old (3.9; meson needs 3.10) + vcpkg_find_acquire_program(RUBY) + vcpkg_find_acquire_program(SWIG) +endif() + +if(VCPKG_HOST_IS_LINUX) + vcpkg_find_acquire_program(PATCHELF) +endif() + +if(VCPKG_HOST_IS_WINDOWS) + vcpkg_find_acquire_program(7Z) + vcpkg_find_acquire_program(CLANG) + vcpkg_find_acquire_program(DARK) + vcpkg_find_acquire_program(DOXYGEN) + vcpkg_find_acquire_program(GASPREPROCESSOR) + vcpkg_find_acquire_program(GO) + vcpkg_find_acquire_program(JOM) + vcpkg_find_acquire_program(NUGET) + vcpkg_find_acquire_program(PYTHON2) +endif() + +list(SORT variables) +message(STATUS "Collected programs: ${variables}") + +set(missing "") +foreach(variable IN LISTS variables) + set(var_contents "${${variable}}") + list(POP_BACK var_contents program) + if(NOT EXISTS "${program}") + list(APPEND missing "${variable}: ${program}") + endif() + list(POP_FRONT var_contents interpreter) + if(interpreter AND NOT EXISTS "${interpreter}") + list(APPEND missing "${variable} (interpreter): ${interpreter}") + endif() +endforeach() +if(missing) + list(JOIN missing "\n " missing) + message(FATAL_ERROR "The following programs do not exist:\n ${missing}") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-find-acquire-program/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-find-acquire-program/vcpkg.json new file mode 100644 index 0000000..0b622eb --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-find-acquire-program/vcpkg.json @@ -0,0 +1,7 @@ +{ + "name": "vcpkg-find-acquire-program", + "version-string": "0", + "port-version": 2, + "description": "Test port to exercise vcpkg_find_acquire_program", + "supports": "native" +} diff --git a/vcpkg/scripts/test_ports/vcpkg-fix-rpath/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-fix-rpath/portfile.cmake new file mode 100644 index 0000000..532c247 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fix-rpath/portfile.cmake @@ -0,0 +1,122 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Test for empty string +set(elf_dir "${CURRENT_PACKAGES_DIR}/lib") +set(test_rpath "") +set(expected "$ORIGIN") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() + +# Test for empty string in the tools directory +set(elf_dir "${CURRENT_PACKAGES_DIR}/tools/hdf5") +set(test_rpath "") +set(expected "$ORIGIN:$ORIGIN/../../lib") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() + +# Simple replacement and outside path test +set(elf_dir "${CURRENT_PACKAGES_DIR}/lib") +set(test_rpath "${CURRENT_PACKAGES_DIR}/lib:/usr/lib/") +set(expected "$ORIGIN") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() + +# Simple pkgconfig path and outside path test +set(elf_dir "${CURRENT_PACKAGES_DIR}/lib/") +set(test_rpath "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../lib:/usr/lib/") +set(expected "$ORIGIN") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() + +# elf dir in subdir +set(elf_dir "${CURRENT_PACKAGES_DIR}/lib/somesubdir") +set(test_rpath "${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../lib:/usr/lib/") +set(expected "$ORIGIN:$ORIGIN/..") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() + +# Getting more complex +set(elf_dir "${CURRENT_PACKAGES_DIR}/plugins/notlib/extrasubdir") +set(test_rpath "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/../../lib/someotherdir2:${CURRENT_INSTALLED_DIR}/lib/pkgconfig/../../someotherdir1:/usr/lib/") +set(expected "$ORIGIN:$ORIGIN/../../../lib:$ORIGIN/../../../lib/someotherdir2:$ORIGIN/../../../someotherdir1") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() + + +set(X_VCPKG_RPATH_KEEP_SYSTEM_PATHS ON) +# Simple replacement and outside path test +set(elf_dir "${CURRENT_PACKAGES_DIR}/lib") +set(test_rpath "${CURRENT_PACKAGES_DIR}/lib:/usr/lib/") +set(expected "$ORIGIN:/usr/lib") + +z_vcpkg_calculate_corrected_rpath( + ELF_FILE_DIR "${elf_dir}" + ORG_RPATH "${test_rpath}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not agree with expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath agrees with expected rpath: '${new_rpath}' ") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-fix-rpath/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-fix-rpath/vcpkg.json new file mode 100644 index 0000000..c39dc39 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fix-rpath/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "vcpkg-fix-rpath", + "version-date": "2024-02-10", + "description": "Test port to check the string replacement in z_vcpkg_fixup_rpath", + "supports": "native & linux" +} diff --git a/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake new file mode 100644 index 0000000..6754431 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/portfile.cmake @@ -0,0 +1,65 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +# Test for empty string +set(macho_dir "${CURRENT_PACKAGES_DIR}/lib") +set(test_rpath "") +set(expected "@loader_path") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# Test for empty string in the tools directory +set(macho_dir "${CURRENT_PACKAGES_DIR}/tools/hdf5") +set(test_rpath "") +set(expected "@loader_path/../../lib") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# macho dir in subdir +set(macho_dir "${CURRENT_PACKAGES_DIR}/lib/somesubdir") +set(test_rpath "") +set(expected "@loader_path/..") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath for '${macho_dir}' does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() + +# Getting more complex +set(macho_dir "${CURRENT_PACKAGES_DIR}/plugins/notlib/extrasubdir") +set(test_rpath "") +set(expected "@loader_path/../../../lib") + +z_vcpkg_calculate_corrected_macho_rpath( + MACHO_FILE_DIR "${macho_dir}" + OUT_NEW_RPATH_VAR new_rpath +) + +if(NOT "x${new_rpath}x" STREQUAL "x${expected}x") + message(FATAL_ERROR "--- Calculated rpath does not match expected rpath: '${new_rpath}' != '${expected}' ") +else() + message(STATUS "--- Calculated rpath matches expected rpath: '${new_rpath}' ") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json new file mode 100644 index 0000000..17d7c76 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-fixup-macho-rpath/vcpkg.json @@ -0,0 +1,6 @@ +{ + "name": "vcpkg-fixup-macho-rpath", + "version-date": "2024-06-15", + "description": "Test port to check the string replacement in z_vcpkg_fixup_macho_rpath", + "supports": "native & osx" +} diff --git a/vcpkg/scripts/test_ports/vcpkg-from-git-test/portfile.cmake b/vcpkg/scripts/test_ports/vcpkg-from-git-test/portfile.cmake new file mode 100644 index 0000000..841a6e2 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-from-git-test/portfile.cmake @@ -0,0 +1,378 @@ +set(VCPKG_POLICY_EMPTY_PACKAGE enabled) + +set(git_test_repo "${CURRENT_BUILDTREES_DIR}/test-git-repo") +file(REMOVE_RECURSE "${git_test_repo}") + +# LFS expects a URL for a local repository +set(git_remote "file:///${git_test_repo}") + +message(STATUS "Creating test git repository") +vcpkg_find_acquire_program(GIT) +vcpkg_list(SET git_config + -c core.autocrlf=false + -c user.email=vcpkg@example.com + -c user.name=vcpkg +) + +vcpkg_list(SET git ${GIT} ${git_config}) + +vcpkg_execute_required_process( + COMMAND ${git} init "test-git-repo" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "git-init" +) +vcpkg_execute_required_process( + COMMAND ${git} config uploadpack.allowReachableSHA1InWant true + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-config" +) +vcpkg_execute_required_process( + COMMAND ${git} checkout -b main + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-new-branch" +) + +file(WRITE "${git_test_repo}/README.txt" "first commit") +vcpkg_execute_required_process( + COMMAND ${git} add "README.txt" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-add.1" +) +vcpkg_execute_required_process( + COMMAND ${git} commit -m "first commit" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-commit.1" +) +vcpkg_execute_in_download_mode( + COMMAND ${git} rev-parse HEAD + OUTPUT_VARIABLE ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" +) +if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed to rev-parse HEAD: ${error_code}") +endif() +string(STRIP "${ref}" ref) + +file(WRITE "${git_test_repo}/README.txt" "second commit") +vcpkg_execute_required_process( + COMMAND ${git} add "README.txt" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-add.2" +) +vcpkg_execute_required_process( + COMMAND ${git} commit -m "second commit" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-commit.2" +) +vcpkg_execute_in_download_mode( + COMMAND ${git} rev-parse HEAD + OUTPUT_VARIABLE head_ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" +) +if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed to rev-parse HEAD: ${error_code}") +endif() +string(STRIP "${head_ref}" head_ref) + +message(STATUS "Testing regular mode") +set(VCPKG_USE_HEAD_VERSION OFF) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" + HEAD_REF main +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "first commit") + message(FATAL_ERROR "Failed to checkout the first commit. Contents were: +${contents} +") +endif() + +message(STATUS "Testing regular mode that happens to match HEAD") +set(VCPKG_USE_HEAD_VERSION OFF) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${head_ref}" + HEAD_REF main +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "second commit") + message(FATAL_ERROR "Failed to checkout the second commit. Contents were: +${contents} +") +endif() + +message(STATUS "Testing regular mode with FETCH_REF") +vcpkg_execute_required_process( + COMMAND ${git} config uploadpack.allowReachableSHA1InWant false + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-config" +) +set(VCPKG_USE_HEAD_VERSION OFF) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" + FETCH_REF main + HEAD_REF main +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "first commit") + message(FATAL_ERROR "Failed to checkout the first commit. Contents were: +${contents} +") +endif() + +message(STATUS "Testing regular mode with FETCH_REF that happens to match HEAD") +set(VCPKG_USE_HEAD_VERSION OFF) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${head_ref}" + FETCH_REF main + HEAD_REF main +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "second commit") + message(FATAL_ERROR "Failed to checkout the second commit. Contents were: +${contents} +") +endif() + +vcpkg_execute_required_process( + COMMAND ${git} config uploadpack.allowReachableSHA1InWant true + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-config" +) + +message(STATUS "Testing head mode") +set(VCPKG_USE_HEAD_VERSION ON) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" + HEAD_REF main +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "second commit") + message(FATAL_ERROR "Failed to checkout the HEAD commit. Contents were: +${contents} +") +endif() +if(NOT "${VCPKG_HEAD_VERSION}" STREQUAL "${head_ref}") + message(FATAL_ERROR "Failed to checkout the right HEAD commit. + Expected: ${head_ref} + Actual : ${VCPKG_HEAD_VERSION} +") +endif() + +message(STATUS "Testing head mode + no HEAD_REF -> just uses REF") +set(VCPKG_USE_HEAD_VERSION ON) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "first commit") + message(FATAL_ERROR "Failed to checkout the regular commit. Contents were: +${contents} +") +endif() + +message(STATUS "Testing new head ref") +file(WRITE "${git_test_repo}/README.txt" "third commit") +vcpkg_execute_required_process( + COMMAND ${git} add "README.txt" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git.7" +) +vcpkg_execute_required_process( + COMMAND ${git} commit -m "second commit" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git.8" +) +vcpkg_execute_in_download_mode( + COMMAND ${git} rev-parse HEAD + OUTPUT_VARIABLE new_head_ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" +) +if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed to rev-parse HEAD: ${error_code}") +endif() +string(STRIP "${new_head_ref}" new_head_ref) + +set(VCPKG_USE_HEAD_VERSION ON) +vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" + HEAD_REF main +) +file(READ "${source_path}/README.txt" contents) +if(NOT "${contents}" STREQUAL "third commit") + message(FATAL_ERROR "Failed to checkout the right HEAD commit. Contents were: +${contents} +") +endif() +if(NOT "${VCPKG_HEAD_VERSION}" STREQUAL "${new_head_ref}") + message(FATAL_ERROR "Failed to checkout the right HEAD commit. + Expected: ${new_head_ref} + Actual : ${VCPKG_HEAD_VERSION} +") +endif() + +message(STATUS "Testing LFS support") +vcpkg_execute_in_download_mode( + COMMAND "${GIT}" lfs --version + OUTPUT_VARIABLE lfs_version_output + ERROR_VARIABLE lfs_version_error + RESULT_VARIABLE lfs_version_result + WORKING_DIRECTORY "${git_test_repo}" +) +if(NOT lfs_version_result) + vcpkg_execute_required_process( + COMMAND ${git} lfs install --local + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-lfs-install" + ) + file(WRITE "${git_test_repo}/.gitattributes" "* text=auto\n*.bin filter=lfs diff=lfs merge=lfs -text\n") + + message(STATUS "Testing fetching with the same Git and LFS urls") + file(WRITE "${git_test_repo}/lfs_file.bin" "fourth commit") + vcpkg_execute_required_process( + COMMAND ${git} add ".gitattributes" "lfs_file.bin" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-lfs-add" + ) + vcpkg_execute_required_process( + COMMAND ${git} commit -m "fourth commit" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-lfs-commit" + ) + vcpkg_execute_in_download_mode( + COMMAND ${git} rev-parse HEAD + OUTPUT_VARIABLE ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" + ) + if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed to rev-parse HEAD: ${error_code}") + endif() + string(STRIP "${ref}" ref) + + vcpkg_execute_in_download_mode( + COMMAND ${git} lfs ls-files --name-only + OUTPUT_VARIABLE lfs_files + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" + ) + if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed lfs ls-files: ${error_code}") + endif() + string(STRIP "${lfs_files}" lfs_files) + if(NOT "${lfs_files}" MATCHES [[lfs_file\.bin]]) + message(FATAL_ERROR "File was not added to LFS") + endif() + + set(VCPKG_USE_HEAD_VERSION OFF) + vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" + HEAD_REF main + LFS + ) + file(READ "${source_path}/lfs_file.bin" contents) + if(NOT "${contents}" STREQUAL "fourth commit") + message(FATAL_ERROR "Failed to checkout the fourth commit. Contents were: +${contents} + ") + endif() + + message(STATUS "Testing fetching from different Git and LFS urls") + # requires LFS 3.0.0 or later for "--force" on prune + string(REGEX MATCH "git-lfs/([0-9\\.]+) " lfs_version "${lfs_version_output}") + set(lfs_version "${CMAKE_MATCH_1}") + if(lfs_version VERSION_GREATER_EQUAL "3.0.0") + file(WRITE "${git_test_repo}/lfs_file2.bin" "fifth commit") + vcpkg_execute_required_process( + COMMAND ${git} add "lfs_file2.bin" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-lfs-add.2" + ) + vcpkg_execute_required_process( + COMMAND ${git} commit -m "fifth commit" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-lfs-commit.2" + ) + vcpkg_execute_in_download_mode( + COMMAND ${git} rev-parse HEAD + OUTPUT_VARIABLE ref + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" + ) + if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed to rev-parse HEAD: ${error_code}") + endif() + string(STRIP "${ref}" ref) + + set(git_test_repo_2 "${CURRENT_BUILDTREES_DIR}/test-git-repo-2") + file(REMOVE_RECURSE "${git_test_repo_2}") + set(git_remote_2 "file:///${git_test_repo_2}") + vcpkg_execute_required_process( + COMMAND ${git} init --bare "test-git-repo-2" + WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}" + LOGNAME "git-init.2" + ) + # note: LFS won't prune "unpushed" files, which is checked using the "origin" remote by default. + # If there is no remote then files are never considered to be "pushed", and so are never pruned. + vcpkg_execute_required_process( + COMMAND ${git} remote add origin "${git_remote_2}" + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-remote-add" + ) + vcpkg_execute_required_process( + COMMAND ${git} push --all origin + WORKING_DIRECTORY "${git_test_repo}" + LOGNAME "git-push" + ) + + vcpkg_execute_in_download_mode( + COMMAND ${git} lfs prune --force --verbose + OUTPUT_VARIABLE lfs_prune + RESULT_VARIABLE error_code + WORKING_DIRECTORY "${git_test_repo}" + ) + if(NOT "${error_code}" EQUAL "0") + message(FATAL_ERROR "Failed to prune LFS files: ${error_code}") + endif() + if(NOT "${lfs_prune}" MATCHES "0 retained") + message(FATAL_ERROR "LFS prune did not delete all files:\n${lfs_prune}") + endif() + + set(VCPKG_USE_HEAD_VERSION OFF) + vcpkg_from_git( + OUT_SOURCE_PATH source_path + URL "${git_remote}" + REF "${ref}" + HEAD_REF main + LFS "${git_remote_2}" + ) + file(READ "${source_path}/lfs_file2.bin" contents) + if(NOT "${contents}" STREQUAL "fifth commit") + message(FATAL_ERROR "Failed to checkout the fifth commit. Contents were: + ${contents} + ") + endif() + else() + message(NOTICE "Git LFS version is older than 3.0.0: some tests were skipped") + endif() +else() + message(NOTICE "Git LFS is not available: some tests were skipped") +endif() diff --git a/vcpkg/scripts/test_ports/vcpkg-from-git-test/vcpkg.json b/vcpkg/scripts/test_ports/vcpkg-from-git-test/vcpkg.json new file mode 100644 index 0000000..609e7f3 --- /dev/null +++ b/vcpkg/scripts/test_ports/vcpkg-from-git-test/vcpkg.json @@ -0,0 +1,4 @@ +{ + "name": "vcpkg-from-git-test", + "version": "0" +} |