Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try to create arm prebuilds #96

Merged
merged 55 commits into from
Oct 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
2c8c8d5
Try to create universal binaries for mac
martenrichter Oct 29, 2022
169f132
Add debug code
martenrichter Oct 29, 2022
becb697
Fix platform detection logic
martenrichter Oct 29, 2022
f0f5524
Switch to cmake.js 7.0
martenrichter Oct 29, 2022
0a56210
Remove unused uv.h
martenrichter Oct 29, 2022
c6c5e07
Move arch option to begining
martenrichter Oct 29, 2022
8c702b3
Merge branch 'master' into applem1
martenrichter Oct 29, 2022
ed10bbc
Move univ bin setting to cmakelist
martenrichter Oct 29, 2022
3b15450
Remove logic from build.js
martenrichter Oct 29, 2022
4caa857
Go back to macos-latest
martenrichter Oct 29, 2022
b4fe34c
Revert cmake.js update (win fails)
martenrichter Oct 29, 2022
f02f076
Merge branch 'applem1' of https://github.com/fails-components/webtran…
martenrichter Oct 29, 2022
a3c5e04
Change syntax cmake option
martenrichter Oct 29, 2022
719ce52
Add output for architecture
martenrichter Oct 29, 2022
067a1db
add debug code
martenrichter Oct 29, 2022
091f6fb
Switch to a cross compile approach
martenrichter Oct 29, 2022
c4720d0
Add BUILDARCH to platform args
martenrichter Oct 29, 2022
7aaef5d
Fix protoc cross compiling issue
martenrichter Oct 29, 2022
ae2ecbd
Make protobuf universal binary
martenrichter Oct 29, 2022
e0c5969
Fix protobuf unibin change
martenrichter Oct 29, 2022
a7dae57
Fix protoc prop
martenrichter Oct 29, 2022
01537ff
Set arch also for other protoc parts multi arch
martenrichter Oct 29, 2022
7beb741
Move protobuf multiarch
martenrichter Oct 29, 2022
01b8b7e
Revert last change
martenrichter Oct 29, 2022
33a8f82
Merge branch 'master' into applem1
martenrichter Oct 29, 2022
2d18c71
Fix multiarch prop
martenrichter Oct 29, 2022
c29a8d5
Fix icu root
martenrichter Oct 29, 2022
95e47c6
Install icu4c arm
martenrichter Oct 29, 2022
d194b37
Fix yaml error
martenrichter Oct 29, 2022
a163990
Fix problem and debug code
martenrichter Oct 29, 2022
95b3fa9
Fix test arch and debug code
martenrichter Oct 29, 2022
191bd78
Use local dir for arm brew
martenrichter Oct 30, 2022
7d9483f
Fix armbrew
martenrichter Oct 30, 2022
d64ae81
add inspection code
martenrichter Oct 30, 2022
f56c9af
may be fix the brew
martenrichter Oct 30, 2022
5482890
may be fix the brew2
martenrichter Oct 30, 2022
c7cfce3
may be fix the brew3
martenrichter Oct 30, 2022
7ac9741
may be fix the brew4
martenrichter Oct 30, 2022
b3fb85b
may be fix the brew5
martenrichter Oct 30, 2022
f5778fd
may be fix the brew6
martenrichter Oct 30, 2022
27f6851
may be fix the brew7
martenrichter Oct 30, 2022
089c58f
may be fix the brew8
martenrichter Oct 30, 2022
dbadb11
may be fix the brew9
martenrichter Oct 30, 2022
3d296d5
may be fix the brew10 and add logic to cmake.txt
martenrichter Oct 30, 2022
5b07423
Fix homebrew logic in cmake.txt
martenrichter Oct 30, 2022
4c0d1f7
Test mechanism for publishpackage
martenrichter Oct 30, 2022
332f911
Fix locahomebrew export line
martenrichter Oct 30, 2022
1530414
Fix locahomebrew export line2
martenrichter Oct 30, 2022
75a5bca
Fix locahomebrew export line3
martenrichter Oct 30, 2022
3e93f9c
Fix locahomebrew export line4
martenrichter Oct 30, 2022
e81e83d
Fix locahomebrew export line5
martenrichter Oct 30, 2022
7617034
Fix locahomebrew export line6
martenrichter Oct 30, 2022
c0af974
remove stale code
martenrichter Oct 30, 2022
da8aa59
Merge branch 'master' into applem1
martenrichter Oct 30, 2022
3c1f9fb
Merge branch 'applem1' of https://github.com/fails-components/webtran…
martenrichter Oct 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/libtest-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ jobs:

- name: Build library
run: npm run build

- name: Test architecture
run: lipo -info build_darwin_x64/Release/webtransport.node

- name: Run unit tests
run: NODE_ENV=production npm test
60 changes: 60 additions & 0 deletions .github/workflows/libtest-macosarmcross.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# This is a basic workflow to help you get started with Actions

name: Mac OS ARM Automated cross build

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
pull_request:
branches: [ master ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build-macosarm:
# The type of runner that the job will run on
runs-on: macos-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install icu libs
# modified snippet from https://github.com/Homebrew/discussions/discussions/2843
run: |
mkdir -p ../armhomebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C ../armhomebrew
echo "Step1 finished"
#../armhomebrew/bin/brew fetch --force --bottle-tag=arm64_big_sur icu4c | grep "Downloaded to"
response=$(../armhomebrew/bin/brew fetch --force --bottle-tag=arm64_big_sur icu4c | grep "Downloaded to")
echo "Step2 finished with response $response"
parsed=($response)
echo "Step3 install ${parsed[2]}"
../armhomebrew/bin/brew install ${parsed[2]}
echo "Step4"
echo "icu4c will be in $(../armhomebrew/bin/brew --prefix)/opt/icu4c"
echo "LOCALHOMEWBREWICU=$(../armhomebrew/bin/brew --prefix)/opt/icu4c"
echo "LOCALHOMEWBREWICU=$(../armhomebrew/bin/brew --prefix)/opt/icu4c" >> $GITHUB_ENV

- name: Test
run: echo ${{ env.LOCALHOMEWBREWICU }}

- name: Set up NodeJS
uses: actions/setup-node@v1
with:
node-version: 16
- name: Install dependencies
run: npm install

- name: Build library
run: BUILDARCH="arm64" LOCALHOMEWBREWICU=${{ env.LOCALHOMEWBREWICU }} npm run build

# - name: Run unit tests
# run: NODE_ENV=production npm test
18 changes: 18 additions & 0 deletions .github/workflows/publish-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ jobs:
include:
- arch: ia32
os: windows-2019
- arch: arm64
os: macos-latest
runs-on: ${{ matrix.os }}
permissions:
contents: write
Expand All @@ -69,6 +71,21 @@ jobs:
- name: Install missing software for Windows
if: runner.os == 'Windows'
run: choco install nasm -yv
# modified snippet from https://github.com/Homebrew/discussions/discussions/2843
- name: Install icu for Mac Arm cross compile
if: ${{ (matrix.arch == 'arm64') && (matrix.os == 'macos-latest')}}
run: |
mkdir -p ../armhomebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C ../armhomebrew
echo "Step1 finished"
#../armhomebrew/bin/brew fetch --force --bottle-tag=arm64_big_sur icu4c | grep "Downloaded to"
response=$(../armhomebrew/bin/brew fetch --force --bottle-tag=arm64_big_sur icu4c | grep "Downloaded to")
echo "Step2 finished with response $response"
parsed=($response)
echo "Step3 install ${parsed[2]}"
../armhomebrew/bin/brew install ${parsed[2]}
echo "Step4"
echo "icu4c will be in $(../armhomebrew/bin/brew --prefix)/opt/icu4c"
echo "LOCALHOMEWBREWICU=$(../armhomebrew/bin/brew --prefix)/opt/icu4c" >> $GITHUB_ENV
- name: Checkout code
uses: actions/checkout@v2
with:
Expand All @@ -86,6 +103,7 @@ jobs:
env:
BUILDARCH: ${{ matrix.arch }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
LOCALHOMEWBREWICU: ${{ env.LOCALHOMEWBREWICU }}
run: node build.js prebuild

# code is not ready... if anyone needs it, I am open for PR
Expand Down
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,22 @@ set(BUILD_TESTING OFF)

set(protobuf_BUILD_PROTOC_BINARIES ON)


IF( NOT WIN32)
IF(APPLE)
SET(ICU_ROOT "/usr/local/opt/icu4c")
IF(DEFINED ENV{LOCALHOMEWBREWICU})
MESSAGE(STATUS "Local homebrew icu detected")
MESSAGE(STATUS $ENV{LOCALHOMEWBREWICU})
SET(ICU_ROOT $ENV{LOCALHOMEWBREWICU})
ELSE()
IF(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
MESSAGE(STATUS "set icu root local")
SET(ICU_ROOT "/usr/local/opt/icu4c")
ELSE()
MESSAGE(STATUS "set icu root homebrew")
SET(ICU_ROOT "/opt/homebrew/icu4c")
ENDIF()
ENDIF()
ENDIF(APPLE)
find_package(ICU COMPONENTS uc i18n REQUIRED)
ENDIF(NOT WIN32)
Expand All @@ -42,6 +55,9 @@ add_subdirectory(third_party/libevent EXCLUDE_FROM_ALL)
SET(protobuf_WITH_ZLIB OFF CACHE BOOL "Build with zlib support")
SET(protobuf_BUILD_TESTS OFF CACHE BOOL "Build tests")
add_subdirectory(third_party/protobuf EXCLUDE_FROM_ALL)
IF(APPLE)
set_target_properties(protoc libprotoc libprotobuf PROPERTIES OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE )
ENDIF(APPLE)

IF (WIN32)
add_compile_definitions(WIN32_LEAN_AND_MEAN NOGDI)
Expand Down Expand Up @@ -908,6 +924,7 @@ ELSE(WIN32)
)
ENDIF(WIN32)


add_custom_command(
OUTPUT
${CMAKE_CURRENT_SOURCE_DIR}/third_party/quiche/quiche/quic/core/proto/cached_network_parameters.pb.h
Expand Down
8 changes: 6 additions & 2 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,10 +201,14 @@ if (argv.length > 2) {
]
if (platform === 'win32') platformargs.push('-t', 'ClangCL')
const pbargs = []
if (platform === 'win32') pbargs.push('-t', 'ClangCL')
const pbargspre = []
if (env.BUILDARCH) pbargspre.push('--arch', env.BUILDARCH)
if (platform === 'win32') pbargs.push('-t', 'ClangCL')
if (env.BUILDARCH) {
pbargspre.push('--arch', env.BUILDARCH)
platformargs.push('--arch', env.BUILDARCH)
}
if (env.GH_TOKEN) pbargspre.push('--u', env.GH_TOKEN)

switch (argv[2]) {
case 'prebuild':
try {
Expand Down
Loading