mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
wip: macOS build
This commit is contained in:
85
.github/workflows/build-qv2ray-cmake.yml
vendored
85
.github/workflows/build-qv2ray-cmake.yml
vendored
@@ -11,6 +11,14 @@ on:
|
|||||||
required: false
|
required: false
|
||||||
jobs:
|
jobs:
|
||||||
build-go:
|
build-go:
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
cross_os: [ windows, linux, darwin ]
|
||||||
|
cross_arch: [ amd64 ]
|
||||||
|
include:
|
||||||
|
- cross_os: asset
|
||||||
|
cross_arch: asset
|
||||||
|
fail-fast: false
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checking out sources
|
- name: Checking out sources
|
||||||
@@ -20,30 +28,26 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
stable: false
|
stable: false
|
||||||
go-version: 1.19.2
|
go-version: 1.19.2
|
||||||
- name: Build golang and common parts
|
- name: Build golang parts
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
./libs/get_source.sh
|
[ ${{ matrix.cross_os }} == asset ] || ./libs/get_source.sh
|
||||||
GOOS=linux GOARCH=amd64 ./libs/build_go.sh
|
[ ${{ matrix.cross_os }} == asset ] || GOOS=${{ matrix.cross_os }} GOARCH=${{ matrix.cross_arch }} ./libs/build_go.sh
|
||||||
GOOS=windows GOARCH=amd64 ./libs/build_go.sh
|
[ ${{ matrix.cross_os }} == asset ] || exit 0
|
||||||
./libs/build_asset.sh
|
./libs/build_asset.sh
|
||||||
- name: Tar files
|
- name: Tar files
|
||||||
run: tar czvf artifacts.tgz ./deployment
|
run: tar czvf artifacts.tgz ./deployment
|
||||||
- name: Uploading Artifact
|
- name: Uploading Artifact
|
||||||
uses: actions/upload-artifact@master
|
uses: actions/upload-artifact@master
|
||||||
with:
|
with:
|
||||||
name: NekoRay-${{ github.sha }}-Common
|
name: NekoRay-${{ github.sha }}-Common-${{ matrix.cross_os }}-${{ matrix.cross_arch }}
|
||||||
path: artifacts.tgz
|
path: artifacts.tgz
|
||||||
build-cpp:
|
build-cpp:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ windows-2022, ubuntu-20.04 ]
|
platform: [ windows-2022, ubuntu-20.04, macos-11 ]
|
||||||
arch: [ x64 ]
|
arch: [ x64 ]
|
||||||
qt_version: [ 5.15.2 ]
|
qt_version: [ 5.15.2 ]
|
||||||
include:
|
|
||||||
- platform: windows-2022
|
|
||||||
arch: x64
|
|
||||||
qtarch: win64_msvc2019_64
|
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
|
|
||||||
runs-on: ${{ matrix.platform }}
|
runs-on: ${{ matrix.platform }}
|
||||||
@@ -77,25 +81,15 @@ jobs:
|
|||||||
setup-python: false
|
setup-python: false
|
||||||
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
cached: ${{ steps.cache-qt.outputs.cache-hit }}
|
||||||
# ========================================================================================================= Other install
|
# ========================================================================================================= Other install
|
||||||
- name: Windows - ${{ matrix.arch }} - ${{ matrix.qt_version }} - Setup Ninja
|
- name: Install ninja-build tool
|
||||||
if: matrix.platform == 'windows-2022'
|
uses: seanmiddleditch/gha-setup-ninja@v3
|
||||||
uses: ashutoshvarma/setup-ninja@master
|
|
||||||
with:
|
|
||||||
# ninja version to download. Default: 1.10.0
|
|
||||||
version: 1.10.0
|
|
||||||
- name: Linux - ${{ matrix.arch }} - ${{ matrix.qt_version }} - Setup Ninja
|
|
||||||
shell: bash
|
|
||||||
if: matrix.platform == 'ubuntu-20.04'
|
|
||||||
run: |
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y ninja-build
|
|
||||||
# ========================================================================================================= 编译与 Qt 无关的依赖
|
# ========================================================================================================= 编译与 Qt 无关的依赖
|
||||||
- name: Cache Download
|
- name: Cache Download
|
||||||
id: cache-deps
|
id: cache-deps
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
path: libs/deps
|
path: libs/deps
|
||||||
key: ${{ hashFiles('libs/build_deps_*.sh') }}
|
key: DepsCache-${{ matrix.platform }}-${{ matrix.arch }}-${{ matrix.qt_version }}-${{ hashFiles('libs/build_deps_*.sh') }}
|
||||||
- name: Build Dependencies
|
- name: Build Dependencies
|
||||||
shell: bash
|
shell: bash
|
||||||
if: steps.cache-deps.outputs.cache-hit != 'true'
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
||||||
@@ -112,7 +106,7 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
|
||||||
cmake --build . --parallel $(nproc)
|
ninja
|
||||||
cd ..
|
cd ..
|
||||||
./libs/deploy_windows64.sh
|
./libs/deploy_windows64.sh
|
||||||
- name: Linux - ${{ matrix.qt_version }} - Generate MakeFile and Build
|
- name: Linux - ${{ matrix.qt_version }} - Generate MakeFile and Build
|
||||||
@@ -122,9 +116,19 @@ jobs:
|
|||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
|
||||||
cmake --build . --parallel $(nproc)
|
ninja
|
||||||
cd ..
|
cd ..
|
||||||
./libs/deploy_linux64.sh
|
./libs/deploy_linux64.sh
|
||||||
|
- name: macOS - ${{ matrix.qt_version }} - Generate MakeFile and Build
|
||||||
|
shell: bash
|
||||||
|
if: matrix.platform == 'macos-11'
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DNKR_PACKAGE_MACOS=1 ..
|
||||||
|
ninja
|
||||||
|
cd ..
|
||||||
|
./libs/deploy_macos.sh
|
||||||
# ========================================================================================================= Deployments
|
# ========================================================================================================= Deployments
|
||||||
- name: Tar files
|
- name: Tar files
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -145,37 +149,32 @@ jobs:
|
|||||||
- name: Checking out sources
|
- name: Checking out sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
- name: Donwload Artifacts
|
- name: Donwload Artifacts
|
||||||
uses: actions/download-artifact@v2
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: NekoRay-${{ github.sha }}-Common
|
path: download-artifact
|
||||||
path: artifacts-common
|
|
||||||
- name: Donwload Artifacts
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: NekoRay-${{ github.sha }}-ubuntu-20.04-x64
|
|
||||||
path: artifacts-linux
|
|
||||||
- name: Donwload Artifacts
|
|
||||||
uses: actions/download-artifact@v2
|
|
||||||
with:
|
|
||||||
name: NekoRay-${{ github.sha }}-windows-2022-x64
|
|
||||||
path: artifacts-windows
|
|
||||||
- name: Release
|
- name: Release
|
||||||
run: |
|
run: |
|
||||||
source libs/deploy_common.sh
|
source libs/deploy_common.sh
|
||||||
curl -Lo - https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xzv
|
curl -Lo - https://github.com/tcnksm/ghr/releases/download/v0.13.0/ghr_v0.13.0_linux_amd64.tar.gz | tar xzv
|
||||||
mv ghr*linux_amd64/ghr .
|
mv ghr*linux_amd64/ghr .
|
||||||
tar xzvf artifacts-linux/artifacts.tgz
|
find . -name artifacts.tgz | xargs -n1 tar xvzf
|
||||||
tar xzvf artifacts-windows/artifacts.tgz
|
|
||||||
tar xzvf artifacts-common/artifacts.tgz
|
|
||||||
cd deployment
|
cd deployment
|
||||||
cp -r assets/* linux64
|
cp -r assets/* linux64
|
||||||
cp -r assets/* windows64
|
cp -r assets/* windows64
|
||||||
|
cp -r assets/* macos-amd64
|
||||||
rm -rf assets *.pdb
|
rm -rf assets *.pdb
|
||||||
|
####
|
||||||
mv linux64 nekoray
|
mv linux64 nekoray
|
||||||
zip -r $version_standalone-linux64.zip nekoray
|
zip -r $version_standalone-linux64.zip nekoray
|
||||||
rm -rf nekoray
|
rm -rf nekoray
|
||||||
|
####
|
||||||
mv windows64 nekoray
|
mv windows64 nekoray
|
||||||
zip -r $version_standalone-windows64.zip nekoray
|
zip -r $version_standalone-windows64.zip nekoray
|
||||||
rm -rf nekoray
|
rm -rf nekoray
|
||||||
|
####
|
||||||
|
mv macos-amd64 nekoray
|
||||||
|
zip -r $version_standalone-macos-amd64.zip nekoray
|
||||||
|
rm -rf nekoray
|
||||||
|
####
|
||||||
cd ..
|
cd ..
|
||||||
./ghr -delete -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment
|
./ghr -delete -t "${{ github.token }}" -n "${{ github.event.inputs.tag }}" "${{ github.event.inputs.tag }}" deployment
|
||||||
@@ -30,6 +30,11 @@ if (NKR_CROSS)
|
|||||||
set_property(TARGET Qt5::lupdate PROPERTY IMPORTED_LOCATION /usr/bin/lupdate)
|
set_property(TARGET Qt5::lupdate PROPERTY IMPORTED_LOCATION /usr/bin/lupdate)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (NKR_PACKAGE OR NKR_PACKAGE_MACOS)
|
||||||
|
message("[add_compile_definitions] NKR_PACKAGE")
|
||||||
|
add_compile_definitions(NKR_PACKAGE)
|
||||||
|
endif ()
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
include("cmake/fuck_windows/fuck.cmake")
|
include("cmake/fuck_windows/fuck.cmake")
|
||||||
|
|
||||||
@@ -51,10 +56,6 @@ include("cmake/nkr.cmake")
|
|||||||
|
|
||||||
find_package(Threads)
|
find_package(Threads)
|
||||||
|
|
||||||
if (NKR_PACKAGE)
|
|
||||||
add_compile_definitions(NKR_PACKAGE)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (NKR_NO_EXTERNAL)
|
if (NKR_NO_EXTERNAL)
|
||||||
add_compile_definitions(NKR_NO_EXTERNAL)
|
add_compile_definitions(NKR_NO_EXTERNAL)
|
||||||
else ()
|
else ()
|
||||||
|
|||||||
@@ -54,6 +54,8 @@ func (s *BaseServer) Update(ctx context.Context, in *gen.UpdateReq) (*gen.Update
|
|||||||
search = "windows64"
|
search = "windows64"
|
||||||
} else if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
|
} else if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
|
||||||
search = "linux64"
|
search = "linux64"
|
||||||
|
} else if runtime.GOOS == "darwin" {
|
||||||
|
search = "macos-" + runtime.GOARCH
|
||||||
} else {
|
} else {
|
||||||
ret.Error = "Not official support platform"
|
ret.Error = "Not official support platform"
|
||||||
return ret, nil
|
return ret, nil
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ set -e
|
|||||||
source libs/deploy_common.sh
|
source libs/deploy_common.sh
|
||||||
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/windows64 || true
|
[ "$GOOS" == "windows" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/windows64 || true
|
||||||
[ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/linux64 || true
|
[ "$GOOS" == "linux" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/linux64 || true
|
||||||
|
[ "$GOOS" == "darwin" ] && [ "$GOARCH" == "amd64" ] && DEST=$DEPLOYMENT/mac-amd64 || true
|
||||||
|
[ "$GOOS" == "darwin" ] && [ "$GOARCH" == "arm64" ] && DEST=$DEPLOYMENT/mac-arm64 || true
|
||||||
if [ -z $DEST ]; then
|
if [ -z $DEST ]; then
|
||||||
echo "Please set GOOS GOARCH"
|
echo "Please set GOOS GOARCH"
|
||||||
exit
|
exit 1
|
||||||
fi
|
fi
|
||||||
rm -rf $DEST
|
rm -rf $DEST
|
||||||
mkdir -p $DEST
|
mkdir -p $DEST
|
||||||
|
|||||||
21
libs/deploy_macos.sh
Executable file
21
libs/deploy_macos.sh
Executable file
@@ -0,0 +1,21 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [[ $(uname -m) == 'arm64' ]]; then
|
||||||
|
ARCH="arm64"
|
||||||
|
else
|
||||||
|
ARCH="amd64"
|
||||||
|
fi
|
||||||
|
|
||||||
|
source libs/deploy_common.sh
|
||||||
|
DEST=$DEPLOYMENT/macos-$ARCH
|
||||||
|
rm -rf $DEST
|
||||||
|
mkdir -p $DEST
|
||||||
|
|
||||||
|
#### deploy qt & DLL runtime => dmg ####
|
||||||
|
pushd $BUILD
|
||||||
|
macdeployqt nekoray.app -dmg -verbose=3
|
||||||
|
popd
|
||||||
|
|
||||||
|
#### copy dmg ####
|
||||||
|
cp $BUILD/*.dmg $DEST
|
||||||
@@ -14,6 +14,7 @@
|
|||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
|
|
||||||
#include "qv2ray/wrapper.hpp"
|
#include "qv2ray/wrapper.hpp"
|
||||||
|
#include "main/NekoRay_Utils.hpp"
|
||||||
|
|
||||||
#define QV_MODULE_NAME "SystemProxy"
|
#define QV_MODULE_NAME "SystemProxy"
|
||||||
|
|
||||||
|
|||||||
@@ -104,9 +104,6 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
ui->toolButton_preferences->setMenu(ui->menu_preferences);
|
ui->toolButton_preferences->setMenu(ui->menu_preferences);
|
||||||
ui->toolButton_server->setMenu(ui->menu_server);
|
ui->toolButton_server->setMenu(ui->menu_server);
|
||||||
ui->menubar->setVisible(false);
|
ui->menubar->setVisible(false);
|
||||||
#ifdef NKR_PACKAGE
|
|
||||||
ui->toolButton_update->hide();
|
|
||||||
#endif
|
|
||||||
connect(ui->toolButton_document, &QToolButton::clicked, this,
|
connect(ui->toolButton_document, &QToolButton::clicked, this,
|
||||||
[=] { QDesktopServices::openUrl(QUrl("https://matsuridayo.github.io/")); });
|
[=] { QDesktopServices::openUrl(QUrl("https://matsuridayo.github.io/")); });
|
||||||
connect(ui->toolButton_ads, &QToolButton::clicked, this,
|
connect(ui->toolButton_ads, &QToolButton::clicked, this,
|
||||||
|
|||||||
5
updater/launcher_darwin.go
Normal file
5
updater/launcher_darwin.go
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
func Launcher() {
|
||||||
|
println("?")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user