Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
38d175b
[vcpkg_configure_meson] Fix append host path
Mar 8, 2022
b858854
New functions vcpkg_setup_pkgconfig_path and vcpkg_restore_pkgconfig_…
Mar 8, 2022
f37504d
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
Mar 9, 2022
fefaa62
Fix bug, add cos
Mar 9, 2022
471c441
Apply suggestions
Mar 9, 2022
c302ed6
Merge branch 'master' of github.com:microsoft/vcpkg into dev/jack/22812
vicroms Mar 11, 2022
548a445
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
Mar 14, 2022
4889eb4
Merge branch 'dev/jack/22812' of https://github.com/JackBoosY/vcpkg i…
Mar 14, 2022
47168aa
Apply suggestions
Mar 14, 2022
4c52ff5
Apply suggestion
Mar 14, 2022
449c934
doc
Mar 14, 2022
3ef0734
Update docs/maintainers/vcpkg_setup_pkgconfig_path.cmake.md
JackBoosY Mar 22, 2022
f177768
Update scripts/cmake/vcpkg_setup_pkgconfig_path.cmake
JackBoosY Mar 22, 2022
fce9c18
Update scripts/cmake/vcpkg_configure_make.cmake
JackBoosY Mar 22, 2022
f67ae2f
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
Apr 7, 2022
5722870
Merge branch 'dev/jack/22812' of https://github.com/JackBoosY/vcpkg i…
Apr 7, 2022
9a7bdb4
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
Apr 12, 2022
1fd873e
Apply suggestions
Apr 18, 2022
767af25
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
Apr 18, 2022
4837448
Apply suggestion
Apr 18, 2022
20cd30a
Merge branch 'master' of https://github.com/microsoft/vcpkg into dev/…
May 6, 2022
94ec276
Apply suggestions
May 6, 2022
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
16 changes: 5 additions & 11 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,6 @@ function(vcpkg_configure_make)
endif()
endif()
debug_message("ENV{LIBS}:$ENV{LIBS}")
vcpkg_find_acquire_program(PKGCONFIG)
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND NOT PKGCONFIG STREQUAL "--static")
set(PKGCONFIG "${PKGCONFIG} --static") # Is this still required or was the PR changing the pc files accordingly merged?
endif()

# Run autoconf if necessary
if (arg_AUTOCONFIG OR requires_autoconfig)
Expand Down Expand Up @@ -763,13 +759,10 @@ function(vcpkg_configure_make)
endif()

# Setup PKG_CONFIG_PATH
set(pkgconfig_installed_dir "${CURRENT_INSTALLED_DIR}${path_suffix_${current_buildtype}}/lib/pkgconfig")
set(pkgconfig_installed_share_dir "${CURRENT_INSTALLED_DIR}/share/pkgconfig")
if(ENV{PKG_CONFIG_PATH})
set(backup_env_pkg_config_path_${current_buildtype} $ENV{PKG_CONFIG_PATH})
set(ENV{PKG_CONFIG_PATH} "${pkgconfig_installed_dir}${VCPKG_HOST_PATH_SEPARATOR}${pkgconfig_installed_share_dir}${VCPKG_HOST_PATH_SEPARATOR}$ENV{PKG_CONFIG_PATH}")
if ("${current_buildtype}" STREQUAL "DEBUG")
vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}/debug")
else()
set(ENV{PKG_CONFIG_PATH} "${pkgconfig_installed_dir}${VCPKG_HOST_PATH_SEPARATOR}${pkgconfig_installed_share_dir}")
vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}")
endif()

# Setup environment
Expand All @@ -790,7 +783,6 @@ function(vcpkg_configure_make)
set(link_config_backup "$ENV{_LINK_}")
set(ENV{_LINK_} "${LINK_ENV_${current_buildtype}}")
endif()
set(ENV{PKG_CONFIG} "${PKGCONFIG}")

vcpkg_list(APPEND lib_env_vars LIB LIBPATH LIBRARY_PATH) # LD_LIBRARY_PATH)
foreach(lib_env_var IN LISTS lib_env_vars)
Expand Down Expand Up @@ -830,6 +822,8 @@ function(vcpkg_configure_make)
file(RENAME "${target_dir}/config.log" "${CURRENT_BUILDTREES_DIR}/config.log-${TARGET_TRIPLET}-${short_name_${current_buildtype}}.log")
endif()
endif()

Comment thread
JackBoosY marked this conversation as resolved.
Outdated
vcpkg_restore_pkgconfig_path()

if(backup_env_pkg_config_path_${current_buildtype})
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
set(ENV{PKG_CONFIG_PATH} "${backup_env_pkg_config_path_${current_buildtype}}")
Expand Down
19 changes: 8 additions & 11 deletions scripts/cmake/vcpkg_configure_meson.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -454,13 +454,6 @@ function(vcpkg_configure_meson)
vcpkg_list(APPEND arg_OPTIONS_RELEASE "-Dcmake_prefix_path=['${CURRENT_INSTALLED_DIR}','${CURRENT_INSTALLED_DIR}/debug']")
endif()

if(NOT arg_NO_PKG_CONFIG)
vcpkg_find_acquire_program(PKGCONFIG)
get_filename_component(PKGCONFIG_PATH ${PKGCONFIG} DIRECTORY)
vcpkg_add_to_path("${PKGCONFIG_PATH}")
set(pkgconfig_share_dir "${CURRENT_INSTALLED_DIR}/share/pkgconfig/")
endif()

set(buildtypes)
if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
set(buildname "DEBUG")
Expand All @@ -482,11 +475,12 @@ function(vcpkg_configure_meson)
message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}}")
file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${suffix_${buildtype}}")
#setting up PKGCONFIG
vcpkg_backup_env_variables(VARS PKG_CONFIG PKG_CONFIG_PATH)
if(NOT arg_NO_PKG_CONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}") # Set via native file?
set(pkgconfig_installed_dir "${CURRENT_INSTALLED_DIR}/${path_suffix_${buildtype}}lib/pkgconfig/")
vcpkg_host_path_list(APPEND ENV{PKG_CONFIG_PATH} "${pkgconfig_installed_dir}" "${pkgconfig_share_dir}" "$ENV{PKG_CONFIG_PATH}")
if ("${buildtype}" STREQUAL "DEBUG")
vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}/debug")
else()
vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}")
endif()
endif()

vcpkg_execute_required_process(
Expand All @@ -510,6 +504,9 @@ function(vcpkg_configure_meson)
endif()
message(STATUS "Configuring ${TARGET_TRIPLET}-${suffix_${buildtype}} done")

if(NOT arg_NO_PKG_CONFIG)
vcpkg_restore_pkgconfig_path()
endif()
vcpkg_restore_env_variables(VARS PKG_CONFIG PKG_CONFIG_PATH)
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
endforeach()

Expand Down
20 changes: 5 additions & 15 deletions scripts/cmake/vcpkg_configure_qmake.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,8 @@ function(vcpkg_configure_qmake)

vcpkg_backup_env_variables(VARS PKG_CONFIG_PATH)

Comment thread
JackBoosY marked this conversation as resolved.
Outdated
vcpkg_find_acquire_program(PKGCONFIG)
set(ENV{PKG_CONFIG} "${PKGCONFIG}")
get_filename_component(PKGCONFIG_PATH "${PKGCONFIG}" DIRECTORY)
vcpkg_add_to_path("${PKGCONFIG_PATH}")

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH}
"${CURRENT_INSTALLED_DIR}/lib/pkgconfig"
"${CURRENT_INSTALLED_DIR}/share/pkgconfig"
"${CURRENT_PACKAGES_DIR}/lib/pkgconfig"
"${CURRENT_PACKAGES_DIR}/share/pkgconfig")
vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}" "${CURRENT_PACKAGES_DIR}")

set(current_binary_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")

Expand Down Expand Up @@ -98,15 +89,12 @@ function(vcpkg_configure_qmake)
file(RENAME "${current_binary_dir}/config.log" "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-rel.log")
endif()

vcpkg_restore_pkgconfig_path()
vcpkg_restore_env_variables(VARS PKG_CONFIG_PATH)
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
endif()

if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH}
"${CURRENT_INSTALLED_DIR}/debug/lib/pkgconfig"
"${CURRENT_INSTALLED_DIR}/share/pkgconfig"
"${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig"
"${CURRENT_PACKAGES_DIR}/share/pkgconfig")
vcpkg_setup_pkgconfig_path(BASE_DIRS "${CURRENT_INSTALLED_DIR}/debug" "${CURRENT_PACKAGES_DIR}/debug")

set(current_binary_dir "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")

Expand Down Expand Up @@ -135,6 +123,8 @@ function(vcpkg_configure_qmake)
file(REMOVE "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-dbg.log")
file(RENAME "${current_binary_dir}/config.log" "${CURRENT_BUILDTREES_DIR}/internal-config-${TARGET_TRIPLET}-dbg.log")
endif()

vcpkg_restore_pkgconfig_path()
endif()

endfunction()
56 changes: 56 additions & 0 deletions scripts/cmake/vcpkg_setup_pkgconfig_path.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#[===[
# vcpkg_setup_pkgconfig_path

Setup the generated pkgconfig file path to PKG_CONFIG_PATH environment variable or restore PKG_CONFIG_PATH environment variable
Comment thread
JackBoosY marked this conversation as resolved.
Outdated

```cmake
vcpkg_setup_pkgconfig_path(BASE_DIRS <"${CURRENT_INSTALLED_DIR}" ...>)
```
```cmake
vcpkg_restore_pkgconfig_path()
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
```

`vcpkg_setup_pkgconfig_path` prepend the default pkgconfig path passed to it to the PKG_CONFIG_PATH environment variable.
`vcpkg_restore_pkgconfig_path` should be called after the configure or build procees end.
Comment thread
JackBoosY marked this conversation as resolved.
Outdated

#]===]
function(vcpkg_setup_pkgconfig_path)
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "BASE_DIRS" "")

if(NOT DEFINED arg_BASE_DIRS OR "${arg_BASE_DIRS}" STREQUAL "")
message(FATAL_ERROR "BASE_DIR must be passed in")
endif()
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()

vcpkg_backup_env_variables(VARS PKGCONFIG_PATH PKG_CONFIG PKG_CONFIG_PATH)
Comment thread
JackBoosY marked this conversation as resolved.
Outdated

vcpkg_find_acquire_program(PKGCONFIG)
get_filename_component(PKGCONFIG_PATH ${PKGCONFIG} DIRECTORY)
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
vcpkg_add_to_path("${PKGCONFIG_PATH}")

if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND NOT PKGCONFIG STREQUAL "--static")
set(PKGCONFIG "${PKGCONFIG} --static") # Is this still required or was the PR changing the pc files accordingly merged?
endif()
Comment thread
JackBoosY marked this conversation as resolved.
Outdated
set(ENV{PKG_CONFIG} "${PKGCONFIG}") # Set via native file?

foreach(base_dir IN LISTS arg_BASE_DIRS)
vcpkg_host_path_list(APPEND pkgconfig_share_dirs "${base_dir}/share/pkgconfig/")
endforeach()

foreach(base_dir IN LISTS arg_BASE_DIRS)
vcpkg_host_path_list(APPEND pkgconfig_share_dirs "${base_dir}/lib/pkgconfig/")
endforeach()

vcpkg_host_path_list(PREPEND ENV{PKG_CONFIG_PATH} ${pkgconfig_installed_dirs} ${pkgconfig_share_dirs})
endfunction()

function(vcpkg_restore_pkgconfig_path)
cmake_parse_arguments(PARSE_ARGV 0 "arg" "" "" "")
if(DEFINED arg_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "${CMAKE_CURRENT_FUNCTION} was passed extra arguments: ${arg_UNPARSED_ARGUMENTS}")
endif()

vcpkg_restore_env_variables(VARS PKGCONFIG_PATH PKG_CONFIG PKG_CONFIG_PATH)
endfunction()
1 change: 1 addition & 0 deletions scripts/ports.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ include("${SCRIPTS}/cmake/vcpkg_install_qmake.cmake")
include("${SCRIPTS}/cmake/vcpkg_list.cmake")
include("${SCRIPTS}/cmake/vcpkg_minimum_required.cmake")
include("${SCRIPTS}/cmake/vcpkg_replace_string.cmake")
include("${SCRIPTS}/cmake/vcpkg_setup_pkgconfig_path.cmake")
include("${SCRIPTS}/cmake/vcpkg_test_cmake.cmake")

include("${SCRIPTS}/cmake/z_vcpkg_apply_patches.cmake")
Expand Down