diff --git a/AudioFilter/build.sh b/AudioFilter/build.sh index 524103ece88f7b29cd5ef074bc1379ab60eaeec1..0203e3a3e3ce76c2917500d8b29cde5dfaf98658 100755 --- a/AudioFilter/build.sh +++ b/AudioFilter/build.sh @@ -34,16 +34,14 @@ elif [ "${PLATFORM}" = "Darwin" ]; then PLATFORM="darwin" SO_FILE_NAME="lib${PLUGIN_NAME}.dylib" alias nproc='sysctl -n hw.logicalcpu' - CONTRIB_PLATFORM_CURT=${ARCH}-apple CONTRIB_PLATFORM_EXTRA=$(uname -r) echo "Building with ${PLATFORM}" fi -while getopts t:c:p:d OPT; do +while getopts t:c:p:d:a: OPT; do case "$OPT" in d) DEBUG=true - export __DEBUG__=true ;; t) PLATFORM="${OPTARG}" @@ -53,13 +51,19 @@ while getopts t:c:p:d OPT; do ;; p) ;; + a) + ARCH="${OPTARG}" # Override the default ARCH value if provided + ;; \?) exit 1 ;; esac done -#cp -r ffmpeg ${CONTRIB_PATH}/src/ +if [ "${PLATFORM}" = "darwin" ]; then + CONTRIB_PLATFORM_CURT=${ARCH}-apple +fi + cp -r ../contrib/mp3lame ${CONTRIB_PATH}/src/ if [ "${PLATFORM}" = "linux-gnu" ] || [ "${PLATFORM}" = "redhat-linux" ] @@ -130,13 +134,15 @@ then EXTRA_DEBUG_LIBRARIES="-lyaml-cpp -lmp3lame" EXTRA_DEFINES="-D__DEBUG__" else - python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} + python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} --arch="${ARCH}" CLANG_OPTS="-O3 -shared" OUTPUT="build-local/jpl/lib/${CONTRIB_PLATFORM}/${SO_FILE_NAME}" fi + ARCH_OPT=" -arch ${ARCH}" + # Compile - clang++ -std=c++17 -fPIC ${CLANG_OPTS} \ + clang++ -std=c++17 -fPIC ${CLANG_OPTS} ${ARCH_OPT}\ -Wl,-no_compact_unwind -Wl,-framework,CoreFoundation \ -Wl,-framework,Security -Wl,-framework,VideoToolbox \ -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo \ @@ -299,7 +305,11 @@ then fi if [ ! ${DEBUG} ]; then - python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + if [ "${PLATFORM}" = "darwin" ]; then + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} --arch="${ARCH}" + else + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + fi fi cd ${CONTRIB_PATH}/src/ffmpeg/ # ffmpeg build configuration files were changed during plugin build diff --git a/AutoAnswer/build.sh b/AutoAnswer/build.sh index ab5552be7d545d92ae1c6ce1bc6ca1ca87d102fa..4be96776afbadca7c21d371a2ee89201b953f9b0 100755 --- a/AutoAnswer/build.sh +++ b/AutoAnswer/build.sh @@ -31,12 +31,11 @@ if [ "${PLATFORM}" = "Linux" ]; then echo "Building with ${PLATFORM}" elif [ "${PLATFORM}" = "Darwin" ]; then SO_FILE_NAME="lib${PLUGIN_NAME}.dylib" - CONTRIB_PLATFORM_CURT=${ARCH}-apple CONTRIB_PLATFORM_EXTRA=$(uname -r) echo "Building with ${PLATFORM}" fi -while getopts t:c:p:d OPT; do +while getopts t:c:p:d:a: OPT; do case "$OPT" in d) DEBUG=true @@ -49,18 +48,26 @@ while getopts t:c:p:d OPT; do ;; p) ;; + a) + ARCH="${OPTARG}" # Override the default ARCH value if provided + ;; \?) exit 1 ;; esac done +if [ "${PLATFORM}" = "Darwin" ]; then + CONTRIB_PLATFORM_CURT=${ARCH}-apple +fi + if [ "${PLATFORM}" = "linux-gnu" ] || [ "${PLATFORM}" = "redhat-linux" ] || [ "${PLATFORM}" = "Darwin" ] then CONTRIB_PLATFORM=${CONTRIB_PLATFORM_CURT}-${PLATFORM} OUTPUTFOLDER=${CONTRIB_PLATFORM} if [ "${PLATFORM}" = "Darwin" ]; then CONTRIB_PLATFORM=${CONTRIB_PLATFORM}${CONTRIB_PLATFORM_EXTRA} + ARCH_OPT=" -arch ${ARCH}" fi if [ ${DEBUG} ]; then @@ -69,13 +76,13 @@ then EXTRA_DEBUG_LIBRARIES="-lyaml-cpp" EXTRA_DEFINES="-D__DEBUG__" else - python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} + python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} --arch=${ARCH} CLANG_OPTS="-O3 -shared" OUTPUT="build-local/jpl/lib/${OUTPUTFOLDER}/${SO_FILE_NAME}" fi # Compile - clang++ -std=c++17 -fPIC ${CLANG_OPTS} \ + clang++ -std=c++17 -fPIC ${CLANG_OPTS} ${ARCH_OPT} \ -Wl,-rpath,"\${ORIGIN}" \ -Wall -Wextra \ -Wno-unused-parameter \ @@ -212,5 +219,9 @@ then fi if [ ! ${DEBUG} ]; then - python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + if [ "${PLATFORM}" = "Darwin" ]; then + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} --arch="${ARCH}" + else + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + fi fi diff --git a/GreenScreen/build.sh b/GreenScreen/build.sh index 515998133ec4919b5c07eaba4ceb5461f1907b0c..e52225bc6b243a9375683e756ba2bfd3940c2169 100755 --- a/GreenScreen/build.sh +++ b/GreenScreen/build.sh @@ -39,7 +39,6 @@ elif [ "${PLATFORM}" = "Darwin" ]; then PLATFORM="darwin" SO_FILE_NAME="lib${PLUGIN_NAME}.dylib" alias nproc='sysctl -n hw.logicalcpu' - CONTRIB_PLATFORM_CURT=${ARCH}-apple CONTRIB_PLATFORM_EXTRA=$(uname -r) echo "Building with ${PLATFORM}" fi @@ -52,7 +51,7 @@ elif [ "${PROCESSOR}" = "NVIDIA" ]; then PREFERENCESFILENAME="${PREFERENCESFILENAME}-accel" fi -while getopts t:c:p:d OPT; do +while getopts t:c:p:d:a: OPT; do case "$OPT" in d) DEBUG=true @@ -68,13 +67,19 @@ while getopts t:c:p:d OPT; do ;; p) ;; + a) + ARCH="${OPTARG}" # Override the default ARCH value if provided + ;; \?) exit 1 ;; esac done -#cp -r ffmpeg ${CONTRIB_PATH}/src/ +if [ "${PLATFORM}" = "darwin" ]; then + CONTRIB_PLATFORM_CURT=${ARCH}-apple +fi + cp -r ../contrib/rav1e ${CONTRIB_PATH}/src/ if [ "${PLATFORM}" = "linux-gnu" ] || [ "${PLATFORM}" = "redhat-linux" ] @@ -182,13 +187,19 @@ then EXTRA_DEBUG_LIBRARIES="-lyaml-cpp -lrav1e" EXTRA_DEFINES="-D__DEBUG__" else - python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} + python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} --arch="${ARCH}" CLANG_OPTS="-O3 -shared" OUTPUT="build-local/jpl/lib/${CONTRIB_PLATFORM}/${SO_FILE_NAME}" fi + ARCH_OPT=" -arch ${ARCH}" + + # Update the install name of libonnxruntime.dylib from "@rpath/libonnxruntime.1.16.2.dylib" + # to "@rpath/libonnxruntime.dylib" before any linking occurs. + install_name_tool -id "@rpath/libonnxruntime.dylib" "${ONNX_PATH}/lib/onnxruntime/${ONNX_LIBS}/libonnxruntime.dylib" + # Compile - clang++ -std=c++17 -fPIC ${CLANG_OPTS} \ + clang++ -std=c++17 -fPIC ${CLANG_OPTS} ${ARCH_OPT} \ -Wl,-no_compact_unwind -Wl,-framework,CoreFoundation \ -Wl,-framework,Security -Wl,-framework,VideoToolbox \ -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo \ @@ -225,6 +236,7 @@ then -lopencv_imgproc \ -lopencv_core \ -lonnxruntime \ + -lswresample \ -lspeex \ -lopus \ ${EXTRA_DEBUG_LIBRARIES} \ @@ -234,17 +246,17 @@ then mkdir -p "./data/model" cp "./modelSRC/mModel.onnx" "./data/model/mModel.onnx" cp "${ONNX_PATH}/lib/onnxruntime/${ONNX_LIBS}/libonnxruntime.dylib" "libonnxruntime.dylib" - install_name_tool -id "@loader_path/libonnxruntime.1.12.0.dylib" "libonnxruntime.dylib" + install_name_tool -id "@loader_path/libonnxruntime.dylib" "libonnxruntime.dylib" install_name_tool -id "@loader_path/${PLUGIN_NAME}" "${OUTPUT}" else mkdir -p "./build-local/jpl/data/model" cp "./modelSRC/mModel.onnx" "./build-local/jpl/data/model/mModel.onnx" cp "./${PREFERENCESFILENAME}.json" "./build-local/jpl/data/preferences.json" cp "${ONNX_PATH}/lib/onnxruntime/${ONNX_LIBS}/libonnxruntime.dylib" "build-local/jpl/lib/${CONTRIB_PLATFORM}/libonnxruntime.dylib" - install_name_tool -id "@loader_path/libonnxruntime.1.12.0.dylib" "build-local/jpl/lib/${CONTRIB_PLATFORM}/libonnxruntime.dylib" + install_name_tool -id "@loader_path/libonnxruntime.dylib" "build-local/jpl/lib/${CONTRIB_PLATFORM}/libonnxruntime.dylib" install_name_tool -id "@loader_path/${SO_FILE_NAME}" "${OUTPUT}" fi - install_name_tool -change "@rpath/libonnxruntime.1.12.0.dylib" "@loader_path/libonnxruntime.dylib" "${OUTPUT}" + install_name_tool -change "@rpath/libonnxruntime.dylib" "@loader_path/libonnxruntime.dylib" "${OUTPUT}" if [ -n "${APPLE_SIGN_CERTIFICATE}" ]; then codesign --force --verify --timestamp -o runtime --sign "${APPLE_SIGN_CERTIFICATE}" "build-local/jpl/lib/${CONTRIB_PLATFORM}/libonnxruntime.dylib" @@ -413,7 +425,11 @@ then fi if [ ! ${DEBUG} ]; then - python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + if [ "${PLATFORM}" = "darwin" ]; then + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} --arch="${ARCH}" + else + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + fi fi cd ${CONTRIB_PATH}/src/ffmpeg/ # ffmpeg build configuration files were changed during plugin build diff --git a/SDK/jplManipulation.py b/SDK/jplManipulation.py index 8846367c2e2a9a5492c332ea5749e0dedb020138..79caad7a351a6bd5663d1c101b1fb12e750fd223 100644 --- a/SDK/jplManipulation.py +++ b/SDK/jplManipulation.py @@ -118,7 +118,7 @@ def onerror(func, path, exc_info): raise -def preAssemble(pluginName, distribution=''): +def preAssemble(pluginName, distribution='', arch=''): localSystem = getSystem() osBuildPath = "build-local" @@ -126,7 +126,7 @@ def preAssemble(pluginName, distribution=''): if (distribution != 'android'): distribution = "x86_64-linux-gnu" elif localSystem == OS_IDS["Darwin"]: - distribution = "x86_64-apple-Darwin" + distribution = f"{arch}-apple-Darwin" elif localSystem == OS_IDS["Windows"]: distribution = "x64-windows" osBuildPath = "msvc" @@ -161,7 +161,7 @@ def preAssemble(pluginName, distribution=''): os.chdir(f"./{osBuildPath}") -def assemble(pluginName, extraPath='', distribution=''): +def assemble(pluginName, extraPath='', distribution='', arch=''): extraPath = '/' + extraPath localSystem = getSystem() root = os.path.dirname(os.path.abspath(__file__)) + "/.." @@ -171,7 +171,7 @@ def assemble(pluginName, extraPath='', distribution=''): if (distribution != 'android'): distribution = "x86_64-linux-gnu" elif localSystem == OS_IDS["Darwin"]: - distribution = "x86_64-apple-Darwin" + distribution = f"{arch}-apple-Darwin" elif localSystem == OS_IDS["Windows"]: distribution = "x64-windows" osBuildPath = 'msvc' @@ -215,6 +215,8 @@ def parser(): help='output intermediate Path') parser.add_argument('--distribution', type=str, default='', help="GNU/Linux or Windows, leave empty. Android, type android") + parser.add_argument('--arch', type=str, + help='Specify the architecture (x86_64, arm64).') # to build or not to build parser.add_argument('--build', action='store_true') @@ -242,11 +244,11 @@ def main(): args = parser() if args.preassemble: - preAssemble(args.plugin, args.distribution) + preAssemble(args.plugin, args.distribution, args.arch) if (args.build): build(args.plugin) if (args.assemble): - assemble(args.plugin, args.extraPath, args.distribution) + assemble(args.plugin, args.extraPath, args.distribution, args.arch) if (args.merge): JPLStructure(args.path, args.output) diff --git a/WaterMark/build.sh b/WaterMark/build.sh index 59c8ffe315ff3c94fcab1b7f05ec1dfed0449464..84556640031170f5f48cdab7dac2b7ef3e70fda3 100755 --- a/WaterMark/build.sh +++ b/WaterMark/build.sh @@ -34,12 +34,11 @@ elif [ "${PLATFORM}" = "Darwin" ]; then PLATFORM="darwin" SO_FILE_NAME="lib${PLUGIN_NAME}.dylib" alias nproc="sysctl -n hw.logicalcpu" - CONTRIB_PLATFORM_CURT=${ARCH}-apple CONTRIB_PLATFORM_EXTRA=$(uname -r) echo "Building with ${PLATFORM}" fi -while getopts t:c:p:d OPT; do +while getopts t:c:p:d:a: OPT; do case "$OPT" in d) DEBUG=true @@ -53,13 +52,19 @@ while getopts t:c:p:d OPT; do ;; p) ;; + a) + ARCH="${OPTARG}" # Override the default ARCH value if provided + ;; \?) exit 1 ;; esac done -#cp -r ffmpeg ${CONTRIB_PATH}/src/ +if [ "${PLATFORM}" = "darwin" ]; then + CONTRIB_PLATFORM_CURT=${ARCH}-apple +fi + cp -r ../contrib/rav1e ${CONTRIB_PATH}/src/ if [ "${PLATFORM}" = "linux-gnu" ] || [ "${PLATFORM}" = "redhat-linux" ] @@ -124,20 +129,21 @@ then elif [ "${PLATFORM}" = "darwin" ] then CONTRIB_PLATFORM=${CONTRIB_PLATFORM_CURT}-${PLATFORM} - if [ ${DEBUG} ]; then OUTPUT="${PLUGIN_NAME}" CLANG_OPTS="-g -fsanitize=address" EXTRA_DEBUG_LIBRARIES="-lyaml-cpp -lrav1e" EXTRA_DEFINES="-D__DEBUG__" else - python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} + python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} --arch="${ARCH}" CLANG_OPTS="-O3 -shared" OUTPUT="build-local/jpl/lib/${CONTRIB_PLATFORM}/${SO_FILE_NAME}" fi + ARCH_OPT=" -arch ${ARCH}" + # Compile - clang++ -std=c++17 -fPIC ${CLANG_OPTS} \ + clang++ -std=c++17 -fPIC ${CLANG_OPTS} ${ARCH_OPT} \ -Wl,-no_compact_unwind -Wl,-framework,CoreFoundation \ -Wl,-framework,Security -Wl,-framework,VideoToolbox \ -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo \ @@ -164,11 +170,11 @@ then -lavformat \ -lavcodec \ -lavutil \ + -lswresample \ -lvpx -lx264 -lbz2 -liconv -lz \ -lspeex \ -lopus \ - "/usr/local/opt/libpng/lib/libpng.a" \ - "/usr/local/opt/freetype/lib/libfreetype.a" \ + -lfreetype \ ${EXTRA_DEBUG_LIBRARIES} \ -o "${OUTPUT}" @@ -302,7 +308,14 @@ then done fi -python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} +if [ ! ${DEBUG} ]; then + if [ "${PLATFORM}" = "darwin" ]; then + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} --arch="${ARCH}" + else + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + fi +fi + cd ${CONTRIB_PATH}/src/ffmpeg/ # ffmpeg build configuration files were changed during plugin build # this git checkout will remove these changes diff --git a/WhisperTranscript/build.sh b/WhisperTranscript/build.sh index 243115e04d49918910b06410a36edeec99dc1a6c..f94a1cd15110f0ca5509a7e8092818fd583f7fd8 100755 --- a/WhisperTranscript/build.sh +++ b/WhisperTranscript/build.sh @@ -41,7 +41,7 @@ elif [ "${PLATFORM}" = "Darwin" ]; then echo "Building with ${PLATFORM}" fi -while getopts t:c:p:d OPT; do +while getopts t:c:p:d:a: OPT; do case "$OPT" in d) DEBUG=true @@ -55,12 +55,19 @@ while getopts t:c:p:d OPT; do ;; p) ;; + a) + ARCH="${OPTARG}" # Override the default ARCH value if provided + ;; \?) exit 1 ;; esac done +if [ "${PLATFORM}" = "darwin" ]; then + CONTRIB_PLATFORM_CURT=${ARCH}-apple +fi + if [ -z "${PROCESSOR}" ]; then PROCESSOR="CPU" echo "PROCESSOR not provided, building with ${PROCESSOR}" @@ -170,10 +177,6 @@ then elif [ "${PLATFORM}" = "darwin" ] then - if [ -f "${CONTRIB_BUILD_PATH}/.ffmpeg" ]; then - rm "${CONTRIB_BUILD_PATH}/.ffmpeg" - rm -rf "${CONTRIB_BUILD_PATH}/ffmpeg" - fi if [ -f "${CONTRIB_BUILD_PATH}/.whispercpp" ]; then rm "${CONTRIB_BUILD_PATH}/.whispercpp" rm -rf "${CONTRIB_BUILD_PATH}/whispercpp" @@ -191,13 +194,15 @@ then EXTRA_DEBUG_LIBRARIES="-lyaml-cpp -lrav1e" EXTRA_DEFINES="-D__DEBUG__" else - python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} + python3 ./../SDK/jplManipulation.py --preassemble --plugin=${PLUGIN_NAME} --arch="${ARCH}" CLANG_OPTS="-O3 -g -shared" OUTPUT="build-local/jpl/lib/${CONTRIB_PLATFORM}/${SO_FILE_NAME}" fi + ARCH_OPT=" -arch ${ARCH}" + # Compile - clang++ -std=c++17 -fPIC ${CLANG_OPTS} \ + clang++ -std=c++17 -fPIC ${CLANG_OPTS} ${ARCH_OPT} \ -Wl,-no_compact_unwind -Wl,-framework,CoreFoundation \ -Wl,-framework,Security -Wl,-framework,VideoToolbox \ -Wl,-framework,CoreMedia -Wl,-framework,CoreVideo \ @@ -230,13 +235,12 @@ then -lavformat \ -lavcodec \ -lavutil \ + -lfreetype \ -lvpx -lx264 -lbz2 -liconv -lz \ "${CONTRIB_PATH}/${CONTRIB_PLATFORM}${CONTRIB_PLATFORM_EXTRA}/lib/libspeex.a" \ "${CONTRIB_PATH}/${CONTRIB_PLATFORM}${CONTRIB_PLATFORM_EXTRA}/lib/libopus.a" \ -lfmt \ -lwhisper \ - "/usr/local/opt/libpng/lib/libpng.a" \ - "/usr/local/opt/freetype/lib/libfreetype.a" \ ${EXTRA_DEBUG_LIBRARIES} \ -o "${OUTPUT}" @@ -382,7 +386,11 @@ then fi if [ ! ${DEBUG} ]; then -python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + if [ "${PLATFORM}" = "darwin" ]; then + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} --arch="${ARCH}" + else + python3 ./../SDK/jplManipulation.py --assemble --plugin=${PLUGIN_NAME} --distribution=${PLATFORM} --extraPath=${EXTRAPATH} + fi fi cd ${CONTRIB_PATH}/src/ffmpeg/ diff --git a/WhisperTranscript/whispercpp/rules.mak b/WhisperTranscript/whispercpp/rules.mak index 22791824945b80fb32054176c4c5843fd550d5e6..6de6da24fa10bf8b9abc7ae667d644a88f1da8c3 100644 --- a/WhisperTranscript/whispercpp/rules.mak +++ b/WhisperTranscript/whispercpp/rules.mak @@ -5,6 +5,10 @@ WHISPERCPP_GITURL := https://github.com/ggerganov/whisper.cpp.git WCONFIG := -DBUILD_SHARED_LIBS=OFF \ -DCMAKE_POSITION_INDEPENDENT_CODE=ON +ifdef HAVE_MACOSX +WCONFIG += -DCMAKE_OSX_ARCHITECTURES=${ARCH} +endif + $(TARBALLS)/whispercpp-$(WHISPERCPP_HASH).tar.xz: $(call download_git,$(WHISPERCPP_GITURL),master,$(WHISPERCPP_HASH)) diff --git a/build-plugin.py b/build-plugin.py index 4204bfce9b915e49583228865b8973992583ff06..7f5c7919e9233d48e1692d4b7c9dd13b9c219a38 100755 --- a/build-plugin.py +++ b/build-plugin.py @@ -47,6 +47,8 @@ def parse(): help='Runtime plugin CPU/GPU setting.') parser.add_argument('--buildOptions', default='', type=str, help="Type all build optionsto pass to package.json 'defines' property.\nThis argument consider that you're using cmake.") + parser.add_argument('--arch', type=str, default=None, + help='Specify the architecture (arm64 or x86_64).') dist = choose_distribution() @@ -93,6 +95,10 @@ def validate_args(parsed_args): if (parsed_args.buildOptions): parsed_args.buildOptions = parsed_args.buildOptions.split(',') + valid_archs = ['arm64', 'x86_64', None] + if parsed_args.arch not in valid_archs: + sys.exit(f"Invalid architecture: {parsed_args.arch}. Must be one of {valid_archs}") + def choose_distribution(): system = platform.system().lower() @@ -113,7 +119,7 @@ def choose_distribution(): return 'Unknown' -def buildPlugin(pluginPath, processor, distribution, buildOptions=''): +def buildPlugin(pluginPath, processor, distribution, arch, buildOptions=''): if distribution == WIN32_DISTRIBUTION_NAME: if (buildOptions): with open(f"{pluginPath}/package.json") as f: @@ -150,6 +156,9 @@ def buildPlugin(pluginPath, processor, distribution, buildOptions=''): install_args.append(processor) install_args.append('-p') install_args.append(str(multiprocessing.cpu_count())) + if arch: + install_args.append('-a') + install_args.append(arch) subprocess.check_call(['chmod', '+x', pluginPath + "/build.sh"]) return subprocess.run([pluginPath + "/build.sh"] + @@ -166,6 +175,7 @@ def main(): currentDir + "/" + plugin, args.processor[i], args.distribution, + args.arch, args.buildOptions) diff --git a/contrib/freetype/rules.mak b/contrib/freetype/rules.mak index a98a3a4a6c53ccef2e51c0ec7fe5525cc2fb71d4..1f5e16e93662904538c246fa5b68d6449dd408a3 100644 --- a/contrib/freetype/rules.mak +++ b/contrib/freetype/rules.mak @@ -32,5 +32,10 @@ ifdef HAVE_ANDROID cd $< && $(HOSTVARS) ./configure $(FTCONFIG) cd $< && $(MAKE) cd $< && $(MAKE) install +else ifdef HAVE_MACOSX + cd $< && $(HOSTVARS) sh autogen.sh + cd $< && $(HOSTVARS) ./configure $(FTCONFIG) + cd $< && $(MAKE) + cd $< && $(MAKE) install endif touch $@