From 8934f4907b1c48db9a2a5ce156ba38d6220e51c9 Mon Sep 17 00:00:00 2001 From: orangeboyChen Date: Thu, 24 Apr 2025 01:35:18 +0800 Subject: [PATCH 1/4] feat: support xcframework for watchOS target --- mars/build_watch.py | 38 ++++++++++--------- mars/comm/verinfo.h | 8 ++-- .../include/openssl/opensslconf-apple.h | 2 + 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/mars/build_watch.py b/mars/build_watch.py index 9ca9673d6..0ae324602 100755 --- a/mars/build_watch.py +++ b/mars/build_watch.py @@ -11,18 +11,18 @@ BUILD_OUT_PATH = 'cmake_build/watchos' INSTALL_PATH = os.path.join(BUILD_OUT_PATH, 'watchOS.out') -WATCH_BUILD_SIMULATOR_CMD = 'cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=SIMULATOR_WATCHOS -DIOS_DEPLOYMENT_TARGET=2.0 -DARCH="i386" -DENABLE_ARC=0 -DENABLE_BITCODE=1 -DENABLE_VISIBILITY=1 && make -j8 && make install' -WATCH_BUILD_OS_CMD = 'cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=WATCHOS -DIOS_DEPLOYMENT_TARGET=2.0 -DARCH="armv7k;arm64_32" -DENABLE_ARC=0 -DENABLE_BITCODE=1 -DENABLE_VISIBILITY=1 && make -j8 && make install' +WATCH_BUILD_SIMULATOR_CMD = 'cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=SIMULATOR_WATCHOS -DIOS_DEPLOYMENT_TARGET=2.0 -DENABLE_ARC=0 -DENABLE_BITCODE=0 -DENABLE_VISIBILITY=1 && make -j8 && make install' +WATCH_BUILD_OS_CMD = 'cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=WATCHOS -DIOS_DEPLOYMENT_TARGET=2.0 -DENABLE_ARC=0 -DENABLE_BITCODE=0 -DENABLE_VISIBILITY=1 && make -j8 && make install' -GEN_WATCH_OS_PROJ = 'cmake ../.. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DIOS_PLATFORM=OS -DIOS_DEPLOYMENT_TARGET=2.0 -DIOS_ARCH="armv7;arm64" -DCMAKE_XCODE_ATTRIBUTE_VALID_ARCHS="armv7k;arm64_32" -DENABLE_ARC=0 -DENABLE_BITCODE=1 -DENABLE_VISIBILITY=1' +GEN_WATCH_OS_PROJ = 'cmake ../.. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../ios.toolchain.cmake -DPLATFORM=OS -DIOS_DEPLOYMENT_TARGET=2.0 -DIOS_ARCH="armv7;arm64" -DCMAKE_XCODE_ATTRIBUTE_VALID_ARCHS="armv7k;arm64_32;arm64" -DENABLE_ARC=0 -DENABLE_BITCODE=0 -DENABLE_VISIBILITY=1' def build_watch(tag=''): gen_mars_revision_file('comm', tag) - + clean(BUILD_OUT_PATH) os.chdir(BUILD_OUT_PATH) - + ret = os.system(WATCH_BUILD_OS_CMD) os.chdir(SCRIPT_PATH) if ret != 0: @@ -30,7 +30,11 @@ def build_watch(tag=''): return False libtool_os_dst_lib = INSTALL_PATH + '/os' - if not libtool_libs(glob.glob(INSTALL_PATH + '/*.a'), libtool_os_dst_lib): + libtool_src_libs = [INSTALL_PATH + '/libcomm.a', + INSTALL_PATH + '/libmars-boost.a', + INSTALL_PATH + '/libxlog.a', + BUILD_OUT_PATH + '/zstd/libzstd.a'] + if not libtool_libs(libtool_src_libs, libtool_os_dst_lib): return False clean(BUILD_OUT_PATH) @@ -40,24 +44,22 @@ def build_watch(tag=''): if ret != 0: print('!!!!!!!!!!!build simulator fail!!!!!!!!!!!!!!!') return False - + libtool_simulator_dst_lib = INSTALL_PATH + '/simulator' - if not libtool_libs(glob.glob(INSTALL_PATH + '/*.a'), libtool_simulator_dst_lib): + if not libtool_libs(libtool_src_libs, libtool_simulator_dst_lib): return False - lipo_src_libs = [] - lipo_src_libs.append(libtool_os_dst_lib) - lipo_src_libs.append(libtool_simulator_dst_lib) - lipo_dst_lib = INSTALL_PATH + '/mars' - - if not lipo_libs(lipo_src_libs, lipo_dst_lib): - return False + dst_framework_path = INSTALL_PATH + '/device/mars.framework' + make_static_framework(libtool_os_dst_lib, dst_framework_path, XLOG_COPY_HEADER_FILES, '../') + os.system('mv ' + dst_framework_path + '/os ' + dst_framework_path + '/mars') - dst_framework_path = INSTALL_PATH + '/mars.framework' - make_static_framework(lipo_dst_lib, dst_framework_path, COMM_COPY_HEADER_FILES, '../') + dst_framework_simulator_path = INSTALL_PATH + '/simu/mars.framework' + make_static_framework(libtool_simulator_dst_lib, dst_framework_simulator_path, XLOG_COPY_HEADER_FILES, '../') + os.system('mv ' + dst_framework_simulator_path + '/simulator ' + dst_framework_simulator_path + '/mars') + os.system('xcodebuild -create-xcframework -framework "' + dst_framework_path + '" -framework "' + dst_framework_simulator_path + '" -output "' + INSTALL_PATH + '/mars.xcframework"') print('==================Output========================') - print(dst_framework_path) + print(INSTALL_PATH + "/mars.xcframework") return True def gen_watch_project(): diff --git a/mars/comm/verinfo.h b/mars/comm/verinfo.h index 4fe71379e..2f35b0ed8 100644 --- a/mars/comm/verinfo.h +++ b/mars/comm/verinfo.h @@ -2,11 +2,11 @@ #ifndef Mars_verinfo_h #define Mars_verinfo_h -#define MARS_REVISION "38eea3ee" -#define MARS_PATH "release/2024-t2.1" +#define MARS_REVISION "db98964c" +#define MARS_PATH "feature/watchos_xcframework" #define MARS_URL "" -#define MARS_BUILD_TIME "2024-07-30 17:02:21" +#define MARS_BUILD_TIME "2025-04-24 01:35:00" #define MARS_TAG "" -#define MARS_BUILD_TIMESTAMP 1722330141 +#define MARS_BUILD_TIMESTAMP 1745429700 #endif diff --git a/mars/openssl/include/openssl/opensslconf-apple.h b/mars/openssl/include/openssl/opensslconf-apple.h index e50d05a51..dae81c5b3 100755 --- a/mars/openssl/include/openssl/opensslconf-apple.h +++ b/mars/openssl/include/openssl/opensslconf-apple.h @@ -18,6 +18,8 @@ # include #elif TARGET_OS_WATCH && TARGET_OS_SIMULATOR && TARGET_CPU_X86 # include +#elif TARGET_OS_WATCH && TARGET_OS_SIMULATOR && TARGET_CPU_X86_64 +# include #elif TARGET_OS_OSX && TARGET_CPU_X86_64 # include #elif TARGET_OS_OSX && TARGET_CPU_ARM64 From 6a9cf41d480a07a558883da77e8917ae7500632d Mon Sep 17 00:00:00 2001 From: orangeboyChen Date: Thu, 24 Apr 2025 01:51:26 +0800 Subject: [PATCH 2/4] feat: support xcframework for watchOS target --- mars/build_watch.py | 11 ++++++----- mars/comm/verinfo.h | 6 +++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/mars/build_watch.py b/mars/build_watch.py index 0ae324602..3a18f2d38 100755 --- a/mars/build_watch.py +++ b/mars/build_watch.py @@ -49,17 +49,18 @@ def build_watch(tag=''): if not libtool_libs(libtool_src_libs, libtool_simulator_dst_lib): return False - dst_framework_path = INSTALL_PATH + '/device/mars.framework' - make_static_framework(libtool_os_dst_lib, dst_framework_path, XLOG_COPY_HEADER_FILES, '../') - os.system('mv ' + dst_framework_path + '/os ' + dst_framework_path + '/mars') + dst_framework_path = INSTALL_PATH + '/device/mars.xcframework' + dst_framework_device_path = INSTALL_PATH + '/device/mars.framework' + make_static_framework(libtool_os_dst_lib, dst_framework_device_path, XLOG_COPY_HEADER_FILES, '../') + os.system('mv ' + dst_framework_device_path + '/os ' + dst_framework_device_path + '/mars') dst_framework_simulator_path = INSTALL_PATH + '/simu/mars.framework' make_static_framework(libtool_simulator_dst_lib, dst_framework_simulator_path, XLOG_COPY_HEADER_FILES, '../') os.system('mv ' + dst_framework_simulator_path + '/simulator ' + dst_framework_simulator_path + '/mars') - os.system('xcodebuild -create-xcframework -framework "' + dst_framework_path + '" -framework "' + dst_framework_simulator_path + '" -output "' + INSTALL_PATH + '/mars.xcframework"') + os.system('xcodebuild -create-xcframework -framework "' + dst_framework_device_path + '" -framework "' + dst_framework_simulator_path + '" -output "' + dst_framework_path + '"') print('==================Output========================') - print(INSTALL_PATH + "/mars.xcframework") + print(dst_framework_path) return True def gen_watch_project(): diff --git a/mars/comm/verinfo.h b/mars/comm/verinfo.h index 2f35b0ed8..b27016586 100644 --- a/mars/comm/verinfo.h +++ b/mars/comm/verinfo.h @@ -2,11 +2,11 @@ #ifndef Mars_verinfo_h #define Mars_verinfo_h -#define MARS_REVISION "db98964c" +#define MARS_REVISION "70dff5c7" #define MARS_PATH "feature/watchos_xcframework" #define MARS_URL "" -#define MARS_BUILD_TIME "2025-04-24 01:35:00" +#define MARS_BUILD_TIME "2025-04-24 01:52:39" #define MARS_TAG "" -#define MARS_BUILD_TIMESTAMP 1745429700 +#define MARS_BUILD_TIMESTAMP 1745430759 #endif From 726d93202d533403ae50a6bd11ee6f2f5ff8fc6f Mon Sep 17 00:00:00 2001 From: orangeboyChen Date: Mon, 2 Feb 2026 15:20:04 +0800 Subject: [PATCH 3/4] commit --- mars/build_watch.py | 12 +++++++++--- mars/comm/verinfo.h | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/mars/build_watch.py b/mars/build_watch.py index 3a18f2d38..c8c4444fc 100755 --- a/mars/build_watch.py +++ b/mars/build_watch.py @@ -49,14 +49,20 @@ def build_watch(tag=''): if not libtool_libs(libtool_src_libs, libtool_simulator_dst_lib): return False - dst_framework_path = INSTALL_PATH + '/device/mars.xcframework' + dst_framework_path = INSTALL_PATH + '/out/mars.xcframework' dst_framework_device_path = INSTALL_PATH + '/device/mars.framework' make_static_framework(libtool_os_dst_lib, dst_framework_device_path, XLOG_COPY_HEADER_FILES, '../') - os.system('mv ' + dst_framework_device_path + '/os ' + dst_framework_device_path + '/mars') + src = os.path.join(dst_framework_device_path, 'os') + dst = os.path.join(dst_framework_device_path, 'mars') + if os.path.exists(src): + os.rename(src, dst) dst_framework_simulator_path = INSTALL_PATH + '/simu/mars.framework' make_static_framework(libtool_simulator_dst_lib, dst_framework_simulator_path, XLOG_COPY_HEADER_FILES, '../') - os.system('mv ' + dst_framework_simulator_path + '/simulator ' + dst_framework_simulator_path + '/mars') + src = os.path.join(dst_framework_simulator_path, 'simulator') + dst = os.path.join(dst_framework_simulator_path, 'mars') + if os.path.exists(src): + shutil.move(src, dst) os.system('xcodebuild -create-xcframework -framework "' + dst_framework_device_path + '" -framework "' + dst_framework_simulator_path + '" -output "' + dst_framework_path + '"') print('==================Output========================') diff --git a/mars/comm/verinfo.h b/mars/comm/verinfo.h index b27016586..b2cb8978e 100644 --- a/mars/comm/verinfo.h +++ b/mars/comm/verinfo.h @@ -2,11 +2,11 @@ #ifndef Mars_verinfo_h #define Mars_verinfo_h -#define MARS_REVISION "70dff5c7" +#define MARS_REVISION "cb6ff26d" #define MARS_PATH "feature/watchos_xcframework" #define MARS_URL "" -#define MARS_BUILD_TIME "2025-04-24 01:52:39" +#define MARS_BUILD_TIME "2026-02-02 15:10:56" #define MARS_TAG "" -#define MARS_BUILD_TIMESTAMP 1745430759 +#define MARS_BUILD_TIMESTAMP 1770016256 #endif From ef2de521a304c347ca71244bf7d8d3417472e053 Mon Sep 17 00:00:00 2001 From: orangeboyChen Date: Mon, 2 Feb 2026 15:23:55 +0800 Subject: [PATCH 4/4] commit --- mars/comm/verinfo.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mars/comm/verinfo.h b/mars/comm/verinfo.h index b2cb8978e..4fe71379e 100644 --- a/mars/comm/verinfo.h +++ b/mars/comm/verinfo.h @@ -2,11 +2,11 @@ #ifndef Mars_verinfo_h #define Mars_verinfo_h -#define MARS_REVISION "cb6ff26d" -#define MARS_PATH "feature/watchos_xcframework" +#define MARS_REVISION "38eea3ee" +#define MARS_PATH "release/2024-t2.1" #define MARS_URL "" -#define MARS_BUILD_TIME "2026-02-02 15:10:56" +#define MARS_BUILD_TIME "2024-07-30 17:02:21" #define MARS_TAG "" -#define MARS_BUILD_TIMESTAMP 1770016256 +#define MARS_BUILD_TIMESTAMP 1722330141 #endif