Skip to content

Commit

Permalink
Merge branch 'experimental': Improvements to the script via removal o…
Browse files Browse the repository at this point in the history
…f hardcoded command to build xcframework
  • Loading branch information
light-tech committed Apr 10, 2021
2 parents 5216d1f + 923387c commit a48efde
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 37 deletions.
33 changes: 3 additions & 30 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,9 @@ jobs:

steps:

- script: |
./build-tools.sh
export REPO_ROOT=`pwd`
export PATH=$PATH:$REPO_ROOT/tools/bin
PLATFORMS=("iOS" "macOS") # iOS-Sim
for p in ${PLATFORMS[@]}; do
./build-libffi.sh $p
done
tar -cJf libffi.tar.xz libffi/Release-iphoneos libffi/Release-maccatalyst
displayName: 'Checkout and build libffi'
enabled: true
- publish: $(System.DefaultWorkingDirectory)/libffi.tar.xz
artifact: libffi
displayName: 'Publish libffi'
enabled: true

- script: ./build-llvm-framework.sh
- script: ./build-llvm-framework.sh "iOS" "iOS-Sim" "macOS"
displayName: 'Checkout and build llvm framework'
enabled: false
enabled: true

- publish: $(System.DefaultWorkingDirectory)/llvm-project/build
artifact: CMakeOutputs
Expand All @@ -43,17 +26,7 @@ jobs:
- publish: $(System.DefaultWorkingDirectory)/LLVM.xcframework.tar.xz
artifact: LLVM.xcframework
displayName: 'Publish LLVM XCFramework'
enabled: false

- publish: $(System.DefaultWorkingDirectory)/LLVM-iOS.tar.xz
artifact: LLVM-iOS
displayName: 'Publish LLVM iOS Lib'
enabled: false

- publish: $(System.DefaultWorkingDirectory)/LLVM-macOS.tar.xz
artifact: LLVM-macOS
displayName: 'Publish LLVM macOS Lib'
enabled: false
enabled: true

- publish: $(System.DefaultWorkingDirectory)/LLVM-Clang-iOS.tar.xz
artifact: LLVM-Clang-iOS
Expand Down
20 changes: 13 additions & 7 deletions build-llvm-framework.sh
Original file line number Diff line number Diff line change
@@ -1,24 +1,30 @@
# Build LLVM XCFramework
# The script arguments are the platforms to build

PLATFORMS=( "$@" )

# Build various tools such as automake, libtool
export REPO_ROOT=`pwd`
./build-tools.sh
export PATH=$PATH:$REPO_ROOT/tools/bin

# Download and extract ninja
wget https://github.com/ninja-build/ninja/releases/download/v1.10.2/ninja-mac.zip
unzip ninja-mac.zip

# Download prebuilt libffi
wget https://github.com/light-tech/LLVM-On-iOS/releases/download/libffi_v3.3plus/libffi.tar.xz
tar xzf libffi.tar.xz
test -d libffi && echo "libffi was successfully extracted"

git clone --single-branch --branch release/11.x https://github.com/llvm/llvm-project.git

PLATFORMS=("iOS" "macOS") # iOS-Sim
FRAMEWORKS_ARGS=()
for p in ${PLATFORMS[@]}; do
echo "Build LLVM for $p"
./build-libffi.sh $p
./build-llvm.sh $p
./prepare-llvm.sh $p
FRAMEWORKS_ARGS+=("-library" "LLVM-$p/llvm.a" "-headers" "LLVM-$p/include")
tar -cJf LLVM-$p.tar.xz LLVM-$p/
tar -cJf LLVM-Clang-$p.tar.xz LLVM-$p/lib/clang/
done

xcodebuild -create-xcframework -library LLVM-iOS/llvm.a -headers LLVM-iOS/include -library LLVM-macOS/llvm.a -headers LLVM-macOS/include -output LLVM.xcframework
echo "Create XC framework with arguments" ${FRAMEWORKS_ARGS[@]}
xcodebuild -create-xcframework ${FRAMEWORKS_ARGS[@]} -output LLVM.xcframework
tar -cJf LLVM.xcframework.tar.xz LLVM.xcframework

0 comments on commit a48efde

Please sign in to comment.