Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[apr] Add HOST_TOOLS_DIR/gen_test_char for cross-compiling to Windows #41416

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ports/activemq-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "activemq-cpp",
"version-semver": "3.9.5",
"port-version": 16,
"port-version": 17,
"description": "Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns server.",
"license": "Apache-2.0",
"supports": "!(uwp | osx)",
"supports": "(windows & !uwp & (x86 | x64)) | (!windows & !osx)",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you trying to exclude arm on windows?

Copy link
Contributor Author

@WangWeiLin-MV WangWeiLin-MV Oct 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Port activemq-cpp: Only allow x86 and x64 under Windows platform

Yes, only x86 x64 is provided in its sln file of the port activemq-cpp, and it previously was skipped by cascade in CI.

"dependencies": [
"apr",
{
Expand Down
23 changes: 23 additions & 0 deletions ports/apr/0100-add-host-tools-dir.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d16eec6..92146f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -87,13 +87,17 @@ STRING(REGEX REPLACE ".*#define APR_PATCH_VERSION[ \t]+([0-9]+).*" "\\1" APR_PAT

CONFIGURE_FILE(include/apr.hwc
${PROJECT_BINARY_DIR}/apr.h)

ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c)

+set(UNOFFICIAL_APR_HOST_TOOLS_DIR "$<TARGET_FILE_DIR:gen_test_char>" CACHE STRING "")
+set(UNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX "$<TARGET_PROPERTY:gen_test_char,SUFFIX>" CACHE STRING "")
+install(TARGETS gen_test_char)
+
ADD_CUSTOM_COMMAND(
COMMENT "Generating character tables, apr_escape_test_char.h, for current locale"
DEPENDS gen_test_char
- COMMAND $<TARGET_FILE:gen_test_char> > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h
+ COMMAND "${UNOFFICIAL_APR_HOST_TOOLS_DIR}/gen_test_char${UNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX}" > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h
OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h
)
ADD_CUSTOM_TARGET(
16 changes: 13 additions & 3 deletions ports/apr/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@

set(VERSION 1.7.5)

vcpkg_download_distfile(ARCHIVE
URLS "https://archive.apache.org/dist/apr/apr-${VERSION}.tar.bz2"
FILENAME "apr-${VERSION}.tar.bz2"
Expand All @@ -11,8 +8,19 @@ vcpkg_extract_source_archive(SOURCE_PATH
ARCHIVE "${ARCHIVE}"
PATCHES
unglue.patch
0100-add-host-tools-dir.diff
)

set(CURRENT_HOST_TOOLS_DIR "${CURRENT_HOST_INSTALLED_DIR}/tools/${PORT}")

set(CROSSCOMPILING_OPTIONS "")
if(VCPKG_CROSSCOMPILING)
list(APPEND CROSSCOMPILING_OPTIONS
"-DUNOFFICIAL_APR_HOST_TOOLS_DIR=${CURRENT_HOST_TOOLS_DIR}"
"-DUNOFFICIAL_APR_HOST_EXECUTABLE_SUFFIX=${VCPKG_HOST_EXECUTABLE_SUFFIX}"
)
endif()

if (VCPKG_TARGET_IS_WINDOWS)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
Expand All @@ -32,6 +40,7 @@ if (VCPKG_TARGET_IS_WINDOWS)
-DMIN_WINDOWS_VER=Windows7
-DAPR_HAVE_IPV6=ON
${FEATURE_OPTIONS}
${CROSSCOMPILING_OPTIONS}
)

vcpkg_cmake_install()
Expand All @@ -42,6 +51,7 @@ if (VCPKG_TARGET_IS_WINDOWS)
)
# There is no way to suppress installation of the headers in debug builds.
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_copy_tools(TOOL_NAMES gen_test_char AUTO_CLEAN)

vcpkg_copy_pdbs()

Expand Down
9 changes: 7 additions & 2 deletions ports/apr/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
{
"name": "apr",
"version": "1.7.5",
"port-version": 1,
"port-version": 2,
"description": "The Apache Portable Runtime (APR) is a C library that forms a system portability layer that covers many operating systems.",
"homepage": "https://apr.apache.org/",
"license": "Apache-2.0",
"supports": "!uwp",
"supports": "!uwp & !mingw",
"dependencies": [
{
"name": "apr",
"host": true,
"platform": "windows"
},
Comment on lines +10 to +14
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought that this dependency was only needed on cross compiling? This would make it a host dependency even when not cross compiling.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the apr manifest. An apr host dependency is a no-op in the native case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right @dg0yt, apologies for the confusion.

{
"name": "vcpkg-cmake",
"host": true,
Expand Down
2 changes: 0 additions & 2 deletions scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ allegro5:x64-android=fail
apr:arm-neon-android=fail
apr:arm64-android=fail
apr:x64-android=fail
# Cross compiling CI machine cannot run gen_test_char to generate apr_escape_test_char.h
apr:arm64-windows=fail
apsi:arm-neon-android=fail
apsi:x64-android=fail
# Broken with CUDA 12; needs update to 3.8.3 and https://github.com/arrayfire/arrayfire/issues/3349 fixed
Expand Down
5 changes: 5 additions & 0 deletions versions/a-/activemq-cpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "0066f657df214848cbfd6b991e8ff4a52902e81b",
"version-semver": "3.9.5",
"port-version": 17
},
{
"git-tree": "1644c99e45b2364ea36c0307b4d7171f4717ccdc",
"version-semver": "3.9.5",
Expand Down
5 changes: 5 additions & 0 deletions versions/a-/apr.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "dfa11d3e5058b640b37c1a6845dbc2980496a7c8",
"version": "1.7.5",
"port-version": 2
},
{
"git-tree": "499cf5fc0959f4a049ec72f0f556400e7191ffd3",
"version": "1.7.5",
Expand Down
4 changes: 2 additions & 2 deletions versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
},
"activemq-cpp": {
"baseline": "3.9.5",
"port-version": 16
"port-version": 17
},
"ada-url": {
"baseline": "2.9.2",
Expand Down Expand Up @@ -170,7 +170,7 @@
},
"apr": {
"baseline": "1.7.5",
"port-version": 1
"port-version": 2
},
"apr-util": {
"baseline": "1.6.3",
Expand Down