aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection')
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/portfile.cmake22
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/CMakeLists.txt22
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/project/main.c39
-rw-r--r--vcpkg/scripts/test_ports/vcpkg-ci-gobject-introspection/vcpkg.json54
4 files changed, 137 insertions, 0 deletions
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."
+ }
+ }
+}