Skip to content

Commit

Permalink
Compile osx manager with vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
talregev committed Nov 29, 2024
1 parent 7cc54fc commit 20538f4
Show file tree
Hide file tree
Showing 12 changed files with 323 additions and 3 deletions.
17 changes: 15 additions & 2 deletions .github/workflows/osx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,12 @@ jobs:
path: deploy/macos_apps_arm64.7z

cmake-build:
name: cmake-build
name: ${{matrix.type}}-build
runs-on: macos-latest
strategy:
matrix:
type: [manager-vcpkg, libs-cmake]
fail-fast: false
steps:
- uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd
with:
Expand All @@ -146,8 +150,17 @@ jobs:
echo "VCPKG_BINARY_SOURCES=clear;x-aws-config,no-sign-request;x-aws,s3://vcpkg.cache.boinc/,read" >> $GITHUB_ENV
- name: libs cmake
if: matrix.type == 'libs-cmake'
run: osx/ci_build_libs_cmake.sh

- name: install vcpkg dependencies
if: matrix.type == 'manager-vcpkg'
run: ./osx/build_vcpkg_3rdparty_for_manager.sh

- name: vcpkg make manager
if: success() && matrix.type == 'manager-vcpkg'
run: ./mac_build/buildMacBOINC-CI.sh --no_shared_headers --cache_dir $(pwd)/3rdParty/osx/mac_vcpkg --vcpkg

- name: Prepare logs on failure
if: ${{ failure() }}
run: python3 ./deploy/prepare_deployment.py logs
Expand All @@ -156,5 +169,5 @@ jobs:
if: ${{ failure() }}
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882
with:
name: osx_logs_cmake-build_${{ github.event.pull_request.head.sha }}
name: osx_logs_${{ matrix.type }}_${{ github.event.pull_request.head.sha }}
path: deploy/logs.7z
16 changes: 16 additions & 0 deletions 3rdParty/vcpkg_ports/configs/manager/osx/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"name": "boinc-manager",
"dependencies":
[
"ftgl",
{
"name": "curl",
"features": ["openssl","c-ares"],
"default-features": false
},
{
"name": "wxwidgets",
"default-features": false
}
]
}
59 changes: 59 additions & 0 deletions 3rdParty/vcpkg_ports/patches/boinc_SetItemBitmap.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
diff --git a/include/wx/osx/choice.h b/include/wx/osx/choice.h
index 37486f8a7c..d80bf53766 100644
--- a/include/wx/osx/choice.h
+++ b/include/wx/osx/choice.h
@@ -73,6 +73,7 @@ public:
virtual int FindString(const wxString& s, bool bCase = false) const wxOVERRIDE;
virtual wxString GetString(unsigned int n) const wxOVERRIDE;
virtual void SetString(unsigned int pos, const wxString& s) wxOVERRIDE;
+ void SetItemBitmap(unsigned int n, const wxBitmap& bitmap);
// osx specific event handling common for all osx-ports

virtual bool OSXHandleClicked(double timestampsec) wxOVERRIDE;
diff --git a/include/wx/osx/core/private.h b/include/wx/osx/core/private.h
index 429c8f7401..cae9f9eebe 100644
--- a/include/wx/osx/core/private.h
+++ b/include/wx/osx/core/private.h
@@ -820,6 +820,7 @@ public :
}

virtual void SetItem(int pos, const wxString& item) = 0;
+ virtual void SetItemBitmap(unsigned int n, const wxBitmap& bitmap) = 0;
};


diff --git a/src/osx/choice_osx.cpp b/src/osx/choice_osx.cpp
index 6df17b34e5..1fcb2a5fc4 100644
--- a/src/osx/choice_osx.cpp
+++ b/src/osx/choice_osx.cpp
@@ -217,6 +217,13 @@ wxString wxChoice::GetString(unsigned int n) const
return m_strings[n] ;
}

+void wxChoice::SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
+{
+ wxCHECK_RET( IsValid(n), wxT("wxChoice::SetItemBitmap(): invalid index") );
+
+ dynamic_cast<wxChoiceWidgetImpl*>(GetPeer())->SetItemBitmap(n, bitmap);
+}
+
// ----------------------------------------------------------------------------
// client data
// ----------------------------------------------------------------------------
diff --git a/src/osx/cocoa/choice.mm b/src/osx/cocoa/choice.mm
index 2f0eb4ba51..52eb85c17d 100644
--- a/src/osx/cocoa/choice.mm
+++ b/src/osx/cocoa/choice.mm
@@ -93,6 +93,12 @@ public:
m_popUpMenu->FindItemByPosition( pos )->SetItemLabel( s ) ;
}

+ void SetItemBitmap(unsigned int n, const wxBitmap& bitmap)
+ {
+ if ( bitmap.Ok() )
+ m_popUpMenu->FindItemByPosition( n )->SetBitmap( bitmap ); ;
+ }
+
private:
wxMenu* m_popUpMenu;
};
14 changes: 14 additions & 0 deletions 3rdParty/vcpkg_ports/patches/boinc_SetVisibilityHidden.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/build/cmake/init.cmake b/build/cmake/init.cmake
index 0584ecaeb5..3e0f5feb3e 100644
--- a/build/cmake/init.cmake
+++ b/build/cmake/init.cmake
@@ -18,6 +18,9 @@ else()
# CMAKE_CXX_STANDARD not defined.
endif()

+set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
+set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden")
+
if(MSVC)
# Determine MSVC runtime library flag
set(MSVC_LIB_USE "/MD")
24 changes: 24 additions & 0 deletions 3rdParty/vcpkg_ports/patches/wxwidgets.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
diff --git a/wxwidgets/portfile.cmake b/wxwidgets/portfile.cmake
index f812fd8c5..27e289f2b 100644
--- a/wxwidgets/portfile.cmake
+++ b/wxwidgets/portfile.cmake
@@ -12,6 +12,8 @@ vcpkg_from_github(
fix-pcre2.patch
gtk3-link-libraries.patch
sdl2.patch
+ boinc_SetItemBitmap.patch
+ boinc_SetVisibilityHidden.patch
)

vcpkg_check_features(
@@ -75,6 +77,10 @@ vcpkg_cmake_configure(
-DwxUSE_UIACTIONSIMULATOR=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_GSPELL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_MSPACK=ON
+ -DwxBUILD_MONOLITHIC=ON
+ -DwxUSE_DIALUP_MANAGER=ON
+ -DwxUSE_UNICODE=ON
+ -DwxUSE_UNICODE_UTF8=ON
${OPTIONS}
"-DPKG_CONFIG_EXECUTABLE=${PKGCONFIG}"
# The minimum cmake version requirement for Cotire is 2.8.12.
Empty file.
3 changes: 3 additions & 0 deletions 3rdParty/vcpkg_ports/triplets/ci/arm64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../vcpkg_root_find.cmake)
include(${VCPKG_ROOT}/triplets/arm64-osx.cmake)

set(VCPKG_BUILD_TYPE release)
set(VCPKG_OSX_DEPLOYMENT_TARGET 10.13)
set(VCPKG_C_FLAGS -mmacosx-version-min=10.13)
set(VCPKG_CXX_FLAGS -mmacosx-version-min=10.13)
3 changes: 3 additions & 0 deletions 3rdParty/vcpkg_ports/triplets/ci/x64-osx.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ include(${CMAKE_CURRENT_LIST_DIR}/../../vcpkg_root_find.cmake)
include(${VCPKG_ROOT}/triplets/x64-osx.cmake)

set(VCPKG_BUILD_TYPE release)
set(VCPKG_OSX_DEPLOYMENT_TARGET 10.13)
set(VCPKG_C_FLAGS -mmacosx-version-min=10.13)
set(VCPKG_CXX_FLAGS -mmacosx-version-min=10.13)
1 change: 1 addition & 0 deletions ci_tools/trailing_whitespaces_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ def check(directory, exclude_dirs, exclude_extensions, exclude_files, fix_errors
".nib",
".o",
".odp",
".patch",
".pdb",
".pdf",
".pdn",
Expand Down
101 changes: 100 additions & 1 deletion mac_build/buildMacBOINC-CI.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ config=""
doclean="-noclean"
beautifier="cat" # we need a fallback if xcpretty is not available
share_paths="yes"
vcpkg="no"
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
Expand All @@ -63,6 +64,9 @@ while [[ $# -gt 0 ]]; do
--no_shared_headers)
share_paths="no"
;;
--vcpkg)
vcpkg="yes"
;;
esac
shift # past argument or value
done
Expand Down Expand Up @@ -94,6 +98,7 @@ if [ "${style}" == "Development" ]; then
fi

if [ ${share_paths} = "yes" ]; then
echo "Building share_paths"
## all targets share the same header and library search paths
## Note: this does not build zip apps, upper case or VBoxWrapper projects.
libSearchPathDbg=""
Expand Down Expand Up @@ -143,6 +148,77 @@ target="x"

rm -f /tmp/depversions.txt

if [ $vcpkg = "yes" ]; then
wx_includes_dirs_vcpkg=$(ls -d $cache_dir/include/wx-3.*/)
vcpkg_setting_pref_vcpkg="-setting OTHER_LDFLAGS"
vcpkg_setting_mgr=" \
-framework SystemConfiguration \
-bind_at_load \
-D_THREAD_SAFE \
-L. \
-lboinc \
-lcurl \
-lcares \
-lresolv \
-lssl \
-lcrypto \
-lexpat \
-ldl \
-lz \
-lldap \
-lwx_osx_cocoau-3.2 \
-lwxscintilla-3.2 \
-lbrotlicommon \
-lbrotlidec \
-lbrotlienc \
-lnanosvg \
-lnanosvgrast \
-lpcre2-32 \
-lpcre2-16 \
-lpcre2-8 \
-lpcre2-posix \
-lbz2 \
-ljpeg \
-llzma \
-lpng \
-lpng16 \
-ltiff \
-lturbojpeg \
-liconv \
-lpthread \
-lm \
"
vcpkg_setting_scr=" \
-lresolv \
-ljpeg \
-lfreetype \
-lbrotlicommon \
-lbrotlidec \
-lbrotlienc \
-lpng \
-lpng16 \
-lm \
-lftgl \
-lz \
-lbz2 \
"

vcpkg_setting_client=" \
-framework SystemConfiguration \
-L. \
-lboinc \
-lcurl \
-lcares \
-lresolv \
-lssl \
-lcrypto \
-ldl \
-lz \
-lldap \
"

fi

## This is code that builds each target individually in the main BOINC Xcode
## project, plus the zip apps, upper case and VBoxWrapper projects.
for buildTarget in `xcodebuild -list -project boinc.xcodeproj`
Expand All @@ -151,7 +227,28 @@ do
if [ $foundTargets -eq 1 ]; then
if [ "${target}" != "Build_All" ]; then
echo "Building ${target}..."
source BuildMacBOINC.sh ${config} ${doclean} -target ${target} -setting HEADER_SEARCH_PATHS "../clientgui ../lib/** ../api/ ${cache_dir}/include ../samples/jpeglib ${cache_dir}/include/freetype2 \\\${HEADER_SEARCH_PATHS}" -setting USER_HEADER_SEARCH_PATHS "" -setting LIBRARY_SEARCH_PATHS "${libSearchPathDbg} ${cache_dir}/lib ../lib \\\${LIBRARY_SEARCH_PATHS}" | tee xcodebuild_${target}.log | $beautifier; retval=${PIPESTATUS[0]}

if [[ $vcpkg = "yes" && ("${target}" = "mgr_boinc" || "${target}" = "ss_app" || "${target}" = "BOINC_Client") ]]; then
vcpkg_setting_pref=$vcpkg_setting_pref_vcpkg
if [ "${target}" = "mgr_boinc" ]; then
vcpkg_setting=$vcpkg_setting_mgr
wx_includes_dirs=$wx_includes_dirs_vcpkg
fi
if [ "${target}" = "ss_app" ]; then
vcpkg_setting=$vcpkg_setting_scr
wx_includes_dirs=""
fi
if [ "${target}" = "BOINC_Client" ]; then
vcpkg_setting=$vcpkg_setting_client
wx_includes_dirs=""
fi
else
vcpkg_setting_pref="-setting USER_HEADER_SEARCH_PATHS"
vcpkg_setting=""
wx_includes_dirs=""
fi

source BuildMacBOINC.sh ${config} ${doclean} -target ${target} -setting HEADER_SEARCH_PATHS "../clientgui ../lib/** ../api/ ${cache_dir}/include ../samples/jpeglib ${cache_dir}/include/freetype2 \\\${HEADER_SEARCH_PATHS} $wx_includes_dirs" -setting USER_HEADER_SEARCH_PATHS "" -setting LIBRARY_SEARCH_PATHS "${libSearchPathDbg} ${cache_dir}/lib ../lib \\\${LIBRARY_SEARCH_PATHS}" $vcpkg_setting_pref "$vcpkg_setting" | tee xcodebuild_${target}.log | $beautifier; retval=${PIPESTATUS[0]}
if [ ${retval} -eq 0 ]; then
echo "Building ${target}...success"
echo
Expand Down Expand Up @@ -186,6 +283,7 @@ fi

verify_product_archs "${rootPath}/zip/build/${style}"

if [ $vcpkg -eq 0 ]; then
target="UpperCase2"
echo "Building ${target}..."
source BuildMacBOINC.sh ${config} ${doclean} -uc2 -setting HEADER_SEARCH_PATHS "../../ ../../api/ ../../lib/ ../../zip/ ../../clientgui/mac/ ../jpeglib/ ../samples/jpeglib/ ${cache_dir}/include ${cache_dir}/include/freetype2 \\\${HEADER_SEARCH_PATHS}" -setting LIBRARY_SEARCH_PATHS "../../mac_build/build/Deployment ${cache_dir}/lib \\\${LIBRARY_SEARCH_PATHS}" | tee xcodebuild_${target}.log | $beautifier; retval=${PIPESTATUS[0]}
Expand All @@ -206,4 +304,5 @@ fi

verify_product_archs "${rootPath}/samples/vboxwrapper/build/${style}"

fi
cd "${rootPath}"
55 changes: 55 additions & 0 deletions osx/build_vcpkg_3rdparty_for_manager.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/bin/sh
set -e

if [ ! -d "osx" ]; then
echo "start this script in the source root directory"
exit 1
fi

CACHE_DIR="$PWD/3rdParty/buildCache/mac"
BUILD_DIR="$PWD/3rdParty/osx"
VCPKG_ROOT="$BUILD_DIR/vcpkg"
VCPKG_X64="$VCPKG_ROOT/installed/x64/x64-osx"
VCPKG_ARM64="$VCPKG_ROOT/installed/arm64/arm64-osx"
MAC_VCPKG=$BUILD_DIR/mac_vcpkg

osx/update_vcpkg_manager_universal.sh

echo " "
echo "Copy includes"
mkdir -p "$MAC_VCPKG/lib"
cp -R $VCPKG_X64/include $MAC_VCPKG
find $VCPKG_X64/lib/* -type d -maxdepth 0 -not -name "pkgconfig" -exec cp -R {} "$MAC_VCPKG/lib" \;

echo "Create universal libs:"

for lib_x64 in $VCPKG_X64/lib/*.a; do
lib_full_name=$(basename $lib_x64)
lib_name=$(basename -s .a $lib_x64)
lib_arm64=""
lib_universal="$MAC_VCPKG/lib/$lib_full_name"
if [ -f "$VCPKG_ARM64/lib/$lib_full_name" ]; then
lib_arm64="$VCPKG_ARM64/lib/$lib_full_name"
elif [ -f "$VCPKG_ARM64/lib/$lib_name-Darwin.a" ]; then
lib_arm64="$VCPKG_ARM64/lib/$lib_name-Darwin.a"
fi
if [ ! -z $lib_arm64 ]; then
echo exist $lib_full_name
lipo -create "$lib_x64" "$lib_arm64" -output $lib_universal
if ! lipo "$lib_x64" -verify_arch x86_64; then
echo "Fail verify x86_64 on $lib_x64"
exit 1
fi
if ! lipo "$lib_arm64" -verify_arch arm64; then
echo "Fail verify arm64 on $lib_arm64"
exit 1
fi
if ! lipo "$lib_universal" -verify_arch x86_64 arm64; then
echo "Fail verify x86_64 arm64 on $lib_universal"
exit 1
fi
else
echo Not exist $lib_full_name
exit 1
fi
done
Loading

0 comments on commit 20538f4

Please sign in to comment.