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] bump to 1.7.5 and did some imporvements, availible from this version of the library. #40742

Merged
merged 18 commits into from
Sep 3, 2024

Conversation

rinrab
Copy link
Contributor

@rinrab rinrab commented Aug 31, 2024

Bump the library to version 1.7.5 and did some imporvements, availible from this version of the library.

  • Making config to be official, since it was released in the library itself.
  • Fix library linkage selection.
  • Disable tests to improve the build performance.
  • Install include files into the directory with 'apr-1' prefix.

In apr of 1.7.5 version, the config was introduced. In this commit it is going to be used instead of unofficial one.

* fix-configcmake.patch: Removed.
* portfile.cmake
  (patches): Fo not apply removed fix-configcmake.patch.
  (vcpkg_cmake_config_fixup): Change package name to apr, since it is official and adjust its path.
APR requires APR_BUILD_STATIC and APR_BUILD_SHARED options to be set for configuring the library linkage. After this commit they will be specified correctly and the library will work correctly in static configuration.
In this version it is 'recommend', but the option defaults to the previous to keep the backward compatibly.
Done via command: `.\vcpkg.exe x-add-version apr'.
@rinrab rinrab marked this pull request as ready for review August 31, 2024 13:01
ports/apr/portfile.cmake Outdated Show resolved Hide resolved
ports/apr/portfile.cmake Outdated Show resolved Hide resolved
…h a warning.

* portfile.cmake
  (install): Copy unofficial-apr-config.cmake
* unofficial-apr-config.cmake: New config file for unofficial-apr package, that forwards to apr package and writes a warning.
@rinrab rinrab marked this pull request as draft August 31, 2024 14:43
@rinrab rinrab marked this pull request as ready for review August 31, 2024 15:20
Check for target existing instead of using VCPKG_LIBRARY_LINKAGE variable for creation 'alias' targets.
@JonLiu1993 JonLiu1993 added the category:port-update The issue is with a library, which is requesting update new revision label Sep 2, 2024
ports/apr/vcpkg.json Outdated Show resolved Hide resolved
@JonLiu1993
Copy link
Member

@rinrab, Thanks for your pr, when I tested the usage by apr:x64-windows , I get this error,please take a look:

1> CMake generation started for default configuration: 'x64-Debug'.
1> Found and using vcpkg toolchain file (F:/Feature-test/apr/scripts/buildsystems/vcpkg.cmake).
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\test\source\repos\CMakeProject1\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"   -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="F:/Feature-test/apr/scripts/buildsystems/vcpkg.cmake" "C:\Users\test\source\repos\CMakeProject1" 2>&1"
1> Working directory: C:\Users\test\source\repos\CMakeProject1\out\build\x64-Debug
1> [CMake] -- The C compiler identification is MSVC 19.40.33814.0
1> [CMake] -- The CXX compiler identification is MSVC 19.40.33814.0
1> [CMake] -- Detecting C compiler ABI info
1> [CMake] -- Detecting C compiler ABI info - done
1> [CMake] -- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting C compile features
1> [CMake] -- Detecting C compile features - done
1> [CMake] -- Detecting CXX compiler ABI info
1> [CMake] -- Detecting CXX compiler ABI info - done
1> [CMake] -- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe - skipped
1> [CMake] -- Detecting CXX compile features
1> [CMake] -- Detecting CXX compile features - done
1> [CMake] CMake Warning at F:/Feature-test/apr/installed/x64-windows/share/unofficial-apr/unofficial-apr-config.cmake:1 (message):
1> [CMake]   find_package(unofficial-apr) is deprecated.
1> [CMake] 
1> [CMake]   Use find_package(apr) instead
1> [CMake] Call Stack (most recent call first):
1> [CMake]   F:/Feature-test/apr/scripts/buildsystems/vcpkg.cmake:859 (_find_package)
1> [CMake]   CMakeProject1/CMakeLists.txt:6 (find_package)
1> [CMake] 
1> [CMake] 
1> [CMake] -- Configuring done (2.0s)
1> [CMake] CMake Error at CMakeProject1/CMakeLists.txt:10 (target_link_libraries):
1> [CMake]   Target "test" links to:
1> [CMake] 
1> [CMake]     unofficial::apr::apr-1
1> [CMake] 
1> [CMake]   but the target was not found.  Possible reasons include:
1> [CMake] 
1> [CMake]     * There is a typo in the target name.
1> [CMake]     * A find_package call is missing for an IMPORTED target.
1> [CMake]     * An ALIAS target is missing.
1> [CMake] 
1> [CMake] 
1> [CMake] 
1> [CMake] -- Generating done (0.0s)
1> [CMake] CMake Generate step failed.  Build files cannot be regenerated correctly.
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\test\source\repos\CMakeProject1\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"   -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="F:/Feature-test/apr/scripts/buildsystems/vcpkg.cmake" "C:\Users\test\source\repos\CMakeProject1" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe"  -G "Ninja"  -DCMAKE_BUILD_TYPE:STRING="Debug" -DCMAKE_INSTALL_PREFIX:PATH="C:\Users\test\source\repos\CMakeProject1\out\install\x64-Debug" -DCMAKE_C_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/cl.exe"   -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="F:/Feature-test/apr/scripts/buildsystems/vcpkg.cmake" "C:\Users\test\source\repos\CMakeProject1" 2>&1"' returned with exit code: 1'.

CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)

project(test)

find_package(unofficial-apr CONFIG REQUIRED)

add_executable(test CMakeProject1.cpp)

target_link_libraries(test PRIVATE unofficial::apr::apr-1 unofficial::apr::aprapp-1 unofficial::apr::libapr-1 unofficial::apr::libaprapp-1)

@rinrab
Copy link
Contributor Author

rinrab commented Sep 2, 2024

This library has non-standard targets. By default, APR builds both static and shared configurations. The target names and library artifacts are apr-1 for the static configuration and libapr-1 for the shared configuration. However, either of these configurations can be disabled via options (which done by the port).

So, when you install the library for the x64-windows triplet, you only get the shared library (libapr-1 and aprapp-1). This results in the non-existence of apr::apr-1, apr::aprapp-1, and their unofficial versions.

If you remove linking against unofficial::apr::apr-1 and unofficial::apr::aprapp-1 from your CMakeLists, it should work.

@JonLiu1993
Copy link
Member

Tested usage successfully by apr:x64-windows:

apr provides CMake targets:

  # this is heuristically generated, and may not be correct
  find_package(apr CONFIG REQUIRED)
  target_link_libraries(main PRIVATE apr::libapr-1 apr::libaprapp-1)

  find_package(unofficial-apr CONFIG REQUIRED)
  target_link_libraries(main PRIVATE unofficial::apr::apr-1 unofficial::apr::aprapp-1 unofficial::apr::libapr-1 unofficial::apr::libaprapp-1)

@JonLiu1993 JonLiu1993 added the info:reviewed Pull Request changes follow basic guidelines label Sep 3, 2024
@vicroms vicroms merged commit f7a181a into microsoft:master Sep 3, 2024
16 checks passed
@dg0yt
Copy link
Contributor

dg0yt commented Sep 4, 2024

target_link_libraries(main PRIVATE unofficial::apr::apr-1 unofficial::apr::aprapp-1 unofficial::apr::libapr-1 unofficial::apr::libaprapp-1)

Ouch. Why does this form of testing and feedback never stop?

Like all ports with varying exported target names, this port should get a usage file with the target_link_libraries(... $<IF:$<TARGET_EXISTS:...>,...,...>) pattern.

@rinrab rinrab mentioned this pull request Sep 4, 2024
@rinrab
Copy link
Contributor Author

rinrab commented Sep 4, 2024

Opened another pull-request with adding the correct usage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-update The issue is with a library, which is requesting update new revision info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants