mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-18 04:54:38 +03:00
wip: macOS build
This commit is contained in:
17
.github/workflows/build-qv2ray-cmake.yml
vendored
17
.github/workflows/build-qv2ray-cmake.yml
vendored
@@ -23,12 +23,22 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Checking out sources
|
- name: Checking out sources
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
- name: Go Status
|
||||||
|
run: git ls-files go | xargs cat | sha1sum > go_status
|
||||||
|
- name: Cache Common Download
|
||||||
|
id: cache-common
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: artifacts.tgz
|
||||||
|
key: CommonCache-${{ matrix.cross_os }}-${{ matrix.cross_arch }}-${{ hashFiles('libs/*.sh', 'go_status') }}
|
||||||
- name: Install Golang
|
- name: Install Golang
|
||||||
|
if: steps.cache-common.outputs.cache-hit != 'true'
|
||||||
uses: actions/setup-go@v2
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
stable: false
|
stable: false
|
||||||
go-version: 1.19.2
|
go-version: 1.19.2
|
||||||
- name: Build golang parts
|
- name: Build golang parts
|
||||||
|
if: steps.cache-common.outputs.cache-hit != 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
[ ${{ matrix.cross_os }} == asset ] || ./libs/get_source.sh
|
[ ${{ matrix.cross_os }} == asset ] || ./libs/get_source.sh
|
||||||
@@ -36,6 +46,7 @@ jobs:
|
|||||||
[ ${{ matrix.cross_os }} == asset ] || exit 0
|
[ ${{ matrix.cross_os }} == asset ] || exit 0
|
||||||
./libs/build_asset.sh
|
./libs/build_asset.sh
|
||||||
- name: Tar files
|
- name: Tar files
|
||||||
|
if: steps.cache-common.outputs.cache-hit != 'true'
|
||||||
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
|
||||||
@@ -45,7 +56,7 @@ jobs:
|
|||||||
build-cpp:
|
build-cpp:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
platform: [ windows-2022, ubuntu-20.04, macos-11 ]
|
platform: [ windows-2022, ubuntu-20.04, macos-10.15 ]
|
||||||
arch: [ x64 ]
|
arch: [ x64 ]
|
||||||
qt_version: [ 5.15.2 ]
|
qt_version: [ 5.15.2 ]
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
@@ -68,7 +79,7 @@ jobs:
|
|||||||
toolset: 14.2
|
toolset: 14.2
|
||||||
arch: ${{ matrix.arch }}
|
arch: ${{ matrix.arch }}
|
||||||
- name: Download Artifacts
|
- name: Download Artifacts
|
||||||
if: matrix.platform == 'macos-11'
|
if: matrix.platform == 'macos-10.15'
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
path: download-artifact
|
path: download-artifact
|
||||||
@@ -127,7 +138,7 @@ jobs:
|
|||||||
./libs/deploy_linux64.sh
|
./libs/deploy_linux64.sh
|
||||||
- name: macOS - ${{ matrix.qt_version }} - Generate MakeFile and Build
|
- name: macOS - ${{ matrix.qt_version }} - Generate MakeFile and Build
|
||||||
shell: bash
|
shell: bash
|
||||||
if: matrix.platform == 'macos-11'
|
if: matrix.platform == 'macos-10.15'
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ if (NKR_CROSS)
|
|||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (NKR_PACKAGE OR NKR_PACKAGE_MACOS)
|
if (NKR_PACKAGE OR NKR_PACKAGE_MACOS)
|
||||||
message("[add_compile_definitions] NKR_PACKAGE")
|
message("[add_compile_definitions] NKR_CPP_USE_APPDATA")
|
||||||
add_compile_definitions(NKR_PACKAGE)
|
add_compile_definitions(NKR_CPP_USE_APPDATA)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
# Windows
|
# Windows
|
||||||
@@ -257,10 +257,17 @@ target_link_libraries(nekoray PRIVATE
|
|||||||
${PLATFORM_FUCKING_LIBRARIES}
|
${PLATFORM_FUCKING_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
set(MACOSX_ICON ${CMAKE_SOURCE_DIR}/res/nekoray.icns)
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
target_sources(nekoray PRIVATE ${MACOSX_ICON})
|
||||||
|
endif ()
|
||||||
|
|
||||||
set_target_properties(nekoray PROPERTIES
|
set_target_properties(nekoray PROPERTIES
|
||||||
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
MACOSX_BUNDLE_ICON_FILE "nekoray.icns"
|
||||||
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
RESOURCE ${MACOSX_ICON}
|
||||||
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/res/MacOSXBundleInfo.plist
|
||||||
|
MACOSX_BUNDLE_GUI_IDENTIFIER moe.nekoray.macosx
|
||||||
MACOSX_BUNDLE TRUE
|
MACOSX_BUNDLE TRUE
|
||||||
WIN32_EXECUTABLE TRUE
|
WIN32_EXECUTABLE TRUE
|
||||||
)
|
)
|
||||||
|
|||||||
18
appdmg.json
Normal file
18
appdmg.json
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"title": "nekoray",
|
||||||
|
"icon": "res/nekoray.icns",
|
||||||
|
"contents": [
|
||||||
|
{
|
||||||
|
"x": 448,
|
||||||
|
"y": 344,
|
||||||
|
"type": "link",
|
||||||
|
"path": "/Applications"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 192,
|
||||||
|
"y": 344,
|
||||||
|
"type": "file",
|
||||||
|
"path": "build/nekoray.app"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -4,7 +4,3 @@ add_compile_definitions(NKR_VERSION=\"${NKR_VERSION}\")
|
|||||||
|
|
||||||
# Debug
|
# Debug
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DNKR_DEBUG")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DNKR_DEBUG")
|
||||||
|
|
||||||
if (NKR_USE_APPDATA)
|
|
||||||
add_compile_definitions(NKR_USE_APPDATA)
|
|
||||||
endif ()
|
|
||||||
|
|||||||
@@ -19,10 +19,11 @@ mv deployment/assets/* deployment/macos-$ARCH
|
|||||||
mv deployment/macos-$ARCH/* $BUILD/nekoray.app/Contents/MacOS
|
mv deployment/macos-$ARCH/* $BUILD/nekoray.app/Contents/MacOS
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#### deploy qt & DLL runtime => dmg ####
|
#### deploy qt & DLL runtime => .app ####
|
||||||
pushd $BUILD
|
pushd $BUILD
|
||||||
macdeployqt nekoray.app -dmg -verbose=3
|
macdeployqt nekoray.app -verbose=3
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#### copy dmg ####
|
#### pack dmg ###
|
||||||
cp $BUILD/*.dmg $DEST
|
sudo npm install -g appdmg
|
||||||
|
appdmg appdmg.json $DEST/nekoray.dmg
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ int main(int argc, char *argv[]) {
|
|||||||
auto args = QApplication::arguments();
|
auto args = QApplication::arguments();
|
||||||
if (args.contains("-many")) NekoRay::dataStore->flag_many = true;
|
if (args.contains("-many")) NekoRay::dataStore->flag_many = true;
|
||||||
if (args.contains("-appdata")) NekoRay::dataStore->flag_use_appdata = true;
|
if (args.contains("-appdata")) NekoRay::dataStore->flag_use_appdata = true;
|
||||||
#ifdef NKR_PACKAGE
|
#ifdef NKR_CPP_USE_APPDATA
|
||||||
NekoRay::dataStore->flag_use_appdata = true;
|
NekoRay::dataStore->flag_use_appdata = true;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
38
res/MacOSXBundleInfo.plist
Normal file
38
res/MacOSXBundleInfo.plist
Normal file
@@ -0,0 +1,38 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>English</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${MACOSX_BUNDLE_EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleGetInfoString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_INFO_STRING}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>${MACOSX_BUNDLE_ICON_FILE}</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>${MACOSX_BUNDLE_GUI_IDENTIFIER}</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleLongVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_LONG_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>${MACOSX_BUNDLE_SHORT_VERSION_STRING}</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>${MACOSX_BUNDLE_BUNDLE_VERSION}</string>
|
||||||
|
<key>CSResourcesFileMapped</key>
|
||||||
|
<true/>
|
||||||
|
<key>NSHumanReadableCopyright</key>
|
||||||
|
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||||
|
<key>NSPrincipalClass</key>
|
||||||
|
<string>NSApplication</string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
||||||
BIN
res/nekoray.icns
Normal file
BIN
res/nekoray.icns
Normal file
Binary file not shown.
Reference in New Issue
Block a user