mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-19 10:20:49 +08:00
add: added more Android build scripts
This commit is contained in:
parent
c12c1b5a19
commit
7cbe05a9d1
1
.gitignore
vendored
1
.gitignore
vendored
@ -12,6 +12,7 @@ CMakeSettings.json
|
|||||||
SourceTrail/
|
SourceTrail/
|
||||||
|
|
||||||
libs/gen/
|
libs/gen/
|
||||||
|
libs/deps
|
||||||
libs/x64-windows/
|
libs/x64-windows/
|
||||||
libs/x86-windows/
|
libs/x86-windows/
|
||||||
libs/x86-android/
|
libs/x86-android/
|
||||||
|
2
3rdparty/libuv
vendored
2
3rdparty/libuv
vendored
@ -1 +1 @@
|
|||||||
Subproject commit 1ab9ea3790378f9f25c4e78e9e2b511c75f9c9ed
|
Subproject commit e8b989ea1f7f9d4083511a2caec7791e9abd1871
|
@ -37,36 +37,18 @@ endif()
|
|||||||
set(QV2RAY_USE_QWIDGET ON CACHE BOOL "Use QWidget as Qv2ray GUI")
|
set(QV2RAY_USE_QWIDGET ON CACHE BOOL "Use QWidget as Qv2ray GUI")
|
||||||
set(QV2RAY_USE_QML OFF CACHE BOOL "Use QML as Qv2ray GUI")
|
set(QV2RAY_USE_QML OFF CACHE BOOL "Use QML as Qv2ray GUI")
|
||||||
|
|
||||||
|
set(ANDROID_PACKAGE_SOURCE ${CMAKE_SOURCE_DIR}/assets/android)
|
||||||
|
set(QT_ANDROID_PACKAGE_SOURCE_DIR "\"android-package-source-directory\":\"${ANDROID_PACKAGE_SOURCE}\",")
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
message("Configuring for Android, ABI: ${ANDROID_ABI}")
|
message("Configuring for Android, ABI: ${ANDROID_ABI}")
|
||||||
include(cmake/platforms/android.cmake)
|
include(cmake/platforms/android.cmake)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_package(Qt5 5.11 COMPONENTS Core Network REQUIRED)
|
|
||||||
set(QV2RAY_QT_LIBS Qt5::Core Qt5::Network)
|
|
||||||
|
|
||||||
if(QV2RAY_USE_QML)
|
|
||||||
message("QML Enabled.")
|
|
||||||
find_package(Qt5 5.11 COMPONENTS Qml Quick Widgets Svg QuickControls2 Gui REQUIRED)
|
|
||||||
list(APPEND QV2RAY_QT_LIBS Qt5::Quick Qt5::Qml Qt5::Widgets Qt5::Svg Qt5::QuickControls2 Qt5::Gui)
|
|
||||||
set(QV2RAY_HAS_GUI ON)
|
|
||||||
elseif(QV2RAY_USE_QWIDGET)
|
|
||||||
message("QWidgets Enabled.")
|
|
||||||
set(QV2RAY_QNODEEDITOR_PROVIDER "module" CACHE STRING "QNodeEditor Provider")
|
|
||||||
set(QV2RAY_HAS_BUILT_IN_THEMES ON CACHE BOOL "Build with built-in themes")
|
|
||||||
find_package(Qt5 5.11 COMPONENTS Widgets Svg Gui REQUIRED)
|
|
||||||
list(APPEND QV2RAY_QT_LIBS Qt5::Widgets Qt5::Svg Qt5::Gui)
|
|
||||||
set(QV2RAY_HAS_GUI ON)
|
|
||||||
else()
|
|
||||||
message("Experimental CLI Support enabled.")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
set(CMAKE_AUTOMOC ON)
|
|
||||||
set(CMAKE_AUTORCC ON)
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
|
||||||
|
|
||||||
cmake_policy(SET CMP0071 NEW)
|
cmake_policy(SET CMP0071 NEW)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17.0")
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.17.0")
|
||||||
@ -186,6 +168,29 @@ include(cmake/backend.cmake)
|
|||||||
# ==================================================================================
|
# ==================================================================================
|
||||||
# Qv2ray Baselib
|
# Qv2ray Baselib
|
||||||
# ==================================================================================
|
# ==================================================================================
|
||||||
|
|
||||||
|
find_package(Qt5 5.11 COMPONENTS Core Network REQUIRED)
|
||||||
|
set(QV2RAY_QT_LIBS Qt5::Core Qt5::Network)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
if(QV2RAY_USE_QML)
|
||||||
|
message("QML Enabled.")
|
||||||
|
find_package(Qt5 5.11 COMPONENTS Qml Quick Widgets Svg QuickControls2 Gui REQUIRED)
|
||||||
|
list(APPEND QV2RAY_QT_LIBS Qt5::Quick Qt5::Qml Qt5::Widgets Qt5::Svg Qt5::QuickControls2 Qt5::Gui)
|
||||||
|
set(QV2RAY_HAS_GUI ON)
|
||||||
|
elseif(QV2RAY_USE_QWIDGET)
|
||||||
|
message("QWidgets Enabled.")
|
||||||
|
set(QV2RAY_QNODEEDITOR_PROVIDER "module" CACHE STRING "QNodeEditor Provider")
|
||||||
|
set(QV2RAY_HAS_BUILT_IN_THEMES ON CACHE BOOL "Build with built-in themes")
|
||||||
|
find_package(Qt5 5.11 COMPONENTS Widgets Svg Gui REQUIRED)
|
||||||
|
list(APPEND QV2RAY_QT_LIBS Qt5::Widgets Qt5::Svg Qt5::Gui)
|
||||||
|
set(QV2RAY_HAS_GUI ON)
|
||||||
|
else()
|
||||||
|
message("Experimental CLI Support enabled.")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(QVPLUGIN_INTERFACE_INCLUDE_DIR "src/plugin-interface")
|
set(QVPLUGIN_INTERFACE_INCLUDE_DIR "src/plugin-interface")
|
||||||
include(src/plugin-interface/QvPluginInterface.cmake)
|
include(src/plugin-interface/QvPluginInterface.cmake)
|
||||||
|
|
||||||
@ -280,13 +285,6 @@ set(QV2RAY_FULL_SOURCES
|
|||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
add_library(qv2ray SHARED ${QV2RAY_FULL_SOURCES})
|
add_library(qv2ray SHARED ${QV2RAY_FULL_SOURCES})
|
||||||
target_link_libraries(qv2ray -llog -landroid)
|
target_link_libraries(qv2ray -llog -landroid)
|
||||||
include(cmake/android/AddQtAndroidApk.cmake)
|
|
||||||
list(APPEND ANDROID_EXTRA_LIBS "${CMAKE_SOURCE_DIR}/libs/x86-android/debug/lib/libprotobufd.so")
|
|
||||||
list(APPEND ANDROID_EXTRA_LIBS "${CMAKE_SOURCE_DIR}/libs/x86-android/debug/lib/libre2.so")
|
|
||||||
add_qt_android_apk(Qv2rayAPK ${PROJECT_NAME}
|
|
||||||
PACKAGE_SOURCES ${CMAKE_SOURCE_DIR}/assets/android
|
|
||||||
DEPENDS ${ANDROID_EXTRA_LIBS}
|
|
||||||
)
|
|
||||||
else()
|
else()
|
||||||
include(cmake/backward-cpp.cmake)
|
include(cmake/backward-cpp.cmake)
|
||||||
add_definitions(-DQV2RAY_HAS_BACKWARD)
|
add_definitions(-DQV2RAY_HAS_BACKWARD)
|
||||||
@ -422,7 +420,6 @@ if(QV2RAY_AUTO_DEPLOY AND APPLE)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
set(ANDROID_)
|
|
||||||
if(QV2RAY_AUTO_DEPLOY AND ANDROID)
|
if(QV2RAY_AUTO_DEPLOY AND ANDROID)
|
||||||
message("Qv2ray Android auto deploy todo.")
|
message("Qv2ray Android auto deploy todo.")
|
||||||
endif()
|
endif()
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<manifest android:versionName="@APK_PACKAGE_VERSION@" package="@APK_PACKAGE_NAME@" android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="@APK_PACKAGE_VERSIONCODE@">
|
<manifest android:versionName="@APK_PACKAGE_VERSION@" package="@APK_PACKAGE_NAME@" android:installLocation="auto" xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="@APK_PACKAGE_VERSIONCODE@">
|
||||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
|
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="28"/>
|
||||||
<application android:label="@APK_PACKAGE_VERSION@" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:icon="@drawable/icon">
|
<application android:label="@APK_DISPLAY_NAME@" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:icon="@drawable/icon">
|
||||||
<activity android:label="@APK_DISPLAY_NAME@" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:screenOrientation="unspecified" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation">
|
<activity android:label="@APK_DISPLAY_NAME@" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:screenOrientation="unspecified" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation">
|
||||||
|
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
@ -60,7 +60,7 @@
|
|||||||
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
* minimal - useful for Quick Controls 2 apps, it is much faster than "full"
|
||||||
* none - useful for apps that don't use any of the above Qt modules
|
* none - useful for apps that don't use any of the above Qt modules
|
||||||
-->
|
-->
|
||||||
<meta-data android:name="android.app.extract_android_style" android:value="default"/>
|
<meta-data android:name="android.app.extract_android_style" android:value="minimal"/>
|
||||||
<!-- extract android style -->
|
<!-- extract android style -->
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 5a62962dbe35e955374688461784ddb7f757a377
|
|
@ -1,8 +1,7 @@
|
|||||||
if(ANDROID)
|
if(ANDROID)
|
||||||
set(CURL_LIBRARIES -lcurl)
|
set(CURL_LIBRARIES -lcurl -lssl -lcrypto -lz)
|
||||||
endif()
|
endif()
|
||||||
|
if(WIN32 OR ANDROID)
|
||||||
if(WIN32)
|
|
||||||
find_package(CURL CONFIG REQUIRED)
|
find_package(CURL CONFIG REQUIRED)
|
||||||
else()
|
else()
|
||||||
find_package(CURL REQUIRED)
|
find_package(CURL REQUIRED)
|
||||||
|
@ -1,23 +1,33 @@
|
|||||||
include(${ANDROID_SDK}/android_openssl/CMakeLists.txt)
|
|
||||||
set(QV2RAY_USE_QML ON)
|
set(QV2RAY_USE_QML ON)
|
||||||
|
|
||||||
set(ANDROID_LIB_ARCH ${ANDROID_ABI})
|
if(NOT ANDROID_SDK)
|
||||||
if(${ANDROID_ABI} STREQUAL "x86_64")
|
set(ANDROID_SDK $ENV{ANDROID_SDK_ROOT})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(${ANDROID_SDK}/android_openssl/CMakeLists.txt)
|
||||||
|
|
||||||
|
set(ANDROID_LIB_ARCH ${CMAKE_ANDROID_ARCH})
|
||||||
|
if(${ANDROID_LIB_ARCH} STREQUAL "x86_64")
|
||||||
set(ANDROID_LIB_ARCH "x64")
|
set(ANDROID_LIB_ARCH "x64")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
message("Android SDK: ${ANDROID_SDK}, ${CMAKE_ANDROID_ARCH}")
|
||||||
|
|
||||||
list(APPEND CMAKE_PROGRAM_PATH
|
list(APPEND CMAKE_PROGRAM_PATH
|
||||||
${CMAKE_SOURCE_DIR}/libs/tools/grpc
|
${CMAKE_SOURCE_DIR}/libs/tools/grpc
|
||||||
${CMAKE_SOURCE_DIR}/libs/tools/protobuf
|
${CMAKE_SOURCE_DIR}/libs/tools/protobuf
|
||||||
|
${CMAKE_SOURCE_DIR}/libs/tools/openssl
|
||||||
)
|
)
|
||||||
|
|
||||||
set(QV2RAY_ANDROID_ROOT ${CMAKE_SOURCE_DIR}/libs/${ANDROID_LIB_ARCH}-android)
|
set(QV2RAY_ANDROID_ROOT ${CMAKE_SOURCE_DIR}/libs/${ANDROID_LIB_ARCH}-android)
|
||||||
if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE) #Debug build: Put Debug paths before Release paths.
|
|
||||||
# list(APPEND CMAKE_PREFIX_PATH
|
|
||||||
# ${QV2RAY_ANDROID_ROOT}/debug
|
|
||||||
# ${QV2RAY_ANDROID_ROOT}
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
message("ASS: ${QV2RAY_ANDROID_ROOT}")
|
||||||
|
if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_TYPE) #Debug build: Put Debug paths before Release paths.
|
||||||
|
set(QV2RAY_ANDROID_DEBUG_LIB ON)
|
||||||
|
list(APPEND CMAKE_PREFIX_PATH
|
||||||
|
${QV2RAY_ANDROID_ROOT}/debug
|
||||||
|
${QV2RAY_ANDROID_ROOT}
|
||||||
|
)
|
||||||
link_directories(
|
link_directories(
|
||||||
${QV2RAY_ANDROID_ROOT}/debug/lib
|
${QV2RAY_ANDROID_ROOT}/debug/lib
|
||||||
${QV2RAY_ANDROID_ROOT}/lib
|
${QV2RAY_ANDROID_ROOT}/lib
|
||||||
@ -27,11 +37,11 @@ if(CMAKE_BUILD_TYPE MATCHES "^[Dd][Ee][Bb][Uu][Gg]$" OR NOT DEFINED CMAKE_BUILD_
|
|||||||
${QV2RAY_ANDROID_ROOT}
|
${QV2RAY_ANDROID_ROOT}
|
||||||
)
|
)
|
||||||
else() #Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files.
|
else() #Release build: Put Release paths before Debug paths. Debug Paths are required so that CMake generates correct info in autogenerated target files.
|
||||||
# list(APPEND CMAKE_PREFIX_PATH
|
set(QV2RAY_ANDROID_DEBUG_LIB OFF)
|
||||||
# ${QV2RAY_ANDROID_ROOT}
|
list(APPEND CMAKE_PREFIX_PATH
|
||||||
# ${QV2RAY_ANDROID_ROOT}/debug
|
${QV2RAY_ANDROID_ROOT}
|
||||||
# )
|
${QV2RAY_ANDROID_ROOT}/debug
|
||||||
|
)
|
||||||
link_directories(
|
link_directories(
|
||||||
${QV2RAY_ANDROID_ROOT}/lib
|
${QV2RAY_ANDROID_ROOT}/lib
|
||||||
${QV2RAY_ANDROID_ROOT}/debug/lib
|
${QV2RAY_ANDROID_ROOT}/debug/lib
|
||||||
|
24
libs/setup-android-libs.sh
Executable file
24
libs/setup-android-libs.sh
Executable file
@ -0,0 +1,24 @@
|
|||||||
|
#!/bin/fish
|
||||||
|
mkdir -p deps; cd ./deps
|
||||||
|
mkdir -p downloaded; cd ./downloaded;
|
||||||
|
|
||||||
|
set KEYWORD android
|
||||||
|
for data in (curl -s https://api.github.com/repos/Qv2ray/Qv2ray-deps/releases/latest | jq ".assets[] | {browser_download_url, name}" -c | grep $KEYWORD)
|
||||||
|
set NAME (echo $data | jq ".name" -r)
|
||||||
|
echo "Downloading: $NAME"
|
||||||
|
curl -sL (echo $data | jq ".browser_download_url" -r) -o $NAME;
|
||||||
|
end
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
for f in (ls)
|
||||||
|
7z x -y ./$f
|
||||||
|
end
|
||||||
|
|
||||||
|
mkdir final
|
||||||
|
for p in arm arm64 x64 x86
|
||||||
|
cp -rv ./$KEYWORD-$p/installed/* ./final
|
||||||
|
end
|
||||||
|
|
||||||
|
rm -rvf ./final/vcpkg
|
||||||
|
cd ..
|
||||||
|
cp -rvf ./deps/final/* ./
|
17
libs/setup-android-tools.sh
Executable file
17
libs/setup-android-tools.sh
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/bin/fish
|
||||||
|
mkdir -p deps; cd ./deps
|
||||||
|
mkdir -p downloaded; cd ./downloaded;
|
||||||
|
|
||||||
|
set KEYWORD tools
|
||||||
|
for data in (curl -s https://api.github.com/repos/Qv2ray/Qv2ray-deps/releases/latest | jq ".assets[] | {browser_download_url, name}" -c | grep $KEYWORD)
|
||||||
|
set NAME (echo $data | jq ".name" -r)
|
||||||
|
echo "Downloading: $NAME"
|
||||||
|
curl -sL (echo $data | jq ".browser_download_url" -r) -o $NAME;
|
||||||
|
end
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
for f in (ls ./downloaded | grep $KEYWORD)
|
||||||
|
7z x -y ./downloaded/$f
|
||||||
|
end
|
||||||
|
|
||||||
|
cp -rvf ./tools ../
|
@ -1,32 +0,0 @@
|
|||||||
Qv2ray Dependencies Directory for Windows x64
|
|
||||||
|
|
||||||
THIS IS A PLACEHOLDER WHICH ALLOWS GIT TO INCLUDE THIS DIRECTORY
|
|
||||||
|
|
||||||
If you want to build Qv2ray on Windows, please download the gRPC and
|
|
||||||
protobuf headers and libraries according to your CPU architecture:
|
|
||||||
|
|
||||||
- Go to https://github.com/Qv2ray/Qv2ray-deps/releases
|
|
||||||
- Download "Qv2ray-deps-x64-windows.7z"
|
|
||||||
|
|
||||||
Then extract the 7z zipball here.
|
|
||||||
|
|
||||||
Make sure these file exists:
|
|
||||||
- Qv2raySourceRoot/libs/x64-windows/tools/grpc/grpc_cpp_plugin.exe
|
|
||||||
- Qv2raySourceRoot/libs/x64-windows/tools/protobuf/protoc.exe
|
|
||||||
|
|
||||||
# ======================================================================
|
|
||||||
|
|
||||||
64 位 Windows 的 Qv2ray 依赖文件夹
|
|
||||||
这个文件的存在使得 git 可以添加此文件夹
|
|
||||||
|
|
||||||
如果你想在 Windows 下编译 Qv2ray, 请遵循这些步骤下载 gRPC 和 protobuf 头文件
|
|
||||||
和库文件:
|
|
||||||
|
|
||||||
- 访问 https://github.com/Qv2ray/Qv2ray-deps/releases
|
|
||||||
- 下载 "Qv2ray-deps-x64-windows.7z"
|
|
||||||
|
|
||||||
然后将这个 7z 压缩包解压到这里
|
|
||||||
|
|
||||||
请确保这些文件存在:
|
|
||||||
- Qv2ray源码根目录/libs/x64-windows/tools/grpc/grpc_cpp_plugin.exe
|
|
||||||
- Qv2ray源码根目录/libs/x64-windows/tools/protobuf/protoc.exe
|
|
@ -1,32 +0,0 @@
|
|||||||
Qv2ray Dependencies Directory for Windows x86
|
|
||||||
|
|
||||||
THIS IS A PLACEHOLDER WHICH ALLOWS GIT TO INCLUDE THIS DIRECTORY
|
|
||||||
|
|
||||||
If you want to build Qv2ray on Windows, please download the gRPC and
|
|
||||||
protobuf headers and libraries according to your CPU architecture:
|
|
||||||
|
|
||||||
- Go to https://github.com/Qv2ray/Qv2ray-deps/releases
|
|
||||||
- Download "Qv2ray-deps-x86-windows.7z"
|
|
||||||
|
|
||||||
Then extract the 7z zipball here.
|
|
||||||
|
|
||||||
Make sure these file exists:
|
|
||||||
- Qv2raySourceRoot/libs/x86-windows/tools/grpc/grpc_cpp_plugin.exe
|
|
||||||
- Qv2raySourceRoot/libs/x86-windows/tools/protobuf/protoc.exe
|
|
||||||
|
|
||||||
# ======================================================================
|
|
||||||
|
|
||||||
32 位 Windows 的 Qv2ray 依赖文件夹
|
|
||||||
这个文件的存在使得 git 可以添加此文件夹
|
|
||||||
|
|
||||||
如果你想在 Windows 下编译 Qv2ray, 请遵循这些步骤下载 gRPC 和 protobuf 头文件
|
|
||||||
和库文件:
|
|
||||||
|
|
||||||
- 访问 https://github.com/Qv2ray/Qv2ray-deps/releases
|
|
||||||
- 下载 "Qv2ray-deps-x86-windows.7z"
|
|
||||||
|
|
||||||
然后将这个 7z 压缩包解压到这里
|
|
||||||
|
|
||||||
请确保这些文件存在:
|
|
||||||
- Qv2ray源码根目录/libs/x86-windows/tools/grpc/grpc_cpp_plugin.exe
|
|
||||||
- Qv2ray源码根目录/libs/x86-windows/tools/protobuf/protoc.exe
|
|
Loading…
Reference in New Issue
Block a user