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

[vcpkg scripts] Crosscompiling fixes #26617

Merged
merged 55 commits into from
Oct 13, 2022
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
cff0492
test osx stuff
Neumann-A Aug 31, 2022
3f0bf20
deactivate most of ci
Neumann-A Sep 1, 2022
ce3fd60
get trace output
Neumann-A Sep 1, 2022
43553d9
add required flags to the linker flags
Neumann-A Sep 1, 2022
b8f6974
also look for --sysroot
Neumann-A Sep 1, 2022
c411a33
Link_args are always shared
Neumann-A Sep 2, 2022
5578e67
fix ar flags
Neumann-A Sep 2, 2022
ac5c8f9
setup FOR_BUILD vars.
Neumann-A Sep 2, 2022
98e8b82
try tricking the build.... but man configure scripts are stupid somet…
Neumann-A Sep 3, 2022
4b5f803
try 2
Neumann-A Sep 3, 2022
cf7adeb
major meson rewrite
Neumann-A Sep 3, 2022
d905202
fix duplicates
Neumann-A Sep 4, 2022
8c6339f
revert --trace-expand
Neumann-A Sep 4, 2022
6757d04
update port version
Neumann-A Sep 4, 2022
0bc3956
Merge remote-tracking branch 'upstream/master' into fix_cpp_osx_and_o…
Neumann-A Sep 4, 2022
332329f
revert pipeline changes
Neumann-A Sep 4, 2022
8b311a4
v db
Neumann-A Sep 4, 2022
886beb6
bump version
Neumann-A Sep 4, 2022
8ee8423
v db
Neumann-A Sep 4, 2022
002f6ba
set flags for rc compilers
Neumann-A Sep 5, 2022
a5b9bc8
a few more ios fixes.
Neumann-A Sep 6, 2022
133b0a0
v db
Neumann-A Sep 6, 2022
176edfb
fix osx/ios logic
Neumann-A Sep 8, 2022
22564ed
documentation and don't fatal_error in build/host machine entry calcu…
Neumann-A Sep 9, 2022
b4a45aa
Merge branch 'fix_cpp_osx_and_others' of https://github.com/Neumann-A…
Neumann-A Sep 9, 2022
1570c35
add android/compiler target stuff from #26570
Neumann-A Sep 14, 2022
1673027
remove extra endif
Neumann-A Sep 14, 2022
d347f83
Merge branch 'master' of https://github.com/microsoft/vcpkg into fix_…
Sep 16, 2022
357b504
Merge remote-tracking branch 'upstream/master' into fix_cpp_osx_and_o…
Neumann-A Sep 17, 2022
5b30569
v db
Neumann-A Sep 17, 2022
7e4ffa9
add target param to linker flags.
Neumann-A Sep 18, 2022
4acc2d0
target in cpp flags
Neumann-A Sep 18, 2022
005ccbe
Make vcpkg-cmake-get-vars more ios compatible
m-kuhn Sep 18, 2022
ad5ae3b
Merge pull request #10 from opengisch/opengisch/misc-osx-ios-android
Neumann-A Sep 18, 2022
6aca335
Update scripts/get_cmake_vars/CMakeLists.txt
Neumann-A Sep 18, 2022
ceb7bfe
More ios fixes
m-kuhn Sep 18, 2022
af8f8ea
Merge pull request #11 from m-kuhn/moreios
Neumann-A Sep 18, 2022
6f18956
fix target adding
Neumann-A Sep 18, 2022
4b8384e
Merge branch 'fix_cpp_osx_and_others' of https://github.com/Neumann-A…
Neumann-A Sep 18, 2022
21553e5
Fix broken loop
m-kuhn Sep 18, 2022
c144ba1
Merge pull request #12 from m-kuhn/fix_broken_loop
Neumann-A Sep 18, 2022
d902437
v db
Neumann-A Sep 18, 2022
342d37f
Merge branch 'fix_cpp_osx_and_others' of https://github.com/Neumann-A…
Neumann-A Sep 18, 2022
0475e5d
v db
Neumann-A Sep 18, 2022
a333006
Merge remote-tracking branch 'upstream/master' into fix_cpp_osx_and_o…
Neumann-A Sep 26, 2022
051c678
bump date
Neumann-A Sep 26, 2022
e422921
v db
Neumann-A Sep 26, 2022
96b5807
v db
Neumann-A Sep 26, 2022
184abe3
Merge branch 'microsoft:master' into fix_cpp_osx_and_others
Neumann-A Sep 28, 2022
f27f316
Merge branch 'microsoft:master' into fix_cpp_osx_and_others
Neumann-A Oct 1, 2022
999c02e
Merge branch 'microsoft:master' into fix_cpp_osx_and_others
Neumann-A Oct 4, 2022
0bf1edb
Merge remote-tracking branch 'upstream/master' into fix_cpp_osx_and_o…
Neumann-A Oct 9, 2022
7292d87
v db
Neumann-A Oct 9, 2022
6ae069e
remove port-version 1
Neumann-A Oct 9, 2022
29d5b6d
v db
Neumann-A Oct 9, 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
2 changes: 1 addition & 1 deletion ports/vcpkg-cmake-get-vars/cmake_get_vars/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ if(CMAKE_SYSROOT AND CMAKE_CXX_COMPILE_OPTIONS_SYSROOT)
string(APPEND EXTRA_FLAGS " \"${CMAKE_CXX_COMPILE_OPTIONS_SYSROOT}${CMAKE_SYSROOT}\"")
endif()

foreach(flags CXX C SHARED_LINKER EXE_LINKER)
foreach(flags CXX C SHARED_LINKER EXE_LINKER STATIC_LINKER MODULE_LINKER)
set(${flags}_FLAGS "${CMAKE_${flags}_FLAGS} ${CMAKE_${flags}_FLAGS_${VCPKG_CONFIGS}} ${EXTRA_FLAGS}")
endforeach()

Expand Down
84 changes: 42 additions & 42 deletions scripts/azure-pipelines/azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,54 +13,54 @@ parameters:
default: 'use default'

jobs:
- template: windows/azure-pipelines.yml
parameters:
triplet: x86-windows
jobName: x86_windows
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: x86-windows
# jobName: x86_windows
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: windows/azure-pipelines.yml
parameters:
triplet: x64-windows
jobName: x64_windows
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: x64-windows
# jobName: x64_windows
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: windows/azure-pipelines.yml
parameters:
triplet: x64-windows-static
jobName: x64_windows_static
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: x64-windows-static
# jobName: x64_windows_static
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: windows/azure-pipelines.yml
parameters:
triplet: x64-windows-static-md
jobName: x64_windows_static_md
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: x64-windows-static-md
# jobName: x64_windows_static_md
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: windows/azure-pipelines.yml
parameters:
triplet: x64-uwp
jobName: x64_uwp
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: x64-uwp
# jobName: x64_uwp
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: windows/azure-pipelines.yml
parameters:
triplet: arm64-windows
jobName: arm64_windows
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: arm64-windows
# jobName: arm64_windows
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: windows/azure-pipelines.yml
parameters:
triplet: arm-uwp
jobName: arm_uwp
poolName: $(windows-pool)
vcpkgToolSha: ${{ parameters.vcpkgToolSha }}
#- template: windows/azure-pipelines.yml
# parameters:
# triplet: arm-uwp
# jobName: arm_uwp
# poolName: $(windows-pool)
# vcpkgToolSha: ${{ parameters.vcpkgToolSha }}

- template: osx/azure-pipelines.yml
parameters:
Expand Down
41 changes: 41 additions & 0 deletions scripts/buildsystems/meson/meson.template.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[binaries]
cmake = ['@CMAKE_COMMAND@']
python = ['@PYTHON3@']
ninja = ['@NINJA@']
pkgconfig= ['@PKGCONFIG@']
@MESON_MT@
@MESON_AR@
@MESON_C@
@MESON_C_LD@
@MESON_CXX@
@MESON_CXX_LD@
@MESON_OBJC@
@MESON_OBJC_LD@
@MESON_OBJCPP@
@MESON_OBJCPP_LD@
@MESON_FC@
@MESON_FC_LD@
@MESON_WINDRES@
@MESON_ADDITIONAL_BINARIES@
[properties]
cmake_toolchain_file = '@SCRIPTS@/buildsystems/vcpkg.cmake'
[cmake]
VCPKG_TARGET_TRIPLET = '@TARGET_TRIPLET@'
VCPKG_HOST_TRIPLET = '@_HOST_TRIPLET@'
VCPKG_CHAINLOAD_TOOLCHAIN_FILE = '@VCPKG_CHAINLOAD_TOOLCHAIN_FILE@'
VCPKG_CRT_LINKAGE = '@VCPKG_CRT_LINKAGE@'
_VCPKG_INSTALLED_DIR = '@_VCPKG_INSTALLED_DIR@'
@MESON_HOST_MACHINE@
@MESON_BUILD_MACHINE@
[built-in options]
default_library = '@MESON_DEFAULT_LIBRARY@'
werror = false
@MESON_CFLAGS@
@MESON_CXXFLAGS@
@MESON_FCFLAGS@
@MESON_OBJCFLAGS@
@MESON_OBJCPPFLAGS@
# b_vscrt
@MESON_VSCRT_LINKAGE@
# c_winlibs/cpp_winlibs
@MESON_WINLIBS@
16 changes: 13 additions & 3 deletions scripts/cmake/vcpkg_configure_make.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ macro(z_vcpkg_determine_autotools_target_arch_mac out_var)
endmacro()

macro(z_vcpkg_extract_cpp_flags_and_set_cflags_and_cxxflags flag_suffix)
string(REGEX MATCHALL "( |^)-D[^ ]+" CPPFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${flag_suffix}}")
string(REGEX MATCHALL "( |^)-D[^ ]+" CXXPPFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${flag_suffix}}")
string(REGEX MATCHALL "( |^)(-D|-isysroot|--sysroot=|-isystem|-m?[Aa][Rr][Cc][Hh]) ?[^ ]+" CPPFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_C_FLAGS_${flag_suffix}}")
string(REGEX MATCHALL "( |^)(-D|-isysroot|--sysroot=|-isystem|-m?[Aa][Rr][Cc][Hh]) ?[^ ]+" CXXPPFLAGS_${flag_suffix} "${VCPKG_DETECTED_CMAKE_CXX_FLAGS_${flag_suffix}}")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@m-kuhn doesn't this also need --target(=| ) ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I originally had it on ldflags also but it ran fine without in the recent tests. I cannot think of a reason for this to be present in cppflags but ultimately i only believe successful builds when it comes to autoconf based builds.

Let me test again

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I cannot think of a reason for this to be present in cppflags

cpp configure results might depend on it? I assume the correct regex is ...|--target=|-target|... (similar to sysroot) if I remember the platform stuff in cmake correct.

Copy link
Contributor

@m-kuhn m-kuhn Sep 18, 2022

Choose a reason for hiding this comment

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

Finally got around to testing your branch, you are correct.
Also LDFLAGS will need it otherwise libpq for arm-neon-android fails with

ld: error: pg_config.o is incompatible with elf64-x86-64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

list(JOIN CXXPPFLAGS_${flag_suffix} "|" CXXREGEX)
if(CXXREGEX)
list(FILTER CPPFLAGS_${flag_suffix} INCLUDE REGEX "(${CXXREGEX})")
Expand Down Expand Up @@ -384,7 +384,7 @@ function(vcpkg_configure_make)
# Currently needed for arm because objdump yields: "unrecognised machine type (0x1c4) in Import Library Format archive"
list(APPEND arg_OPTIONS lt_cv_deplibs_check_method=pass_all)
endif()
elseif(NOT VCPKG_TARGET_IS_OSX)
else()
# Because OSX dosn't like CMAKE_C(XX)_COMPILER (cc) in CC/CXX and rather wants to have gcc/g++
function(z_vcpkg_make_set_env envvar cmakevar)
set(prog "${VCPKG_DETECTED_CMAKE_${cmakevar}} ${ARGN}")
Expand Down Expand Up @@ -754,10 +754,14 @@ function(vcpkg_configure_make)

# Setup environment
set(ENV{CPPFLAGS} "${CPPFLAGS_${current_buildtype}}")
set(ENV{CPPFLAGS_FOR_BUILD} "${CPPFLAGS_${current_buildtype}}")
set(ENV{CFLAGS} "${CFLAGS_${current_buildtype}}")
set(ENV{CFLAGS_FOR_BUILD} "${CFLAGS_${current_buildtype}}")
set(ENV{CXXFLAGS} "${CXXFLAGS_${current_buildtype}}")
#set(ENV{CXXFLAGS_FOR_BUILD} "${CXXFLAGS_${current_buildtype}}") -> doesn't exist officially
set(ENV{RCFLAGS} "${VCPKG_DETECTED_CMAKE_RC_FLAGS_${current_buildtype}}")
set(ENV{LDFLAGS} "${LDFLAGS_${current_buildtype}}")
set(ENV{LDFLAGS_FOR_BUILD} "${LDFLAGS_${current_buildtype}}")
if(ARFLAGS_${current_buildtype} AND NOT (arg_USE_WRAPPERS AND VCPKG_TARGET_IS_WINDOWS))
# Target windows with wrappers enabled cannot forward ARFLAGS since it breaks the wrapper
set(ENV{ARFLAGS} "${ARFLAGS_${current_buildtype}}")
Expand All @@ -767,6 +771,12 @@ function(vcpkg_configure_make)
# and libtool tries to avoid versioning for shared libraries and no symbolic links are created.
if(VCPKG_TARGET_IS_ANDROID)
set(ENV{LDFLAGS} "-avoid-version $ENV{LDFLAGS}")
set(ENV{LDFLAGS_FOR_BUILD} "-avoid-version $ENV{LDFLAGS_FOR_BUILD}")
endif()

if(VCPKG_TARGET_IS_OSX) # This is so stupid but configure scripts are stupid and don't use all flags sometimes o.O
set(ENV{CC} "$ENV{CC} $ENV{CPPFLAGS} $ENV{CFLAGS}")
set(ENV{CC_FOR_BUILD} "$ENV{CC_FOR_BUILD} $ENV{CPPFLAGS} $ENV{CFLAGS}")
endif()

if(LINK_ENV_${current_buildtype})
Expand Down
Loading