Add ability to build monero wallet lib as universal lib. Update macOS build guide. Change default arch for macOS project to .

This commit is contained in:
m 2024-05-15 20:35:21 +01:00
parent 888543c3fd
commit bf2ff45282
3 changed files with 42 additions and 8 deletions

View file

@ -74,6 +74,15 @@ Build the Monero libraries and their dependencies:
`$ ./build_monero_all.sh`
If you be needed to build universal monero lib, then it will require additional steps. Steps for build universal monero lib on mac with Apple Silicon (arm64):
- Need to install Rosetta: `$ softwareupdate --install-rosetta`
- Need to install [Brew](https://brew.sh/) with rosetta: `$ arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"` (or take another way to install brew, but be use that you have installed it into /usr/local as it's using for x86_64 macs)
- Install dependencies for build monero wallet lib for x86_64 with brew: `$ arch -x86_64 /usr/local/bin/brew install unbound boost@1.76 zmq` and link installed boost@1.76 for x86_64 `$ arch -x86_64 /usr/local/bin/brew link boost@1.76`
- Run building script with additional argument: `$ ./build_monero_all.sh universal`
If you will be needed to build monero wallet lib only for x86_64 on arm64 mac, then you need use steps above, but run build script with rosetta without arguments: `$ arch -x86_64 ./build_monero_all.sh`.
It is now time to change back to the base directory of the CakeWallet source code:
`$ cd ../../`

View file

@ -437,7 +437,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
@ -572,7 +572,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
@ -601,7 +601,7 @@
isa = XCBuildConfiguration;
baseConfigurationReference = 33E5194F232828860026EE4D /* AppInfo.xcconfig */;
buildSettings = {
ARCHS = arm64;
ARCHS = "$(ARCHS_STANDARD)";
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;

View file

@ -4,6 +4,8 @@ set -x -e
cd "$(dirname "$0")"
NPROC="-j$(sysctl -n hw.logicalcpu)"
LIBS=""
MONEROC_RELEASE_DIR="../monero_c/release/monero"
../prepare_moneroc.sh
@ -18,13 +20,36 @@ then
popd
done
else
if [[ "x$1" == "xuniversal" ]]; then
ARCHS=(arm64 x86_64)
else
ARCHS=$(uname -m)
fi
for COIN in monero;
do
pushd ../monero_c
./build_single.sh ${COIN} host-apple-darwin $NPROC
popd
for ARCH in "${ARCHS[@]}";
do
if [[ "$ARCH" == "arm64" ]]; then
export HOMEBREW_PREFIX=/opt/homebrew
HOST="aarch64-host-apple-darwin"
else
export HOMEBREW_PREFIX=/usr/local
HOST="${ARCH}-host-apple-darwin"
fi
LIBS="${LIBS} -arch ${ARCH} ${MONEROC_RELEASE_DIR}/${HOST}_libwallet2_api_c.dylib"
if [[ ! $(uname -m) == $ARCH ]]; then
PRC="arch -${ARCH}"
fi
pushd ../monero_c
$PRC ./build_single.sh ${COIN} ${HOST} $NPROC
unxz -f ./release/monero/${HOST}_libwallet2_api_c.dylib.xz
popd
done
done
fi
unxz -f ../monero_c/release/monero/host-apple-darwin_libwallet2_api_c.dylib.xz
# unxz -f ../monero_c/release/wownero/host-apple-darwin_libwallet2_api_c.dylib.xz
lipo -create ${LIBS} -output "${MONEROC_RELEASE_DIR}/host-apple-darwin_libwallet2_api_c.dylib"