@@ -53,29 +53,65 @@ mkdir -p "$BUILD_DIR"
5353
5454case " $AUTOBUILD_PLATFORM " in
5555 darwin* )
56- # Configure with CMake using vcpkg toolchain with universal binary support
57- cmake -S " $top " -B " $BUILD_DIR " \
56+ # Build for x64 architecture
57+ BUILD_DIR_X64=" $top /build_autobuild_x64"
58+ mkdir -p " $BUILD_DIR_X64 "
59+
60+ echo " Building for x86_64..."
61+ cmake -S " $top " -B " $BUILD_DIR_X64 " \
5862 -DCMAKE_TOOLCHAIN_FILE=" $VCPKG_ROOT /scripts/buildsystems/vcpkg.cmake" \
59- -DVCPKG_TARGET_TRIPLET=universal-osx \
60- -DVCPKG_OVERLAY_TRIPLETS=" $top /triplets" \
63+ -DVCPKG_TARGET_TRIPLET=x64-osx \
6164 -DCMAKE_BUILD_TYPE=Release \
6265 -DBUILD_SHARED_LIBS=OFF \
6366 -DENTROPY_BUILD_TESTS=OFF \
64- -DCMAKE_OSX_ARCHITECTURES=" x86_64;arm64 " \
67+ -DCMAKE_OSX_ARCHITECTURES=" x86_64" \
6568 -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 \
66- -DCMAKE_INSTALL_PREFIX=" $stage "
67-
68- # Build the project
69- cmake --build " $BUILD_DIR " --config Release
70-
71- # Install to staging directory
72- cmake --install " $BUILD_DIR " --config Release
73-
74- # Move installed files to expected locations for autobuild
69+ -DCMAKE_INSTALL_PREFIX=" $stage /x64"
70+
71+ cmake --build " $BUILD_DIR_X64 " --config Release
72+ cmake --install " $BUILD_DIR_X64 " --config Release
73+
74+ # Build for arm64 architecture
75+ BUILD_DIR_ARM64=" $top /build_autobuild_arm64"
76+ mkdir -p " $BUILD_DIR_ARM64 "
77+
78+ echo " Building for arm64..."
79+ cmake -S " $top " -B " $BUILD_DIR_ARM64 " \
80+ -DCMAKE_TOOLCHAIN_FILE=" $VCPKG_ROOT /scripts/buildsystems/vcpkg.cmake" \
81+ -DVCPKG_TARGET_TRIPLET=arm64-osx \
82+ -DCMAKE_BUILD_TYPE=Release \
83+ -DBUILD_SHARED_LIBS=OFF \
84+ -DENTROPY_BUILD_TESTS=OFF \
85+ -DCMAKE_OSX_ARCHITECTURES=" arm64" \
86+ -DCMAKE_OSX_DEPLOYMENT_TARGET=13.3 \
87+ -DCMAKE_INSTALL_PREFIX=" $stage /arm64"
88+
89+ cmake --build " $BUILD_DIR_ARM64 " --config Release
90+ cmake --install " $BUILD_DIR_ARM64 " --config Release
91+
92+ # Create universal binaries using lipo
7593 mkdir -p " $stage /lib/release"
76- if [ -f " $stage /lib/libEntropyCore.a" ]; then
77- mv " $stage /lib/libEntropyCore.a" " $stage /lib/release/"
94+
95+ echo " Creating universal binary with lipo..."
96+ if [ -f " $stage /x64/lib/libEntropyCore.a" ] && [ -f " $stage /arm64/lib/libEntropyCore.a" ]; then
97+ lipo -create \
98+ " $stage /x64/lib/libEntropyCore.a" \
99+ " $stage /arm64/lib/libEntropyCore.a" \
100+ -output " $stage /lib/release/libEntropyCore.a"
101+ echo " Universal binary created successfully"
102+ else
103+ echo " Error: Could not find architecture-specific libraries"
104+ exit 1
78105 fi
106+
107+ # Copy headers from x64 build (they should be identical)
108+ mkdir -p " $stage /include"
109+ if [ -d " $stage /x64/include" ]; then
110+ cp -R " $stage /x64/include" /* " $stage /include/"
111+ fi
112+
113+ # Clean up architecture-specific staging directories
114+ rm -rf " $stage /x64" " $stage /arm64"
79115
80116 # Move headers to EntropyCore subdirectory
81117 if [ -d " $stage /include" ]; then
0 commit comments