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

Test missing macros at build time on Mac #49

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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: 4 additions & 0 deletions .pipelines/build-package-preconfigured.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ parameters:
values:
- ffmpeg
- ffmpeg-cloud
- hellocmake
- hellomeson
- hunspell
- hunspell-debug
- libpng
- libzip-static
- libzip-dynamic
- macrotest-cmake
- macrotest-meson
- minizip
- openssl-static
- opencv4
Expand Down
5 changes: 3 additions & 2 deletions .pipelines/templates/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ stages:
- powershell: |
echo "##vso[task.setvariable variable=binExists]$(if (Test-Path "$(Build.ArtifactStagingDirectory)/package/bin") { 'true' } else { 'false' })"
echo "##vso[task.setvariable variable=srcExists]$(if (Test-Path "$(Build.ArtifactStagingDirectory)/package/src") { 'true' } else { 'false' })"
echo "##vso[task.setvariable variable=buildtreesExists]$(if (Test-Path "$(Build.SourcesDirectory)/vcpkg/buildtrees") { 'true' } else { 'false' })"
name: CheckDirectories
displayName: 'Verify builds ran'

Expand All @@ -107,14 +108,14 @@ stages:
- pwsh: |
./scripts/copy-logs.ps1 -Source "./vcpkg/buildtrees" -Destination "$(Build.ArtifactStagingDirectory)/logs"
displayName: Stage logs
condition: and(succeededOrFailed(), ${{ parameters.publishToPipelineArtifacts }}, or(eq(variables.binExists, 'true'), eq(variables.srcExists, 'true')))
condition: and(succeededOrFailed(), ${{ parameters.publishToPipelineArtifacts }}, eq(variables.buildtreesExists, 'true'))

- task: PublishBuildArtifacts@1
displayName: Publish logs
inputs:
pathToPublish: $(Build.ArtifactStagingDirectory)/logs
artifactName: $(osName)-logs
condition: and(succeededOrFailed(), ${{ parameters.publishToPipelineArtifacts }}, or(eq(variables.binExists, 'true'), eq(variables.srcExists, 'true')))
condition: and(succeededOrFailed(), ${{ parameters.publishToPipelineArtifacts }}, eq(variables.buildtreesExists, 'true'))

- stage: PublishToGitHubRelease
displayName: 'Publish to GitHub Release'
Expand Down
28 changes: 28 additions & 0 deletions custom-ports/hellocmake/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# hellocmake
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mike-malburg/hellocmake
REF master
SHA512 abdf17c67b59daf64ba971294d67bf53d3380be01618eb42ed06fe1da206da7b9d4ce4662bf00abafc4c7098750f515c761ba1bbebad66c024caefe7c6b78041
HEAD_REF master
)

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)
set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled)

vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
--no-warn-unused-cli
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

# Move hellocmake exe to tools dir
vcpkg_copy_tools(
TOOL_NAMES hellocmaketest
SEARCH_DIR ${CURRENT_PACKAGES_DIR}/bin
DESTINATION ${CURRENT_PACKAGES_DIR}/tools
AUTO_CLEAN
)
16 changes: 16 additions & 0 deletions custom-ports/hellocmake/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "hellocmake",
"version": "1.0.0",
"port-version": 1,
"description": "A test program built with cmake, including a shared library and a exe which depends on that library. The exe prints off OS version macro data, as well, for debugging purposes",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
27 changes: 27 additions & 0 deletions custom-ports/hellomeson/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# hellomeson
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mike-malburg/hellomeson
REF master
SHA512 189ed23f4e944225d49d85920556480edf2305e141c24d70345532c1cc2ed754af8f03c266ab8d22f99c5bb59c1b2b5aca3796c21bd186917bbc8f6c55c131ee
HEAD_REF master
)

set(VCPKG_POLICY_SKIP_COPYRIGHT_CHECK enabled)
set(VCPKG_POLICY_ALLOW_EXES_IN_BIN enabled)

vcpkg_configure_meson(
SOURCE_PATH "${SOURCE_PATH}"
)

vcpkg_install_meson()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()

# # Move hellomesontest exe to tools dir
vcpkg_copy_tools(
TOOL_NAMES hellomesontest
SEARCH_DIR ${CURRENT_PACKAGES_DIR}/bin
DESTINATION ${CURRENT_PACKAGES_DIR}/tools
AUTO_CLEAN
)
12 changes: 12 additions & 0 deletions custom-ports/hellomeson/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "hellomeson",
"version": "1.0.0",
"port-version": 1,
"description": "A test program built with meson, including a shared library and a exe which depends on that library. The exe prints off OS version macro data, as well, for debugging purposes",
"dependencies": [
{
"name": "vcpkg-tool-meson",
"host": true
}
]
}
6 changes: 6 additions & 0 deletions custom-ports/macrotest-cmake/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# macrotest-cmake
This is not signed for mac on the build server. Because of this, you will have to run this before you are able to execute it, if it was built on the build server:

```bash
sudo xattr -rd com.apple.quarantine macrotest-cmake
```
24 changes: 24 additions & 0 deletions custom-ports/macrotest-cmake/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# macrotest-cmake
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mike-malburg/macrotest-cmake
REF main
SHA512 40baa81ab881794b4f94c894c985fb03c3a6478043b9ded4de840ce0f9121ae45e6f9bd18b533e205d86f4ff8d4ddaf1d0e5e27c6cb4aaea5e4cf69c9829173e
HEAD_REF main
)

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

vcpkg_configure_cmake(SOURCE_PATH "${SOURCE_PATH}")
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

# Move main exe to tools dir
vcpkg_copy_tools(
TOOL_NAMES macrotest-cmake
SEARCH_DIR ${CURRENT_PACKAGES_DIR}/bin
DESTINATION ${CURRENT_PACKAGES_DIR}/tools
AUTO_CLEAN
)
16 changes: 16 additions & 0 deletions custom-ports/macrotest-cmake/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "macrotest-cmake",
"version": "1.0.0",
"port-version": 1,
"description": "A test program, built with cmake, which prints off OS version macro data for debugging purposes.",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}
6 changes: 6 additions & 0 deletions custom-ports/macrotest-meson/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# macrotest-meson
This is not signed for mac on the build server. Because of this, you will have to run this before you are able to execute it, if it was built on the build server:

```bash
sudo xattr -rd com.apple.quarantine macrotest-meson
```
24 changes: 24 additions & 0 deletions custom-ports/macrotest-meson/portfile.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# macrotest-meson
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO mike-malburg/macrotest-meson
REF main
SHA512 291f6d4a1d98f87123322fb4e60072df600bd7f7f3f344bc7f294e6ce91958ea36be98d40afecdab647b03ad1723a213db12b40d9f192041784a9d026bd9bc03
HEAD_REF main
)

set(VCPKG_POLICY_EMPTY_INCLUDE_FOLDER enabled)

vcpkg_configure_meson(SOURCE_PATH "${SOURCE_PATH}")
vcpkg_install_meson()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")

# Move main exe to tools dir
vcpkg_copy_tools(
TOOL_NAMES macrotest-meson
SEARCH_DIR ${CURRENT_PACKAGES_DIR}/bin
DESTINATION ${CURRENT_PACKAGES_DIR}/tools
AUTO_CLEAN
)
12 changes: 12 additions & 0 deletions custom-ports/macrotest-meson/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "macrotest-meson",
"version": "1.0.0",
"port-version": 1,
"description": "A test program, built with meson, which prints off OS version macro data for debugging purposes.",
"dependencies": [
{
"name": "vcpkg-tool-meson",
"host": true
}
]
}
108 changes: 108 additions & 0 deletions preconfigured-packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,114 @@
"linkType": "dynamic",
"buildType": "release"
}
},
{
"name": "hellocmake",
"mac": {
"package": "hellocmake",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": false,
"lib": true,
"bin": true,
"share": true,
"tools": true
}
},
"win": {
"package": "hellocmake",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": false,
"lib": true,
"bin": true,
"share": true,
"tools": true
}
}
},
{
"name": "hellomeson",
"mac": {
"package": "hellomeson",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": true,
"lib": true,
"bin": true,
"share": true,
"tools": true
}
},
"win": {
"package": "hellomeson",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": true,
"lib": true,
"bin": true,
"share": true,
"tools": true
}
}
},
{
"name": "macrotest-cmake",
"mac": {
"package": "macrotest-cmake",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": false,
"lib": false,
"bin": false,
"share": true,
"tools": true
}
},
"win": {
"package": "macrotest-cmake",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": false,
"lib": false,
"bin": false,
"share": true,
"tools": true
}
}
},
{
"name": "macrotest-meson",
"mac": {
"package": "macrotest-meson",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": false,
"lib": false,
"bin": false,
"share": true,
"tools": true
}
},
"win": {
"package": "macrotest-meson",
"linkType": "dynamic",
"buildType": "release",
"publish": {
"include": false,
"lib": false,
"bin": false,
"share": true,
"tools": true
}
}
}
]
}
11 changes: 8 additions & 3 deletions scripts/ps-modules/Build/Build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -286,11 +286,15 @@ function Run-PrestageAndFinalizeBuildArtifactsStep {
$srcX64Dir = "./vcpkg/installed/$($triplets[1])"
$destArm64LibDir = "$preStagePath/arm64Lib"
$destX64LibDir = "$preStagePath/x64Lib"
$destArm64ToolsDir = "$preStagePath/arm64Tools"
$destX64ToolsDir = "$preStagePath/x64Tools"
$srcToDestDirs = @{
"$srcArm64Dir/include" = "$preStagePath"
"$srcArm64Dir/share" = "$preStagePath"
"$srcArm64Dir/$libDir" = "$destArm64LibDir"
"$srcX64Dir/$libDir" = "$destX64LibDir"
"$srcArm64Dir/$toolsDir" = "$destArm64ToolsDir"
"$srcX64Dir/$toolsDir" = "$destX64ToolsDir"
}
}
else {
Expand Down Expand Up @@ -324,9 +328,10 @@ function Run-PrestageAndFinalizeBuildArtifactsStep {
}

# Finalize artifacts (Mac-only)
if((Get-IsOnMacOS) -and (Test-Path $destArm64LibDir)) {
$destUniversalLibDir = "$preStagePath/lib"
Create-FinalizedMacBuildArtifacts -arm64LibDir "$destArm64LibDir" -x64LibDir "$destX64LibDir" -universalLibDir "$destUniversalLibDir"
if((Get-IsOnMacOS) -and ((Test-Path $destArm64LibDir) -or (Test-Path $destArm64ToolsDir))) {
$destUniversalLibDir = "$preStagePath/lib"
$destUniversalToolsDir = "$preStagePath/tools"
Create-FinalizedMacBuildArtifacts -arm64LibDir "$destArm64LibDir" -x64LibDir "$destX64LibDir" -universalLibDir "$destUniversalLibDir" -arm64ToolsDir "$destArm64ToolsDir" -x64ToolsDir "$destX64ToolsDir" -universalToolsDir "$destUniversalToolsDir"
}
}

Expand Down
Loading